public class Cp4dToken extends AbstractToken
| Constructor and Description |
|---|
Cp4dToken() |
Cp4dToken(Cp4dServiceInstanceTokenResponse response)
This ctor will extract the ICP4D access token from the specified Cp4dTokenResponse instance,
and compute the refresh time as "80% of the timeToLive added to the issued-at time".
|
Cp4dToken(Cp4dTokenResponse response)
This ctor will extract the ICP4D access token from the specified Cp4dTokenResponse instance,
and compute the refresh time as "80% of the timeToLive added to the issued-at time".
|
Cp4dToken(java.lang.String accessToken)
This ctor is used to store a user-managed access token which will never expire.
|
Cp4dToken(java.lang.Throwable t)
This ctor is used to store an exception which indicates an error with the most recent
token server interaction.
|
| Modifier and Type | Method and Description |
|---|---|
java.lang.String |
getAccessToken() |
boolean |
isTokenValid()
Check if the currently stored access token is valid.
|
boolean |
needsRefresh()
Returns true iff this object does not hold a valid access token or has one which has crossed our refresh
time.
|
getException, setExceptionpublic Cp4dToken()
public Cp4dToken(java.lang.String accessToken)
accessToken - the user-managed access tokenpublic Cp4dToken(java.lang.Throwable t)
t - the exception to store in this objectpublic Cp4dToken(Cp4dTokenResponse response)
response - the Cp4dTokenResponse instancepublic Cp4dToken(Cp4dServiceInstanceTokenResponse response)
response - the Cp4dTokenResponse instancepublic boolean needsRefresh()
needsRefresh in class AbstractTokenpublic boolean isTokenValid()
isTokenValid in class AbstractTokenpublic java.lang.String getAccessToken()
getAccessToken in class AbstractTokenCopyright © 2022 IBM Cloud Developer Experience. All rights reserved.