예제 #1
0
        public async Task Assert(IdTokenRequirements requirements, string idToken, string clientSecret, DateTime?pointInTime = null)
        {
            if (string.IsNullOrWhiteSpace(idToken))
            {
                throw new IdTokenValidationException("ID token is required but missing.");
            }

            var verifiedToken = await DecodeSignedToken(requirements, idToken, clientSecret).ConfigureAwait(false);

            IdTokenClaimValidator.AssertClaimsMeetRequirements(requirements, verifiedToken, pointInTime ?? DateTime.Now);
        }
        private void ValidateToken(string token, IdTokenRequirements reqs = null)
        {
            var decodedToken = securityTokenHandler.ReadJwtToken(token);

            IdTokenClaimValidator.AssertClaimsMeetRequirements(reqs ?? defaultReqs, decodedToken, tokensWereValid);
        }