如何在intercept-url标记内引用spring bean属性以确保Spring安全?

时间:2019-02-15 19:27:18

标签: spring spring-security javabeans access intercept

我目前正在尝试引用我在XML文件内创建的spring bean,该文件用于访问控制标签中的spring-security应用程序。这是我的代码。

<bean id="devbox-freeipa-zone" class="com.stratahealth.pathways.connect.logon.beans.TargetedAuthorizationZone">
    <property name="name" value="${logon.freeipa.zone.name}" />
    <property name="target" ref="devbox-gateway-target" />

    <property name="roles" value="role1,role2" />

</bean>


<!-- Security Manager -->
<security:http pattern="/${logon.freeipa.zone.name}.zone/**"
               use-expressions="true"
               access-decision-manager-ref="devbox-freeipa-decision-manager"
               auto-config="true" authentication-manager-ref="devbox-freeipa-zone-authenticationManager">

    <!--
        Use the following to determine which roles are required for the specified LDAP zone. Configure the following property
        ${logon.ZONENAME.roles.list} either as a singular role or comma separated values.
    -->
    <security:intercept-url pattern="/**" access="isAuthenticated() and @zoneAuthenticationService.authenticationhasRoles(authentication, devbox-freeipa-zone.roles)" />

    <security:form-login login-page="/Interactive/UsernamePasswordAuth.xhtml?zone=${logon.freeipa.zone.name}"
                         login-processing-url="/${logon.freeipa.zone.name}.zone/j_spring_security_check"
                         authentication-failure-url="/Interactive/LdapFailure.xhtml"
                         default-target-url="/${logon.freeipa.zone.name}.zone/api/app/postLogin" />
    <security:http-basic />
    <security:access-denied-handler ref="devbox-freeipa-access-denied-handler"/>

</security:http>

我要开始工作的是在我的spring安全配置的拦截URL标记内引用“ devbox-freeipa-zone.roles” bean。但是任何时候我尝试我的应用程序都不会抛出任何异常/错误。我刚收到404。

有人可以帮我吗?

0 个答案:

没有答案