Java Spring授权没有启动
我有下面的SpringSecurityXML文件,它具有身份验证和授权配置。这里的问题是身份验证工作正常,但授权没有启动,甚至没有检索角色。我之前也做过类似的工作,但没有遇到任何问题。唯一的区别是我当时用的是Spring3,现在用的是Spring4。我在这里遗漏了什么或者我做错了什么Java Spring授权没有启动,java,spring,spring-security,authorization,spring-security-rest,Java,Spring,Spring Security,Authorization,Spring Security Rest,我有下面的SpringSecurityXML文件,它具有身份验证和授权配置。这里的问题是身份验证工作正常,但授权没有启动,甚至没有检索角色。我之前也做过类似的工作,但没有遇到任何问题。唯一的区别是我当时用的是Spring3,现在用的是Spring4。我在这里遗漏了什么或者我做错了什么 <security:authentication-manager alias="preAuthManager"> <security:authentication-provider ref
<security:authentication-manager alias="preAuthManager">
<security:authentication-provider ref="preAuthProvider" />
</security:authentication-manager>
<bean id="preAuthProvider" class="org.springframework.security.web.authentication.preauth.PreAuthenticatedAuthenticationProvider">
<property name="preAuthenticatedUserDetailsService" ref="frfPreAuthUserDetailsService" />
</bean>
<bean id="frfPreAuthProcessingFilter" class="*.*.*.ws.infra.FRFPreAuthenticatedProcessingFilter">
<property name="authenticationManager" ref="preAuthManager" />
<property name="stripDomain" value="true" />
<property name="toLowerCase" value="true" />
</bean>
<bean id="preAuthEntryPoint" class="org.springframework.security.web.authentication.Http403ForbiddenEntryPoint" />
<bean id="frfPreAuthUserDetailsService" class="*.*.*.ws.infra.FRFPreAuthenticatedUserDeatilsService">
<!-- Configure the Role Service ... 1) InMemoryRoleRetriever 2) Arrow2RoleRetriver; This configuration is shown below...-->
<property name="roleService" ref="arrow2RoleServiceImpl" />
</bean>
<bean id="arrow2RoleServiceImpl" class="*.*.*.ws.arrowrest.ArrowRoleRetriever">
<constructor-arg index="0" value="${arrow.rest.endPoint}" />
<constructor-arg index="1" value="authorized-function-names" />
<constructor-arg>
<map>
<entry key="CallerName" value="${arrow.appName}"></entry>
<entry key="ApplicationName" value="${arrow.appName}"></entry>
</map>
</constructor-arg>
</bean>
<!-- <global-method-security pre-post-annotations="enabled"/> -->
<security:global-method-security secured-annotations="enabled"/>
<security:http pattern="/WEB-INF/jsp/access_denied.jsp" security="none"/>
<security:http pattern = "/app/*" create-session="never" use-expressions="false" auto-config="false" entry-point-ref="preAuthEntryPoint"
authentication-manager-ref="preAuthManager"
access-decision-manager-ref="accessDecisionManager"
xmlns="http://www.springframework.org/schema/security">
<security:custom-filter ref="frfPreAuthProcessingFilter" before="PRE_AUTH_FILTER" />
<security:intercept-url pattern="/app/3a4/rules" method="GET" access="ROLE_ADMIN"/>
</security:http>
<!-- Allows access if principal has the proper granted authority -->
<bean id="accessDecisionManager" class="org.springframework.security.access.vote.UnanimousBased" xmlns="http://www.springframework.org/schema/beans">
<constructor-arg>
<list>
<bean class="org.springframework.security.access.vote.RoleVoter" />
</list>
</constructor-arg>
<property name="allowIfAllAbstainDecisions" value="false" />
</bean>
您所说的授权尚未启动是什么意思?任何回复,任何错误,任何日志?你调用什么URL?身份验证完成后,我希望“accessDecisionManager”应该启动并对照用户角色检查角色以做出决定。没有发生这种情况,请求成功,没有错误,但没有进行授权。我正在调用*/app/3a4/rules此方法。将日志安全级别更改为调试,您就可以找到问题所在。因为只有安全配置不足以理解和帮助问题。@Raj_Mad9您没有保护URL/app/3a4/rules
。您只保护/app/rules
。因此,所有用户都可以访问/app/3a4/rules
@dur,这是一个复制粘贴错误。我已经保护了/app/3a4/规则。这里的问题是授权甚至没有启动,这意味着没有根据访问角色检查AOLE(在身份验证之后,访问决策管理器甚至没有进入画面)