Interface OAuth2CredentialFactory
- All Known Implementing Classes:
OAuth2CredentialFactoryImpl
public interface OAuth2CredentialFactory
OAuth2CredentialFactory implementation is a factory class that returns
GoogleCredential objects.-
Method Summary
Modifier and TypeMethodDescriptioncom.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.GoogleCredentialgetGoogleCredential(com.google.api.client.util.store.DataStore<com.google.api.client.auth.oauth2.StoredCredential> datastore, ClientCredentials authContext) Returns aGoogleCredentialfrom a data store.com.google.api.client.googleapis.auth.oauth2.GoogleCredentialgetGoogleCredential(ClientCredentials credentials) Returns aGoogleCredentialfrom 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 storedataStoreDirectory- 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 aGoogleCredentialfrom a data store. If one does not exist, a newGoogleCredentialwill be generated and persisted in the data store.- Parameters:
datastore- a file or memory backed data storeauthContext-ClientCredentialsobject containing the parameters needed to find an existing or create a new instance ofGoogleCredential- 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 aGoogleCredentialfrom the default data store. If one does not exist, a newGoogleCredentialwill be generated and persisted in the data store.- Returns:
- Google-specific subclass of
Credential - Throws:
IOException- if the default data store is not available
-