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

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

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

            if (options.JtiGenerator == null)
            {
                throw new ArgumentNullException(nameof(MvJwtIssuerOptions.JtiGenerator));
            }
        }
Beispiel #2
0
 public JwtFactory(IOptions <MvJwtIssuerOptions> jwtOptions)
 {
     _jwtOptions = jwtOptions.Value;
     ThrowIfInvalidOptions(_jwtOptions);
 }