Skip to content

Commit 78e24e1

Browse files
committed
Update oidc.rs
1 parent febbe81 commit 78e24e1

File tree

1 file changed

+15
-9
lines changed

1 file changed

+15
-9
lines changed

src/webserver/oidc.rs

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -335,19 +335,20 @@ where
335335
}
336336

337337
log::debug!("Redirecting to OIDC provider");
338-
338+
339339
// Get HTTP client from app data for potential cache refresh
340340
let http_client = match get_http_client_from_appdata(&request) {
341341
Ok(client) => client,
342342
Err(e) => {
343343
log::error!("Failed to get HTTP client from app data: {}", e);
344344
// Fall back to cached client without refresh
345345
let client = oidc_state.get_client().await;
346-
let response = build_auth_provider_redirect_response(&client, &oidc_state.config, &request);
346+
let response =
347+
build_auth_provider_redirect_response(&client, &oidc_state.config, &request);
347348
return Ok(request.into_response(response));
348349
}
349350
};
350-
351+
351352
let client = oidc_state.get_client_with_refresh(http_client).await;
352353
let response = build_auth_provider_redirect_response(&client, &oidc_state.config, &request);
353354
Ok(request.into_response(response))
@@ -364,11 +365,12 @@ async fn handle_oidc_callback(
364365
log::error!("Failed to get HTTP client from app data: {}", e);
365366
// Fall back to cached client without refresh
366367
let oidc_client = oidc_state.get_client().await;
367-
let resp = build_auth_provider_redirect_response(&oidc_client, &oidc_state.config, &request);
368+
let resp =
369+
build_auth_provider_redirect_response(&oidc_client, &oidc_state.config, &request);
368370
return Ok(request.into_response(resp));
369371
}
370372
};
371-
373+
372374
let oidc_client = oidc_state.get_client_with_refresh(http_client).await;
373375
let query_string = request.query_string();
374376
match process_oidc_callback(&oidc_client, query_string, &request).await {
@@ -409,14 +411,17 @@ where
409411
let oidc_client = oidc_state.get_client().await;
410412
match get_authenticated_user_info(&oidc_client, &request) {
411413
Ok(Some(claims)) => {
412-
log::trace!("Storing authenticated user info in request extensions: {claims:?}");
414+
log::trace!(
415+
"Storing authenticated user info in request extensions: {claims:?}"
416+
);
413417
request.extensions_mut().insert(claims);
414418
let future = service.call(request);
415419
return future.await;
416420
}
417421
Ok(None) => {
418422
log::trace!("No authenticated user found");
419-
return handle_unauthenticated_request(oidc_state, request, service).await;
423+
return handle_unauthenticated_request(oidc_state, request, service)
424+
.await;
420425
}
421426
Err(e) => {
422427
log::debug!(
@@ -426,12 +431,13 @@ where
426431
Redirecting to OIDC provider to re-authenticate."
427432
)
428433
);
429-
return handle_unauthenticated_request(oidc_state, request, service).await;
434+
return handle_unauthenticated_request(oidc_state, request, service)
435+
.await;
430436
}
431437
}
432438
}
433439
};
434-
440+
435441
let oidc_client = oidc_state.get_client_with_refresh(http_client).await;
436442
match get_authenticated_user_info(&oidc_client, &request) {
437443
Ok(Some(claims)) => {

0 commit comments

Comments
 (0)