[openstreetmap/openstreetmap-website] Add openid connect support using doorkeeper-openid_connect gem (PR #4226)
Milan Cvetkovic
notifications at github.com
Fri Sep 15 18:20:31 UTC 2023
@milan-cvetkovic commented on this pull request.
> + state = SecureRandom.urlsafe_base64(16)
+ verifier = SecureRandom.urlsafe_base64(48)
+ challenge = Base64.urlsafe_encode64(Digest::SHA256.digest(verifier), :padding => false)
+
+ authorize_client(user, client, :state => state, :code_challenge => challenge, :code_challenge_method => "S256", :scope => "openid read_prefs")
+ assert_response :redirect
+ code = validate_redirect(client, state)
+
+ tokens = request_tokens(client, code, verifier)
+ id_token = tokens[:id_token]
+ access_token = tokens[:access_token]
+
+ assert_not_nil(id_token)
+
+ data, _headers = JWT.decode id_token, Doorkeeper::OpenidConnect.signing_key.keypair, true, {
+ :algorithm => [Doorkeeper::OpenidConnect.signing_algorithm.to_s],
This was my original intention. The problem is that in test environment discovery endpoint returns a mix of test host names in the remaining endpoints:
- `issuer` is based on server_url and server_protocol, consistently in test and development
- the remaining endpoints have correct paths, but have different hosts in development and test:
- host in development is `http://localhost:3000` for all remaining endpoints
- host in testing is `http://www.example.com`
For example, `jwks_uri` is set to `http://www.example.com/oauth2/discovery/keys`.
I am not too sure where the example.com comes from, and how it disapears in development...
I added a separate test for discovery endpoint which verifies that the endpoints have correct path. More importantly it gets the key informrmation from jwks endpoint (using path only) and verifies that kid is in fact kid of the configured key
--
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/pull/4226#discussion_r1327641528
You are receiving this because you are subscribed to this thread.
Message ID: <openstreetmap/openstreetmap-website/pull/4226/review/1629502461 at github.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/rails-dev/attachments/20230915/f204c07d/attachment.htm>
More information about the rails-dev
mailing list