HDIV:Spring MVC应用程序获取"未经授权的访问"错误

时间:2015-05-31 19:44:26

标签: java spring jsp spring-mvc hdiv

刚刚将HDIV spring MVC show case项目中的配置示例实现到我的Web应用程序中并配置了启动链接等,我可以在URL中看到HDIV状态参数。

我已经将index.jsp配置为以与show case项目中提到的相同方式重定向到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>

1 个答案:

答案 0 :(得分:0)

您似乎正在客户端生成cookie。结果,HDIV没有注意到它。我认为您正在使用Adobe® Marketing Cloud并且正在生成该Cookie。

尝试在Cookie中禁用完整性:

    <hdiv:config avoidCookiesIntegrity="true">

我希望它有所帮助。