0
私は認証され、Spring SecurityによってActive Directoryに承認されています。 しかし、LDAP属性(たとえば、MAIL)を取得することはできません。 私はそれ...InetOrgPersonContextMapperクラスの使用方法
@Bean
public InetOrgPersonContextMapper inetOrgPersonContextMapper(){
InetOrgPersonContextMapper contextMapper = new InetOrgPersonContextMapper();
return contextMapper;
}
@Bean
public LdapAuthenticationProvider ldapAuthenticationProvider(){
LdapAuthenticationProvider ldapAuthenticationProvider = new LdapAuthenticationProvider(ldapAuthenticator(),ldapAuthoritiesPopulator());
ldapAuthenticationProvider.setUserDetailsContextMapper(inetOrgPersonContextMapper());
return ldapAuthenticationProvider;
}
ために使用InetOrgPersonContextMapperをしようとしているが、私は私のコントローラでretrive属性をしようとしたときには、ClassCastExeption
Authentication auth = SecurityContextHolder.getContext().getAuthentication();
InetOrgPerson person = (InetOrgPerson)auth.getPrincipal();
が私にreitrive属性の正しい方法を教えてください取得します。