Package com.google.auth.oauth2
Class UserAuthorizer.Builder
java.lang.Object
com.google.auth.oauth2.UserAuthorizer.Builder
- Enclosing class:
UserAuthorizer
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate URI
private ClientId
private PKCEProvider
private Collection
<String> private URI
private TokenStore
private HttpTransportFactory
private URI
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbuild()
setCallbackUri
(URI callbackUri) Sets the redirect URI registered with your OAuth provider.setClientAuthenticationType
(UserAuthorizer.ClientAuthenticationType clientAuthentication) Sets the optionalUserAuthorizer.ClientAuthenticationType
, one of the client authentication methods defined in RFC 7591.setClientId
(ClientId clientId) Sets the OAuth 2.0 client ID.setHttpTransportFactory
(HttpTransportFactory transportFactory) Sets the HTTP transport factory.setPKCEProvider
(PKCEProvider pkce) Sets the optionalPKCEProvider
to enable Proof Key for Code Exchange to be used.setScopes
(Collection<String> scopes) Sets the OAuth 2.0 scopes to request.setTokenServerUri
(URI tokenServerUri) Sets the token exchange endpoint.setTokenStore
(TokenStore tokenStore) Sets theTokenStore
to use for long term token storage.setUserAuthUri
(URI userAuthUri) Sets the authorization URI where the user is directed to log in and grant authorization.
-
Field Details
-
clientId
-
tokenStore
-
callbackUri
-
tokenServerUri
-
userAuthUri
-
scopes
-
transportFactory
-
pkce
-
clientAuthenticationType
-
-
Constructor Details
-
Builder
protected Builder() -
Builder
-
-
Method Details
-
setClientId
Sets the OAuth 2.0 client ID.- Parameters:
clientId
- the client ID- Returns:
- this
Builder
object
-
setTokenStore
Sets theTokenStore
to use for long term token storage.- Parameters:
tokenStore
- the token store- Returns:
- this
Builder
object
-
setScopes
Sets the OAuth 2.0 scopes to request.- Parameters:
scopes
- the scopes to request- Returns:
- this
Builder
object
-
setTokenServerUri
Sets the token exchange endpoint.- Parameters:
tokenServerUri
- the token exchange endpoint to use- Returns:
- this
Builder
object
-
setCallbackUri
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
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
- theHttpTransportFactory
to set- Returns:
- this
Builder
object
-
setPKCEProvider
Sets the optionalPKCEProvider
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
- thePKCEProvider
to set- Returns:
- this
Builder
object
-
setClientAuthenticationType
@CanIgnoreReturnValue public UserAuthorizer.Builder setClientAuthenticationType(UserAuthorizer.ClientAuthenticationType clientAuthentication) Sets the optionalUserAuthorizer.ClientAuthenticationType
, one of the client authentication methods defined in RFC 7591. This specifies how your application authenticates itself to the authorization server.- Parameters:
clientAuthentication
- theClientAuthenticationType
to set- Returns:
- this
Builder
object
-
getClientId
-
getTokenStore
-
getScopes
-
getTokenServerUri
-
getCallbackUri
-
getUserAuthUri
-
getHttpTransportFactory
-
getPKCEProvider
-
getClientAuthenticationType
-
build
-