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) UseFileDataStoreFactorywithStoredCredentialinstead, 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 FilePersistedCredentialscredentialsDeprecated.User credentials repository.private java.io.FilefileDeprecated.File to store user credentials.private static booleanIS_WINDOWSDeprecated.private com.google.api.client.json.JsonFactoryjsonFactoryDeprecated.Json factory for serializing user credentials.private java.util.concurrent.locks.LocklockDeprecated.Lock on access to the store.private static java.util.logging.LoggerLOGGERDeprecated.
-
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 voiddelete(java.lang.String userId, Credential credential)Deprecated.Deletes the credential of the given user ID.protected booleanisSymbolicLink(java.io.File file)Deprecated.Returns whether the given file is a symbolic link.booleanload(java.lang.String userId, Credential credential)Deprecated.Loads the credential for the given user ID.private voidloadCredentials(java.io.File file)Deprecated.voidmigrateTo(com.google.api.client.util.store.DataStore<StoredCredential> credentialDataStore)Deprecated.Migrates to the new format usingDataStoreofStoredCredential.voidmigrateTo(com.google.api.client.util.store.FileDataStoreFactory dataStoreFactory)Deprecated.Migrates to the newFileDataStoreFactoryformat.private voidsave()Deprecated.voidstore(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.IOExceptionDeprecated.- 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.IOExceptionDeprecated.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.IOExceptionDeprecated.Description copied from interface:CredentialStoreStores the credential of the given user ID.- Specified by:
storein interfaceCredentialStore- Parameters:
userId- user ID whose credential needs to be storedcredential- credential whoseaccess token,refresh token, andexpiration timeneed to be stored- Throws:
java.io.IOException
-
delete
public void delete(java.lang.String userId, Credential credential) throws java.io.IOExceptionDeprecated.Description copied from interface:CredentialStoreDeletes the credential of the given user ID.- Specified by:
deletein 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:CredentialStoreLoads the credential for the given user ID.- Specified by:
loadin interfaceCredentialStore- Parameters:
userId- user ID whose credential needs to be loadedcredential- credential whoseaccess token,refresh token, andexpiration timeneed to be set if the credential already exists in storage- Returns:
trueif the credential has been successfully found and loaded orfalseotherwise
-
loadCredentials
private void loadCredentials(java.io.File file) throws java.io.IOExceptionDeprecated.- Throws:
java.io.IOException
-
save
private void save() throws java.io.IOExceptionDeprecated.- Throws:
java.io.IOException
-
migrateTo
public final void migrateTo(com.google.api.client.util.store.FileDataStoreFactory dataStoreFactory) throws java.io.IOExceptionDeprecated.Migrates to the newFileDataStoreFactoryformat.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 usingDataStoreofStoredCredential.- Parameters:
credentialDataStore- credential data store- Throws:
java.io.IOException- Since:
- 1.16
-
-