Package com.zendesk.sdk.storage
Interface IdentityStorage
-
- All Superinterfaces:
- SdkStorage.UserStorage
public interface IdentityStorage extends SdkStorage.UserStorage
Provides storage of an Access token
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method and Description Identity
anonymiseIdentity()
Anonymises the stored IdentityIdentity
getIdentity()
Gets the stored identity.AccessToken
getStoredAccessToken()
Gets a storedAccessToken
from the device.java.lang.String
getStoredAccessTokenAsBearerToken()
Gets the stored access token as a bearer value for an authorization header.java.lang.Long
getUserId()
Gets a stored user ID from the device.java.lang.String
getUUID()
Gets the stored UUID of the current user or creates one if required.void
storeAccessToken(AccessToken accessToken)
Stores anAccessToken
on the devicevoid
storeIdentity(Identity identity)
Stores an identity.void
storeUserId(java.lang.Long userId)
Stores a user ID for use in blips.-
Methods inherited from interface com.zendesk.sdk.storage.SdkStorage.UserStorage
clearUserData, getCacheKey
-
-
-
-
Method Detail
-
storeAccessToken
void storeAccessToken(AccessToken accessToken)
Stores anAccessToken
on the device- Parameters:
accessToken
- The access token to store
-
getStoredAccessToken
AccessToken getStoredAccessToken()
Gets a storedAccessToken
from the device.- Returns:
- The stored
AccessToken
or null if one is not stored or if the storage is unavailable.
-
storeUserId
void storeUserId(java.lang.Long userId)
Stores a user ID for use in blips. The value should come fromAccessToken.getUserId()
, parsed to aLong
usingLong.parseLong(String)
.- Parameters:
userId
- The user ID to store.
-
getUserId
java.lang.Long getUserId()
Gets a stored user ID from the device. This should be sent in every blip to identify the authenticated user.- Returns:
- the user ID
-
getStoredAccessTokenAsBearerToken
java.lang.String getStoredAccessTokenAsBearerToken()
Gets the stored access token as a bearer value for an authorization header.- Returns:
- A bearer token for use in an Authorization header or null. If the token is present this will be like "Bearer {token}". If the token is missing it will be null
-
getUUID
java.lang.String getUUID()
Gets the stored UUID of the current user or creates one if required.- Returns:
- the UUID of the current user
-
storeIdentity
void storeIdentity(Identity identity)
Stores an identity.- Parameters:
identity
- The identity to store.
-
getIdentity
Identity getIdentity()
Gets the stored identity.- Returns:
- The stored identity if it is available or null if none was found.
-
anonymiseIdentity
Identity anonymiseIdentity()
Anonymises the stored IdentityThis method will anonymise a stored
AnonymousIdentity
if one exists. It does not affect JWT identities.- Returns:
- The anonymised identity if one existed or null if it did not.
-
-