Class LogoutRequest

  • All Implemented Interfaces:
    Message, Request

    @Immutable
    public class LogoutRequest
    extends AbstractRequest
    Logout request initiated by an OpenID relying party (RP).

    Example HTTP 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 Session Management 1.0, section 5.
    • Constructor Detail

      • 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 be null if the toHTTPRequest() 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

        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 be null if the toHTTPRequest() method will not be used.
        idTokenHint - The ID token hint (recommended), null if 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 be null if the toHTTPRequest() method will not be used.
    • Method Detail

      • getIDTokenHint

        public com.nimbusds.jwt.JWT getIDTokenHint()
        Returns the ID token hint.
        Returns:
        The ID token hint, null if not specified.
      • getPostLogoutRedirectionURI

        public URI getPostLogoutRedirectionURI()
        Return the post-logout redirection URI.
        Returns:
        The post-logout redirection URI, null if not specified.
      • getState

        public State getState()
        Returns the state parameter for a post-logout redirection URI.
        Returns:
        The state parameter, null if not specified.
      • toParameters

        public Map<String,​List<String>> toParameters()
        Returns the URI query 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 an 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 the end-session endpoint URI with the query 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

        public HTTPRequest toHTTPRequest()
        Description copied from interface: Request
        Returns 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 URI query 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 be null.
        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 be null if the toHTTPRequest() method will not be used.
        params - The parameters, empty map if none. Must not be null.
        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, null if 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 be null if the toHTTPRequest() 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

        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 be null.
        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 request.

        Example HTTP request (GET):

         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:
        httpRequest - The HTTP request. Must not be null.
        Returns:
        The logout request.
        Throws:
        ParseException - If the HTTP request couldn't be parsed to a logout request.