【发布时间】:2015-09-13 00:11:23
【问题描述】:
我正在使用基于令牌的身份验证。我有一个自定义身份验证过滤器,它执行 REST 调用来对用户进行身份验证。我设法创建和配置自定义身份验证提供程序,但无法设置提供程序的顺序。我希望默认 DaoAuthenticationProvider 是默认值,而 customProvider 是次要的。
这就是我配置 customAuthenticationProvider 的方式
@Inject
private CustomAuthenticationProvider customAuthenticationProvider;
@Inject
public void configureGlobal(AuthenticationManagerBuilder auth) throws Exception {
auth.authenticationProvider(customAuthenticationProvider)
.userDetailsService(userDetailsService)
.passwordEncoder(passwordEncoder());
}
如何将 customAuthenticationProvider 配置为第二个提供者?
PS:我无法将 customAuthenticationProvider 注入 SecurityConfiguration.java,因为在我将以下范围添加到 customAuthenticationProvider 之前无法创建代理。
@Component("alfrescoAuthenticationProvider")
@Scope(proxyMode = ScopedProxyMode.TARGET_CLASS, value = "prototype")
public class AlfrescoAuthenticationProvider implements AuthenticationProvider {
....
}
【问题讨论】:
标签: jhipster