Beispiel #1
0
        public TokenProviderMiddleware(
            RequestDelegate next,
            IOptions <TokenProviderOptionsWithIdentifier> options,
            ILoggerFactory loggerFactory)
        {
            _next       = next;
            _logger     = loggerFactory.CreateLogger <TokenProviderMiddleware>();
            _jwtService = new JwtService(options, loggerFactory);

            _options = options.Value;
            JwtHelper.ThrowIfInvalidOptions(_options);

            if (_options.IdentityResolver == null)
            {
                throw new ArgumentNullException("IdentityResolver");
            }

            _serializerSettings = new JsonSerializerSettings
            {
                Formatting = Formatting.Indented,
            };
        }