assertValid method
Implementation
void assertValid(TokenType type) {
if (type == TokenType.jwt) {
// TODO: Define general JWT requirements
return;
}
if (issuedAt == null) {
throw MissingParameterExeception('iat');
}
switch (type) {
case TokenType.jwt:
break;
case TokenType.access:
if (issuer == null) {
throw MissingParameterExeception('iss');
}
if (subject == null) {
throw MissingParameterExeception('sub');
}
if (audience == null) {
throw MissingParameterExeception('aud');
}
if (expiration == null) {
throw MissingParameterExeception('exp');
}
if (scope == null) {
throw MissingParameterExeception('scope');
}
break;
case TokenType.dpop:
if (jwtId == null) {
throw MissingParameterExeception('jti');
}
if (httpMethod == null) {
throw MissingParameterExeception('htm');
}
if (httpUri == null) {
throw MissingParameterExeception('htu');
}
break;
}
}