public async Task <ActionResult <UserDto> > GetCurrentUser() { var email = User?.FindFirst(ClaimTypes.Email)?.Value; var user = await _userManager.FindByEmailAsync(email); return(new UserDto { Email = user.Email, Token = _tokenService.CreateToken(user), DisplayName = user.DisplayName }); }
public IActionResult GetSecuredData() { return(Ok("Secured data " + User.FindFirst(ClaimTypes.NameIdentifier).Value)); }
public async Task <ActionResult <IEnumerable <MessageDto> > > GetMessageThread(string username) { var currentUsername = User.FindFirst(ClaimTypes.Name)?.Value; return(Ok(await _messageRepository.GetMessageThread(currentUsername, username))); }