Skip to content

Commit 9555b56

Browse files
pilartomasclaude
andcommitted
style(gateway): apply cargo fmt formatting
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent c926fcc commit 9555b56

2 files changed

Lines changed: 7 additions & 15 deletions

File tree

apps/gateway/src/auth.rs

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -96,8 +96,7 @@ impl FromRequestParts<GatewayState> for AuthUser {
9696
}
9797

9898
// Fall back to session auth (OIDC JWT, NextAuth cookie, or local mode)
99-
let user_id =
100-
validate_request(pool, &parts.headers, state.jwks.as_ref()).await?;
99+
let user_id = validate_request(pool, &parts.headers, state.jwks.as_ref()).await?;
101100

102101
// Resolve account from membership
103102
let account_id = db::find_account_id_by_user(pool, &user_id)
@@ -199,10 +198,7 @@ async fn validate_oauth(
199198
async fn try_bearer_jwt(headers: &HeaderMap, jwks: Option<&JwksManager>) -> Option<String> {
200199
let jwks = jwks?;
201200

202-
let auth_header = headers
203-
.get(hyper::header::AUTHORIZATION)?
204-
.to_str()
205-
.ok()?;
201+
let auth_header = headers.get(hyper::header::AUTHORIZATION)?.to_str().ok()?;
206202

207203
let token = auth_header
208204
.strip_prefix("Bearer ")
@@ -223,10 +219,7 @@ async fn try_bearer_jwt(headers: &HeaderMap, jwks: Option<&JwksManager>) -> Opti
223219
}
224220

225221
/// Validate a NextAuth session cookie (HS256 JWT signed with NEXTAUTH_SECRET).
226-
async fn validate_nextauth_cookie(
227-
pool: &PgPool,
228-
headers: &HeaderMap,
229-
) -> Result<String, AuthError> {
222+
async fn validate_nextauth_cookie(pool: &PgPool, headers: &HeaderMap) -> Result<String, AuthError> {
230223
let cookie_header = headers
231224
.get(hyper::header::COOKIE)
232225
.and_then(|v| v.to_str().ok())

apps/gateway/src/jwks.rs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -142,11 +142,10 @@ impl JwksManager {
142142
self.maybe_refresh().await;
143143

144144
let cache = self.cache.read().await;
145-
self.try_decode(token, kid, &cache.keys)?
146-
.ok_or_else(|| {
147-
warn!(kid = ?kid, "JWT kid not found in JWKS after refresh");
148-
AuthError("invalid token".to_string())
149-
})
145+
self.try_decode(token, kid, &cache.keys)?.ok_or_else(|| {
146+
warn!(kid = ?kid, "JWT kid not found in JWKS after refresh");
147+
AuthError("invalid token".to_string())
148+
})
150149
}
151150

152151
/// Try to decode the token using the cached keys.

0 commit comments

Comments
 (0)