예제 #1
0
        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
            });
        }
예제 #2
0
 public IActionResult GetSecuredData()
 {
     return(Ok("Secured data " + User.FindFirst(ClaimTypes.NameIdentifier).Value));
 }
예제 #3
0
        public async Task <ActionResult <IEnumerable <MessageDto> > > GetMessageThread(string username)
        {
            var currentUsername = User.FindFirst(ClaimTypes.Name)?.Value;

            return(Ok(await _messageRepository.GetMessageThread(currentUsername, username)));
        }