0
스프링 보안 LDAP 및 인증 기능을 사용하지만 LDAP 엔트리에서 userLevel 속성을로드하여 사용자 수준을 결정해야합니다.스프링 보안 LDAP LDAP에서 역할로드
내 봄 보안 구성이
@Profile(value = {"sit", "uat", "prod"})
@Configuration
@EnableWebSecurity
public class SecurityConfig extends WebSecurityConfigurerAdapter {
@Autowired
protected Environment environment;
public SecurityConfig() {
super();
}
@Override
protected void configure(AuthenticationManagerBuilder auth) throws Exception {
auth.ldapAuthentication()
.userSearchBase("dc=fantasycompany,dc=com")
.userDnPatterns("cn={0},ou=users,ou=somedepartment,o=departments,c=US,dc=fantasycompany,dc=com")
.contextSource()
.url("ldaps://someserver:636")
.managerDn("cn=someone,cn=users,dc=fantasycompany,dc=com")
.managerPassword("somethingsomething");
}
@Override
protected void configure(HttpSecurity httpSecurity) throws Exception {
/**httpSecurity.authorizeRequests()
.anyRequest().fullyAuthenticated()
.and()
.formLogin()
.loginPage("/login")
.loginProcessingUrl("/perform_login")
.defaultSuccessUrl("/",true)
.failureUrl("/login.html?error=true");*/
httpSecurity
.csrf().disable()
.authorizeRequests()
.antMatchers("/login*").permitAll()
.antMatchers("/css/*").permitAll()
.anyRequest().authenticated()
.and()
.formLogin()
.loginPage("/login")
.defaultSuccessUrl("/",true)
.failureUrl("/login?error=true")
.and()
.logout()
.logoutUrl("/logout")
.deleteCookies("JSESSIONID");
}
}
어떻게 역할에 LDAP 항목에서 유저 레벨 속성을로드 봄을 얻을 수 있어요처럼 보인다?