I have implemented Spring Security 4.0.1 with database authentication and ldap authentication successfully. All configurations have been made via Java config.
In order to enable Spring Security to cache users for our REST API, especially when ldap authentication is used, I want to configure Spring Security to use the already configured EhCache.
Now to the main problem. I saw the capability of the XML configuration to tell the framework to actually use a cache with cache-ref="userCache"
, like the following:
<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>
Now I am asking how is it possible to configure the cache-ref
with Java config? I tried to find a setter for this one in the corresponding Java classes, but I couldn't find anything.
Would be great if someone could help me.
Thanks!