Skip to content

Commit 1e455ff

Browse files
cursoragentlovasoa
andcommitted
Move OIDC callback handling after user authentication check
Co-authored-by: contact <contact@ophir.dev>
1 parent c877076 commit 1e455ff

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

src/webserver/oidc.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -291,17 +291,17 @@ where
291291
fn call(&self, request: ServiceRequest) -> Self::Future {
292292
log::trace!("Started OIDC middleware request handling");
293293

294-
// Handle OIDC callback URL even for authenticated users
295-
if request.path() == SQLPAGE_REDIRECT_URI {
296-
log::debug!("The request is the OIDC callback for an authenticated user");
297-
return Self::handle_authenticated_oidc_callback(request);
298-
}
299-
300294
let oidc_client = Arc::clone(&self.oidc_state.client);
301295
match get_authenticated_user_info(&oidc_client, &request) {
302296
Ok(Some(claims)) => {
303297
log::trace!("Storing authenticated user info in request extensions: {claims:?}");
304298
request.extensions_mut().insert(claims);
299+
300+
// Handle OIDC callback URL for authenticated users
301+
if request.path() == SQLPAGE_REDIRECT_URI {
302+
log::debug!("The request is the OIDC callback for an authenticated user");
303+
return Self::handle_authenticated_oidc_callback(request);
304+
}
305305
}
306306
Ok(None) => {
307307
log::trace!("No authenticated user found");

0 commit comments

Comments
 (0)