Skip to content

Commit

Permalink
Merge pull request #207 from Open-MBEE/feature/206
Browse files Browse the repository at this point in the history
fix(ldap): encode group search filter
  • Loading branch information
HuiJun authored Oct 7, 2022
2 parents 3b4c6c5 + 1a654a3 commit 5bd2995
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import org.springframework.ldap.core.support.BaseLdapPathContextSource;
import org.springframework.ldap.core.support.LdapContextSource;
import org.springframework.ldap.filter.*;
import org.springframework.ldap.support.LdapEncoder;
import org.springframework.security.authentication.AuthenticationProvider;
import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder;
import org.springframework.security.config.annotation.authentication.configurers.ldap.LdapAuthenticationProviderConfigurer;
Expand Down Expand Up @@ -185,7 +186,7 @@ public Collection<? extends GrantedAuthority> getGrantedAuthorities(

AndFilter andFilter = new AndFilter();
HardcodedFilter groupsFilter = new HardcodedFilter(
groupSearchFilter.replace("{0}", userDn));
groupSearchFilter.replace("{0}", LdapEncoder.filterEncode(userDn)));
andFilter.and(groupsFilter);
andFilter.and(orFilter);

Expand Down

0 comments on commit 5bd2995

Please sign in to comment.