Class Credential.Builder (1.36.0)

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
Name Description
method Credential.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
Name Description
refreshListener CredentialRefreshListener

refresh listener

Returns
Type Description
Credential.Builder

build()

public Credential build()

Returns a new credential instance.

Returns
Type Description
Credential

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

getClock()

public final Clock getClock()

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

Returns
Type Description
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
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 for refresh token requests to the token server or null for none.

Returns
Type Description
com.google.api.client.http.HttpRequestInitializer

getTokenServerUrl()

public final GenericUrl getTokenServerUrl()

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

Returns
Type Description
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
Type Description
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
Name Description
clientAuthentication com.google.api.client.http.HttpExecuteInterceptor
Returns
Type Description
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
Name Description
clock com.google.api.client.util.Clock
Returns
Type Description
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
Name Description
jsonFactory com.google.api.client.json.JsonFactory
Returns
Type Description
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
Name Description
refreshListeners Collection<CredentialRefreshListener>
Returns
Type Description
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
Name Description
requestInitializer com.google.api.client.http.HttpRequestInitializer
Returns
Type Description
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
Name Description
tokenServerEncodedUrl String
Returns
Type Description
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
Name Description
tokenServerUrl com.google.api.client.http.GenericUrl
Returns
Type Description
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
Name Description
transport com.google.api.client.http.HttpTransport
Returns
Type Description
Credential.Builder