简体   繁体   English

Spring Security和REST API?

[英]Spring Security and REST API?

I'm working with Spring Security and I have a REST API for validating the username and password. 我正在使用Spring Security,我有一个REST API来验证用户名和密码。 So how to using REST API to authenticate username and password in Spring Security? 那么如何在Spring Security中使用REST API来验证用户名和密码呢?

Implement your own custom AuthenticationProvider, you'll have chance to override the authenticate(Authentication auth) method. 实现自己的自定义AuthenticationProvider,您将有机会覆盖authenticate(Authentication auth)方法。 Then register your provider bean with Spring Security configuration, like below 然后使用Spring Security配置注册您的provider bean,如下所示

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

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

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