Java 如何使用安全约束将用户重定向到特定页面?
我有两个组:ts_管理员和ts_用户。从登录页面,管理员登录后应直接进入管理员视图,用户应进入用户视图。我不知道该怎么办,我需要帮助。我已经加载了一个包含安全约束的XML页面,也许我们可以从这一点进一步了解它Java 如何使用安全约束将用户重定向到特定页面?,java,html,xml,login-control,security-constraint,Java,Html,Xml,Login Control,Security Constraint,我有两个组:ts_管理员和ts_用户。从登录页面,管理员登录后应直接进入管理员视图,用户应进入用户视图。我不知道该怎么办,我需要帮助。我已经加载了一个包含安全约束的XML页面,也许我们可以从这一点进一步了解它 <welcome-file-list> <welcome-file>index.html</welcome-file> </welcome-file-list> <security-constraint> <
<welcome-file-list>
<welcome-file>index.html</welcome-file>
</welcome-file-list>
<security-constraint>
<display-name>timesheet user permission</display-name>
<web-resource-collection>
<web-resource-name>timesheet_user_resources</web-resource-name>
<url-pattern>/index.html</url-pattern>
<url-pattern>/</url-pattern>
<url-pattern>/rs/*</url-pattern>
<http-method>GET</http-method>
<http-method>POST</http-method>
<http-method>PUT</http-method>
<http-method>DELETE</http-method>
<http-method>OPTIONS</http-method>
</web-resource-collection>
<auth-constraint>
<role-name>ts_users</role-name>
</auth-constraint>
<user-data-constraint>
<transport-guarantee>CONFIDENTIAL</transport-guarantee>
</user-data-constraint>
</security-constraint>
<security-role>
<role-name>ts_users</role-name>
</security-role>
<security-role>
<role-name>ts_admins</role-name>
</security-role>
<security-constraint>
<display-name>timesheet admin permissions</display-name>
<web-resource-collection>
<web-resource-name>timesheet_admin_resources</web-resource-name>
<url-pattern>/rs/*</url-pattern>
<url-pattern>/indexAdmin.html</url-pattern>
<http-method>GET</http-method>
<http-method>POST</http-method>
<http-method>PUT</http-method>
<http-method>DELETE</http-method>
<http-method>OPTIONS</http-method>
</web-resource-collection>
<auth-constraint>
<role-name>ts_admins</role-name>
</auth-constraint>
<user-data-constraint>
<transport-guarantee>CONFIDENTIAL</transport-guarantee>
</user-data-constraint>
</security-constraint>
<login-config>
<auth-method>FORM</auth-method>
<realm-name>MyRealm</realm-name>
<form-login-config id="FormLoginConfig_1">
<form-login-page>/login.html</form-login-page>
<form-error-page>/error.html</form-error-page>
</form-login-config>
</login-config>
index.html
时间表用户权限
时间表\用户\资源
/index.html
/
/rs/*
得到
邮递
放
删除
选择权
ts_用户
保密的
ts_用户
ts_管理员
时间表管理员权限
时间表\管理\资源
/rs/*
/index.html
得到
邮递
放
删除
选择权
ts_管理员
保密的
形式
我的王国
/login.html
/error.html
加载的XML文件设置良好,不需要任何更改。我在index和indexAdmin页面上都创建了链接,以便于交换,并且我还使用ng show仅在系统验证一个作为管理员时显示链接。在JS页面上,添加了
$scope.isAdmin=data.data.admin代码>