Class FileCredentialStore (1.36.0)

public class FileCredentialStore implements CredentialStore

Deprecated. (to be removed in the future) Use FileDataStoreFactory with StoredCredential instead, optionally using #migrateTo(FileDataStoreFactory) or #migrateTo(DataStore) to migrating an existing FileCredentialStore.

Beta
Thread-safe file implementation of a credential store.

Inheritance

java.lang.Object > FileCredentialStore

Implements

CredentialStore

Constructors

FileCredentialStore(File file, JsonFactory jsonFactory) (deprecated)

public FileCredentialStore(File file, JsonFactory jsonFactory)
Parameters
Name Description
file File

File to store user credentials

jsonFactory com.google.api.client.json.JsonFactory

JSON factory to serialize user credentials

Methods

delete(String userId, Credential credential) (deprecated)

public void delete(String userId, Credential credential)

Deletes the credential of the given user ID.

Parameters
Name Description
userId String
credential Credential
Exceptions
Type Description
IOException
protected boolean isSymbolicLink(File file)

Returns whether the given file is a symbolic link.

Parameter
Name Description
file File
Returns
Type Description
boolean
Exceptions
Type Description
IOException

load(String userId, Credential credential) (deprecated)

public boolean load(String userId, Credential credential)

Loads the credential for the given user ID.

Parameters
Name Description
userId String
credential Credential
Returns
Type Description
boolean

migrateTo(DataStore<StoredCredential> credentialDataStore) (deprecated)

public final void migrateTo(DataStore<StoredCredential> credentialDataStore)

Migrates to the new format using DataStore of StoredCredential.

Parameter
Name Description
credentialDataStore com.google.api.client.util.store.DataStore<StoredCredential>

credential data store

Exceptions
Type Description
IOException

migrateTo(FileDataStoreFactory dataStoreFactory) (deprecated)

public final void migrateTo(FileDataStoreFactory dataStoreFactory)

Migrates to the new FileDataStoreFactory format.

Sample usage:

public static FileDataStore migrate(FileCredentialStore credentialStore, File dataDirectory) throws IOException { FileDataStore dataStore = new FileDataStore(dataDirectory); credentialStore.migrateTo(dataStore); return dataStore; }

Parameter
Name Description
dataStoreFactory com.google.api.client.util.store.FileDataStoreFactory

file data store factory

Exceptions
Type Description
IOException

store(String userId, Credential credential) (deprecated)

public void store(String userId, Credential credential)

Stores the credential of the given user ID.

Parameters
Name Description
userId String
credential Credential
Exceptions
Type Description
IOException