You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When using the XML namespace to configure a user-service it was pretty easy to make it a caching one by adding a reference using the cache-ref attribute and point it to a UserCache implementation.
With Java based configuration this option is only available for the jdbcAuthentication and not for a plain UserDetailsService or LdapUserDetailsService.
It would be nice if it was possible to specify a userCache for each option available and that that would wrap the UserDetailsService in a CachingUserDetailsService when needed.
It looks to me like CachingUserDetailService is not intended for direct usage given the non-public constructor. I think the intent for caching is that we set a cache on a AbstractUserDetailsAuthenticationProvider. I believe the approach for java config would be for there to be a userCache method added to AbstractDaoAuthenticationConfigurer so that we can do:
This has not been implemented. We would welcome a PR for this.
I'd suggest that we move CachingUserDetailsService to org.springframework.security.core.userdetails in spring-security-core. Then make the constructor public.
User's can then construct CachingUserDetailsService directly.
Would you be interested in submitting a PR for this?
Made CachingUserDetailsService constructor public and moved to spring-core to make it easier to configure caching in UserDetailsService
Fixesspring-projectsgh-4139
When using the XML namespace to configure a
user-service
it was pretty easy to make it a caching one by adding a reference using thecache-ref
attribute and point it to aUserCache
implementation.With Java based configuration this option is only available for the
jdbcAuthentication
and not for a plainUserDetailsService
orLdapUserDetailsService
.It would be nice if it was possible to specify a
userCache
for each option available and that that would wrap theUserDetailsService
in aCachingUserDetailsService
when needed.Related: #2837
Stackoverflow: http://stackoverflow.com/questions/40766098/springcachebasedusercache-is-null/40782952?noredirect=1#comment68816495_40782952
The text was updated successfully, but these errors were encountered: