Class FileCredentialStore
- java.lang.Object
-
- com.google.api.client.extensions.java6.auth.oauth2.FileCredentialStore
-
- All Implemented Interfaces:
CredentialStore
@Deprecated @Beta public class FileCredentialStore extends Object implements CredentialStore
Deprecated.(to be removed in the future) UseFileDataStoreFactory
withStoredCredential
instead, optionally usingmigrateTo(FileDataStoreFactory)
ormigrateTo(DataStore)
to migrating an existingFileCredentialStore
.Beta
Thread-safe file implementation of a credential store.- Since:
- 1.11
- Author:
- Rafael Naufal
-
-
Constructor Summary
Constructors Constructor Description FileCredentialStore(File file, com.google.api.client.json.JsonFactory jsonFactory)
Deprecated.
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods 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 usingDataStore
ofStoredCredential
.void
migrateTo(com.google.api.client.util.store.FileDataStoreFactory dataStoreFactory)
Deprecated.Migrates to the newFileDataStoreFactory
format.void
store(String userId, Credential credential)
Deprecated.Stores the credential of the given user ID.
-
-
-
Constructor Detail
-
FileCredentialStore
public FileCredentialStore(File file, com.google.api.client.json.JsonFactory jsonFactory) throws IOException
Deprecated.- Parameters:
file
- File to store user credentialsjsonFactory
- JSON factory to serialize user credentials- Throws:
IOException
-
-
Method Detail
-
isSymbolicLink
protected boolean isSymbolicLink(File file) throws IOException
Deprecated.Returns whether the given file is a symbolic link.- Throws:
IOException
- Since:
- 1.13
-
store
public void store(String userId, Credential credential) throws IOException
Deprecated.Description copied from interface:CredentialStore
Stores the credential of the given user ID.- Specified by:
store
in interfaceCredentialStore
- Parameters:
userId
- user ID whose credential needs to be storedcredential
- credential whoseaccess token
,refresh token
, andexpiration time
need to be stored- Throws:
IOException
-
delete
public void delete(String userId, Credential credential) throws IOException
Deprecated.Description copied from interface:CredentialStore
Deletes the credential of the given user ID.- Specified by:
delete
in interfaceCredentialStore
- Parameters:
userId
- user ID whose credential needs to be deletedcredential
- credential to be deleted- Throws:
IOException
-
load
public boolean load(String userId, Credential credential)
Deprecated.Description copied from interface:CredentialStore
Loads the credential for the given user ID.- Specified by:
load
in interfaceCredentialStore
- Parameters:
userId
- user ID whose credential needs to be loadedcredential
- credential whoseaccess token
,refresh token
, andexpiration time
need to be set if the credential already exists in storage- Returns:
true
if the credential has been successfully found and loaded orfalse
otherwise
-
migrateTo
public final void migrateTo(com.google.api.client.util.store.FileDataStoreFactory dataStoreFactory) throws IOException
Deprecated.Migrates to the newFileDataStoreFactory
format.Sample usage:
public static FileDataStore migrate(FileCredentialStore credentialStore, File dataDirectory) throws IOException { FileDataStore dataStore = new FileDataStore(dataDirectory); credentialStore.migrateTo(dataStore); return dataStore; }
- Parameters:
dataStoreFactory
- file data store factory- Throws:
IOException
- Since:
- 1.16
-
migrateTo
public final void migrateTo(com.google.api.client.util.store.DataStore<StoredCredential> credentialDataStore) throws IOException
Deprecated.Migrates to the new format usingDataStore
ofStoredCredential
.- Parameters:
credentialDataStore
- credential data store- Throws:
IOException
- Since:
- 1.16
-
-