public async Task <JsonResult> GetToken(bool regenerateToken = false)
        {
            var user = await this.userService.GetUserByEmailAsync(ClaimsReader.ReadEmail(this.User));

            var token = await this.tokenService.GetLongLivedUserToken(user, regenerateToken);

            return(Json(token));
        }
        public async Task <IActionResult> LoginCallback(string redirectUri = "")
        {
            var email = ClaimsReader.ReadEmail(this.User);

            if (email == null)
            {
                throw new UnknownProviderException();
            }

            var user = await this.userService.GetOrCreateUserByEmailAsync(
                email,
                ClaimsReader.ReadName(this.User),
                ClaimsReader.ReadSubject(this.User));

            if (string.IsNullOrWhiteSpace(redirectUri))
            {
                return(Ok());
            }
            else
            {
                return(Redirect(redirectUri));
            }
        }
        public async Task <UserDto> GetMe()
        {
            var result = await this.userService.GetUserByEmailAsync(ClaimsReader.ReadEmail(this.User));

            return(this.dtoMapper.Map <UserDto>(result));
        }
Example #4
0
 public async Task <User> GetMe()
 {
     return(await this.userService.GetUserByEmailAsync(ClaimsReader.ReadEmail(this.User)));
 }