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) 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.
Since:
1.11
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    Deprecated.
    User credentials repository.
    private final File
    Deprecated.
    File to store user credentials.
    private static final boolean
    Deprecated.
     
    private final com.google.api.client.json.JsonFactory
    Deprecated.
    Json factory for serializing user credentials.
    private final Lock
    Deprecated.
    Lock on access to the store.
    private static final Logger
    Deprecated.
     
  • Constructor Summary

    Constructors
    Constructor
    Description
    FileCredentialStore(File file, com.google.api.client.json.JsonFactory jsonFactory)
    Deprecated.
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    delete(String userId, Credential credential)
    Deprecated.
    Deletes the credential of the given user ID.
    protected boolean
    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.
    private void
    Deprecated.
     
    final void
    migrateTo(com.google.api.client.util.store.DataStore<StoredCredential> credentialDataStore)
    Deprecated.
    Migrates to the new format using DataStore of StoredCredential.
    final void
    migrateTo(com.google.api.client.util.store.FileDataStoreFactory dataStoreFactory)
    Deprecated.
    Migrates to the new FileDataStoreFactory format.
    private void
    Deprecated.
     
    void
    store(String userId, Credential credential)
    Deprecated.
    Stores the credential of the given user ID.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • LOGGER

      private static final Logger LOGGER
      Deprecated.
    • jsonFactory

      private final com.google.api.client.json.JsonFactory jsonFactory
      Deprecated.
      Json factory for serializing user credentials.
    • lock

      private final Lock lock
      Deprecated.
      Lock on access to the store.
    • credentials

      private FilePersistedCredentials credentials
      Deprecated.
      User credentials repository.
    • file

      private final File file
      Deprecated.
      File to store user credentials.
    • IS_WINDOWS

      private static final boolean IS_WINDOWS
      Deprecated.
  • Constructor Details

    • FileCredentialStore

      public FileCredentialStore(File file, com.google.api.client.json.JsonFactory jsonFactory) throws IOException
      Deprecated.
      Parameters:
      file - File to store user credentials
      jsonFactory - JSON factory to serialize user credentials
      Throws:
      IOException
  • Method Details

    • 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 interface CredentialStore
      Parameters:
      userId - user ID whose credential needs to be stored
      credential - credential whose access token, refresh token, and expiration 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 interface CredentialStore
      Parameters:
      userId - user ID whose credential needs to be deleted
      credential - 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 interface CredentialStore
      Parameters:
      userId - user ID whose credential needs to be loaded
      credential - credential whose access token, refresh token, and expiration time need to be set if the credential already exists in storage
      Returns:
      true if the credential has been successfully found and loaded or false otherwise
    • loadCredentials

      private void loadCredentials(File file) throws IOException
      Deprecated.
      Throws:
      IOException
    • save

      private void save() throws IOException
      Deprecated.
      Throws:
      IOException
    • migrateTo

      public final void migrateTo(com.google.api.client.util.store.FileDataStoreFactory dataStoreFactory) throws IOException
      Deprecated.
      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;
        }
       
      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 using DataStore of StoredCredential.
      Parameters:
      credentialDataStore - credential data store
      Throws:
      IOException
      Since:
      1.16