public async Task <AccessTokenResponseModel> RefreshToken(GetUserIdByRefreshTokenRequest request)
        {
            var getUserIdResponse = await _userManagementService.GetIdByRefreshToken(request);

            var accessToken = _accessTokenService.Create(new UserAccessTokenPayload
            {
                Id = getUserIdResponse.Id
            }, request.RefreshToken);

            return(new AccessTokenResponseModel
            {
                AccessToken = accessToken
            });
        }
示例#2
0
        public async Task <GetUserIdResponse> GetIdByRefreshToken(GetUserIdByRefreshTokenRequest request)
        {
            var user = await DbContext.Users.FirstOrDefaultAsync(u => u.RefreshToken == request.RefreshToken);

            if (user == null)
            {
                throw new EntityNotFoundException <User>();
            }

            return(new GetUserIdResponse
            {
                Id = user.Id
            });
        }
        public async Task <GetUserIdResponse> GetIdByRefreshToken(GetUserIdByRefreshTokenRequest request)
        {
            var getUserIdResponse = await ProcessRequest(request, _userRepository.GetIdByRefreshToken);

            return(getUserIdResponse);
        }