Package com.nimbusds.openid.connect.sdk
Class LogoutRequest
- java.lang.Object
-
- com.nimbusds.oauth2.sdk.AbstractRequest
-
- com.nimbusds.openid.connect.sdk.LogoutRequest
-
@Immutable public class LogoutRequest extends AbstractRequest
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
Constructors Constructor Description LogoutRequest(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
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description ClientIDgetClientID()Returns the client ID.com.nimbusds.jwt.JWTgetIDTokenHint()Returns the ID token hint.StringgetLogoutHint()Returns the logout hint.URIgetPostLogoutRedirectionURI()Return the post-logout redirection URI.StategetState()Returns the state parameter for a post-logout redirection URI.List<com.nimbusds.langtag.LangTag>getUILocales()Returns the end-user's preferred languages and scripts for the user interface, ordered by preference.static LogoutRequestparse(HTTPRequest httpRequest)Parses a logout request from the specified HTTP GET or POST request.static LogoutRequestparse(String query)Parses a logout request from the specified URI query string.static LogoutRequestparse(URI uri)Parses a logout request from the specified URI.static LogoutRequestparse(URI uri, String query)Parses a logout request from the specified URI query string.static LogoutRequestparse(URI uri, Map<String,List<String>> params)Parses a logout request from the specified URI and query parameters.static LogoutRequestparse(Map<String,List<String>> params)Parses a logout request from the specified parameters.HTTPRequesttoHTTPRequest()Returns the matching HTTP request.Map<String,List<String>>toParameters()Returns the parameters for this logout request.StringtoQueryString()Returns the URI query string for this logout request.URItoURI()Returns the complete URI representation for this logout request, consisting of theend-session endpoint URIwith thequery stringappended.-
Methods inherited from class com.nimbusds.oauth2.sdk.AbstractRequest
getEndpointURI
-
-
-
-
Constructor Detail
-
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 benullif thetoHTTPRequest()method will not be used.idTokenHint- The ID token hint (recommended),nullif not specified.logoutHint- The optional logout hint,nullif not specified.clientID- The optional client ID,nullif not specified.postLogoutRedirectURI- The optional post-logout redirection URI,nullif not specified.state- The optional state parameter for the post-logout redirection URI,nullif 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 benullif thetoHTTPRequest()method will not be used.idTokenHint- The ID token hint (recommended),nullif not specified.postLogoutRedirectURI- The optional post-logout redirection URI,nullif not specified.state- The optional state parameter for the post-logout redirection URI,nullif not specified.
-
LogoutRequest
public LogoutRequest(URI uri, com.nimbusds.jwt.JWT idTokenHint)
Creates a new OpenID Connect logout request without a post-logout redirection.- Parameters:
uri- The URI of the end-session endpoint. May benullif thetoHTTPRequest()method will not be used.idTokenHint- The ID token hint (recommended),nullif not specified.
-
LogoutRequest
public LogoutRequest(URI uri)
Creates a new OpenID Connect logout request without a post-logout redirection.- Parameters:
uri- The URI of the end-session endpoint. May benullif thetoHTTPRequest()method will not be used.
-
-
Method Detail
-
getIDTokenHint
public com.nimbusds.jwt.JWT getIDTokenHint()
Returns the ID token hint. Corresponds to the optionalid_token_hintparameter.- Returns:
- The ID token hint,
nullif not specified.
-
getLogoutHint
public String getLogoutHint()
Returns the logout hint. Corresponds to the optionallogout_hintparameter.- Returns:
- The logout hint,
nullif not specified.
-
getClientID
public ClientID getClientID()
Returns the client ID. Corresponds to the optionalclient_idparameter.- Returns:
- The client ID,
nullif not specified.
-
getPostLogoutRedirectionURI
public URI getPostLogoutRedirectionURI()
Return the post-logout redirection URI.- Returns:
- The post-logout redirection URI,
nullif not specified.
-
getState
public State getState()
Returns the state parameter for a post-logout redirection URI. Corresponds to the optionalstateparameter.- Returns:
- The state parameter,
nullif not specified.
-
getUILocales
public List<com.nimbusds.langtag.LangTag> getUILocales()
Returns the end-user's preferred languages and scripts for the user interface, ordered by preference. Corresponds to the optionalui_localesparameter.- Returns:
- The preferred UI locales,
nullif not specified.
-
toParameters
public Map<String,List<String>> 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
public String 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
public URI toURI()
Returns the complete URI representation for this logout request, consisting of theend-session endpoint URIwith thequery stringappended.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
public HTTPRequest toHTTPRequest()
Description copied from interface:RequestReturns the matching HTTP request.- Returns:
- The HTTP request.
-
parse
public static LogoutRequest parse(Map<String,List<String>> params) throws ParseException
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
public static LogoutRequest parse(URI uri, Map<String,List<String>> params) throws ParseException
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 benullif 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
public static LogoutRequest parse(String query) throws ParseException
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,nullif none.- Returns:
- The logout request.
- Throws:
ParseException- If the query string couldn't be parsed to a logout request.
-
parse
public static LogoutRequest parse(URI uri, String query) throws ParseException
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 benullif thetoHTTPRequest()method will not be used.query- The URI query string,nullif none.- Returns:
- The logout request.
- Throws:
ParseException- If the query string couldn't be parsed to a logout request.
-
parse
public static LogoutRequest parse(URI uri) throws ParseException
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
public static LogoutRequest parse(HTTPRequest httpRequest) throws ParseException
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.
-
-