【发布时间】:2020-12-07 12:13:46
【问题描述】:
我想写一个自定义的 LdapAuthenticationProvider 如下:
public Authentication authenticate(Authentication authentication) throws AuthenticationException {
LdapAuthenticationProvider ldap = new LdapAuthenticationProvider(); // don't know how to do
instantiate this
Authentication authentication1 = super.authenticate(authentication);
return new LdapToken(null,null,"",true,"");
}
我的意图是将身份验证委托给默认的 LdapAuthenticationProvider,但在身份验证后返回一些自定义令牌。
但我无法创建 LdapAuthenticationProvider 的对象,因为 LdapAuthenticationProviderConfigurer 的构建方法实际上返回 LdapAuthenticationProvider 的对象是私有的。而且我不想使用 XML 配置文件。
谁能告诉我如何做到这一点?
【问题讨论】:
标签: spring-boot rest spring-security ldap spring-ldap