【发布时间】:2018-03-09 16:47:18
【问题描述】:
我对 Spring Security 非常陌生。我想在当前安全机制之上实现基本身份验证。我在 security-context.xml 中创建了如下配置。
<http auto-config="true" use-expressions="true" pattern="/test/info/**">
<intercept-url pattern="/**" access="hasRole('ROLE_USER')" />
</http>
<authentication-manager id="basicAuthentication">
<authentication-provider>
<user-service>
<user name="user1" password="user1Pass" authorities="ROLE_USER" />
</user-service>
</authentication-provider>
</authentication-manager>
如果我没有任何其他安全配置,它可以正常工作。但是如果我添加以下配置,我上面提到的配置将被覆盖。它还调用类 com.aws.web.service.AwsUserDetailsService。
<authentication-manager id="authMgr">
<authentication-provider user-service-ref="**userDetailsService**">
</authentication-provider>
</authentication-manager>
谁能告诉我如何解决这个问题?
【问题讨论】:
-
您正在覆盖先前声明的身份验证提供程序并在
**userDetailsService**"中使用wildchar 将获取它将在类路径中找到的第一个类