Class FileCredentialStore
- java.lang.Object
-
- com.google.api.client.extensions.java6.auth.oauth2.FileCredentialStore
-
- All Implemented Interfaces:
CredentialStore
@Deprecated @Beta public class FileCredentialStore extends java.lang.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
-
-
Field Summary
Fields Modifier and Type Field Description private FilePersistedCredentials
credentials
Deprecated.User credentials repository.private java.io.File
file
Deprecated.File to store user credentials.private static boolean
IS_WINDOWS
Deprecated.private com.google.api.client.json.JsonFactory
jsonFactory
Deprecated.Json factory for serializing user credentials.private java.util.concurrent.locks.Lock
lock
Deprecated.Lock on access to the store.private static java.util.logging.Logger
LOGGER
Deprecated.
-
Constructor Summary
Constructors Constructor Description FileCredentialStore(java.io.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(java.lang.String userId, Credential credential)
Deprecated.Deletes the credential of the given user ID.protected boolean
isSymbolicLink(java.io.File file)
Deprecated.Returns whether the given file is a symbolic link.boolean
load(java.lang.String userId, Credential credential)
Deprecated.Loads the credential for the given user ID.private void
loadCredentials(java.io.File file)
Deprecated.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.private void
save()
Deprecated.void
store(java.lang.String userId, Credential credential)
Deprecated.Stores the credential of the given user ID.
-
-
-
Field Detail
-
LOGGER
private static final java.util.logging.Logger LOGGER
Deprecated.
-
jsonFactory
private final com.google.api.client.json.JsonFactory jsonFactory
Deprecated.Json factory for serializing user credentials.
-
lock
private final java.util.concurrent.locks.Lock lock
Deprecated.Lock on access to the store.
-
credentials
private FilePersistedCredentials credentials
Deprecated.User credentials repository.
-
file
private final java.io.File file
Deprecated.File to store user credentials.
-
IS_WINDOWS
private static final boolean IS_WINDOWS
Deprecated.
-
-
Constructor Detail
-
FileCredentialStore
public FileCredentialStore(java.io.File file, com.google.api.client.json.JsonFactory jsonFactory) throws java.io.IOException
Deprecated.- Parameters:
file
- File to store user credentialsjsonFactory
- JSON factory to serialize user credentials- Throws:
java.io.IOException
-
-
Method Detail
-
isSymbolicLink
protected boolean isSymbolicLink(java.io.File file) throws java.io.IOException
Deprecated.Returns whether the given file is a symbolic link.- Throws:
java.io.IOException
- Since:
- 1.13
-
store
public void store(java.lang.String userId, Credential credential) throws java.io.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:
java.io.IOException
-
delete
public void delete(java.lang.String userId, Credential credential) throws java.io.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:
java.io.IOException
-
load
public boolean load(java.lang.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
-
loadCredentials
private void loadCredentials(java.io.File file) throws java.io.IOException
Deprecated.- Throws:
java.io.IOException
-
save
private void save() throws java.io.IOException
Deprecated.- Throws:
java.io.IOException
-
migrateTo
public final void migrateTo(com.google.api.client.util.store.FileDataStoreFactory dataStoreFactory) throws java.io.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:
java.io.IOException
- Since:
- 1.16
-
migrateTo
public final void migrateTo(com.google.api.client.util.store.DataStore<StoredCredential> credentialDataStore) throws java.io.IOException
Deprecated.Migrates to the new format usingDataStore
ofStoredCredential
.- Parameters:
credentialDataStore
- credential data store- Throws:
java.io.IOException
- Since:
- 1.16
-
-