예제 #1
0
        public async Task <IActionResult> GetDetails([FromQuery] SearchDetailsRequest request)
        {
            if (string.IsNullOrWhiteSpace(request.ClientId) && string.IsNullOrWhiteSpace(request.Token))
            {
                return(BadRequest("Request is null"));
            }

            //var res = await _oAuthService.GetDetails(request);
            var res = new Client
            {
                ClientId             = "Jeremy",
                Secret               = "Henry",
                ClientResourceAccess = new List <ClientResourceAccess>
                {
                    new ClientResourceAccess
                    {
                        ClientId   = "CJ",
                        Access     = "12345",
                        ResourceId = "zzzzz"
                    }
                }
            };

            return(Ok(res));
        }
예제 #2
0
        public async Task <IActionResult> GetDetails([FromQuery] SearchDetailsRequest request)
        {
            if (string.IsNullOrWhiteSpace(request.ClientId) && string.IsNullOrWhiteSpace(request.Token))
            {
                return(BadRequest("Request is null"));
            }

            var res = await _oAuthService.GetDetails(request);

            return(Ok(res));
        }
예제 #3
0
        public async Task <Client> GetDetails(SearchDetailsRequest request)
        {
            var clientId = (!string.IsNullOrWhiteSpace(request.Token)
                ? (await oAuthContext.AccessToken.SingleOrDefaultAsync(x => x.Token == request.Token))?.ClientId
                : request.ClientId)?.Trim();

            return(string.IsNullOrEmpty(clientId)
                ? null
                : await oAuthContext.Client
                   .Include(x => x.ClientAccessParameter)
                   .Include(x => x.ClientResourceAccess)
                   .Include(x => x.ClientImpersonationClient)
                   .SingleOrDefaultAsync(x => x.ClientId == clientId));
        }