我的任务是使用spring-security概念登录到应用程序。 我能够使用Spring安全登录,但它仅适用于“ROLE_ADMIN”(因为我已经包括(<user name="Sriram" password="12345" authorities="ROLE_USER" />
)在弹簧security.xml文件,使用Spring Security进行授权
因此,只有斯利拉姆可以登录到应用程序。现在我的问题是的,我应该登录使用以下凭证(<user name="Yogesh" password="12345" authorities="DIRECT_CUSTOMER" />
)应用这意味着验证应该发生的特定用户
- 案例1:如果斯利拉姆日志中 - >他只能看到他的授权下页 。
- 案例2:如果Yogesh登录 - >他只能看到他的授权下一页
这意味着它必须在spring-security.xml中验证登录。
这是我的弹簧security.xml文件:
<http auto-config="true" access-denied-page="/accessDenied.jsp">
<intercept-url pattern="/" access="ROLE_USER"/>
<form-login login-page="/login" default-target-url="/login"
authentication-failure-url="/loginfailed" />
<logout logout-success-url="/logout" />
</http>
<authentication-manager>
<authentication-provider>
<user-service>
<user name="Sriram" password="12345" authorities="ROLE_USER" />
<!-- <user name="Vignesh" password="12345" authorities="ROLE_ADMIN" /> -->
<!-- <user name="Yogesh" password="12345" authorities="PARTNER_CUSTOMER" /> -->
</user-service>
</authentication-provider>
</authentication-manager>
谢谢你的朋友:)说,Sriram是一个超级管理员。所以,他只能看到他相关的下一个jsp文件。比如说,Yogesh是MasterAdmin,所以他只能看到他相关的下一个jsp文件。说,Vignesh是用户,所以他应该只看到他相关的下一个jsp页面。我如何在这里实现这个?我想要想法 – Yogesh
我在spring-security.xml中做了哪些改变。我的意思是在这一行 –
Yogesh
我已更新我的回答 – underdog