Backend API. Server-side code: this runs in a Codename One backend, not in the app on the device.

public final class OAuth2AuthorizationRequest

  1. Object
  2. OAuth2AuthorizationRequest
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.

Nested types

class OAuth2AuthorizationRequest.BuilderBuilds an OAuth2AuthorizationRequest.

Methods

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.
public static OAuth2AuthorizationRequest.Builder from(OAuth2AuthorizationRequest request)A builder that starts as a copy of request.
public String getRegistrationId()
public String getAuthorizationUri()
public String getClientId()
public String getRedirectUri()The address the provider is asked to answer at, which the exchange of the code must repeat exactly.
public Set<String> getScopes()
public String getState()
public String getNonce()The value the ID token must repeat, or null when no ID token is asked for.
public String getCodeVerifier()The PKCE verifier.
public Map<String, Object> getAdditionalParameters()What the request carries besides the parameters OAuth2 defines.
public String getAuthorizationRequestUri()The address the browser is sent to.
public Map<String, Object> toMap()The request as a map of text, numbers and lists: what a session, or a cookie, can keep.
public static OAuth2AuthorizationRequest fromMap(Map stored)The request toMap wrote, or null when stored is not one.

Inherited methods

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

public static OAuth2AuthorizationRequest.Builder from(OAuth2AuthorizationRequest request)
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.