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,
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(DataStore<StoredCredential> credentialDataStore)
Deprecated.
Migrates to the new format using
DataStore of StoredCredential . |
void |
migrateTo(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, 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(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(DataStore<StoredCredential> credentialDataStore) throws IOException
DataStore
of StoredCredential
.credentialDataStore
- credential data storeIOException
Copyright © 2011–2019 Google. All rights reserved.