-
-
Notifications
You must be signed in to change notification settings - Fork 337
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
Support nonce and acr with OIDC + Tests #883
Support nonce and acr with OIDC + Tests #883
Conversation
e78e2f3
to
8b90c90
Compare
Opening the PR for checking whether the tests work in the CI |
56706b3
to
1bf114a
Compare
3603767
to
bb6445b
Compare
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.
Thanks @dsagal for your review! 🙏
I made the changes requested.
@@ -167,33 +224,43 @@ export class OIDCConfig { | |||
profile, | |||
})); | |||
|
|||
delete mreq.session.oidc; | |||
mreq.session.oidc = { |
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.
Is what I wrote good to you?
app/server/lib/OIDCConfig.ts
Outdated
res.redirect(targetUrl ?? '/'); | ||
} catch (err) { | ||
log.error(`OIDC callback failed: ${err.stack}`); | ||
// Delete the session data even if the login failed. | ||
if (Object.prototype.hasOwnProperty.call(err, 'response')) { | ||
log.error(`Response received: ${err.response?.body ?? err.response}`); |
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.
I realized that the error may be multiple things (especially the body may be a buffer).
I made some changes, with the hope it will be fine for you. If that's too tricky or you feel a bit uncomfortable, I may remove this log and reintroduce it a bit later or in a separate PR.
561dc45
to
15732bc
Compare
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.
@SleepyLeslie, would you be able to run your tests against Authentik again, since quite a lot of code changed since your review? All code looks good to me now, so approving from my end.
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.
Testing this against our OIDC example that uses Authelia, and State, Nonce and PKCE all seem to be working as expected! 🎉
I've left a few minor nitpick comments, I don't think any of them are necessary from my perspective 🙂
I took into account your remarks @Spoffy, thank you! |
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.
Thanks for the bits of cleanup!
All the changes requested have been resolved, or are no longer relevant, and latest version has been reviewed.
New variables have been introduced in this PR: - GRIST_OIDC_IDP_ENABLED_PROTECTIONS - GRIST_OIDC_IDP_ACR_VALUES - GRIST_OIDC_IDP_EXTRA_CLIENT_METADATA
New variables have been introduced in this PR: - GRIST_OIDC_IDP_ENABLED_PROTECTIONS - GRIST_OIDC_IDP_ACR_VALUES - GRIST_OIDC_IDP_EXTRA_CLIENT_METADATA
Context
Proposed solution
GRIST_OIDC_IDP_ENABLED_PROTECTIONS
variable who can contain comma-separated values with either:STATE
,NONCE
andPKCE
, and defaults toSTATE,PKCE
;GRIST_OIDC_IDP_ACR_VALUES
variable with space separated values;