TokenCacheItem Class

  • java.lang.Object
    • Serializable
      • com.microsoft.aad.adal.TokenCacheItem

public class TokenCacheItem

Extended result to store more info Queries will be performed over this item not the key.

Constructor Summary

Constructor Description
TokenCacheItem()

Default constructor for cache item.

Method Summary

Modifier and Type Method and Description
TokenCacheItem createFRRTTokenCacheItem(final String authority, final AuthenticationResult authResult)

Create FRT token cache entry. Will not store clientId, resource and AT.

TokenCacheItem createMRRTTokenCacheItem(final String authority, final String clientId, final AuthenticationResult authResult)

Create MRRT token cache item. Will not store AT and resource in the token cache.

TokenCacheItem createRegularTokenCacheItem(final String authority, final String resource, final String clientId, final AuthenticationResult authResult)

Create regular RT token cache item.

String getAccessToken()

Get the access token.

String getAuthority()

Get the authority.

String getClientId()

Get the client identifier.

Date getExpiresOn()

Get the expire date.

final Date getExtendedExpiresOn()

Get the extended expired time.

final String getFamilyClientId()

Get family client identifier.

boolean getIsMultiResourceRefreshToken()

Get the multi-resource refresh token flag.

String getRawIdToken()

Get raw ID token.

String getRefreshToken()

Get the refresh token string.

String getResource()

Get the resource.

String getSpeRing()
String getTenantId()

Get tenant identifier.

final Date getTokenUpdateTime()
UserInfo getUserInfo()

Get the user information.

final boolean isExtendedLifetimeValid()

Verify if the token cache token is valid for the extended expired time.

boolean isTokenExpired(final Date expiresOn)

Checks expiration time.

void setAccessToken(String accessToken)

Set the access token string.

void setAuthority(String authority)

Set the authority.

void setClientId(String clientId)

Set the client identifier.

void setExpiresOn(final Date expiresOn)

Set the expire date.

final void setExtendedExpiresOn(final Date extendedExpiresOn)

Set the extended expired time.

final void setFamilyClientId(final String familyClientId)

Set family client identifier.

void setIsMultiResourceRefreshToken(boolean isMultiResourceRefreshToken)

Set the multi-resource refresh token flag.

void setRawIdToken(String rawIdToken)

Set raw ID token.

void setRefreshToken(String refreshToken)

Set the fresh token string.

void setResource(String resource)

Set the resource.

void setTenantId(String tenantId)

Set tenant identifier.

void setUserInfo(UserInfo info)

Set the user information.

Constructor Details

TokenCacheItem

public TokenCacheItem()

Default constructor for cache item.

Method Details

createFRRTTokenCacheItem

public static TokenCacheItem createFRRTTokenCacheItem(final String authority, final AuthenticationResult authResult)

Create FRT token cache entry. Will not store clientId, resource and AT.

Parameters:

authority - required authority identifier.
authResult - required authentication result to create FRRT refresh token cache item.

Returns:

TokenCacheItem

createMRRTTokenCacheItem

public static TokenCacheItem createMRRTTokenCacheItem(final String authority, final String clientId, final AuthenticationResult authResult)

Create MRRT token cache item. Will not store AT and resource in the token cache.

Parameters:

authority - required authority identifier.
clientId - required client identifier.
authResult - required authentication result to create multi-resource refresh token cache item.

Returns:

TokenCacheItem

createRegularTokenCacheItem

public static TokenCacheItem createRegularTokenCacheItem(final String authority, final String resource, final String clientId, final AuthenticationResult authResult)

Create regular RT token cache item.

Parameters:

authority - required authority identifier.
resource - required resource identifier.
clientId - required client identifier.
authResult - required authentication result to create regular token cache item.

Returns:

TokenCacheItem

getAccessToken

public String getAccessToken()

Get the access token.

Returns:

the access token string.

getAuthority

public String getAuthority()

Get the authority.

Returns:

authority url string.

getClientId

public String getClientId()

Get the client identifier.

Returns:

client identifier string.

getExpiresOn

public Date getExpiresOn()

Get the expire date.

Returns:

the time the token get expired.

getExtendedExpiresOn

public final Date getExtendedExpiresOn()

Get the extended expired time.

Returns:

the extended expired date.

getFamilyClientId

public final String getFamilyClientId()

Get family client identifier.

Returns:

the family client ID string.

getIsMultiResourceRefreshToken

public boolean getIsMultiResourceRefreshToken()

Get the multi-resource refresh token flag.

Returns:

true if the token is a multi-resource refresh token, else return false.

getRawIdToken

public String getRawIdToken()

Get raw ID token.

Returns:

raw ID token string.

getRefreshToken

public String getRefreshToken()

Get the refresh token string.

Returns:

the refresh token string.

getResource

public String getResource()

Get the resource.

Returns:

resource String.

getSpeRing

public String getSpeRing()

getTenantId

public String getTenantId()

Get tenant identifier.

Returns:

the tenant identifier string.

getTokenUpdateTime

protected final Date getTokenUpdateTime()

getUserInfo

public UserInfo getUserInfo()

Get the user information.

Returns:

UserInfo object.

isExtendedLifetimeValid

public final boolean isExtendedLifetimeValid()

Verify if the token cache token is valid for the extended expired time.

Returns:

true if the access token is not null and is not expired in the extended expired time, else return false.

isTokenExpired

public static boolean isTokenExpired(final Date expiresOn)

Checks expiration time.

Parameters:

expiresOn - the time in type Date to check if it is expired

Returns:

true if expired

setAccessToken

public void setAccessToken(String accessToken)

Set the access token string.

Parameters:

accessToken - the access token string.

setAuthority

public void setAuthority(String authority)

Set the authority.

Parameters:

authority - String authority url.

setClientId

public void setClientId(String clientId)

Set the client identifier.

Parameters:

clientId - client identifier string.

setExpiresOn

public void setExpiresOn(final Date expiresOn)

Set the expire date.

Parameters:

expiresOn - the expire time.

setExtendedExpiresOn

public final void setExtendedExpiresOn(final Date extendedExpiresOn)

Set the extended expired time.

Parameters:

extendedExpiresOn - extended expired date.

setFamilyClientId

public final void setFamilyClientId(final String familyClientId)

Set family client identifier.

Parameters:

familyClientId - the family client ID string.

setIsMultiResourceRefreshToken

public void setIsMultiResourceRefreshToken(boolean isMultiResourceRefreshToken)

Set the multi-resource refresh token flag.

Parameters:

isMultiResourceRefreshToken - true if the token is a multi-resource refresh token.

setRawIdToken

public void setRawIdToken(String rawIdToken)

Set raw ID token.

Parameters:

rawIdToken - raw ID token string.

setRefreshToken

public void setRefreshToken(String refreshToken)

Set the fresh token string.

Parameters:

refreshToken - the refresh token string.

setResource

public void setResource(String resource)

Set the resource.

Parameters:

resource - resource identifier.

setTenantId

public void setTenantId(String tenantId)

Set tenant identifier.

Parameters:

tenantId - the tenant identifier string.

setUserInfo

public void setUserInfo(UserInfo info)

Set the user information.

Parameters:

info - UserInfo object which contains user information.

Applies to