Class TokenApiImpl
- java.lang.Object
-
- com.cumulocity.sdk.client.messaging.notifications.TokenApiImpl
-
-
Field Summary
Fields Modifier and Type Field Description static CumulocityMediaType
TOKEN_MEDIA_TYPE
static String
TOKEN_REQUEST_URI
static String
UNSUBSCRIBE_REQUEST_URI
-
Constructor Summary
Constructors Constructor Description TokenApiImpl()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Token
create(NotificationTokenRequestRepresentation tokenRequest)
Creates new access Token.Token
refresh(Token expiredToken)
Refreshes an expired Token.void
unsubscribe(Token token)
Unsubscribe a subscriber using supplied Token.TokenClaims
verify(Token token)
Verifies supplied Token.
-
-
-
Field Detail
-
TOKEN_MEDIA_TYPE
public static final CumulocityMediaType TOKEN_MEDIA_TYPE
-
TOKEN_REQUEST_URI
public static final String TOKEN_REQUEST_URI
- See Also:
- Constant Field Values
-
UNSUBSCRIBE_REQUEST_URI
public static final String UNSUBSCRIBE_REQUEST_URI
- See Also:
- Constant Field Values
-
-
Method Detail
-
create
public Token create(NotificationTokenRequestRepresentation tokenRequest) throws IllegalArgumentException, SDKException
Description copied from interface:TokenApi
Creates new access Token.- Specified by:
create
in interfaceTokenApi
- Parameters:
tokenRequest
- containing claim - subscriber, subscription and desired validity duration for the Token.- Returns:
- generated Token with JWT Token string
- Throws:
IllegalArgumentException
- if the tokenClaim is nullSDKException
- if the Token could not be created
-
verify
public TokenClaims verify(Token token) throws SDKException
Description copied from interface:TokenApi
Verifies supplied Token.- Specified by:
verify
in interfaceTokenApi
- Parameters:
token
- to be verified- Returns:
- TokenClaim if the supplied Token was successfully verified
- Throws:
SDKException
- if the Token failed verification or could not be verified
-
refresh
public Token refresh(Token expiredToken) throws IllegalArgumentException, SDKException
Description copied from interface:TokenApi
Refreshes an expired Token.- Specified by:
refresh
in interfaceTokenApi
- Parameters:
expiredToken
- to be refreshed- Returns:
- refreshed Token, valid for the same duration of time as the original Token
- Throws:
IllegalArgumentException
- if the supplied Token is nullSDKException
- if the Token wasn't valid or the operation fails
-
unsubscribe
public void unsubscribe(Token token) throws SDKException
Description copied from interface:TokenApi
Unsubscribe a subscriber using supplied Token.- Specified by:
unsubscribe
in interfaceTokenApi
- Throws:
SDKException
-
-