Class OAuth2AuthorizationRequest

java.lang.Object
com.codename1.backend.security.oauth2.client.OAuth2AuthorizationRequest

public final class OAuth2AuthorizationRequest extends Object
One user being sent to an identity provider: where to, and the three values that tie the provider's answer back to this browser -- the state, the nonce the ID token must repeat, and the PKCE verifier whose hash went with the request. It is kept, between the redirect out and the answer coming back, by an AuthorizationRequestRepository.
  • Method Details

    • from

      public static OAuth2AuthorizationRequest.Builder from(ClientRegistration registration, String redirectUri)
      A request through registration, with a new state, nonce and PKCE verifier of 256 random bits each.
    • from

      A builder that starts as a copy of request.
    • getRegistrationId

      public String getRegistrationId()
    • getAuthorizationUri

      public String getAuthorizationUri()
    • getClientId

      public String getClientId()
    • getRedirectUri

      public String getRedirectUri()
      The address the provider is asked to answer at, which the exchange of the code must repeat exactly.
    • getScopes

      public Set<String> getScopes()
    • getState

      public String getState()
    • getNonce

      public String getNonce()
      The value the ID token must repeat, or null when no ID token is asked for.
    • getCodeVerifier

      public String getCodeVerifier()
      The PKCE verifier. It never leaves this server except in the exchange of the code; the request carries its SHA-256.
    • getAdditionalParameters

      public Map<String,Object> getAdditionalParameters()
      What the request carries besides the parameters OAuth2 defines.
    • getAuthorizationRequestUri

      public String getAuthorizationRequestUri()
      The address the browser is sent to.
    • toMap

      public Map<String,Object> toMap()
      The request as a map of text, numbers and lists: what a session, or a cookie, can keep.
    • fromMap

      public static OAuth2AuthorizationRequest fromMap(Map stored)
      The request toMap() wrote, or null when stored is not one.