Class StoredCredential
- java.lang.Object
-
- com.google.api.client.auth.oauth2.StoredCredential
-
- All Implemented Interfaces:
java.io.Serializable
@Beta public final class StoredCredential extends java.lang.Object implements java.io.SerializableBeta
Credential information to be stored in aDataStoreFactory.Implementation is thread safe.
- Since:
- 1.16
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description private java.lang.StringaccessTokenAccess token ornullfor none.static java.lang.StringDEFAULT_DATA_STORE_IDDefault data store ID.private java.lang.LongexpirationTimeMillisecondsExpected expiration time in milliseconds ornullfor none.private java.util.concurrent.locks.LocklockLock on access to the store.private java.lang.StringrefreshTokenRefresh token ornullfor none.private static longserialVersionUID
-
Constructor Summary
Constructors Constructor Description StoredCredential()StoredCredential(Credential credential)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanequals(java.lang.Object other)java.lang.StringgetAccessToken()Returns the access token ornullfor none.static com.google.api.client.util.store.DataStore<StoredCredential>getDefaultDataStore(com.google.api.client.util.store.DataStoreFactory dataStoreFactory)Returns the stored credential data store using the IDDEFAULT_DATA_STORE_ID.java.lang.LonggetExpirationTimeMilliseconds()Returns the expected expiration time in milliseconds ornullfor none.java.lang.StringgetRefreshToken()Returns the refresh token ornullfor none.inthashCode()StoredCredentialsetAccessToken(java.lang.String accessToken)Sets the access token ornullfor none.StoredCredentialsetExpirationTimeMilliseconds(java.lang.Long expirationTimeMilliseconds)Sets the expected expiration time in milliseconds ornullfor none.StoredCredentialsetRefreshToken(java.lang.String refreshToken)Sets the refresh token ornullfor none.java.lang.StringtoString()
-
-
-
Field Detail
-
DEFAULT_DATA_STORE_ID
public static final java.lang.String DEFAULT_DATA_STORE_ID
Default data store ID.
-
serialVersionUID
private static final long serialVersionUID
- See Also:
- Constant Field Values
-
lock
private final java.util.concurrent.locks.Lock lock
Lock on access to the store.
-
accessToken
private java.lang.String accessToken
Access token ornullfor none.
-
expirationTimeMilliseconds
private java.lang.Long expirationTimeMilliseconds
Expected expiration time in milliseconds ornullfor none.
-
refreshToken
private java.lang.String refreshToken
Refresh token ornullfor none.
-
-
Constructor Detail
-
StoredCredential
public StoredCredential()
-
StoredCredential
public StoredCredential(Credential credential)
- Parameters:
credential- existing credential to copy from
-
-
Method Detail
-
getAccessToken
public java.lang.String getAccessToken()
Returns the access token ornullfor none.
-
setAccessToken
public StoredCredential setAccessToken(java.lang.String accessToken)
Sets the access token ornullfor none.
-
getExpirationTimeMilliseconds
public java.lang.Long getExpirationTimeMilliseconds()
Returns the expected expiration time in milliseconds ornullfor none.
-
setExpirationTimeMilliseconds
public StoredCredential setExpirationTimeMilliseconds(java.lang.Long expirationTimeMilliseconds)
Sets the expected expiration time in milliseconds ornullfor none.
-
getRefreshToken
public java.lang.String getRefreshToken()
Returns the refresh token ornullfor none.
-
setRefreshToken
public StoredCredential setRefreshToken(java.lang.String refreshToken)
Sets the refresh token ornullfor none.
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
equals
public boolean equals(java.lang.Object other)
- Overrides:
equalsin classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
getDefaultDataStore
public static com.google.api.client.util.store.DataStore<StoredCredential> getDefaultDataStore(com.google.api.client.util.store.DataStoreFactory dataStoreFactory) throws java.io.IOException
Returns the stored credential data store using the IDDEFAULT_DATA_STORE_ID.- Parameters:
dataStoreFactory- data store factory- Returns:
- stored credential data store
- Throws:
java.io.IOException
-
-