Class Credential.Builder
- java.lang.Object
-
- com.google.api.client.auth.oauth2.Credential.Builder
-
- Enclosing class:
- Credential
public static class Credential.Builder extends java.lang.Object
Credential builder.Implementation is not thread-safe.
-
-
Field Summary
Fields Modifier and Type Field Description (package private) com.google.api.client.http.HttpExecuteInterceptor
clientAuthentication
Client authentication ornull
for none (seeTokenRequest.setClientAuthentication(HttpExecuteInterceptor)
).(package private) com.google.api.client.util.Clock
clock
Clock used for expiration checks.(package private) com.google.api.client.json.JsonFactory
jsonFactory
JSON factory to use for parsing response for refresh token request ornull
if not refreshing tokens.(package private) Credential.AccessMethod
method
Method of presenting the access token to the resource server (for exampleBearerToken.AuthorizationHeaderAccessMethod
).(package private) java.util.Collection<CredentialRefreshListener>
refreshListeners
Listeners for refresh token results.(package private) com.google.api.client.http.HttpRequestInitializer
requestInitializer
HTTP request initializer for refresh token requests to the token server ornull
for none.(package private) com.google.api.client.http.GenericUrl
tokenServerUrl
Token server URL ornull
if not refreshing tokens.(package private) com.google.api.client.http.HttpTransport
transport
HTTP transport for executing refresh token request ornull
if not refreshing tokens.
-
Constructor Summary
Constructors Constructor Description Builder(Credential.AccessMethod method)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Credential.Builder
addRefreshListener(CredentialRefreshListener refreshListener)
Adds a listener for refresh token results.Credential
build()
Returns a new credential instance.com.google.api.client.http.HttpExecuteInterceptor
getClientAuthentication()
Returns the client authentication ornull
for none (seeTokenRequest.setClientAuthentication(HttpExecuteInterceptor)
).com.google.api.client.util.Clock
getClock()
Returns the clock to use for expiration checks orClock.SYSTEM
as default.com.google.api.client.json.JsonFactory
getJsonFactory()
Returns the JSON factory to use for parsing response for refresh token request ornull
if not refreshing tokens.Credential.AccessMethod
getMethod()
Returns the method of presenting the access token to the resource server (for exampleBearerToken.AuthorizationHeaderAccessMethod
).java.util.Collection<CredentialRefreshListener>
getRefreshListeners()
Returns the listeners for refresh token results.com.google.api.client.http.HttpRequestInitializer
getRequestInitializer()
Returns the HTTP request initializer for refresh token requests to the token server ornull
for none.com.google.api.client.http.GenericUrl
getTokenServerUrl()
Returns the token server URL ornull
if not refreshing tokens.com.google.api.client.http.HttpTransport
getTransport()
Returns the HTTP transport for executing refresh token request ornull
if not refreshing tokens.Credential.Builder
setClientAuthentication(com.google.api.client.http.HttpExecuteInterceptor clientAuthentication)
Sets the client authentication ornull
for none (seeTokenRequest.setClientAuthentication(HttpExecuteInterceptor)
).Credential.Builder
setClock(com.google.api.client.util.Clock clock)
Sets the clock to use for expiration checks.Credential.Builder
setJsonFactory(com.google.api.client.json.JsonFactory jsonFactory)
Sets the JSON factory to use for parsing response for refresh token request ornull
if not refreshing tokens.Credential.Builder
setRefreshListeners(java.util.Collection<CredentialRefreshListener> refreshListeners)
Sets the listeners for refresh token results.Credential.Builder
setRequestInitializer(com.google.api.client.http.HttpRequestInitializer requestInitializer)
Sets the HTTP request initializer for refresh token requests to the token server ornull
for none.Credential.Builder
setTokenServerEncodedUrl(java.lang.String tokenServerEncodedUrl)
Sets the encoded token server URL ornull
if not refreshing tokens.Credential.Builder
setTokenServerUrl(com.google.api.client.http.GenericUrl tokenServerUrl)
Sets the token server URL ornull
if not refreshing tokens.Credential.Builder
setTransport(com.google.api.client.http.HttpTransport transport)
Sets the HTTP transport for executing refresh token request ornull
if not refreshing tokens.
-
-
-
Field Detail
-
method
final Credential.AccessMethod method
Method of presenting the access token to the resource server (for exampleBearerToken.AuthorizationHeaderAccessMethod
).
-
transport
com.google.api.client.http.HttpTransport transport
HTTP transport for executing refresh token request ornull
if not refreshing tokens.
-
jsonFactory
com.google.api.client.json.JsonFactory jsonFactory
JSON factory to use for parsing response for refresh token request ornull
if not refreshing tokens.
-
tokenServerUrl
com.google.api.client.http.GenericUrl tokenServerUrl
Token server URL ornull
if not refreshing tokens.
-
clock
com.google.api.client.util.Clock clock
Clock used for expiration checks.
-
clientAuthentication
com.google.api.client.http.HttpExecuteInterceptor clientAuthentication
Client authentication ornull
for none (seeTokenRequest.setClientAuthentication(HttpExecuteInterceptor)
).
-
requestInitializer
com.google.api.client.http.HttpRequestInitializer requestInitializer
HTTP request initializer for refresh token requests to the token server ornull
for none.
-
refreshListeners
java.util.Collection<CredentialRefreshListener> refreshListeners
Listeners for refresh token results.
-
-
Constructor Detail
-
Builder
public Builder(Credential.AccessMethod method)
- Parameters:
method
- method of presenting the access token to the resource server (for exampleBearerToken.AuthorizationHeaderAccessMethod
)
-
-
Method Detail
-
build
public Credential build()
Returns a new credential instance.
-
getMethod
public final Credential.AccessMethod getMethod()
Returns the method of presenting the access token to the resource server (for exampleBearerToken.AuthorizationHeaderAccessMethod
).
-
getTransport
public final com.google.api.client.http.HttpTransport getTransport()
Returns the HTTP transport for executing refresh token request ornull
if not refreshing tokens.
-
setTransport
public Credential.Builder setTransport(com.google.api.client.http.HttpTransport transport)
Sets the HTTP transport for executing refresh token request ornull
if not refreshing tokens.Overriding is only supported for the purpose of calling the super implementation and changing the return type, but nothing else.
-
getClock
public final com.google.api.client.util.Clock getClock()
Returns the clock to use for expiration checks orClock.SYSTEM
as default.- Since:
- 1.9
-
setClock
public Credential.Builder setClock(com.google.api.client.util.Clock clock)
Sets the clock to use for expiration checks.The default value is Clock.SYSTEM.
- Since:
- 1.9
-
getJsonFactory
public final com.google.api.client.json.JsonFactory getJsonFactory()
Returns the JSON factory to use for parsing response for refresh token request ornull
if not refreshing tokens.
-
setJsonFactory
public Credential.Builder setJsonFactory(com.google.api.client.json.JsonFactory jsonFactory)
Sets the JSON factory to use for parsing response for refresh token request ornull
if not refreshing tokens.Overriding is only supported for the purpose of calling the super implementation and changing the return type, but nothing else.
-
getTokenServerUrl
public final com.google.api.client.http.GenericUrl getTokenServerUrl()
Returns the token server URL ornull
if not refreshing tokens.
-
setTokenServerUrl
public Credential.Builder setTokenServerUrl(com.google.api.client.http.GenericUrl tokenServerUrl)
Sets the token server URL ornull
if not refreshing tokens.Overriding is only supported for the purpose of calling the super implementation and changing the return type, but nothing else.
-
setTokenServerEncodedUrl
public Credential.Builder setTokenServerEncodedUrl(java.lang.String tokenServerEncodedUrl)
Sets the encoded token server URL ornull
if not refreshing tokens.Overriding is only supported for the purpose of calling the super implementation and changing the return type, but nothing else.
-
getClientAuthentication
public final com.google.api.client.http.HttpExecuteInterceptor getClientAuthentication()
Returns the client authentication ornull
for none (seeTokenRequest.setClientAuthentication(HttpExecuteInterceptor)
).
-
setClientAuthentication
public Credential.Builder setClientAuthentication(com.google.api.client.http.HttpExecuteInterceptor clientAuthentication)
Sets the client authentication ornull
for none (seeTokenRequest.setClientAuthentication(HttpExecuteInterceptor)
).Overriding is only supported for the purpose of calling the super implementation and changing the return type, but nothing else.
-
getRequestInitializer
public final com.google.api.client.http.HttpRequestInitializer getRequestInitializer()
Returns the HTTP request initializer for refresh token requests to the token server ornull
for none.
-
setRequestInitializer
public Credential.Builder setRequestInitializer(com.google.api.client.http.HttpRequestInitializer requestInitializer)
Sets the HTTP request initializer for refresh token requests to the token server ornull
for none.Overriding is only supported for the purpose of calling the super implementation and changing the return type, but nothing else.
-
addRefreshListener
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.
- Parameters:
refreshListener
- refresh listener
-
getRefreshListeners
public final java.util.Collection<CredentialRefreshListener> getRefreshListeners()
Returns the listeners for refresh token results.
-
setRefreshListeners
public Credential.Builder setRefreshListeners(java.util.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.
-
-