<p></p>
<p><b>@milan-cvetkovic</b> commented on this pull request.</p>
<hr>
<p>In <a href="https://github.com/openstreetmap/openstreetmap-website/pull/4226#discussion_r1327641528">test/integration/oauth2_test.rb</a>:</p>
<pre style='color:#555'>> + 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],
</pre>
<p dir="auto">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:</p>
<ul dir="auto">
<li><code class="notranslate">issuer</code> is based on server_url and server_protocol, consistently in test and development</li>
<li>the remaining endpoints have correct paths, but have different hosts in development and test:
<ul dir="auto">
<li>host in development is <code class="notranslate">http://localhost:3000</code> for all remaining endpoints</li>
<li>host in testing is <code class="notranslate">http://www.example.com</code></li>
</ul>
</li>
</ul>
<p dir="auto">For example, <code class="notranslate">jwks_uri</code> is set to <code class="notranslate">http://www.example.com/oauth2/discovery/keys</code>.<br>
I am not too sure where the example.com comes from, and how it disapears in development...</p>
<p dir="auto">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</p>
<p style="font-size:small;-webkit-text-size-adjust:none;color:#666;">—<br />Reply to this email directly, <a href="https://github.com/openstreetmap/openstreetmap-website/pull/4226#discussion_r1327641528">view it on GitHub</a>, or <a href="https://github.com/notifications/unsubscribe-auth/AAK2OLMZP4BRL3NOE6WCOLLX2SL67ANCNFSM6AAAAAA4KPKL4I">unsubscribe</a>.<br />You are receiving this because you are subscribed to this thread.<img src="https://github.com/notifications/beacon/AAK2OLNBXVO4T5GPI2YZHO3X2SL67A5CNFSM6AAAAAA4KPKL4KWGG33NNVSW45C7OR4XAZNRKB2WY3CSMVYXKZLTORJGK5TJMV32UY3PNVWWK3TUL5UWJTTBEA572.gif" height="1" width="1" alt="" /><span style="color: transparent; font-size: 0; display: none; visibility: hidden; overflow: hidden; opacity: 0; width: 0; height: 0; max-width: 0; max-height: 0; mso-hide: all">Message ID: <span><openstreetmap/openstreetmap-website/pull/4226/review/1629502461</span><span>@</span><span>github</span><span>.</span><span>com></span></span></p>
<script type="application/ld+json">[
{
"@context": "http://schema.org",
"@type": "EmailMessage",
"potentialAction": {
"@type": "ViewAction",
"target": "https://github.com/openstreetmap/openstreetmap-website/pull/4226#discussion_r1327641528",
"url": "https://github.com/openstreetmap/openstreetmap-website/pull/4226#discussion_r1327641528",
"name": "View Pull Request"
},
"description": "View this Pull Request on GitHub",
"publisher": {
"@type": "Organization",
"name": "GitHub",
"url": "https://github.com"
}
}
]</script>