Class StoredCredential

java.lang.Object
com.google.api.client.auth.oauth2.StoredCredential
All Implemented Interfaces:
Serializable

@Beta public final class StoredCredential extends Object implements Serializable
Beta
Credential information to be stored in a DataStoreFactory.

Implementation is thread safe.

Since:
1.16
See Also:
  • Field Details

    • DEFAULT_DATA_STORE_ID

      public static final String DEFAULT_DATA_STORE_ID
      Default data store ID.
    • serialVersionUID

      private static final long serialVersionUID
      See Also:
    • lock

      private final Lock lock
      Lock on access to the store.
    • accessToken

      private String accessToken
      Access token or null for none.
    • expirationTimeMilliseconds

      private Long expirationTimeMilliseconds
      Expected expiration time in milliseconds or null for none.
    • refreshToken

      private String refreshToken
      Refresh token or null for none.
  • Constructor Details

    • StoredCredential

      public StoredCredential()
    • StoredCredential

      public StoredCredential(Credential credential)
      Parameters:
      credential - existing credential to copy from
  • Method Details

    • getAccessToken

      public String getAccessToken()
      Returns the access token or null for none.
    • setAccessToken

      public StoredCredential setAccessToken(String accessToken)
      Sets the access token or null for none.
    • getExpirationTimeMilliseconds

      public Long getExpirationTimeMilliseconds()
      Returns the expected expiration time in milliseconds or null for none.
    • setExpirationTimeMilliseconds

      public StoredCredential setExpirationTimeMilliseconds(Long expirationTimeMilliseconds)
      Sets the expected expiration time in milliseconds or null for none.
    • getRefreshToken

      public String getRefreshToken()
      Returns the refresh token or null for none.
    • setRefreshToken

      public StoredCredential setRefreshToken(String refreshToken)
      Sets the refresh token or null for none.
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • equals

      public boolean equals(Object other)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • getDefaultDataStore

      public static com.google.api.client.util.store.DataStore<StoredCredential> getDefaultDataStore(com.google.api.client.util.store.DataStoreFactory dataStoreFactory) throws IOException
      Returns the stored credential data store using the ID DEFAULT_DATA_STORE_ID.
      Parameters:
      dataStoreFactory - data store factory
      Returns:
      stored credential data store
      Throws:
      IOException