com.google.api.client.googleapis.auth.oauth2
Class GoogleCredential.Builder

java.lang.Object
  extended by com.google.api.client.auth.oauth2.Credential.Builder
      extended by com.google.api.client.googleapis.auth.oauth2.GoogleCredential.Builder
Enclosing class:
GoogleCredential

public static class GoogleCredential.Builder
extends Credential.Builder

Google credential builder.

Implementation is not thread-safe.


Constructor Summary
GoogleCredential.Builder()
           
 
Method Summary
 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 the service account flow or null for none.
 String getServiceAccountScopes()
          Returns the space-separated OAuth scopes to use with the 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 setJsonFactory(JsonFactory jsonFactory)
           
 GoogleCredential.Builder setRefreshListeners(List<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 the service account flow or null for none.
 GoogleCredential.Builder setServiceAccountPrivateKeyFromP12File(File p12File)
          Sets the private key to use with the the service account flow or null for none.
 GoogleCredential.Builder setServiceAccountScopes(Iterable<String> serviceAccountScopes)
          Sets the space-separated OAuth scopes to use with the the service account flow or null for none.
 GoogleCredential.Builder setServiceAccountScopes(String... serviceAccountScopes)
          Sets the space-separated OAuth scopes to use with the 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)
           
 
Methods inherited from class com.google.api.client.auth.oauth2.Credential.Builder
getClientAuthentication, getJsonFactory, getMethod, getRefreshListeners, getRequestInitializer, getTokenServerUrl, getTransport
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GoogleCredential.Builder

public GoogleCredential.Builder()
Method Detail

build

public GoogleCredential build()
Overrides:
build in class Credential.Builder

setTransport

public GoogleCredential.Builder setTransport(HttpTransport transport)
Overrides:
setTransport in class Credential.Builder

setJsonFactory

public GoogleCredential.Builder setJsonFactory(JsonFactory jsonFactory)
Overrides:
setJsonFactory in class Credential.Builder

setClientSecrets

public GoogleCredential.Builder setClientSecrets(String clientId,
                                                 String clientSecret)
Sets the client identifier and secret.

Overriding is only supported for the purpose of calling the super implementation and changing the return type, but nothing else.


setClientSecrets

public GoogleCredential.Builder setClientSecrets(GoogleClientSecrets clientSecrets)
Sets the client secrets.

Overriding is only supported for the purpose of calling the super implementation and changing the return type, but nothing else.


getServiceAccountId

public final String getServiceAccountId()
Returns the service account ID (typically an e-mail address) or null for none.


setServiceAccountId

public GoogleCredential.Builder setServiceAccountId(String serviceAccountId)
Sets the service account ID (typically an e-mail address) or null for none.

Overriding is only supported for the purpose of calling the super implementation and changing the return type, but nothing else.


getServiceAccountScopes

public final String getServiceAccountScopes()
Returns the space-separated OAuth scopes to use with the the service account flow or null for none.


setServiceAccountScopes

public GoogleCredential.Builder setServiceAccountScopes(String... serviceAccountScopes)
Sets the space-separated OAuth scopes to use with the the service account flow or null for none.

Overriding is only supported for the purpose of calling the super implementation and changing the return type, but nothing else.

Parameters:
serviceAccountScopes - list of scopes to be joined by a space separator (or a single value containing multiple space-separated scopes)

setServiceAccountScopes

public GoogleCredential.Builder setServiceAccountScopes(Iterable<String> serviceAccountScopes)
Sets the space-separated OAuth scopes to use with the the service account flow or null for none.

Overriding is only supported for the purpose of calling the super implementation and changing the return type, but nothing else.

Parameters:
serviceAccountScopes - list of scopes to be joined by a space separator (or a single value containing multiple space-separated scopes)

getServiceAccountPrivateKey

public final PrivateKey getServiceAccountPrivateKey()
Returns the private key to use with the the service account flow or null for none.


setServiceAccountPrivateKey

public GoogleCredential.Builder setServiceAccountPrivateKey(PrivateKey serviceAccountPrivateKey)
Sets the private key to use with the the service account flow or null for none.

Overriding is only supported for the purpose of calling the super implementation and changing the return type, but nothing else.


setServiceAccountPrivateKeyFromP12File

public GoogleCredential.Builder setServiceAccountPrivateKeyFromP12File(File p12File)
                                                                throws GeneralSecurityException,
                                                                       IOException
Sets the private key to use with the the service account flow or null for none.

Overriding is only supported for the purpose of calling the super implementation and changing the return type, but nothing else.

Parameters:
p12File - input stream to the p12 file (closed at the end of this method in a finally block)
Throws:
GeneralSecurityException
IOException

getServiceAccountUser

public final String getServiceAccountUser()
Returns the email address of the user the application is trying to impersonate in the service account flow or null for none.


setServiceAccountUser

public 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.

Overriding is only supported for the purpose of calling the super implementation and changing the return type, but nothing else.


setRequestInitializer

public GoogleCredential.Builder setRequestInitializer(HttpRequestInitializer requestInitializer)
Overrides:
setRequestInitializer in class Credential.Builder

addRefreshListener

public GoogleCredential.Builder addRefreshListener(CredentialRefreshListener refreshListener)
Overrides:
addRefreshListener in class Credential.Builder

setRefreshListeners

public GoogleCredential.Builder setRefreshListeners(List<CredentialRefreshListener> refreshListeners)
Overrides:
setRefreshListeners in class Credential.Builder

setTokenServerUrl

public GoogleCredential.Builder setTokenServerUrl(GenericUrl tokenServerUrl)
Overrides:
setTokenServerUrl in class Credential.Builder

setTokenServerEncodedUrl

public GoogleCredential.Builder setTokenServerEncodedUrl(String tokenServerEncodedUrl)
Overrides:
setTokenServerEncodedUrl in class Credential.Builder

setClientAuthentication

public GoogleCredential.Builder setClientAuthentication(HttpExecuteInterceptor clientAuthentication)
Overrides:
setClientAuthentication in class Credential.Builder


Copyright © 2010-2012 Google. All Rights Reserved.