刚刚将 HDIV spring MVC 展示案例项目中的配置示例实现到我的 Web 应用程序中并配置了启动链接等,我可以在 URL 中看到 HDIV 状态参数。
我已将 index.jsp 配置为以与展示案例项目中提到的相同方式重定向到 welcome.html 页面,并且它可以工作。
问题是,如果我刷新welcome.html 页面,我得到一个错误“未经授权的访问”,或者如果我第二次从welcome.html 页面访问任何链接,它会抛出同样的错误。从日志中我可以看到 -
015-05-31 12:53:02,131 org.hdiv.logs.Logger - INVALID_COOKIE;/welcome.htm;cookie:AMCV_5C21123F5245AF0C0A490D45%40AdobeOrg;-2017484664%7CMCMID%7C04001757167802827442558962327640098514%7CMCAAMLH-1433633264%7C9%7CMCAAMB-1433633264%7CNRX38WO0n5BH8Th-nqAG_A%7CMCAID%7CNONE;;0:0:0:0:0:0:0:1;0:0:0:0:0:0:0:1;anonymous;
我必须以浏览器的隐身模式再次打开该页面才能访问它,这将再次在第二次尝试或刷新浏览器时引发错误。
我的示例配置 -
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:hdiv="http://www.hdiv.org/schema/hdiv"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.hdiv.org/schema/hdiv http://www.hdiv.org/schema/hdiv/hdiv.xsd">
<hdiv:config excludedExtensions="css,png,gif,jpeg,jpg,js,ico">
<hdiv:sessionExpired loginPage="/login.htm" homePage="/"/>
<!-- <hdiv:startPages>/attacks/.*</hdiv:startPages> -->
<hdiv:startPages method="get">/,/login.htm,/logout.htm</hdiv:startPages>
<hdiv:startPages method="post">/j_spring_security_check</hdiv:startPages>
<hdiv:startParameters>_csrf</hdiv:startParameters>
</hdiv:config>
<!-- Accepted pattern within the application for all editable parameters (generated from textbox and textarea) -->
<hdiv:validation id="safeText">
<hdiv:acceptedPattern><![CDATA[^[a-zA-Z0-9@.\-_]*$]]></hdiv:acceptedPattern>
</hdiv:validation>
<!-- Finally, it's necessary to define editable data validation list for
the application -->
<hdiv:editableValidations>
<!-- <hdiv:validationRule url="/secure/.*"></hdiv:validationRule> -->
<!-- Finally, it's necessary to define editable data validation list for
the application -->
<hdiv:validationRule url="/oe/.*"></hdiv:validationRule>
<hdiv:validationRule url="/safetext/.*" enableDefaults="false">safeText</hdiv:validationRule>
</hdiv:editableValidations>
</beans>