Example #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));
        }
Example #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"));
            }
        }