Class UserAuthorizer.Builder

java.lang.Object
com.google.auth.oauth2.UserAuthorizer.Builder
Enclosing class:
UserAuthorizer

public static class UserAuthorizer.Builder extends Object
  • Field Details

  • Constructor Details

    • Builder

      protected Builder()
    • Builder

      protected Builder(UserAuthorizer authorizer)
  • Method Details

    • setClientId

      @CanIgnoreReturnValue public UserAuthorizer.Builder setClientId(ClientId clientId)
      Sets the OAuth 2.0 client ID.
      Parameters:
      clientId - the client ID
      Returns:
      this Builder object
    • setTokenStore

      @CanIgnoreReturnValue public UserAuthorizer.Builder setTokenStore(TokenStore tokenStore)
      Sets the TokenStore to use for long term token storage.
      Parameters:
      tokenStore - the token store
      Returns:
      this Builder object
    • setScopes

      @CanIgnoreReturnValue public UserAuthorizer.Builder setScopes(Collection<String> scopes)
      Sets the OAuth 2.0 scopes to request.
      Parameters:
      scopes - the scopes to request
      Returns:
      this Builder object
    • setTokenServerUri

      @CanIgnoreReturnValue public UserAuthorizer.Builder setTokenServerUri(URI tokenServerUri)
      Sets the token exchange endpoint.
      Parameters:
      tokenServerUri - the token exchange endpoint to use
      Returns:
      this Builder object
    • setCallbackUri

      @CanIgnoreReturnValue public UserAuthorizer.Builder setCallbackUri(URI callbackUri)
      Sets the redirect URI registered with your OAuth provider. This is where the user's browser will be redirected after granting or denying authorization.
      Parameters:
      callbackUri - the redirect URI
      Returns:
      this Builder object
    • setUserAuthUri

      @CanIgnoreReturnValue public UserAuthorizer.Builder setUserAuthUri(URI userAuthUri)
      Sets the authorization URI where the user is directed to log in and grant authorization.
      Parameters:
      userAuthUri - the authorization URI
      Returns:
      this Builder object
    • setHttpTransportFactory

      @CanIgnoreReturnValue public UserAuthorizer.Builder setHttpTransportFactory(HttpTransportFactory transportFactory)
      Sets the HTTP transport factory.
      Parameters:
      transportFactory - the HttpTransportFactory to set
      Returns:
      this Builder object
    • setPKCEProvider

      @CanIgnoreReturnValue public UserAuthorizer.Builder setPKCEProvider(PKCEProvider pkce)
      Sets the optional PKCEProvider to enable Proof Key for Code Exchange to be used. This enhances security by using a code challenge and verifier to prevent authorization code interception attacks.
      Parameters:
      pkce - the PKCEProvider to set
      Returns:
      this Builder object
    • setClientAuthenticationType

      @CanIgnoreReturnValue public UserAuthorizer.Builder setClientAuthenticationType(UserAuthorizer.ClientAuthenticationType clientAuthentication)
      Sets the optional UserAuthorizer.ClientAuthenticationType, one of the client authentication methods defined in RFC 7591. This specifies how your application authenticates itself to the authorization server.
      Parameters:
      clientAuthentication - the ClientAuthenticationType to set
      Returns:
      this Builder object
    • getClientId

      public ClientId getClientId()
    • getTokenStore

      public TokenStore getTokenStore()
    • getScopes

      public Collection<String> getScopes()
    • getTokenServerUri

      public URI getTokenServerUri()
    • getCallbackUri

      public URI getCallbackUri()
    • getUserAuthUri

      public URI getUserAuthUri()
    • getHttpTransportFactory

      public HttpTransportFactory getHttpTransportFactory()
    • getPKCEProvider

      public PKCEProvider getPKCEProvider()
    • getClientAuthenticationType

      public UserAuthorizer.ClientAuthenticationType getClientAuthenticationType()
    • build

      public UserAuthorizer build()