Browse Source

quieted logging on database cleanup tasks when no expired elements are found

pull/988/head
Justin Richer 9 years ago
parent
commit
1ed3e2c47a
  1. 5
      openid-connect-server/src/main/java/org/mitre/oauth2/service/impl/DefaultOAuth2AuthorizationCodeService.java
  2. 14
      openid-connect-server/src/main/java/org/mitre/oauth2/service/impl/DefaultOAuth2ProviderTokenService.java
  3. 4
      openid-connect-server/src/main/java/org/mitre/openid/connect/service/impl/DefaultApprovedSiteService.java

5
openid-connect-server/src/main/java/org/mitre/oauth2/service/impl/DefaultOAuth2AuthorizationCodeService.java

@ -121,8 +121,9 @@ public class DefaultOAuth2AuthorizationCodeService implements AuthorizationCodeS
repository.remove(code);
}
logger.info("Removed " + codes.size() + " expired authorization codes.");
if (codes.size() > 0) {
logger.info("Removed " + codes.size() + " expired authorization codes.");
}
}
/**

14
openid-connect-server/src/main/java/org/mitre/oauth2/service/impl/DefaultOAuth2ProviderTokenService.java

@ -423,14 +423,16 @@ public class DefaultOAuth2ProviderTokenService implements OAuth2TokenEntityServi
*/
@Override
public void clearExpiredTokens() {
logger.info("Cleaning out all expired tokens");
logger.debug("Cleaning out all expired tokens");
// get all the duplicated tokens first to maintain consistency
tokenRepository.clearDuplicateAccessTokens();
tokenRepository.clearDuplicateRefreshTokens();
Collection<OAuth2AccessTokenEntity> accessTokens = getExpiredAccessTokens();
logger.info("Found " + accessTokens.size() + " expired access tokens");
if (accessTokens.size() > 0) {
logger.info("Found " + accessTokens.size() + " expired access tokens");
}
for (OAuth2AccessTokenEntity oAuth2AccessTokenEntity : accessTokens) {
try {
revokeAccessToken(oAuth2AccessTokenEntity);
@ -442,13 +444,17 @@ public class DefaultOAuth2ProviderTokenService implements OAuth2TokenEntityServi
}
Collection<OAuth2RefreshTokenEntity> refreshTokens = getExpiredRefreshTokens();
logger.info("Found " + refreshTokens.size() + " expired refresh tokens");
if (refreshTokens.size() > 0) {
logger.info("Found " + refreshTokens.size() + " expired refresh tokens");
}
for (OAuth2RefreshTokenEntity oAuth2RefreshTokenEntity : refreshTokens) {
revokeRefreshToken(oAuth2RefreshTokenEntity);
}
Collection<AuthenticationHolderEntity> authHolders = getOrphanedAuthenticationHolders();
logger.info("Found " + authHolders.size() + " orphaned authentication holders");
if (authHolders.size() > 0) {
logger.info("Found " + authHolders.size() + " orphaned authentication holders");
}
for(AuthenticationHolderEntity authHolder : authHolders) {
authenticationHolderRepository.remove(authHolder);
}

4
openid-connect-server/src/main/java/org/mitre/openid/connect/service/impl/DefaultApprovedSiteService.java

@ -158,7 +158,9 @@ public class DefaultApprovedSiteService implements ApprovedSiteService {
logger.info("Clearing expired approved sites");
Collection<ApprovedSite> expiredSites = getExpired();
logger.info("Found " + expiredSites.size() + " expired approved sites.");
if (expiredSites.size() > 0) {
logger.info("Found " + expiredSites.size() + " expired approved sites.");
}
if (expiredSites != null) {
for (ApprovedSite expired : expiredSites) {
remove(expired);

Loading…
Cancel
Save