Example #1
0
        private static void ThrowIfInvalidOptions(TokenIssuerOptions options)
        {
            if (options == null)
            {
                throw new ArgumentNullException(nameof(options));
            }

            if (options.ValidFor <= TimeSpan.Zero)
            {
                throw new ArgumentException("Must be a non-zero TimeSpan.", nameof(options.ValidFor));
            }

            if (options.SigningCredentials == null)
            {
                throw new ArgumentNullException(nameof(options.SigningCredentials));
            }

            if (options.JtiGenerator == null)
            {
                throw new ArgumentNullException(nameof(options.JtiGenerator));
            }
        }
Example #2
0
 public TokenProviderMiddleware(RequestDelegate next, IOptions <TokenIssuerOptions> options)
 {
     _next    = next;
     _options = options.Value;
 }