Interface OAuth2CredentialFactory

All Known Implementing Classes:
OAuth2CredentialFactoryImpl

public interface OAuth2CredentialFactory
OAuth2CredentialFactory implementation is a factory class that returns GoogleCredential objects.
  • Method Summary

    Modifier and Type
    Method
    Description
    com.google.api.client.util.store.DataStore<com.google.api.client.auth.oauth2.StoredCredential>
    getDataStore(String id, String dataStoreDirectory)
    Returns a file-backed data store.
    com.google.api.client.googleapis.auth.oauth2.GoogleCredential
    getGoogleCredential(com.google.api.client.util.store.DataStore<com.google.api.client.auth.oauth2.StoredCredential> datastore, ClientCredentials authContext)
    Returns a GoogleCredential from a data store.
    com.google.api.client.googleapis.auth.oauth2.GoogleCredential
    Returns a GoogleCredential from the default data store.
  • Method Details

    • getDataStore

      com.google.api.client.util.store.DataStore<com.google.api.client.auth.oauth2.StoredCredential> getDataStore(String id, String dataStoreDirectory) throws IOException
      Returns a file-backed data store.
      Parameters:
      id - unique identifier for the data store
      dataStoreDirectory - name of the data store directory
      Returns:
      file-backed data store
      Throws:
      IOException
    • getGoogleCredential

      com.google.api.client.googleapis.auth.oauth2.GoogleCredential getGoogleCredential(com.google.api.client.util.store.DataStore<com.google.api.client.auth.oauth2.StoredCredential> datastore, ClientCredentials authContext) throws IOException
      Returns a GoogleCredential from a data store. If one does not exist, a new GoogleCredential will be generated and persisted in the data store.
      Parameters:
      datastore - a file or memory backed data store
      authContext - ClientCredentials object containing the parameters needed to find an existing or create a new instance of GoogleCredential
      Returns:
      Google-specific subclass of Credential
      Throws:
      IOException - if the default data store is not available
    • getGoogleCredential

      com.google.api.client.googleapis.auth.oauth2.GoogleCredential getGoogleCredential(ClientCredentials credentials) throws IOException
      Returns a GoogleCredential from the default data store. If one does not exist, a new GoogleCredential will be generated and persisted in the data store.
      Returns:
      Google-specific subclass of Credential
      Throws:
      IOException - if the default data store is not available