【问题标题】:HDIV: Spring MVC application getting "Unauthorized access" errorHDIV:Spring MVC 应用程序出现“未经授权的访问”错误
【发布时间】:2015-06-01 16:19:33
【问题描述】:

刚刚将 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>

【问题讨论】:

    标签: java spring jsp spring-mvc hdiv


    【解决方案1】:

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

    尝试在 cookie 中禁用完整性:

        <hdiv:config avoidCookiesIntegrity="true">
    

    希望对你有帮助。

    【讨论】:

    • 感谢 Fernando 的建议,但它没有帮助,相反,现在我什至无法通过未经授权的访问进入我的起始页面,因为它找不到 HDIV 参数。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2022-11-09
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2023-03-05
    相关资源
    最近更新 更多