如何在弹簧安全中外部化url

时间:2014-04-09 10:20:39

标签: spring spring-security

我有一个弹簧安全文件,我的配置如下。

<security:session-management
            invalid-session-url="/login.jsp">
            <security:concurrency-control
                max-sessions="1" />
    </security:session-management>

我想要将invalid-session-url的值外部化。 我已配置xyz.properties个文件。 当我使用占位符作为invalid-session-url =&#34; $ {login.url}&#34;时,它抛出异常

    Caused by: java.lang.IllegalArgumentException: url must start with '/' or with 'http(s)'
    at org.springframework.util.Assert.isTrue(Assert.java:65) ~[spring-core-3.1.1.RELEASE.jar:3.1.1.RELEASE]
    at org.springframework.security.web.session.SimpleRedirectInvalidSessionStrategy.<init>(SimpleRedirectInvalidSessionStrategy.java:26) ~[spring-security-web-3.1.1.RELEASE.jar:3.1.1.RELEASE]
    at org.springframework.security.config.http.HttpConfigurationBuilder.createSessionManagementFilters(HttpConfigurationBuilder.java:277) ~[spring-security-config-3.1.1.RELEASE.jar:3.1.1.RELEASE]
    at org.springframework.security.config.http.HttpConfigurationBuilder.<init>(HttpConfigurationBuilder.java:128) ~[spring-security-config-3.1.1.RELEASE.jar:3.1.1.RELEASE]
    at org.springframework.security.config.http.HttpSecurityBeanDefinitionParser.createFilterChain(HttpSecurityBeanDefinitionParser.java:119) ~[spring-security-config-3.1.1.RELEASE.jar:3.1.1.RELEASE]
    at org.springframework.security.config.http.HttpSecurityBeanDefinitionParser.parse(HttpSecurityBeanDefinitionParser.java:83) ~[spring-security-config-3.1.1.RELEASE.jar:3.1.1.RELEASE]
    at org.springframework.security.config.SecurityNamespaceHandler.parse(SecurityNamespaceHandler.java:90) ~[spring-security-config-3.1.1.RELEASE.jar:3.1.1.RELEASE]
    at org.springframework.beans.factory.xml.BeanDefinitionParserDelegate.parseCustomElement(BeanDefinitionParserDelegate.java:1419) ~[spring-beans-3.1.1.RELEASE.jar:3.1.1.RELEASE]
    at org.springframework.beans.factory.xml.BeanDefinitionParserDelegate.parseCustomElement(BeanDefinitionParserDelegate.java:1409) ~[spring-beans-3.1.1.RELEASE.jar:3.1.1.RELEASE]
    at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.parseBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:184) ~[spring-beans-3.1.1.RELEASE.jar:3.1.1.RELEASE]
    at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.doRegisterBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:140) ~[spring-beans-3.1.1.RELEASE.jar:3.1.1.RELEASE]
    at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.registerBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:111) ~[spring-beans-3.1.1.RELEASE.jar:3.1.1.RELEASE]
    at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.registerBeanDefinitions(XmlBeanDefinitionReader.java:493) ~[spring-beans-3.1.1.RELEASE.jar:3.1.1.RELEASE]
    at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:390) ~[spring-beans-3.1.1.RELEASE.jar:3.1.1.RELEASE]

0 个答案:

没有答案