public AccountController(IOptions <OpcaoToken> jwtOptions, IUow uow, IClienteRepositorio repository) : base(uow) { _repository = repository; _tokenOptions = jwtOptions.Value; ThrowIfInvalidOptions(_tokenOptions); _serializerSettings = new JsonSerializerSettings { Formatting = Formatting.Indented, ContractResolver = new CamelCasePropertyNamesContractResolver() }; }
private static void ThrowIfInvalidOptions(OpcaoToken options) { if (options == null) { throw new ArgumentNullException(nameof(options)); } if (options.ValidFor <= TimeSpan.Zero) { throw new ArgumentException("O perĂodo deve ser maior que zero", nameof(OpcaoToken.ValidFor)); } if (options.SigningCredentials == null) { throw new ArgumentNullException(nameof(OpcaoToken.SigningCredentials)); } if (options.JtiGenerator == null) { throw new ArgumentNullException(nameof(OpcaoToken.JtiGenerator)); } }