private async Task <Client> GetUserClient(string clientKey)
        {
            var result = await _clientFinder.GetByClientId(clientKey);

            if (result.HasNoValue)
            {
                var message = $"Client '{clientKey}' is not registered in the system.";
                throw new FailureResult(message);
            }
            return(result.Value);
        }
Exemplo n.º 2
0
        private async Task <ValidateClientResult> GetResult(ValidateClientQuery query)
        {
            var result = await _clientFinder.GetByClientId(query.ClientId);

            if (result.HasNoValue)
            {
                return(ValidateClientResult.Failed($"Client '{query.ClientId}' is not registered in the system."));
            }
            var client = result.Value;

            if (!client.Active)
            {
                return(ValidateClientResult.Failed("Client is inactive."));
            }

            return(new ValidateClientResult(true, client.Id.Id, client.Name, client.AllowedOrigin, client.RedirectUri));
        }