|
|
@ -169,9 +169,6 @@ public class JpaOAuth2TokenRepository implements OAuth2TokenRepository { |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/* (non-Javadoc) |
|
|
|
|
|
|
|
* @see org.mitre.oauth2.repository.OAuth2TokenRepository#getAccessTokensForClient(org.mitre.oauth2.model.ClientDetailsEntity) |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public List<OAuth2AccessTokenEntity> getAccessTokensForClient(ClientDetailsEntity client) { |
|
|
|
public List<OAuth2AccessTokenEntity> getAccessTokensForClient(ClientDetailsEntity client) { |
|
|
|
TypedQuery<OAuth2AccessTokenEntity> queryA = manager.createNamedQuery(OAuth2AccessTokenEntity.QUERY_BY_CLIENT, OAuth2AccessTokenEntity.class); |
|
|
|
TypedQuery<OAuth2AccessTokenEntity> queryA = manager.createNamedQuery(OAuth2AccessTokenEntity.QUERY_BY_CLIENT, OAuth2AccessTokenEntity.class); |
|
|
@ -180,9 +177,6 @@ public class JpaOAuth2TokenRepository implements OAuth2TokenRepository { |
|
|
|
return accessTokens; |
|
|
|
return accessTokens; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/* (non-Javadoc) |
|
|
|
|
|
|
|
* @see org.mitre.oauth2.repository.OAuth2TokenRepository#getRefreshTokensForClient(org.mitre.oauth2.model.ClientDetailsEntity) |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public List<OAuth2RefreshTokenEntity> getRefreshTokensForClient(ClientDetailsEntity client) { |
|
|
|
public List<OAuth2RefreshTokenEntity> getRefreshTokensForClient(ClientDetailsEntity client) { |
|
|
|
TypedQuery<OAuth2RefreshTokenEntity> queryR = manager.createNamedQuery(OAuth2RefreshTokenEntity.QUERY_BY_CLIENT, OAuth2RefreshTokenEntity.class); |
|
|
|
TypedQuery<OAuth2RefreshTokenEntity> queryR = manager.createNamedQuery(OAuth2RefreshTokenEntity.QUERY_BY_CLIENT, OAuth2RefreshTokenEntity.class); |
|
|
@ -233,11 +227,6 @@ public class JpaOAuth2TokenRepository implements OAuth2TokenRepository { |
|
|
|
return new LinkedHashSet<>(JpaUtil.getResultPage(query,pageCriteria)); |
|
|
|
return new LinkedHashSet<>(JpaUtil.getResultPage(query,pageCriteria)); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* (non-Javadoc) |
|
|
|
|
|
|
|
* @see org.mitre.oauth2.repository.OAuth2TokenRepository#getAccessTokensForResourceSet(org.mitre.uma.model.ResourceSet) |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public Set<OAuth2AccessTokenEntity> getAccessTokensForResourceSet(ResourceSet rs) { |
|
|
|
public Set<OAuth2AccessTokenEntity> getAccessTokensForResourceSet(ResourceSet rs) { |
|
|
|
TypedQuery<OAuth2AccessTokenEntity> query = manager.createNamedQuery(OAuth2AccessTokenEntity.QUERY_BY_RESOURCE_SET, OAuth2AccessTokenEntity.class); |
|
|
|
TypedQuery<OAuth2AccessTokenEntity> query = manager.createNamedQuery(OAuth2AccessTokenEntity.QUERY_BY_RESOURCE_SET, OAuth2AccessTokenEntity.class); |
|
|
@ -245,13 +234,9 @@ public class JpaOAuth2TokenRepository implements OAuth2TokenRepository { |
|
|
|
return new LinkedHashSet<>(query.getResultList()); |
|
|
|
return new LinkedHashSet<>(query.getResultList()); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/* (non-Javadoc) |
|
|
|
|
|
|
|
* @see org.mitre.oauth2.repository.OAuth2TokenRepository#clearDuplicateAccessTokens() |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|
@Transactional(value="defaultTransactionManager") |
|
|
|
@Transactional(value="defaultTransactionManager") |
|
|
|
public void clearDuplicateAccessTokens() { |
|
|
|
public void clearDuplicateAccessTokens() { |
|
|
|
|
|
|
|
|
|
|
|
Query query = manager.createQuery("select a.jwt, count(1) as c from OAuth2AccessTokenEntity a GROUP BY a.jwt HAVING count(1) > 1"); |
|
|
|
Query query = manager.createQuery("select a.jwt, count(1) as c from OAuth2AccessTokenEntity a GROUP BY a.jwt HAVING count(1) > 1"); |
|
|
|
@SuppressWarnings("unchecked") |
|
|
|
@SuppressWarnings("unchecked") |
|
|
|
List<Object[]> resultList = query.getResultList(); |
|
|
|
List<Object[]> resultList = query.getResultList(); |
|
|
@ -270,9 +255,6 @@ public class JpaOAuth2TokenRepository implements OAuth2TokenRepository { |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/* (non-Javadoc) |
|
|
|
|
|
|
|
* @see org.mitre.oauth2.repository.OAuth2TokenRepository#clearDuplicateRefreshTokens() |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|
@Transactional(value="defaultTransactionManager") |
|
|
|
@Transactional(value="defaultTransactionManager") |
|
|
|
public void clearDuplicateRefreshTokens() { |
|
|
|
public void clearDuplicateRefreshTokens() { |
|
|
|