Ejemplo n.º 1
0
        public async Task <ActionResult <Protocol.HttpModel.Challenge> > AcceptChallenge(string orderId, string authId, string challengeId)
        {
            var account = await _accountService.FromRequestAsync(HttpContext.RequestAborted);

            var challenge = await _orderService.ProcessChallengeAsync(account, orderId, authId, challengeId, HttpContext.RequestAborted);

            if (challenge == null)
            {
                throw new NotFoundException();
            }

            var challengeResponse = new Protocol.HttpModel.Challenge(challenge, GetChallengeUrl(challenge));

            return(challengeResponse);
        }
Ejemplo n.º 2
0
        public async Task <ActionResult <Protocol.HttpModel.Challenge> > AcceptChallenge(string orderId, string authId, string challengeId)
        {
            var account = await _accountService.FromRequestAsync(HttpContext.RequestAborted);

            var challenge = await _orderService.ProcessChallengeAsync(account, orderId, authId, challengeId, HttpContext.RequestAborted);

            if (challenge == null)
            {
                throw new NotFoundException();
            }

            var linkHeaderUrl = Url.RouteUrl("GetAuthorization", new { orderId = orderId, authId = authId }, HttpContext.GetProtocol());
            var linkHeader    = $"<{linkHeaderUrl}>;rel=\"up\"";

            HttpContext.Response.Headers.AddOrMerge("Link", linkHeader);

            var challengeResponse = new Protocol.HttpModel.Challenge(challenge, GetChallengeUrl(challenge));

            return(challengeResponse);
        }