validateToken method
Implementation
Stream<Exception> validateToken(
{bool validateClaims = true, bool validateExpiry = true}) async* {
var keyStore = JsonWebKeyStore();
var jwksUri = client.issuer.metadata.jwksUri;
if (jwksUri != null) {
keyStore.addKeySetUrl(jwksUri);
}
if (!await idToken.verify(keyStore,
allowedArguments:
client.issuer.metadata.idTokenSigningAlgValuesSupported)) {
yield JoseException('Could not verify token signature');
}
yield* Stream.fromIterable(idToken.claims
.validate(
expiryTolerance: const Duration(seconds: 30),
issuer: client.issuer.metadata.issuer,
clientId: client.clientId,
nonce: nonce)
.where((e) =>
validateExpiry ||
!(e is JoseException && e.message.startsWith('JWT expired.'))));
}