FileDataStoreFactory with
StoredCredential instead, optionally using
migrateTo(FileDataStoreFactory) or migrateTo(DataStore) to
migrating an existing FileCredentialStore.@Deprecated @Beta public class FileCredentialStore extends Object implements CredentialStore
Beta | Constructor and Description |
|---|
FileCredentialStore(File file,
com.google.api.client.json.JsonFactory jsonFactory)
Deprecated.
|
| Modifier and Type | Method and Description |
|---|---|
void |
delete(String userId,
Credential credential)
Deprecated.
Deletes the credential of the given user ID.
|
protected boolean |
isSymbolicLink(File file)
Deprecated.
Returns whether the given file is a symbolic link.
|
boolean |
load(String userId,
Credential credential)
Deprecated.
Loads the credential for the given user ID.
|
void |
migrateTo(com.google.api.client.util.store.DataStore<StoredCredential> credentialDataStore)
Deprecated.
Migrates to the new format using
DataStore of StoredCredential. |
void |
migrateTo(com.google.api.client.util.store.FileDataStoreFactory dataStoreFactory)
Deprecated.
Migrates to the new
FileDataStoreFactory format. |
void |
store(String userId,
Credential credential)
Deprecated.
Stores the credential of the given user ID.
|
public FileCredentialStore(File file, com.google.api.client.json.JsonFactory jsonFactory) throws IOException
file - File to store user credentialsjsonFactory - JSON factory to serialize user credentialsIOExceptionprotected boolean isSymbolicLink(File file) throws IOException
IOExceptionpublic void store(String userId, Credential credential) throws IOException
CredentialStorestore in interface CredentialStoreuserId - user ID whose credential needs to be storedcredential - credential whose access token,
refresh token, and
expiration time need to be storedIOExceptionpublic void delete(String userId, Credential credential) throws IOException
CredentialStoredelete in interface CredentialStoreuserId - user ID whose credential needs to be deletedcredential - credential to be deletedIOExceptionpublic boolean load(String userId, Credential credential)
CredentialStoreload in interface CredentialStoreuserId - user ID whose credential needs to be loadedcredential - credential whose access token,
refresh token, and
expiration time need to be set if the
credential already exists in storagetrue if the credential has been successfully found and loaded or false
otherwisepublic final void migrateTo(com.google.api.client.util.store.FileDataStoreFactory dataStoreFactory)
throws IOException
FileDataStoreFactory format.
Sample usage:
public static FileDataStore migrate(FileCredentialStore credentialStore, File dataDirectory)
throws IOException {
FileDataStore dataStore = new FileDataStore(dataDirectory);
credentialStore.migrateTo(dataStore);
return dataStore;
}
dataStoreFactory - file data store factoryIOExceptionpublic final void migrateTo(com.google.api.client.util.store.DataStore<StoredCredential> credentialDataStore) throws IOException
DataStore of StoredCredential.credentialDataStore - credential data storeIOExceptionCopyright © 2011–2022 Google. All rights reserved.