-
Notifications
You must be signed in to change notification settings - Fork 66
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
[58320] Exposing sign in service public key for access token decoding #12814
Conversation
@bosawt Im not able to extract the public cert from the URL. I tried to use the jwt.io site and decode the value at the uri = URI.parse('http://localhost:3000/sign_in/openid_connect/c
erts')
response = JSON.parse(Net::HTTP.get_response(uri).body)
jwk = response['keys'].first
public_key = JWT::JWK::RSA.import(jwk).public_key the result of printing |
@joeniquette I followed your steps and tried printing it out to a string, looks fine to me?
|
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.
Tested and got a public key, LGTM!
@joeniquette Were you able to figure this out for you? I admit I'm not in love with the JWK thing as it's a pain to get the public key out of it, but 🤷 I guess it's part of the OIDC spec |
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.
LGTM
I just tried it again and was able to get it to work. Thank you John, I was
missing the `.to_s` 🤦. I wish the jwt.io site compare worked here,
but I dont have time to figure out why it doesnt. You dont need my approval
to merge, but yes I confirmed this does work and returns only the public
key.
…On Fri, May 26, 2023 at 1:21 PM Ryan McNeil ***@***.***> wrote:
***@***.**** approved this pull request.
LGTM
—
Reply to this email directly, view it on GitHub
<#12814 (review)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AQ745HTVFV6GFKQSAI7MUXDXIDQ75ANCNFSM6AAAAAAYPQEBKE>
.
You are receiving this because you were mentioned.Message ID:
<department-of-veterans-affairs/vets-api/pull/12814/review/1446657637@
github.com>
--
Respectfully,
*Joe Niquette*
|
Summary
/sign_in/openid_connect/certs
, that allows for any Sign in Service client to retrieve the public key associated with encoded access_token jets. This can be useful for clients to decode the access tokens and confirm this access token came from the sign in serviceRelated issue(s)
Testing done
localhost:3000/sign_in/openid_connect/certs
, confirmed response:{"keys":[{"kty":"RSA","n":"q-pGrTVuIUeEXkcJAftVRfw3SSCZOXisy6SQ6ArhxirP5vvP2e0kN2XnSmBsIln05KnjLaOc5Ai-tDZk-euknDiBO_1qqUHg2LyCefyZYKtBdTfaGS-pVVfGfUo56WnAiRU5B43kvHCT8LDqy9hWI5Rf34p0KinLoOhtcwJEmdhnqw-DYxHSKAd55pl-pTPsvj2fj2yRJ_JRS6JrFTNYW3BSHQPaPYLtfrBEYXj6W-Xca3l0M9TNkqPycP5XNmk--6d1aaGvVXzLSeCoi0XvaQ6kQxStzPFpRiBBvM7kqRpPwzZH1Cck3JUdeKAbTfemBKOKW3Xi0gL58WtHLHmsIQ","e":"AQAB","alg":"RS256","use":"sig","kid":"3466532fee9067b03724e8afe31d567cadc0bd8a54b0635c8f93f4651b0c432e"}]}
What areas of the site does it impact?
Sign in Service Authentication
Acceptance criteria
localhost:3000/sign_in/openid_connect/certs
public_key
corresponding toSettings.sign_in.jwt_encode_key