Skip to content

Commit

Permalink
fix: Updated misleading Password Rest Provider message (#4105)
Browse files Browse the repository at this point in the history
Signed-off-by: MMaiero <[email protected]>

Signed-off-by: MMaiero <[email protected]>
  • Loading branch information
MMaiero authored Aug 11, 2022
1 parent d0670af commit 358c5ab
Showing 1 changed file with 2 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
import java.util.Base64.Decoder;
import java.util.Optional;
import java.util.StringTokenizer;
import java.util.regex.Pattern;

import javax.annotation.Priority;
import javax.servlet.http.HttpServletRequest;
Expand All @@ -45,14 +44,13 @@
@Priority(200)
public class PasswordAuthenticationProvider implements AuthenticationProvider {

private static final String PASSWORD_AUTH_FAILED_MSG = "{} Rest - Failure - Password Authentication failed";
private static final String PASSWORD_AUTH_FAILED_MSG = "{} Rest - Failure - Authentication failed as username or password not matching";

private static final Logger logger = LoggerFactory.getLogger(PasswordAuthenticationProvider.class);

private static final String KURA_USER_PREFIX = "kura.user.";
private static final String KURA_NEED_PASSWORD_CHANGE = "kura.need.password.change";
private static final String KURA_PASSWORD_CREDENTIAL = "kura.password";
private static final Pattern COLON = Pattern.compile("[:]");

private static final Logger auditLogger = LoggerFactory.getLogger("AuditLogger");

Expand Down Expand Up @@ -121,7 +119,7 @@ public Optional<Principal> authenticate(final HttpServletRequest request,

try {
if (cryptoService.sha256Hash(credentials.password).equals(storedPasswordHash)) {
auditLogger.info("{} Rest - Success - Password Authentication succeeded", auditContext);
auditLogger.info("{} Rest - Success - Authentication succeeded via password provider", auditContext);
return Optional.of(() -> credentials.username);
} else {
auditLogger.warn(PASSWORD_AUTH_FAILED_MSG, auditContext);
Expand Down

0 comments on commit 358c5ab

Please sign in to comment.