Example #1
0
        public async Task AllowCorsOriginIfNotYetAllowed(string clientId, string origin)
        {
            var exists = await _securityRepository.Exists <ClientCorsOrigin>(o => o.Client.ClientId == clientId && o.Origin == origin);

            if (exists)
            {
                Log(true, nameof(ClientCorsOrigin), origin, nameof(Client), clientId);
            }
            else
            {
                Log(false, nameof(ClientCorsOrigin), origin, nameof(Client), clientId);
                var corsOrigin = CreateOrigin(origin);
                await _securityRepository.AddOrigin(corsOrigin, clientId);
            }
        }