Class AccessTokenResponse.Builder

java.lang.Object
org.forgerock.am.oauth2.AccessTokenResponse.Builder
Enclosing class:
AccessTokenResponse

public static final class AccessTokenResponse.Builder extends Object
Access token response builder.
Since:
7.0.0
  • Constructor Details

    • Builder

      public Builder()
  • Method Details

    • accessToken

      public AccessTokenResponse.Builder accessToken(String accessToken)
      Sets the access token.
      Parameters:
      accessToken - the access token
      Returns:
      the builder instance
    • tokenType

      public AccessTokenResponse.Builder tokenType(String tokenType)
      Sets the token type.
      Parameters:
      tokenType - the token type
      Returns:
      the builder instance
    • expiresIn

      public AccessTokenResponse.Builder expiresIn(Duration expiresIn)
      Sets the expires in duration.
      Parameters:
      expiresIn - the expires in duration
      Returns:
      the builder instance
    • scopes

      public AccessTokenResponse.Builder scopes(Set<String> scopes)
      Sets the scopes associated with access token.
      Parameters:
      scopes - the scopes associated with access token
      Returns:
      the builder instance
    • build

      public AccessTokenResponse build()
      Builds a new access token response instance, ensuring all prerequisites.
      Returns:
      an access token response
      Throws:
      NullPointerException - if accessToken, tokenType or expiration are null
      IllegalArgumentException - if accessToken or tokenType are blank