繁体   English   中英

如何使用struts1.2限制浏览器中任何链接从URL的直接访问

[英]how to restrict direct access from url with any link in browser using struts1.2

嗨,在这种情况下,朋友们出于安全目的,我必须限制从url链接的直接访问,我需要相同的代码来执行此过程,任何人都可以帮助我。 在此过程中,将涉及两个用户(管理员和用户)。

我试过了 但不起作用

<security-role><role-name>admin</role-name></security-role>
<security-role><role-name>user</role-name></security-role>

<security-constraint>
<web-resource-collection>
<web-resource-name>Admin</web-resource-name>
<url-pattern>/jsp/*</url-pattern>  
<http-method>GET</http-method>
<http-method>POST</http-method>
</web-resource-collection>
<auth-constraint>
<role-name>admin</role-name>
</auth-constraint>
</security-constraint>
<security-constraint>
<web-resource-collection>
<web-resource-name>User</web-resource-name>
<url-pattern>/jsp/*</url-pattern>  
<http-method>GET</http-method>
<http-method>POST</http-method>
</web-resource-collection>
<auth-constraint>
<role-name>user</role-name>
</auth-constraint>
</security-constraint>

我想请求处理器可能会帮助您。 动作servlet在每个请求上都调用此方法。 覆盖此内容并自行验证网址可能会有所帮助。

http://struts.apache.org/release/1.2.x/userGuide/building_controller.html#request_processor http://wiki.apache.org/struts/RequestProcessor

看看这是否符合您的要求。

暂无
暂无

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

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