-
Notifications
You must be signed in to change notification settings - Fork 2
[OLH-1727] Add logging and testing for session state during authentication flow #2718
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from 4 commits
e143259
8c2737a
737cbf3
53afc52
1761196
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -48,6 +48,11 @@ export async function generateTokenSet( | |
| queryParams: CallbackParamsType, | ||
| clientAssertion: string | ||
| ) { | ||
| logger.info( | ||
| { trace: req.res?.locals.trace }, | ||
| `request session state: ${req.session.state}` | ||
| ); | ||
|
|
||
| const tokenSet: TokenSet = await req.oidc.callback( | ||
| req.oidc.metadata.redirect_uris[0], | ||
| queryParams, | ||
|
|
@@ -60,6 +65,21 @@ export async function generateTokenSet( | |
| }, | ||
| } | ||
| ); | ||
| logger.info( | ||
|
||
| { trace: req.res?.locals.trace }, | ||
| `Generated token session state: ${tokenSet.session_state}` | ||
| ); | ||
| if (tokenSet.session_state !== req.session.state) { | ||
|
||
| this.handleOidcCallbackError( | ||
| req, | ||
| req.res!, | ||
| { | ||
| error: "session_state_mismatch", | ||
| description: "Session state mismatch after OICD callback", | ||
| }, | ||
| false | ||
| ); | ||
| } | ||
| return tokenSet; | ||
| } | ||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could we make this a debug line please