简体   繁体   English

Spring Security和Angularjs登录

[英]Spring Security and Angularjs Login

The example in this link: https://spring.io/guides/tutorials/spring-security-and-angular-js/ , uses an end point named user. 该链接中的示例: https : //spring.io/guides/tutorials/spring-security-and-angular-js/ ,使用名为user的端点。 Then with $http.get in angular the app try to reach that end point. 然后将$ http.get插入角度,应用程序尝试到达该终点。 If it reached it means that the user is authenticated. 如果达到,则表示用户已通过身份验证。

In my demo app I am using $http in a post to my login end point. 在我的演示应用程序中,我在到登录端点的帖子中使用$ http。 Doing so it will authenticate the user as well. 这样做也将对用户进行身份验证。 Now my question: Which one should I use? 现在我的问题是:我应该使用哪一个? Is it any difference between then besides the http verb? 除了http动词之外,它们之间还有什么区别吗?

the /user endpoint in the example is to verify authentication, even with that you have to have a separate endpoint, say /login POST for the actual authentication itself. 该示例中的/user端点是为了验证身份验证,即使您必须有一个单独的端点,例如/login POST代表实际的身份验证本身。

On a side note, as per my understanding, as per the guide we check /user each time we do a backend call which imho is not a very good design. 顺便说一句,根据我的理解,按照我们每次执行后端调用时都要检查/user的指南,恕我直言,这不是一个很好的设计。 If you are planing to implement this approach in your app you can consider any other alternatives.. 如果您打算在您的应用中实施此方法,则可以考虑其他任何替代方法。

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

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