/// <summary> /// RefreshToken revoke /// </summary> /// <param name="Request"></param> /// <returns></returns> public BaseResponse RevokeTokenRefresh(UpdateUserRefreshTokenRequest Request) { return(base.ExecuteWithExceptionHandledOperation(() => { BaseResponse response = new BaseResponse(); UserRefreshToken entity = _uof.UserRefreshTokenRepository.Find(x => x.Id == Request.Id && x.IsActive); if (entity == null) { response.IsSucceed = false; response.Message = "Güncellenecek refresh token bulunamadı."; response.ResultCode = (int)HttpStatusCode.NotFound; return response; } entity.IsActive = false; var resultUpdate = _uof.UserRefreshTokenRepository.Update(entity, Request.ClientUserId); if (resultUpdate == null) { response.IsSucceed = false; response.Message = "Refresh Token güncelleme işlemi başarısız."; response.ResultCode = (int)HttpStatusCode.NotFound; return response; } // Commit changes _uof.Commit(); return response; })); }
private BaseResponse RevokeTokenRefresh(int Id) { // eski refresh token pasife alinir UpdateUserRefreshTokenRequest Request = new UpdateUserRefreshTokenRequest() { Id = Id, ClientUserId = CurrentUser.Id }; BaseResponse response = _userService.RevokeTokenRefresh(Request); return(response); }
public async Task UpdateRefreshToken(UpdateUserRefreshTokenRequest request) { var user = await DbContext.Users.FirstOrDefaultAsync(u => u.Id == request.Id); if (user == null) { throw new EntityNotFoundException <User>(); } user.RefreshToken = request.RefreshToken; await DbContext.SaveChangesAsync(); }
public async Task UpdateRefreshToken(UpdateUserRefreshTokenRequest request) { await ProcessRequest(request, _userRepository.UpdateRefreshToken); }