public static class AuthorizationCodeFlow.Builder
Authorization code flow builder.
Implementation is not thread-safe.
Constructors
Builder(Credential.AccessMethod method, HttpTransport transport, JsonFactory jsonFactory, GenericUrl tokenServerUrl, HttpExecuteInterceptor clientAuthentication, String clientId, String authorizationServerEncodedUrl)
public Builder(Credential.AccessMethod method, HttpTransport transport, JsonFactory jsonFactory, GenericUrl tokenServerUrl, HttpExecuteInterceptor clientAuthentication, String clientId, String authorizationServerEncodedUrl)
Name | Description |
method | Credential.AccessMethod method of presenting the access token to the resource server (for example BearerToken#authorizationHeaderAccessMethod) |
transport | com.google.api.client.http.HttpTransport HTTP transport |
jsonFactory | com.google.api.client.json.JsonFactory JSON factory |
tokenServerUrl | com.google.api.client.http.GenericUrl token server URL |
clientAuthentication | com.google.api.client.http.HttpExecuteInterceptor client authentication or |
clientId | String client identifier |
authorizationServerEncodedUrl | String authorization server encoded URL |
Methods
addRefreshListener(CredentialRefreshListener refreshListener)
public AuthorizationCodeFlow.Builder addRefreshListener(CredentialRefreshListener refreshListener)
Adds a listener for refresh token results.
Overriding is only supported for the purpose of calling the super implementation and changing the return type, but nothing else.
Name | Description |
refreshListener | CredentialRefreshListener refresh listener |
Type | Description |
AuthorizationCodeFlow.Builder |
build()
public AuthorizationCodeFlow build()
Returns a new instance of an authorization code flow based on this builder.
Type | Description |
AuthorizationCodeFlow |
enablePKCE()
public AuthorizationCodeFlow.Builder enablePKCE()
Enables Proof Key for Code Exchange (PKCE) for this Athorization Code Flow.
Type | Description |
AuthorizationCodeFlow.Builder |
getAuthorizationServerEncodedUrl()
public final String getAuthorizationServerEncodedUrl()
Returns the authorization server encoded URL.
Type | Description |
String |
getClientAuthentication()
public final HttpExecuteInterceptor getClientAuthentication()
Returns the client authentication or null
for none (see TokenRequest#setClientAuthentication(HttpExecuteInterceptor)).
Type | Description |
com.google.api.client.http.HttpExecuteInterceptor |
getClientId()
public final String getClientId()
Returns the client identifier.
Type | Description |
String |
getClock()
public final Clock getClock()
Returns the clock passed along to the Credential or Clock#SYSTEM when system default is used.
Type | Description |
com.google.api.client.util.Clock |
getCredentialCreatedListener()
public final AuthorizationCodeFlow.CredentialCreatedListener getCredentialCreatedListener()
Returns the credential created listener or null
for none.
Type | Description |
AuthorizationCodeFlow.CredentialCreatedListener |
getCredentialDataStore()
public final DataStore<StoredCredential> getCredentialDataStore()
Beta
Returns the stored credential data store or null
for none.
Type | Description |
com.google.api.client.util.store.DataStore<StoredCredential> |
getCredentialStore() (deprecated)
public final CredentialStore getCredentialStore()
Deprecated. (to be removed in the future) Use #getCredentialDataStore() instead.
Beta
Returns the credential persistence store or null
for none.
Type | Description |
CredentialStore |
getJsonFactory()
public final JsonFactory getJsonFactory()
Returns the JSON factory.
Type | Description |
com.google.api.client.json.JsonFactory |
getMethod()
public final Credential.AccessMethod getMethod()
Returns the method of presenting the access token to the resource server (for example BearerToken#authorizationHeaderAccessMethod).
Type | Description |
Credential.AccessMethod |
getRefreshListeners()
public final Collection<CredentialRefreshListener> getRefreshListeners()
Returns the listeners for refresh token results.
Type | Description |
Collection<CredentialRefreshListener> |
getRequestInitializer()
public final HttpRequestInitializer getRequestInitializer()
Returns the HTTP request initializer or null
for none.
Type | Description |
com.google.api.client.http.HttpRequestInitializer |
getScopes()
public final Collection<String> getScopes()
Returns a collection of scopes.
Type | Description |
Collection<String> |
getTokenServerUrl()
public final GenericUrl getTokenServerUrl()
Returns the token server URL.
Type | Description |
com.google.api.client.http.GenericUrl |
getTransport()
public final HttpTransport getTransport()
Returns the HTTP transport.
Type | Description |
com.google.api.client.http.HttpTransport |
setAuthorizationServerEncodedUrl(String authorizationServerEncodedUrl)
public AuthorizationCodeFlow.Builder setAuthorizationServerEncodedUrl(String authorizationServerEncodedUrl)
Sets the authorization server encoded URL.
Overriding is only supported for the purpose of calling the super implementation and changing the return type, but nothing else.
Name | Description |
authorizationServerEncodedUrl | String |
Type | Description |
AuthorizationCodeFlow.Builder |
setClientAuthentication(HttpExecuteInterceptor clientAuthentication)
public AuthorizationCodeFlow.Builder setClientAuthentication(HttpExecuteInterceptor clientAuthentication)
Sets the client authentication or null
for none (see TokenRequest#setClientAuthentication(HttpExecuteInterceptor)).
Overriding is only supported for the purpose of calling the super implementation and changing the return type, but nothing else.
Name | Description |
clientAuthentication | com.google.api.client.http.HttpExecuteInterceptor |
Type | Description |
AuthorizationCodeFlow.Builder |
setClientId(String clientId)
public AuthorizationCodeFlow.Builder setClientId(String clientId)
Sets the client identifier.
Overriding is only supported for the purpose of calling the super implementation and changing the return type, but nothing else.
Name | Description |
clientId | String |
Type | Description |
AuthorizationCodeFlow.Builder |
setClock(Clock clock)
public AuthorizationCodeFlow.Builder setClock(Clock clock)
Sets the clock to pass to the Credential.
The default value for this parameter is Clock#SYSTEM
Overriding is only supported for the purpose of calling the super implementation and changing the return type, but nothing else.
Name | Description |
clock | com.google.api.client.util.Clock |
Type | Description |
AuthorizationCodeFlow.Builder |
setCredentialCreatedListener(AuthorizationCodeFlow.CredentialCreatedListener credentialCreatedListener)
public AuthorizationCodeFlow.Builder setCredentialCreatedListener(AuthorizationCodeFlow.CredentialCreatedListener credentialCreatedListener)
Sets the credential created listener or null
for none.
Overriding is only supported for the purpose of calling the super implementation and changing the return type, but nothing else.
Name | Description |
credentialCreatedListener | AuthorizationCodeFlow.CredentialCreatedListener |
Type | Description |
AuthorizationCodeFlow.Builder |
setCredentialDataStore(DataStore<StoredCredential> credentialDataStore)
public AuthorizationCodeFlow.Builder setCredentialDataStore(DataStore<StoredCredential> credentialDataStore)
Beta
Sets the stored credential data store or null
for none.
Warning: not compatible with #setCredentialStore, and if it is called before this method is called, this method will throw an IllegalArgumentException.
Overriding is only supported for the purpose of calling the super implementation and changing the return type, but nothing else.
Name | Description |
credentialDataStore | com.google.api.client.util.store.DataStore<StoredCredential> |
Type | Description |
AuthorizationCodeFlow.Builder |
setCredentialStore(CredentialStore credentialStore) (deprecated)
public AuthorizationCodeFlow.Builder setCredentialStore(CredentialStore credentialStore)
Deprecated. (to be removed in the future) Use #setDataStoreFactory(DataStoreFactory) or #setCredentialDataStore(DataStore) instead.
Beta
Sets the credential persistence store or null
for none.
Warning: not compatible with #setDataStoreFactory or #setCredentialDataStore, and if either of those is called before this method is called, this method will throw an IllegalArgumentException.
Overriding is only supported for the purpose of calling the super implementation and changing the return type, but nothing else.
Name | Description |
credentialStore | CredentialStore |
Type | Description |
AuthorizationCodeFlow.Builder |
setDataStoreFactory(DataStoreFactory dataStoreFactory)
public AuthorizationCodeFlow.Builder setDataStoreFactory(DataStoreFactory dataStoreFactory)
Beta
Sets the data store factory or null
for none.
Warning: not compatible with #setCredentialStore, and if it is called before this method is called, this method will throw an IllegalArgumentException.
Overriding is only supported for the purpose of calling the super implementation and changing the return type, but nothing else.
Name | Description |
dataStoreFactory | com.google.api.client.util.store.DataStoreFactory |
Type | Description |
AuthorizationCodeFlow.Builder |
Type | Description |
IOException |
setJsonFactory(JsonFactory jsonFactory)
public AuthorizationCodeFlow.Builder setJsonFactory(JsonFactory jsonFactory)
Sets the JSON factory.
Overriding is only supported for the purpose of calling the super implementation and changing the return type, but nothing else.
Name | Description |
jsonFactory | com.google.api.client.json.JsonFactory |
Type | Description |
AuthorizationCodeFlow.Builder |
setMethod(Credential.AccessMethod method)
public AuthorizationCodeFlow.Builder setMethod(Credential.AccessMethod method)
Sets the method of presenting the access token to the resource server (for example BearerToken#authorizationHeaderAccessMethod).
Overriding is only supported for the purpose of calling the super implementation and changing the return type, but nothing else.
Name | Description |
method | Credential.AccessMethod |
Type | Description |
AuthorizationCodeFlow.Builder |
setRefreshListeners(Collection<CredentialRefreshListener> refreshListeners)
public AuthorizationCodeFlow.Builder setRefreshListeners(Collection<CredentialRefreshListener> refreshListeners)
Sets the listeners for refresh token results.
Overriding is only supported for the purpose of calling the super implementation and changing the return type, but nothing else.
Name | Description |
refreshListeners | Collection<CredentialRefreshListener> |
Type | Description |
AuthorizationCodeFlow.Builder |
setRequestInitializer(HttpRequestInitializer requestInitializer)
public AuthorizationCodeFlow.Builder setRequestInitializer(HttpRequestInitializer requestInitializer)
Sets the HTTP request initializer or null
for none.
Overriding is only supported for the purpose of calling the super implementation and changing the return type, but nothing else.
Name | Description |
requestInitializer | com.google.api.client.http.HttpRequestInitializer |
Type | Description |
AuthorizationCodeFlow.Builder |
setScopes(Collection<String> scopes)
public AuthorizationCodeFlow.Builder setScopes(Collection<String> scopes)
Sets the collection of scopes.
Overriding is only supported for the purpose of calling the super implementation and changing the return type, but nothing else.
Name | Description |
scopes | Collection<String> collection of scopes |
Type | Description |
AuthorizationCodeFlow.Builder |
setTokenServerUrl(GenericUrl tokenServerUrl)
public AuthorizationCodeFlow.Builder setTokenServerUrl(GenericUrl tokenServerUrl)
Sets the token server URL.
Overriding is only supported for the purpose of calling the super implementation and changing the return type, but nothing else.
Name | Description |
tokenServerUrl | com.google.api.client.http.GenericUrl |
Type | Description |
AuthorizationCodeFlow.Builder |
setTransport(HttpTransport transport)
public AuthorizationCodeFlow.Builder setTransport(HttpTransport transport)
Sets the HTTP transport.
Overriding is only supported for the purpose of calling the super implementation and changing the return type, but nothing else.
Name | Description |
transport | com.google.api.client.http.HttpTransport |
Type | Description |
AuthorizationCodeFlow.Builder |