Class Credential.Builder (1.32.1)

public static class Credential.Builder

Credential builder.

Implementation is not thread-safe.

Inheritance

java.lang.Object > Credential.Builder

Constructors

Builder(Credential.AccessMethod method)

public Builder(Credential.AccessMethod method)
Parameter
NameDescription
methodCredential.AccessMethod

method of presenting the access token to the resource server (for example BearerToken.AuthorizationHeaderAccessMethod)

Methods

addRefreshListener(CredentialRefreshListener refreshListener)

public Credential.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
NameDescription
refreshListenerCredentialRefreshListener

refresh listener

Returns
TypeDescription
Credential.Builder

build()

public Credential build()

Returns a new credential instance.

Returns
TypeDescription
Credential

getClientAuthentication()

public final HttpExecuteInterceptor getClientAuthentication()

Returns the client authentication or null for none (see TokenRequest#setClientAuthentication(HttpExecuteInterceptor)).

Returns
TypeDescription
com.google.api.client.http.HttpExecuteInterceptor

getClock()

public final Clock getClock()

Returns the clock to use for expiration checks or Clock#SYSTEM as default.

Returns
TypeDescription
com.google.api.client.util.Clock

getJsonFactory()

public final JsonFactory getJsonFactory()

Returns the JSON factory to use for parsing response for refresh token request or null if not refreshing tokens.

Returns
TypeDescription
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
TypeDescription
Credential.AccessMethod

getRefreshListeners()

public final Collection<CredentialRefreshListener> getRefreshListeners()

Returns the listeners for refresh token results.

Returns
TypeDescription
Collection<CredentialRefreshListener>

getRequestInitializer()

public final HttpRequestInitializer getRequestInitializer()

Returns the HTTP request initializer for refresh token requests to the token server or null for none.

Returns
TypeDescription
com.google.api.client.http.HttpRequestInitializer

getTokenServerUrl()

public final GenericUrl getTokenServerUrl()

Returns the token server URL or null if not refreshing tokens.

Returns
TypeDescription
com.google.api.client.http.GenericUrl

getTransport()

public final HttpTransport getTransport()

Returns the HTTP transport for executing refresh token request or null if not refreshing tokens.

Returns
TypeDescription
com.google.api.client.http.HttpTransport

setClientAuthentication(HttpExecuteInterceptor clientAuthentication)

public Credential.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
NameDescription
clientAuthenticationcom.google.api.client.http.HttpExecuteInterceptor
Returns
TypeDescription
Credential.Builder

setClock(Clock clock)

public Credential.Builder setClock(Clock clock)

Sets the clock to use for expiration checks.

The default value is Clock.SYSTEM.

Parameter
NameDescription
clockcom.google.api.client.util.Clock
Returns
TypeDescription
Credential.Builder

setJsonFactory(JsonFactory jsonFactory)

public Credential.Builder setJsonFactory(JsonFactory jsonFactory)

Sets the JSON factory to use for parsing response for refresh token request or null if not refreshing tokens.

Overriding is only supported for the purpose of calling the super implementation and changing the return type, but nothing else.

Parameter
NameDescription
jsonFactorycom.google.api.client.json.JsonFactory
Returns
TypeDescription
Credential.Builder

setRefreshListeners(Collection<CredentialRefreshListener> refreshListeners)

public Credential.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
NameDescription
refreshListenersCollection<CredentialRefreshListener>
Returns
TypeDescription
Credential.Builder

setRequestInitializer(HttpRequestInitializer requestInitializer)

public Credential.Builder setRequestInitializer(HttpRequestInitializer requestInitializer)

Sets the HTTP request initializer for refresh token requests to the token server 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
NameDescription
requestInitializercom.google.api.client.http.HttpRequestInitializer
Returns
TypeDescription
Credential.Builder

setTokenServerEncodedUrl(String tokenServerEncodedUrl)

public Credential.Builder setTokenServerEncodedUrl(String tokenServerEncodedUrl)

Sets the encoded token server URL or null if not refreshing tokens.

Overriding is only supported for the purpose of calling the super implementation and changing the return type, but nothing else.

Parameter
NameDescription
tokenServerEncodedUrlString
Returns
TypeDescription
Credential.Builder

setTokenServerUrl(GenericUrl tokenServerUrl)

public Credential.Builder setTokenServerUrl(GenericUrl tokenServerUrl)

Sets the token server URL or null if not refreshing tokens.

Overriding is only supported for the purpose of calling the super implementation and changing the return type, but nothing else.

Parameter
NameDescription
tokenServerUrlcom.google.api.client.http.GenericUrl
Returns
TypeDescription
Credential.Builder

setTransport(HttpTransport transport)

public Credential.Builder setTransport(HttpTransport transport)

Sets the HTTP transport for executing refresh token request or null if not refreshing tokens.

Overriding is only supported for the purpose of calling the super implementation and changing the return type, but nothing else.

Parameter
NameDescription
transportcom.google.api.client.http.HttpTransport
Returns
TypeDescription
Credential.Builder