AttestoClient.Logout (AttestoClient v2.26.0)

Copy Markdown View Source

Build an OpenID Connect RP-Initiated Logout request.

The returned URL directs the user agent to the provider's discovered end_session_endpoint. This module constructs the standards-based request; it does not destroy an application session. The caller owns logout-state correlation and decides when local session termination is appropriate.

Summary

Functions

Build an RP-Initiated Logout URL.

Functions

url(opts)

@spec url(keyword()) :: {:ok, String.t()} | {:error, term()}

Build an RP-Initiated Logout URL.

:issuer is required. Discovery is fetched unless :metadata is supplied. :outbound names deliberate exceptions to the HTTPS and public-address rules for the issuer and its endpoints (AttestoClient.Outbound). The request parameters are all optional, as in RP-Initiated Logout 1.0 §2: :id_token_hint, :logout_hint, :client_id, :post_logout_redirect_uri, :state, and :ui_locales.

An endpoint query containing any of those names, or any repeated name, returns {:error, :invalid_endpoint_query}. Names are percent-decoded before comparison. Other fixed query parameters are preserved.

Send :id_token_hint when the ID Token is still at hand; the specification recommends it. Without one, the URL is the validated end_session_endpoint with whatever parameters were given, and the provider decides whether to ask the End-User to confirm (§2).

:post_logout_redirect_uri without :id_token_hint requires :client_id: the provider validates the redirect against a client's registration, and with no ID Token the client_id parameter is the only thing that names the client (§2, §3). That combination without :client_id returns {:error, :missing_client_id}.