@@ -15,6 +15,57 @@ an OpenID Provider (OP) log out the End-User.
1515
1616.. _OpenID Connect RP-Initiated Logout 1.0 : https://openid.net/specs/openid-connect-rpinitiated-1_0.html
1717
18+ The logout goes through the browser. The OP may ask the user to confirm, and
19+ only redirects back to the RP under some conditions:
20+
21+ .. mermaid ::
22+
23+ sequenceDiagram
24+ autonumber
25+ participant User as User's browser<br/>(User Agent)
26+ participant RP as Relying Party<br/>(Client)
27+ box rgba(80, 120, 220, 0.12) EndSessionEndpoint
28+ participant OP as OpenID Provider<br/>(Authorization Server)
29+ end
30+
31+ Note over RP: logout_redirect()
32+ RP-->>User: 302 Found → /logout
33+ User->>OP: GET /logout (id_token_hint, post_logout_redirect_uri, state)
34+ opt No valid id_token_hint
35+ OP-->>User: 200 OK + confirmation page
36+ User->>OP: POST /logout
37+ end
38+ Note over OP: end_session()
39+ alt Valid post_logout_redirect_uri
40+ autonumber 5
41+ OP-->>User: 302 Found → post_logout_redirect_uri?state=…
42+ User->>RP: GET post_logout_redirect_uri?state=…
43+ Note over RP: validate_logout_response()
44+ else Otherwise
45+ autonumber 5
46+ OP-->>User: 200 OK + logged out page
47+ end
48+
49+ 1. The RP redirects the browser to the end session endpoint of the OP. With
50+ an Authlib client, ``logout_redirect() `` builds this redirection.
51+ 2. The request contains the parameters listed in `Request Parameters `_.
52+ :class: `EndSessionEndpoint ` checks the ``id_token_hint `` signature with
53+ the OP keys.
54+ 3. Interactive mode only, when ``needs_confirmation `` is true: there is no
55+ valid ``id_token_hint ``. The application shows a confirmation page.
56+ 4. The user confirms the logout.
57+ 5. ``end_session `` terminates the user session. Then:
58+
59+ a. If the `Post-Logout Redirection `_ conditions are met, the OP
60+ redirects the browser to ``post_logout_redirect_uri ``, with the
61+ ``state ``.
62+ b. Otherwise, ``create_endpoint_response `` returns ``None `` and the
63+ application renders its own page.
64+ 6. Case a only. The browser returns to the RP. With an Authlib client,
65+ ``validate_logout_response() `` checks the ``state ``.
66+
67+ The ``/logout `` path is an example.
68+
1869End Session Endpoint
1970--------------------
2071
0 commit comments