public static class GoogleCredential.Builder
extends com.google.api.client.auth.oauth2.Credential.Builder
Implementation is not thread-safe.
Constructor and Description |
---|
Builder() |
Modifier and Type | Method and Description |
---|---|
GoogleCredential.Builder |
addRefreshListener(com.google.api.client.auth.oauth2.CredentialRefreshListener refreshListener) |
GoogleCredential |
build() |
String |
getServiceAccountId()
Returns the service account ID (typically an e-mail address) or
null for none. |
PrivateKey |
getServiceAccountPrivateKey()
Returns the private key to use with the service account flow or
null for none. |
String |
getServiceAccountPrivateKeyId()
Beta Returns the id of the private key to use with the service account flow or null
for none. |
String |
getServiceAccountProjectId()
Returns the service account Project ID or
null for none. |
Collection<String> |
getServiceAccountScopes()
Returns a collection of OAuth scopes to use with the service account flow or
null
for none. |
String |
getServiceAccountUser()
Returns the email address of the user the application is trying to impersonate in the service
account flow or
null for none. |
GoogleCredential.Builder |
setClientAuthentication(com.google.api.client.http.HttpExecuteInterceptor clientAuthentication) |
GoogleCredential.Builder |
setClientSecrets(GoogleClientSecrets clientSecrets)
Sets the client secrets.
|
GoogleCredential.Builder |
setClientSecrets(String clientId,
String clientSecret)
Sets the client identifier and secret.
|
GoogleCredential.Builder |
setClock(com.google.api.client.util.Clock clock) |
GoogleCredential.Builder |
setJsonFactory(com.google.api.client.json.JsonFactory jsonFactory) |
GoogleCredential.Builder |
setRefreshListeners(Collection<com.google.api.client.auth.oauth2.CredentialRefreshListener> refreshListeners) |
GoogleCredential.Builder |
setRequestInitializer(com.google.api.client.http.HttpRequestInitializer requestInitializer) |
GoogleCredential.Builder |
setServiceAccountId(String serviceAccountId)
Sets the service account ID (typically an e-mail address) or
null for none. |
GoogleCredential.Builder |
setServiceAccountPrivateKey(PrivateKey serviceAccountPrivateKey)
Sets the private key to use with the service account flow or
null for none. |
GoogleCredential.Builder |
setServiceAccountPrivateKeyFromP12File(File p12File)
Sets the private key to use with the service account flow or
null for none. |
GoogleCredential.Builder |
setServiceAccountPrivateKeyFromP12File(InputStream p12FileInputStream)
Sets the private key to use with the service account flow or
null for none. |
GoogleCredential.Builder |
setServiceAccountPrivateKeyFromPemFile(File pemFile)
Beta Sets the private key to use with the service account flow or null for none. |
GoogleCredential.Builder |
setServiceAccountPrivateKeyId(String serviceAccountPrivateKeyId)
Beta Sets the id of the private key to use with the service account flow or null for
none. |
GoogleCredential.Builder |
setServiceAccountProjectId(String serviceAccountProjectId)
Sets the service account Project ID or
null for none. |
GoogleCredential.Builder |
setServiceAccountScopes(Collection<String> serviceAccountScopes)
Sets the space-separated OAuth scopes to use with the service account flow or
null for none. |
GoogleCredential.Builder |
setServiceAccountUser(String serviceAccountUser)
Sets the email address of the user the application is trying to impersonate in the service
account flow or
null for none. |
GoogleCredential.Builder |
setTokenServerEncodedUrl(String tokenServerEncodedUrl) |
GoogleCredential.Builder |
setTokenServerUrl(com.google.api.client.http.GenericUrl tokenServerUrl) |
GoogleCredential.Builder |
setTransport(com.google.api.client.http.HttpTransport transport) |
public GoogleCredential build()
build
in class com.google.api.client.auth.oauth2.Credential.Builder
public GoogleCredential.Builder setTransport(com.google.api.client.http.HttpTransport transport)
setTransport
in class com.google.api.client.auth.oauth2.Credential.Builder
public GoogleCredential.Builder setJsonFactory(com.google.api.client.json.JsonFactory jsonFactory)
setJsonFactory
in class com.google.api.client.auth.oauth2.Credential.Builder
public GoogleCredential.Builder setClock(com.google.api.client.util.Clock clock)
setClock
in class com.google.api.client.auth.oauth2.Credential.Builder
public GoogleCredential.Builder setClientSecrets(String clientId, String clientSecret)
Overriding is only supported for the purpose of calling the super implementation and changing the return type, but nothing else.
public GoogleCredential.Builder setClientSecrets(GoogleClientSecrets clientSecrets)
Overriding is only supported for the purpose of calling the super implementation and changing the return type, but nothing else.
public final String getServiceAccountId()
null
for none.public GoogleCredential.Builder setServiceAccountId(String serviceAccountId)
null
for none.
Overriding is only supported for the purpose of calling the super implementation and changing the return type, but nothing else.
public final String getServiceAccountProjectId()
null
for none.public GoogleCredential.Builder setServiceAccountProjectId(String serviceAccountProjectId)
null
for none.
Overriding is only supported for the purpose of calling the super implementation and changing the return type, but nothing else.
public final Collection<String> getServiceAccountScopes()
null
for none.public GoogleCredential.Builder setServiceAccountScopes(Collection<String> serviceAccountScopes)
null
for none.
Overriding is only supported for the purpose of calling the super implementation and changing the return type, but nothing else.
serviceAccountScopes
- collection of scopes to be joined by a space separator (or a
single value containing multiple space-separated scopes)public final PrivateKey getServiceAccountPrivateKey()
null
for none.public GoogleCredential.Builder setServiceAccountPrivateKey(PrivateKey serviceAccountPrivateKey)
null
for none.
Overriding is only supported for the purpose of calling the super implementation and changing the return type, but nothing else.
@Beta public final String getServiceAccountPrivateKeyId()
Beta
null
for none.@Beta public GoogleCredential.Builder setServiceAccountPrivateKeyId(String serviceAccountPrivateKeyId)
Beta
null
for
none.
Overriding is only supported for the purpose of calling the super implementation and changing the return type, but nothing else.
public GoogleCredential.Builder setServiceAccountPrivateKeyFromP12File(File p12File) throws GeneralSecurityException, IOException
null
for none.
Overriding is only supported for the purpose of calling the super implementation and changing the return type, but nothing else.
p12File
- p12 file objectGeneralSecurityException
IOException
public GoogleCredential.Builder setServiceAccountPrivateKeyFromP12File(InputStream p12FileInputStream) throws GeneralSecurityException, IOException
null
for none.
Overriding is only supported for the purpose of calling the super implementation and changing the return type, but nothing else.
p12FileInputStream
- input stream to the p12 file. This file is closed at the end of
this method in a finally block.GeneralSecurityException
IOException
@Beta public GoogleCredential.Builder setServiceAccountPrivateKeyFromPemFile(File pemFile) throws GeneralSecurityException, IOException
Beta
null
for none.
Overriding is only supported for the purpose of calling the super implementation and changing the return type, but nothing else.
pemFile
- input stream to the PEM file (closed at the end of this method in a finally
block)GeneralSecurityException
IOException
public final String getServiceAccountUser()
null
for none.public GoogleCredential.Builder setServiceAccountUser(String serviceAccountUser)
null
for none.
Overriding is only supported for the purpose of calling the super implementation and changing the return type, but nothing else.
public GoogleCredential.Builder setRequestInitializer(com.google.api.client.http.HttpRequestInitializer requestInitializer)
setRequestInitializer
in class com.google.api.client.auth.oauth2.Credential.Builder
public GoogleCredential.Builder addRefreshListener(com.google.api.client.auth.oauth2.CredentialRefreshListener refreshListener)
addRefreshListener
in class com.google.api.client.auth.oauth2.Credential.Builder
public GoogleCredential.Builder setRefreshListeners(Collection<com.google.api.client.auth.oauth2.CredentialRefreshListener> refreshListeners)
setRefreshListeners
in class com.google.api.client.auth.oauth2.Credential.Builder
public GoogleCredential.Builder setTokenServerUrl(com.google.api.client.http.GenericUrl tokenServerUrl)
setTokenServerUrl
in class com.google.api.client.auth.oauth2.Credential.Builder
public GoogleCredential.Builder setTokenServerEncodedUrl(String tokenServerEncodedUrl)
setTokenServerEncodedUrl
in class com.google.api.client.auth.oauth2.Credential.Builder
public GoogleCredential.Builder setClientAuthentication(com.google.api.client.http.HttpExecuteInterceptor clientAuthentication)
setClientAuthentication
in class com.google.api.client.auth.oauth2.Credential.Builder
Copyright © 2010–2019 Google. All rights reserved.