public async Task <IActionResult> Get()
        {
            var query = new GetProfileConfirmationQuery
            {
                UserId = CurrentUserId
            };

            return(Ok(await _mediator.Send(query)));
        }
示例#2
0
        public async Task OnAuthorizationAsync(AuthorizationFilterContext context)
        {
            var userId = context.HttpContext.User?.Claims?.FirstOrDefault(p => p.Type == ClaimTypes.NameIdentifier)?.Value;

            var query = new GetProfileConfirmationQuery
            {
                UserId = Guid.Parse(userId)
            };

            var profileConfirmation = await _mediator.Send(query);

            if (profileConfirmation == null ||
                profileConfirmation.IsDeleted)
            {
                throw new ApplicationApiException(HttpStatusCode.Unauthorized, "User must have confirmation");
            }
        }