spring Boot和Angular JS:处理身份验证的最佳方法是什么?

时间:2021-07-08 05:27:50

I'm devoloping an application using Spring Boot , Spring Data and Angular JS .

我正在使用Spring Boot,Spring Data和Angular JS开发应用程序。

what is the best way to deal with the authentication ???

什么是处理身份验证的最佳方法???

I've never used spring security before and I can't find an example using a database (users and Roles) .can I use spring security even if I have html pages ?

我之前从未使用过Spring安全性,但我找不到使用数据库(用户和角色)的例子。即使我有html页面,我也使用spring security吗?

what I want is that when a User (from my database) logs in , he will find his personal data. what I mean is for example like in facebook home page ,the user's name is shown on the topbar , he can see his profil ...

我想要的是当用户(来自我的数据库)登录时,他会找到他的个人数据。我的意思是例如在facebook主页中,用户的名字显示在顶部栏上,他可以看到他的个人资料......

Also a part of my menu must be shown only to my admin user . is that possible ?

此外,我的菜单的一部分必须仅显示给我的管理员用户。那可能吗 ?

I'll be gratful if someone can tell me what are the steps to follow or give me a link for a good tutorial . I'm lost

如果有人可以告诉我要遵循的步骤或给我一个好的教程链接,我会很感激。我迷路了

1 个解决方案

#1


1  

You must go through this tutorial which was based on Dave Syer's blog posts. It clearly describes about angularjs with spring boot and authentication.

您必须完成本教程,该教程基于Dave Syer的博客文章。它清楚地描述了有弹簧启动和身份验证的angularjs。

My personal suggestion for is to use Spring Security with form login, which supports role based authentication. Custom menu display is not that hard when you have angularjs and role based authentication with you. (But I'm afraid you will not be able to have 100% html solution - May have to use jsp if statement.)

我个人的建议是使用Spring Security和表单登录,它支持基于角色的身份验证。当您使用angularjs和基于角色的身份验证时,自定义菜单显示并不难。 (但我担心你无法拥有100%的HTML解决方案 - 可能必须使用jsp if语句。)

Another alternative would be, if you have jboss as application server, you can use login-config.xml to change permissions

另一种选择是,如果你有jboss作为应用服务器,你可以使用login-config.xml来改变权限

#1


1  

You must go through this tutorial which was based on Dave Syer's blog posts. It clearly describes about angularjs with spring boot and authentication.

您必须完成本教程,该教程基于Dave Syer的博客文章。它清楚地描述了有弹簧启动和身份验证的angularjs。

My personal suggestion for is to use Spring Security with form login, which supports role based authentication. Custom menu display is not that hard when you have angularjs and role based authentication with you. (But I'm afraid you will not be able to have 100% html solution - May have to use jsp if statement.)

我个人的建议是使用Spring Security和表单登录,它支持基于角色的身份验证。当您使用angularjs和基于角色的身份验证时,自定义菜单显示并不难。 (但我担心你无法拥有100%的HTML解决方案 - 可能必须使用jsp if语句。)

Another alternative would be, if you have jboss as application server, you can use login-config.xml to change permissions

另一种选择是,如果你有jboss作为应用服务器,你可以使用login-config.xml来改变权限