Class TokenApiImpl
java.lang.Object
com.cumulocity.sdk.client.messaging.notifications.TokenApiImpl
- All Implemented Interfaces:
TokenApi
-
Field Summary
Modifier and TypeFieldDescriptionstatic final CumulocityMediaType
static final String
static final String
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptioncreate
(NotificationTokenRequestRepresentation tokenRequest) Creates new access Token.Refreshes an expired Token.void
unsubscribe
(Token token) Unsubscribe a subscriber using supplied Token.Verifies supplied Token.
-
Field Details
-
TOKEN_MEDIA_TYPE
-
TOKEN_REQUEST_URI
- See Also:
-
UNSUBSCRIBE_REQUEST_URI
- See Also:
-
-
Constructor Details
-
TokenApiImpl
public TokenApiImpl()
-
-
Method Details
-
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
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
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
Description copied from interface:TokenApi
Unsubscribe a subscriber using supplied Token.- Specified by:
unsubscribe
in interfaceTokenApi
- Throws:
SDKException
-