verify

verifies the tokens is valid, used in case the token was signed with "none" as algorithm

Parameters

encodedToken string

the encoded token

Return Value

Type: Token

a decoded Token

Examples

long now = Clock.currTime.toUnixTime();

Token token = new Token(JWTAlgorithm.NONE);

token.claims.nbf = now + (60 * 60);

string encodedToken = token.encode();

assertThrown!NotBeforeException(verify(encodedToken));

token = new Token(JWTAlgorithm.NONE);

token.claims.iat = now - 3600;

token.claims.exp = now - 60;

encodedToken = token.encode();

assertThrown!ExpiredException(token = verify(encodedToken));

Meta