CredentialStore
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 | Description |
---|---|
FileCredentialStore(File file,
com.google.api.client.json.JsonFactory jsonFactory) |
Deprecated.
|
Modifier and Type | Method | 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 credentialsIOException
protected boolean isSymbolicLink(File file) throws IOException
IOException
public void store(String userId, Credential credential) throws IOException
CredentialStore
store
in interface CredentialStore
userId
- user ID whose credential needs to be storedcredential
- credential whose access token
,
refresh token
, and
expiration time
need to be storedIOException
public void delete(String userId, Credential credential) throws IOException
CredentialStore
delete
in interface CredentialStore
userId
- user ID whose credential needs to be deletedcredential
- credential to be deletedIOException
public boolean load(String userId, Credential credential)
CredentialStore
load
in interface CredentialStore
userId
- 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 factoryIOException
public final void migrateTo(com.google.api.client.util.store.DataStore<StoredCredential> credentialDataStore) throws IOException
DataStore
of StoredCredential
.credentialDataStore
- credential data storeIOException
Copyright © 2011–2019 Google. All rights reserved.