简体   繁体   English

春季第三方认证

[英]Spring third party authentication

What I want is first check local database for authentication. 我想要的是首先检查本地数据库的身份验证。 if user is not authenticated. 如果用户未通过身份验证。 make a rest call with username and password to another server which returns a success message and complete user bean. 使用用户名和密码对另一个服务器进行休息呼叫,该服务器返回成功消息并完成用户Bean。 which I want to store in spring security session. 我想将其存储在春季安全会议中。 how can I achive this.? 我怎么能做到这一点? I tried with loadUserByUsername() method but there is no password parameter. 我尝试使用loadUserByUsername()方法,但是没有密码参数。

You need to implement your own version of AuthenticationProvider interface. 您需要实现自己的AuthenticationProvider接口版本。

Inject it in your security configuration with something like: 将其注入您的安全配置中,如下所示:

<authentication-manager>
  <authentication-provider ref="myAuthenticationProvider" />
</authentication-manager>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM