Пример #1
0
        Task OnApiKeyValidated(ApiKeyValidatedContext context)
        {
            if (context.ApiKey == configuration.GetSection("ApiKeys")["DefaultKey"])
            {
                context.Success();
            }

            return(Task.CompletedTask);
        }
Пример #2
0
        public void Validacia1(ApiKeyValidatedContext context)
        {
            // foreach (var kluc in this.databaza.ApiKeys) {

            // if (context.ApiKey == kluc.Key)
            // {
            context.Principal = new ClaimsPrincipal();

            context.Success();
            // }
            // else if (context.ApiKey == "789")
            // {
            throw new NotSupportedException("You must upgrade.");
            // }
            //}
        }