Exemplo n.º 1
0
        public ActionResult <bool> Authorize([FromQuery, Required] string code)
        {
            var userId = ClaimHelpers.GetUserId(Request.HttpContext.User);

            if (!userId.HasValue)
            {
                return(StatusCode(StatusCodes.Status403Forbidden, "Unknown user id"));
            }

            return(_quickConnect.AuthorizeRequest(userId.Value, code));
        }
Exemplo n.º 2
0
        public async Task <ActionResult <bool> > Authorize([FromQuery, Required] string code)
        {
            var userId = ClaimHelpers.GetUserId(Request.HttpContext.User);

            if (!userId.HasValue)
            {
                return(StatusCode(StatusCodes.Status403Forbidden, "Unknown user id"));
            }

            try
            {
                return(await _quickConnect.AuthorizeRequest(userId.Value, code).ConfigureAwait(false));
            }
            catch (AuthenticationException)
            {
                return(Unauthorized("Quick connect is disabled"));
            }
        }