From 645f375f1dba66305d47eeb0f48f2c81996e5b71 Mon Sep 17 00:00:00 2001 From: Andrei Piankouski Date: Wed, 14 Aug 2024 12:06:15 +0300 Subject: [PATCH] EPMRPP-87165 || Add logs --- .../auth/integration/ldap/LdapAuthProvider.java | 2 +- .../parameter/CustomPasswordEncoderFactory.java | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/main/java/com/epam/reportportal/auth/integration/ldap/LdapAuthProvider.java b/src/main/java/com/epam/reportportal/auth/integration/ldap/LdapAuthProvider.java index 9045fe3d..0f56c0be 100644 --- a/src/main/java/com/epam/reportportal/auth/integration/ldap/LdapAuthProvider.java +++ b/src/main/java/com/epam/reportportal/auth/integration/ldap/LdapAuthProvider.java @@ -118,7 +118,7 @@ protected AuthenticationProvider getDelegate() { * New encoder cannot be used everywhere since it does not have implementation for LDAP */ LOGGER.error("PASSWORD_ENCODER_TYPE: " + it); - final PasswordEncoder delegate = CustomPasswordEncoderFactory.createDelegatingPasswordEncoder().get(it.toLowerCase()); + final PasswordEncoder delegate = CustomPasswordEncoderFactory.createDelegatingPasswordEncoder(); builder.passwordEncoder(new org.springframework.security.crypto.password.PasswordEncoder() { diff --git a/src/main/java/com/epam/reportportal/auth/integration/parameter/CustomPasswordEncoderFactory.java b/src/main/java/com/epam/reportportal/auth/integration/parameter/CustomPasswordEncoderFactory.java index ccca7c4b..5333ab56 100644 --- a/src/main/java/com/epam/reportportal/auth/integration/parameter/CustomPasswordEncoderFactory.java +++ b/src/main/java/com/epam/reportportal/auth/integration/parameter/CustomPasswordEncoderFactory.java @@ -30,9 +30,10 @@ */ public class CustomPasswordEncoderFactory { - public static Map createDelegatingPasswordEncoder() { + public static PasswordEncoder createDelegatingPasswordEncoder() { + String encodingId = "bcrypt"; Map encoders = new HashMap<>(); - encoders.put("bcrypt", new BCryptPasswordEncoder()); + encoders.put(encodingId, new BCryptPasswordEncoder()); encoders.put("ldap", new org.springframework.security.crypto.password.LdapShaPasswordEncoder()); encoders.put("MD4", new org.springframework.security.crypto.password.Md4PasswordEncoder()); encoders.put("MD5", new org.springframework.security.crypto.password.MessageDigestPasswordEncoder("MD5")); @@ -50,7 +51,7 @@ public static Map createDelegatingPasswordEncoder() { new org.springframework.security.crypto.password.MessageDigestPasswordEncoder("SHA-256")); encoders.put("sha256", new org.springframework.security.crypto.password.StandardPasswordEncoder()); encoders.put("argon2", new Argon2PasswordEncoder()); - return encoders; + return new DelegatingPasswordEncoder(encodingId, encoders); } }