You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: primer/index.bs
+19-10Lines changed: 19 additions & 10 deletions
Original file line number
Diff line number
Diff line change
@@ -360,18 +360,27 @@ id, the [=code challenge=], the user's webid, their desired response types, and
360
360
}
361
361
```
362
362
363
-
<h4 id="authorization-code-pkce-flow-step-11" class="no-num">11. Send authorization code to redirect url</h4>
363
+
<h4 id="authorization-code-pkce-flow-step-11" class="no-num">11. Send authorization code and `iss` parameter to redirect url</h4>
364
364
365
365
Once Alice successfully logs in, the OP redirects back to the application via the provided
366
-
redirect uri, including useful information with it:
366
+
redirect uri. The OP includes the authorization code as well as its own issuer identifier as the iss parameter to protect against mix-up attacks:
367
367
368
368
```http
369
-
302 redirect to: https://decentphotos.example/callback?code=m-OrTPHdRsm8W_e9P0J2Bt
369
+
302 redirect to: https://decentphotos.example/callback?code=m-OrTPHdRsm8W_e9P0J2Bt&iss=https%3A%2F%2Fsecureauth.example
370
370
```
371
371
372
-
This redirect gives decentphotos the [=authorization code=] that it will exchange for requested tokens.
372
+
This redirect gives decentphotos the [=authorization code=] that it will exchange for requested tokens, along with the issuer identifier required for the next validation step.
373
373
374
-
<h4 id="authorization-code-pkce-flow-step-12" class="no-num">12. Generates a DPoP Client Key Pair</h4>
Before proceeding to exchange the code for tokens, decentphotos must verify the `iss` parameter.
377
+
This ensures the application is receiving the code from the exact OP it intended to communicate with.
378
+
379
+
The application checks that the `iss` value (`https://secureauth.example`) matches the issuer URL it resolved in Step 3.
380
+
If the `iss` parameter is missing or does not match the expected OP, decentphotos must reject the response, abort the authentication flow, and optionally display an error to Alice.
381
+
In our example, the issuer matches, so we may safely continue.
382
+
383
+
<h4 id="authorization-code-pkce-flow-step-13" class="no-num">13. Generates a DPoP Client Key Pair</h4>
375
384
376
385
Solid-OIDC depends on
377
386
[Demonstration of Proof-of-Possession (DPoP) tokens](https://tools.ietf.org/html/draft-ietf-oauth-dpop).
@@ -410,7 +419,7 @@ The public key looks like:
410
419
}
411
420
```
412
421
413
-
<h4 id="authorization-code-pkce-flow-step-13" class="no-num">13. Generates a DPoP Header</h4>
422
+
<h4 id="authorization-code-pkce-flow-step-14" class="no-num">14. Generates a DPoP Header</h4>
414
423
415
424
Now that we generated a private key for the client, we need to generate the DPoP header. To do
416
425
so, we create a [JSON Web Token](https://jwt.io/introduction/) and sign it using the key we
@@ -459,7 +468,7 @@ Token Body:
459
468
that can optionally be used by the server to defend against replay attacks
460
469
- `"iat": 1603306128`: The date the token was issued, in this case October 21, 2020 15:52:33 GMT.
461
470
462
-
<h4 id="authorization-code-pkce-flow-step-14" class="no-num">14. Token request with code and code verifier</h4>
471
+
<h4 id="authorization-code-pkce-flow-step-15" class="no-num">15. Token request with code and code verifier</h4>
463
472
464
473
Now, we have everything we need to make an auth request. No need to redirect the web browser
465
474
for this one. We only need to make an AJAX request to the `token` endpoint as defined in the
@@ -495,7 +504,7 @@ Body:
495
504
496
505
Once this request is completed decentphotos can remove the code verifier from session storage.
0 commit comments