Package com.nimbusds.openid.connect.sdk
Class LogoutRequest
java.lang.Object
com.nimbusds.oauth2.sdk.AbstractRequest
com.nimbusds.openid.connect.sdk.LogoutRequest
Logout request initiated by an OpenID relying party (RP). Supports HTTP GET
and POST. HTTP POST is the recommended method to protect the optional ID
token hint parameter from potentially getting recorded in access logs.
Example HTTP POST request:
POST /op/logout HTTP/1.1 Host: server.example.com Content-Type: application/x-www-form-urlencoded id_token_hint=eyJhbGciOiJSUzI1NiJ9.eyJpc3Mi... &post_logout_redirect_uri=https%3A%2F%2Fclient.example.org%2Fpost-logout &state=af0ifjsldkj
Example URL for an HTTP GET request:
https://server.example.com/op/logout? id_token_hint=eyJhbGciOiJSUzI1NiJ9.eyJpc3Mi... &post_logout_redirect_uri=https%3A%2F%2Fclient.example.org%2Fpost-logout &state=af0ifjsldkj
Related specifications:
- OpenID Connect RP-Initiated Logout 1.0, section 2.
-
Constructor Summary
ConstructorDescriptionLogoutRequest
(URI uri) Creates a new OpenID Connect logout request without a post-logout redirection.LogoutRequest
(URI uri, com.nimbusds.jwt.JWT idTokenHint) Creates a new OpenID Connect logout request without a post-logout redirection.LogoutRequest
(URI uri, com.nimbusds.jwt.JWT idTokenHint, String logoutHint, ClientID clientID, URI postLogoutRedirectURI, State state, List<com.nimbusds.langtag.LangTag> uiLocales) Creates a new OpenID Connect logout request.LogoutRequest
(URI uri, com.nimbusds.jwt.JWT idTokenHint, URI postLogoutRedirectURI, State state) Creates a new OpenID Connect logout request. -
Method Summary
Modifier and TypeMethodDescriptionReturns the client ID.com.nimbusds.jwt.JWT
Returns the ID token hint.Returns the logout hint.Return the post-logout redirection URI.getState()
Returns the state parameter for a post-logout redirection URI.List<com.nimbusds.langtag.LangTag>
Returns the end-user's preferred languages and scripts for the user interface, ordered by preference.static LogoutRequest
parse
(HTTPRequest httpRequest) Parses a logout request from the specified HTTP GET or POST request.static LogoutRequest
Parses a logout request from the specified URI query string.static LogoutRequest
Parses a logout request from the specified URI.static LogoutRequest
Parses a logout request from the specified URI query string.static LogoutRequest
Parses a logout request from the specified URI and query parameters.static LogoutRequest
Parses a logout request from the specified parameters.Returns the matching HTTP request.Returns the parameters for this logout request.Returns the URI query string for this logout request.toURI()
Returns the complete URI representation for this logout request, consisting of theend-session endpoint URI
with thequery string
appended.Methods inherited from class com.nimbusds.oauth2.sdk.AbstractRequest
getEndpointURI
-
Constructor Details
-
LogoutRequest
public LogoutRequest(URI uri, com.nimbusds.jwt.JWT idTokenHint, String logoutHint, ClientID clientID, URI postLogoutRedirectURI, State state, List<com.nimbusds.langtag.LangTag> uiLocales) Creates a new OpenID Connect logout request.- Parameters:
uri
- The URI of the end-session endpoint. May benull
if thetoHTTPRequest()
method will not be used.idTokenHint
- The ID token hint (recommended),null
if not specified.logoutHint
- The optional logout hint,null
if not specified.clientID
- The optional client ID,null
if not specified.postLogoutRedirectURI
- The optional post-logout redirection URI,null
if not specified.state
- The optional state parameter for the post-logout redirection URI,null
if not specified.uiLocales
- The optional end-user's preferred languages and scripts for the user interface, ordered by preference.
-
LogoutRequest
public LogoutRequest(URI uri, com.nimbusds.jwt.JWT idTokenHint, URI postLogoutRedirectURI, State state) Creates a new OpenID Connect logout request.- Parameters:
uri
- The URI of the end-session endpoint. May benull
if thetoHTTPRequest()
method will not be used.idTokenHint
- The ID token hint (recommended),null
if not specified.postLogoutRedirectURI
- The optional post-logout redirection URI,null
if not specified.state
- The optional state parameter for the post-logout redirection URI,null
if not specified.
-
LogoutRequest
Creates a new OpenID Connect logout request without a post-logout redirection.- Parameters:
uri
- The URI of the end-session endpoint. May benull
if thetoHTTPRequest()
method will not be used.idTokenHint
- The ID token hint (recommended),null
if not specified.
-
LogoutRequest
Creates a new OpenID Connect logout request without a post-logout redirection.- Parameters:
uri
- The URI of the end-session endpoint. May benull
if thetoHTTPRequest()
method will not be used.
-
-
Method Details
-
getIDTokenHint
Returns the ID token hint. Corresponds to the optionalid_token_hint
parameter.- Returns:
- The ID token hint,
null
if not specified.
-
getLogoutHint
Returns the logout hint. Corresponds to the optionallogout_hint
parameter.- Returns:
- The logout hint,
null
if not specified.
-
getClientID
Returns the client ID. Corresponds to the optionalclient_id
parameter.- Returns:
- The client ID,
null
if not specified.
-
getPostLogoutRedirectionURI
Return the post-logout redirection URI.- Returns:
- The post-logout redirection URI,
null
if not specified.
-
getState
Returns the state parameter for a post-logout redirection URI. Corresponds to the optionalstate
parameter.- Returns:
- The state parameter,
null
if not specified.
-
getUILocales
Returns the end-user's preferred languages and scripts for the user interface, ordered by preference. Corresponds to the optionalui_locales
parameter.- Returns:
- The preferred UI locales,
null
if not specified.
-
toParameters
Returns the parameters for this logout request.Example parameters:
id_token_hint = eyJhbGciOiJSUzI1NiJ9.eyJpc3Mi... post_logout_redirect_uri = https://client.example.com/post-logout state = af0ifjsldkj
- Returns:
- The parameters.
-
toQueryString
Returns the URI query string for this logout request.Note that the '?' character preceding the query string in a URI is not included in the returned string.
Example URI query string:
id_token_hint = eyJhbGciOiJSUzI1NiJ9.eyJpc3Mi... &post_logout_redirect_uri=https%3A%2F%2Fclient%2Eexample%2Ecom%2Fpost-logout &state=af0ifjsldkj
- Returns:
- The URI query string.
-
toURI
Returns the complete URI representation for this logout request, consisting of theend-session endpoint URI
with thequery string
appended.Example URI:
https://server.example.com/logout? id_token_hint = eyJhbGciOiJSUzI1NiJ9.eyJpc3Mi... &post_logout_redirect_uri=https%3A%2F%2Fclient%2Eexample%2Ecom%2Fpost-logout &state=af0ifjsldkj
- Returns:
- The URI representation.
-
toHTTPRequest
Description copied from interface:Request
Returns the matching HTTP request.- Returns:
- The HTTP request.
-
parse
Parses a logout request from the specified parameters.Example parameters:
id_token_hint = eyJhbGciOiJSUzI1NiJ9.eyJpc3Mi... post_logout_redirect_uri = https://client.example.com/post-logout state = af0ifjsldkj
- Parameters:
params
- The parameters, empty map if none. Must not benull
.- Returns:
- The logout request.
- Throws:
ParseException
- If the parameters couldn't be parsed to a logout request.
-
parse
Parses a logout request from the specified URI and query parameters.Example parameters:
id_token_hint = eyJhbGciOiJSUzI1NiJ9.eyJpc3Mi... post_logout_redirect_uri = https://client.example.com/post-logout state = af0ifjsldkj
- Parameters:
uri
- The URI of the end-session endpoint. May benull
if thetoHTTPRequest()
method will not be used.params
- The parameters, empty map if none. Must not benull
.- Returns:
- The logout request.
- Throws:
ParseException
- If the parameters couldn't be parsed to a logout request.
-
parse
Parses a logout request from the specified URI query string.Example URI query string:
id_token_hint = eyJhbGciOiJSUzI1NiJ9.eyJpc3Mi... &post_logout_redirect_uri=https%3A%2F%2Fclient%2Eexample%2Ecom%2Fpost-logout &state=af0ifjsldkj
- Parameters:
query
- The URI query string,null
if none.- Returns:
- The logout request.
- Throws:
ParseException
- If the query string couldn't be parsed to a logout request.
-
parse
Parses a logout request from the specified URI query string.Example URI query string:
id_token_hint = eyJhbGciOiJSUzI1NiJ9.eyJpc3Mi... &post_logout_redirect_uri=https%3A%2F%2Fclient%2Eexample%2Ecom%2Fpost-logout &state=af0ifjsldkj
- Parameters:
uri
- The URI of the end-session endpoint. May benull
if thetoHTTPRequest()
method will not be used.query
- The URI query string,null
if none.- Returns:
- The logout request.
- Throws:
ParseException
- If the query string couldn't be parsed to a logout request.
-
parse
Parses a logout request from the specified URI.Example URI:
https://server.example.com/logout? id_token_hint = eyJhbGciOiJSUzI1NiJ9.eyJpc3Mi... &post_logout_redirect_uri=https%3A%2F%2Fclient%2Eexample%2Ecom%2Fpost-logout &state=af0ifjsldkj
- Parameters:
uri
- The URI. Must not benull
.- Returns:
- The logout request.
- Throws:
ParseException
- If the URI couldn't be parsed to a logout request.
-
parse
Parses a logout request from the specified HTTP GET or POST request.Example HTTP POST request:
POST /op/logout HTTP/1.1 Host: server.example.com Content-Type: application/x-www-form-urlencoded id_token_hint=eyJhbGciOiJSUzI1NiJ9.eyJpc3Mi... &post_logout_redirect_uri=https%3A%2F%2Fclient.example.org%2Fpost-logout &state=af0ifjsldkj
- Parameters:
httpRequest
- The HTTP request. Must not benull
.- Returns:
- The logout request.
- Throws:
ParseException
- If the HTTP request couldn't be parsed to a logout request.
-