private static void ThrowIfInvalidOptions(JwtIssuerSettings options) { if (options == null) { throw new ArgumentNullException(nameof(options)); } if (options.ValidFor <= TimeSpan.Zero) { throw new ArgumentException("Must be a non-zero TimeSpan.", nameof(JwtIssuerSettings.ValidFor)); } if (options.SigningCredentials == null) { throw new ArgumentNullException(nameof(JwtIssuerSettings.SigningCredentials)); } if (options.JtiGenerator == null) { throw new ArgumentNullException(nameof(JwtIssuerSettings.JtiGenerator)); } }
public JwtFactory(IJwtTokenHandler jwtTokenHandler, JwtIssuerSettings jwtIssuerSettings) { _jwtTokenHandler = jwtTokenHandler; _jwtOptions = jwtIssuerSettings; ThrowIfInvalidOptions(_jwtOptions); }