about summary refs log tree commit diff
path: root/src/indieauth
diff options
context:
space:
mode:
authorVika <vika@fireburn.ru>2024-08-18 00:20:22 +0300
committerVika <vika@fireburn.ru>2024-08-18 00:27:53 +0300
commit7c4546faced6d1add4b6c904529601576baa50f4 (patch)
tree2708f9de5290ab745ded1c77a3cc63820ddede39 /src/indieauth
parent90d2e2d20928d06ab971090dc22ddff267e80d39 (diff)
downloadkittybox-7c4546faced6d1add4b6c904529601576baa50f4.tar.zst
indieauth: Extension -> State
whoops
Diffstat (limited to 'src/indieauth')
-rw-r--r--src/indieauth/mod.rs22
1 files changed, 12 insertions, 10 deletions
diff --git a/src/indieauth/mod.rs b/src/indieauth/mod.rs
index 808b9b7..06ec1f7 100644
--- a/src/indieauth/mod.rs
+++ b/src/indieauth/mod.rs
@@ -252,10 +252,11 @@ async fn verify_credential<A: AuthBackend>(
     }
 }
 
-#[tracing::instrument(skip(backend, confirmation))]
+#[tracing::instrument(skip(backend))]
+#[cfg_attr(not(debug_assertions), tracing::instrument(skip(confirmation)))]
 async fn authorization_endpoint_confirm<A: AuthBackend>(
     Host(host): Host,
-    Extension(backend): Extension<A>,
+    State(backend): State<A>,
     cookies: CookieJar,
     Json(confirmation): Json<AuthorizationConfirmation>,
 ) -> Response {
@@ -323,10 +324,11 @@ async fn authorization_endpoint_confirm<A: AuthBackend>(
 #[tracing::instrument(skip(backend, db))]
 async fn authorization_endpoint_post<A: AuthBackend, D: Storage + 'static>(
     Host(host): Host,
-    Extension(backend): Extension<A>,
-    Extension(db): Extension<D>,
+    State(backend): State<A>,
+    State(db): State<D>,
     Form(grant): Form<GrantRequest>,
 ) -> Response {
+    tracing::debug!("Processing grant...");
     match grant {
         GrantRequest::AuthorizationCode {
             code,
@@ -414,8 +416,8 @@ async fn authorization_endpoint_post<A: AuthBackend, D: Storage + 'static>(
 #[tracing::instrument(skip(backend, db))]
 async fn token_endpoint_post<A: AuthBackend, D: Storage + 'static>(
     Host(host): Host,
-    Extension(backend): Extension<A>,
-    Extension(db): Extension<D>,
+    State(backend): State<A>,
+    State(db): State<D>,
     Form(grant): Form<GrantRequest>,
 ) -> Response {
     #[inline]
@@ -667,7 +669,7 @@ async fn token_endpoint_post<A: AuthBackend, D: Storage + 'static>(
 async fn introspection_endpoint_post<A: AuthBackend>(
     Host(host): Host,
     TypedHeader(Authorization(auth_token)): TypedHeader<Authorization<Bearer>>,
-    Extension(backend): Extension<A>,
+    State(backend): State<A>,
     Form(token_request): Form<TokenIntrospectionRequest>,
 ) -> Response {
     use serde_json::json;
@@ -702,7 +704,7 @@ async fn introspection_endpoint_post<A: AuthBackend>(
 
 async fn revocation_endpoint_post<A: AuthBackend>(
     Host(host): Host,
-    Extension(backend): Extension<A>,
+    State(backend): State<A>,
     Form(revocation): Form<TokenRevocationRequest>,
 ) -> impl IntoResponse {
     let me: url::Url = format!("https://{}/", host).parse().unwrap();
@@ -758,8 +760,8 @@ async fn get_profile<D: Storage + 'static>(
 async fn userinfo_endpoint_get<A: AuthBackend, D: Storage + 'static>(
     Host(host): Host,
     TypedHeader(Authorization(auth_token)): TypedHeader<Authorization<Bearer>>,
-    Extension(backend): Extension<A>,
-    Extension(db): Extension<D>
+    State(backend): State<A>,
+    State(db): State<D>
 ) -> Response {
     use serde_json::json;