public UserToken GetTokenByRefreshToken(string refreshToken) { if (string.IsNullOrWhiteSpace(refreshToken)) { return(null); } var refreshTokenIdHash = Hasher.GetSha256Hash(refreshToken); return(_tokenRepository .Include(x => x.User) .GetFinder() .One(UserTokenSpecifications.RefreshTokenIdHash(refreshTokenIdHash))); }
public void DeleteTokenByUserId(int userId) { var userToken = _tokenRepository .Include(x => x.User) .GetFinder() .One(UserTokenSpecifications.User(userId)); if (userToken == null) { return; } _tokenRepository.Delete(userToken); _tokenRepository.Commit(); }