大家好,我们正在尝试为我们的Web应用程序实现一些功能,我们正在使用Spring Framework v4.1.1和Spring Security v3.1.7进行Web应用程序.我们正在使用自定义身份验证提供程序进行身份验证过程,一切正常,但是当我们尝试使用Spring Security中的JSP标记隐藏页面中特定角色的某些内容时,它不起作用.
这是我们的security-conf.xml
<http pattern="/resources/**" security="none" />
<http use-expressions="true">
<form-login login-page="/login" authentication-failure-url="/loginerroneo"
default-target-url="/seleccionar-empresa" always-use-default-target="true"/>
<logout logout-success-url="/login" logout-url="/salir"/>
<session-management invalid-session-url="/login" />
</http>
<authentication-manager>
<authentication-provider user-service-ref="userDetailsService">
</authentication-provider>
</authentication-manager>
<global-method-security pre-post-annotations="enabled"/>
<beans:bean id="userDetailsService" class="com.grupo.seguridad.acceso.service.impl.UserDetailsServiceAdapater"/>
Run Code Online (Sandbox Code Playgroud)
当我们<sec:authentication property="principal.authorities"/> 在页面中使用此标记时,我们得到了[VENDEDOR,ADMINISTRADOR]这是正确的.
但是当我们尝试使用标记隐藏页面的某些内容时:
<sec:authorize access="hasRole('ADMINISTRADOR')">
<button class="btn btn-small btnGuardar" href="#dlgGuardar" data-toggle="modal">
<i class="icon-hdd"></i> <strong>Una Opcion</strong>
</button>
</sec:authorize>
Run Code Online (Sandbox Code Playgroud)
这是行不通的.
我们不知道我们做错了什么.谢谢你的帮助,最诚挚的问候,