示例#1
0
        public JwtTokenValidation(IConfiguration configuration,
                                  GoogleDiscoverCacheContainer googleDiscoverCacheContainer,
                                  NortonDiscoverCacheContainer nortonDiscoverCacheContainer)
        {
            _configuration = configuration;

            // we probably don't want to check for the client_id.  We are only interested in the fact that the authority issued the jwt.
            _nortonProviderValidator =
                new ProviderValidator(nortonDiscoverCacheContainer, null);
            _googleProviderValidator =
                new ProviderValidator(googleDiscoverCacheContainer, null);
        }
示例#2
0
        public async Task <ClaimsPrincipal> ValidateToken(string provider, string idToken)
        {
            ProviderValidator providerValidator = null;

            switch (provider)
            {
            case "google-id_token":
                providerValidator = _googleProviderValidator;
                break;

            case "norton-id_token":
                providerValidator = _nortonProviderValidator;
                break;
            }

            var cp = await providerValidator.ValidateToken(idToken);

            return(cp);
        }