我已成功实现了Spring Security 4.0.1数据库身份验证和ldap身份验证。所有配置都是通过Java配置完成的。
为了使Spring Security能够为我们的REST API缓存用户,特别是在使用ldap身份验证时,我想配置Spring Security以使用已配置的EhCache。
现在到了主要问题。我看到XML配置的功能告诉框架实际使用cache-ref="userCache"
的缓存,如下所示:
<authentication-manager>
<authentication-provider>
...
<ldap-user-service server-ref="ldapServer"
user-search-filter="uid={0}" user-search-base="ou=people"
group-search-filter="member={0}" group-search-base="ou=groups"
cache-ref="userCache" />
</authentication-provider>
</authentication-manager>
现在我想问如何用Java配置配置cache-ref
?我试图在相应的Java类中为这个找到一个setter,但是我找不到任何东西。
如果有人可以帮助我会很棒。
谢谢!