Class TokenApiImpl
java.lang.Object
com.cumulocity.sdk.client.messaging.notifications.TokenApiImpl
- All Implemented Interfaces:
TokenApi
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final CumulocityMediaTypestatic final Stringstatic final String -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncreate(NotificationTokenRequestRepresentation tokenRequest) Creates new access Token.Refreshes an expired Token.voidunsubscribe(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:TokenApiCreates new access Token.- Specified by:
createin 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:TokenApiVerifies supplied Token.- Specified by:
verifyin 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:TokenApiRefreshes an expired Token.- Specified by:
refreshin 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:TokenApiUnsubscribe a subscriber using supplied Token.- Specified by:
unsubscribein interfaceTokenApi- Throws:
SDKException
-