public static class GoogleCredential.Builder extends Credential.Builder
Implementation is not thread-safe.
Constructor and Description |
---|
Builder() |
Modifier and Type | Method and Description |
---|---|
GoogleCredential.Builder |
addRefreshListener(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()
|
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(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(Clock clock) |
GoogleCredential.Builder |
setJsonFactory(JsonFactory jsonFactory) |
GoogleCredential.Builder |
setRefreshListeners(Collection<CredentialRefreshListener> refreshListeners) |
GoogleCredential.Builder |
setRequestInitializer(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)
|
GoogleCredential.Builder |
setServiceAccountPrivateKeyId(String serviceAccountPrivateKeyId)
|
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(GenericUrl tokenServerUrl) |
GoogleCredential.Builder |
setTransport(HttpTransport transport) |
getClientAuthentication, getClock, getJsonFactory, getMethod, getRefreshListeners, getRequestInitializer, getTokenServerUrl, getTransport
public GoogleCredential build()
build
in class Credential.Builder
public GoogleCredential.Builder setTransport(HttpTransport transport)
setTransport
in class Credential.Builder
public GoogleCredential.Builder setJsonFactory(JsonFactory jsonFactory)
setJsonFactory
in class Credential.Builder
public GoogleCredential.Builder setClock(Clock clock)
setClock
in class 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 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(HttpRequestInitializer requestInitializer)
setRequestInitializer
in class Credential.Builder
public GoogleCredential.Builder addRefreshListener(CredentialRefreshListener refreshListener)
addRefreshListener
in class Credential.Builder
public GoogleCredential.Builder setRefreshListeners(Collection<CredentialRefreshListener> refreshListeners)
setRefreshListeners
in class Credential.Builder
public GoogleCredential.Builder setTokenServerUrl(GenericUrl tokenServerUrl)
setTokenServerUrl
in class Credential.Builder
public GoogleCredential.Builder setTokenServerEncodedUrl(String tokenServerEncodedUrl)
setTokenServerEncodedUrl
in class Credential.Builder
public GoogleCredential.Builder setClientAuthentication(HttpExecuteInterceptor clientAuthentication)
setClientAuthentication
in class Credential.Builder
Copyright © 2010–2019 Google. All rights reserved.