有 Java 编程相关的问题?

你可以在下面搜索框中键入要查询的问题!

JavaHDIV:SpringMVC应用程序获取“未授权访问”错误

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

我已经配置了索引。jsp重定向到欢迎页面。html页面以与show case项目中提到的相同的方式工作

问题是我是否刷新了欢迎页面。html页面我得到一个错误“未经授权的访问”,或者如果我访问任何来自欢迎的链接。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) 个答案

  1. # 1 楼答案

    看起来您正在客户端生成cookie。因此,HDIV没有注意到这一点。我认为您正在使用Adobe® Marketing Cloud,它正在生成cookie

    尝试禁用Cookie中的完整性:

        <hdiv:config avoidCookiesIntegrity="true">
    

    我希望有帮助