-
Notifications
You must be signed in to change notification settings - Fork 114
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
Add support for two OpenID Connect key-pairs #11626
base: main
Are you sure you want to change the base?
Conversation
changelog: Internal, OpenID Connect, Support two OIDC key-pairs
_matching_cert = [ | ||
AppArtifacts.store.oidc_primary_public_key, | ||
AppArtifacts.store.oidc_secondary_public_key, | ||
].compact.find do |key| |
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.
having an unused variable here has me 👀
would it make sense to break this into two methods, or to just ditch the variable entirely? Or switch to .each
with a return
?
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.
Ah yeah, I don't think the assignment is doing anything. I was originally considering using the matching cert to log which key was used, but I decided against it since logout is deprecated. I removed the assignment.
Co-authored-by: Zach Margolis <[email protected]>
Co-authored-by: Zach Margolis <[email protected]>
key_from_response = JWT::JWK.import(json[:keys].first).public_key | ||
public_key = AppArtifacts.store.oidc_public_key | ||
# Primary key should be first | ||
primary_key_from_response = JWT::JWK.import(json[:keys].first).public_key |
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.
The .keys[1]
jumped out at me, maybe we could destructuring to avoid hardcoding indexes?
primary_key_from_response = JWT::JWK.import(json[:keys].first).public_key | |
primary_key_from_response, secondary_key_from_response = json[:keys].map do |key| | |
JWT::JWK.import(key).public_key | |
end |
🛠 Summary of changes
Following up on #11612, this adds a secondary OpenID Connect key-pair that gives us the ability to do a zero downtime rotation. The two externally facing elements that require changes are:
id_token_hint
parameter in OIDC LogoutPreviously, we did not allow "missing" app artifacts, but we may not always have a secondary key-pair, so the class was modified to allow it (though it still defaults to not allowing it).