Skip to content

Commit

Permalink
chore: Lower logger levels on some authentication messages (#8832)
Browse files Browse the repository at this point in the history
  • Loading branch information
netroms authored Sep 27, 2021
1 parent d8fae6c commit 5e6ae51
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ public UserDetails loadUserByUsername( String username )

if ( ObjectUtils.anyIsFalse( enabled, credentialsNonExpired, accountNonLocked, accountNonExpired ) )
{
log.info( String.format(
log.debug( String.format(
"Login attempt for disabled/locked user: '%s', enabled: %b, account non-expired: %b, credentials non-expired: %b, account non-locked: %b",
username, enabled, accountNonExpired, credentialsNonExpired, accountNonLocked ) );
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,14 +115,14 @@ public Authentication authenticate( Authentication auth )

if ( securityService.isLocked( username ) )
{
log.info( String.format( "Temporary lockout for user: %s and IP: %s", username, ip ) );
log.debug( String.format( "Temporary lockout for user: %s and IP: %s", username, ip ) );

throw new LockedException( String.format( "IP is temporarily locked: %s", ip ) );
}

if ( !LongValidator.getInstance().isValid( code ) || !SecurityUtils.verify( userCredentials, code ) )
{
log.info(
log.debug(
String.format( "Two-factor authentication failure for user: %s", userCredentials.getUsername() ) );

throw new BadCredentialsException( "Invalid verification code" );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ public void handleAuthenticationFailure( AbstractAuthenticationFailureEvent even
{
TwoFactorWebAuthenticationDetails authDetails = (TwoFactorWebAuthenticationDetails) details;

log.info( String.format( "Login attempt failed for remote IP: %s", authDetails.getIp() ) );
log.debug( String.format( "Login attempt failed for remote IP: %s", authDetails.getIp() ) );
}

if ( OAuth2LoginAuthenticationToken.class.isAssignableFrom( auth.getClass() ) )
Expand All @@ -93,7 +93,7 @@ public void handleAuthenticationFailure( AbstractAuthenticationFailureEvent even
WebAuthenticationDetails tokenDetails = (WebAuthenticationDetails) authenticationToken.getDetails();
String remoteAddress = tokenDetails.getRemoteAddress();

log.info( String.format( "OIDC login attempt failed for remote IP: %s", remoteAddress ) );
log.debug( String.format( "OIDC login attempt failed for remote IP: %s", remoteAddress ) );
}

securityService.registerFailedLogin( username );
Expand Down

0 comments on commit 5e6ae51

Please sign in to comment.