Skip to content

Commit

Permalink
EPMRPP-94013 || Not possible to create LDAP integration with any enco…
Browse files Browse the repository at this point in the history
…der type
  • Loading branch information
APiankouski committed Aug 27, 2024
1 parent ae07128 commit 0f05a5c
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -103,28 +103,6 @@ protected AuthenticationProvider getDelegate() {
.PasswordCompareConfigurer passwordCompareConfigurer = builder.passwordCompare();
LdapParameter.PASSWORD_ATTRIBUTE.getParameter(integration)
.ifPresent(passwordCompareConfigurer::passwordAttribute);

/*
* DIRTY HACK. If LDAP password has salt, ldaptemplate.compare operation does not work
* since we don't know server's salt.
* To enable local password comparison, we need to provide password encoder from crypto's
* package
* This is why we just wrap old encoder with new one interface
* New encoder cannot be used everywhere since it does not have implementation for LDAP
*/
final PasswordEncoder delegate = PasswordEncoderFactories.createDelegatingPasswordEncoder();
builder.passwordEncoder(new org.springframework.security.crypto.password.PasswordEncoder() {

@Override
public String encode(CharSequence rawPassword) {
return delegate.encode(rawPassword);
}

@Override
public boolean matches(CharSequence rawPassword, String encodedPassword) {
return delegate.matches(rawPassword, encodedPassword);
}
});
});

LdapParameter.USER_DN_PATTERN.getParameter(integration).ifPresent(builder::userDnPatterns);
Expand Down
1 change: 1 addition & 0 deletions src/main/resources/banner.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,5 @@ ${AnsiColor.BRIGHT_YELLOW}
/_/
${info.build.name}: ${info.build.version}
Built with ♡ by EPAM Systems
Some words
Spring Boot ${spring-boot.formatted-version}

0 comments on commit 0f05a5c

Please sign in to comment.