簡體   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