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)
Parameters | |
---|---|
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.
Parameter | |
---|---|
Name | Description |
refreshListener |
CredentialRefreshListener refresh listener |
Returns | |
---|---|
Type | Description |
AuthorizationCodeFlow.Builder |
build()
public AuthorizationCodeFlow build()
Returns a new instance of an authorization code flow based on this builder.
Returns | |
---|---|
Type | Description |
AuthorizationCodeFlow |
enablePKCE()
public AuthorizationCodeFlow.Builder enablePKCE()
Enables Proof Key for Code Exchange (PKCE) for this Athorization Code Flow.
Returns | |
---|---|
Type | Description |
AuthorizationCodeFlow.Builder |
getAuthorizationServerEncodedUrl()
public final String getAuthorizationServerEncodedUrl()
Returns the authorization server encoded URL.
Returns | |
---|---|
Type | Description |
String |
getClientAuthentication()
public final HttpExecuteInterceptor getClientAuthentication()
Returns the client authentication or null
for none (see TokenRequest#setClientAuthentication(HttpExecuteInterceptor)).
Returns | |
---|---|
Type | Description |
com.google.api.client.http.HttpExecuteInterceptor |
getClientId()
public final String getClientId()
Returns the client identifier.
Returns | |
---|---|
Type | Description |
String |
getClock()
public final Clock getClock()
Returns the clock passed along to the Credential or Clock#SYSTEM when system default is used.
Returns | |
---|---|
Type | Description |
com.google.api.client.util.Clock |
getCredentialCreatedListener()
public final AuthorizationCodeFlow.CredentialCreatedListener getCredentialCreatedListener()
Returns the credential created listener or null
for none.
Returns | |
---|---|
Type | Description |
AuthorizationCodeFlow.CredentialCreatedListener |
getCredentialDataStore()
public final DataStore<StoredCredential> getCredentialDataStore()
Beta
Returns the stored credential data store or null
for none.
Returns | |
---|---|
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.
Returns | |
---|---|
Type | Description |
CredentialStore |
getJsonFactory()
public final JsonFactory getJsonFactory()
Returns the JSON factory.
Returns | |
---|---|
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).
Returns | |
---|---|
Type | Description |
Credential.AccessMethod |
getRefreshListeners()
public final Collection<CredentialRefreshListener> getRefreshListeners()
Returns the listeners for refresh token results.
Returns | |
---|---|
Type | Description |
Collection<CredentialRefreshListener> |
getRequestInitializer()
public final HttpRequestInitializer getRequestInitializer()
Returns the HTTP request initializer or null
for none.
Returns | |
---|---|
Type | Description |
com.google.api.client.http.HttpRequestInitializer |
getScopes()
public final Collection<String> getScopes()
Returns a collection of scopes.
Returns | |
---|---|
Type | Description |
Collection<String> |
getTokenServerUrl()
public final GenericUrl getTokenServerUrl()
Returns the token server URL.
Returns | |
---|---|
Type | Description |
com.google.api.client.http.GenericUrl |
getTransport()
public final HttpTransport getTransport()
Returns the HTTP transport.
Returns | |
---|---|
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.
Parameter | |
---|---|
Name | Description |
authorizationServerEncodedUrl |
String |
Returns | |
---|---|
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.
Parameter | |
---|---|
Name | Description |
clientAuthentication |
com.google.api.client.http.HttpExecuteInterceptor |
Returns | |
---|---|
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.
Parameter | |
---|---|
Name | Description |
clientId |
String |
Returns | |
---|---|
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.
Parameter | |
---|---|
Name | Description |
clock |
com.google.api.client.util.Clock |
Returns | |
---|---|
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.
Parameter | |
---|---|
Name | Description |
credentialCreatedListener |
AuthorizationCodeFlow.CredentialCreatedListener |
Returns | |
---|---|
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.
Parameter | |
---|---|
Name | Description |
credentialDataStore |
com.google.api.client.util.store.DataStore<StoredCredential> |
Returns | |
---|---|
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.
Parameter | |
---|---|
Name | Description |
credentialStore |
CredentialStore |
Returns | |
---|---|
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.
Parameter | |
---|---|
Name | Description |
dataStoreFactory |
com.google.api.client.util.store.DataStoreFactory |
Returns | |
---|---|
Type | Description |
AuthorizationCodeFlow.Builder |
Exceptions | |
---|---|
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.
Parameter | |
---|---|
Name | Description |
jsonFactory |
com.google.api.client.json.JsonFactory |
Returns | |
---|---|
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.
Parameter | |
---|---|
Name | Description |
method |
Credential.AccessMethod |
Returns | |
---|---|
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.
Parameter | |
---|---|
Name | Description |
refreshListeners |
Collection<CredentialRefreshListener> |
Returns | |
---|---|
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.
Parameter | |
---|---|
Name | Description |
requestInitializer |
com.google.api.client.http.HttpRequestInitializer |
Returns | |
---|---|
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.
Parameter | |
---|---|
Name | Description |
scopes |
Collection<String> collection of scopes |
Returns | |
---|---|
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.
Parameter | |
---|---|
Name | Description |
tokenServerUrl |
com.google.api.client.http.GenericUrl |
Returns | |
---|---|
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.
Parameter | |
---|---|
Name | Description |
transport |
com.google.api.client.http.HttpTransport |
Returns | |
---|---|
Type | Description |
AuthorizationCodeFlow.Builder |