spring - Jhipster 和 Spring Security - 添加身份验证提供程序保持活动的默认 jdbcauthentication 模式
问题描述
我已经向我的 jHipster 应用程序添加了一个自定义 LDAP 身份验证提供程序机制。没有在类中插入任何configureGlobal(AuthenticationManagerBuilder auth)
或configureGlobal(AuthenticationManagerBuilder auth)
方法SecurityConfiguration
,但在我的自定义实现上带有@Component
注释AuthenticationProvider
,新的身份验证工作正常,但是,我失去了数据库上用户的默认身份验证。
我尝试将其添加到securityConfiguration
:
@Inject
public void configureGlobal(AuthenticationManagerBuilder auth) throws Exception {
super.configure(auth);
auth.authenticationProvider(aDauthenticationProvider);
}
但结果是一样的,我失去了数据库身份验证。
如何将默认身份验证机制添加到 AuthenticationManagerBuilder 的提供者列表中?
谢谢
解决方案
我找到了解决方案,如果有人遇到我的问题,我会写这个。
在 GlobalConfigure 方法上添加此代码行就足够了:
auth.userDetailsService(userDetailsService).passwordEncoder(passwordEncoder());
将预定义的 JDBC 身份验证方法添加到身份验证提供程序列表中。
推荐阅读
- typescript - 如何描述类的返回值?
- firebase - Firebase 云消息传递延迟
- c - 如何遍历链表并仅打印包含特定数据的内容,然后再次运行以打印包含 c 中其他数据的内容?
- sql-server - 如何使用子句将系统版本控制添加到此表定义中?
- regex - 使用正则表达式运算符 (=~) 时变量不扩展
- c# - c# 中的递归加载,我错过了什么?
- json - 返回值以记录时出现表达式错误
- javascript - 如何让一个函数为表格中的每个按钮工作
- bash - 使用 cat 和 echo 写入 /dev/ttyUSB0
- apache-spark - 将 Scalapb 与 spark 结构化流和 java 生成的 protobuf 类一起使用