public static class Credential.Builder extends Object
Implementation is not thread-safe.
Constructor and Description |
---|
Builder(Credential.AccessMethod method) |
Modifier and Type | Method and Description |
---|---|
Credential.Builder |
addRefreshListener(CredentialRefreshListener refreshListener)
Adds a listener for refresh token results.
|
Credential |
build()
Returns a new credential instance.
|
HttpExecuteInterceptor |
getClientAuthentication()
Returns the client authentication or
null for none (see
TokenRequest.setClientAuthentication(HttpExecuteInterceptor) ). |
Clock |
getClock()
Returns the clock to use for expiration checks or
Clock.SYSTEM as default. |
JsonFactory |
getJsonFactory()
Returns the JSON factory to use for parsing response for refresh token request or
null if not refreshing tokens. |
Credential.AccessMethod |
getMethod()
Returns the method of presenting the access token to the resource server (for example
BearerToken.AuthorizationHeaderAccessMethod ). |
Collection<CredentialRefreshListener> |
getRefreshListeners()
Returns the listeners for refresh token results.
|
HttpRequestInitializer |
getRequestInitializer()
Returns the HTTP request initializer for refresh token requests to the token server or
null for none. |
GenericUrl |
getTokenServerUrl()
Returns the token server URL or
null if not refreshing tokens. |
HttpTransport |
getTransport()
Returns the HTTP transport for executing refresh token request or
null if not
refreshing tokens. |
Credential.Builder |
setClientAuthentication(HttpExecuteInterceptor clientAuthentication)
Sets the client authentication or
null for none (see
TokenRequest.setClientAuthentication(HttpExecuteInterceptor) ). |
Credential.Builder |
setClock(Clock clock)
Sets the clock to use for expiration checks.
|
Credential.Builder |
setJsonFactory(JsonFactory jsonFactory)
Sets the JSON factory to use for parsing response for refresh token request or
null
if not refreshing tokens. |
Credential.Builder |
setRefreshListeners(Collection<CredentialRefreshListener> refreshListeners)
Sets the listeners for refresh token results.
|
Credential.Builder |
setRequestInitializer(HttpRequestInitializer requestInitializer)
Sets the HTTP request initializer for refresh token requests to the token server or
null for none. |
Credential.Builder |
setTokenServerEncodedUrl(String tokenServerEncodedUrl)
Sets the encoded token server URL or
null if not refreshing tokens. |
Credential.Builder |
setTokenServerUrl(GenericUrl tokenServerUrl)
Sets the token server URL or
null if not refreshing tokens. |
Credential.Builder |
setTransport(HttpTransport transport)
Sets the HTTP transport for executing refresh token request or
null if not refreshing
tokens. |
public Builder(Credential.AccessMethod method)
method
- method of presenting the access token to the resource server (for example
BearerToken.AuthorizationHeaderAccessMethod
)public Credential build()
public final Credential.AccessMethod getMethod()
BearerToken.AuthorizationHeaderAccessMethod
).public final HttpTransport getTransport()
null
if not
refreshing tokens.public Credential.Builder setTransport(HttpTransport transport)
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.
public final Clock getClock()
Clock.SYSTEM
as default.public Credential.Builder setClock(Clock clock)
The default value is Clock.SYSTEM.
public final JsonFactory getJsonFactory()
null
if not refreshing tokens.public Credential.Builder setJsonFactory(JsonFactory jsonFactory)
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.
public final GenericUrl getTokenServerUrl()
null
if not refreshing tokens.public Credential.Builder setTokenServerUrl(GenericUrl tokenServerUrl)
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.
public Credential.Builder setTokenServerEncodedUrl(String tokenServerEncodedUrl)
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.
public final HttpExecuteInterceptor getClientAuthentication()
null
for none (see
TokenRequest.setClientAuthentication(HttpExecuteInterceptor)
).public Credential.Builder setClientAuthentication(HttpExecuteInterceptor clientAuthentication)
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.
public final HttpRequestInitializer getRequestInitializer()
null
for none.public Credential.Builder setRequestInitializer(HttpRequestInitializer requestInitializer)
null
for none.
Overriding is only supported for the purpose of calling the super implementation and changing the return type, but nothing else.
public Credential.Builder addRefreshListener(CredentialRefreshListener refreshListener)
Overriding is only supported for the purpose of calling the super implementation and changing the return type, but nothing else.
refreshListener
- refresh listenerpublic final Collection<CredentialRefreshListener> getRefreshListeners()
public Credential.Builder setRefreshListeners(Collection<CredentialRefreshListener> refreshListeners)
Overriding is only supported for the purpose of calling the super implementation and changing the return type, but nothing else.
Copyright © 2011–2019 Google. All rights reserved.