Class TokenApiImpl
- java.lang.Object
-
- com.cumulocity.sdk.client.messaging.notifications.TokenApiImpl
-
-
Field Summary
Fields Modifier and Type Field Description static CumulocityMediaTypeTOKEN_MEDIA_TYPEstatic StringTOKEN_REQUEST_URIstatic StringUNSUBSCRIBE_REQUEST_URI
-
Constructor Summary
Constructors Constructor Description TokenApiImpl()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Tokencreate(NotificationTokenRequestRepresentation tokenRequest)Creates new access Token.Tokenrefresh(Token expiredToken)Refreshes an expired Token.voidunsubscribe(Token token)Unsubscribe a subscriber using supplied Token.TokenClaimsverify(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: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
public TokenClaims verify(Token token) throws SDKException
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
public Token refresh(Token expiredToken) throws IllegalArgumentException, SDKException
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
public void unsubscribe(Token token) throws SDKException
Description copied from interface:TokenApiUnsubscribe a subscriber using supplied Token.- Specified by:
unsubscribein interfaceTokenApi- Throws:
SDKException
-
-