Announcement Announcement Module
Collapse
No announcement yet.
Custom Authentication manager and EhcacheBaseduser Page Title Module
Move Remove Collapse
This topic is closed
X
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Custom Authentication manager and EhcacheBaseduser

    Hi All,

    I am having an issue where I keep getting cache misses. I checked my cachestore and it looks like its never being populated with any users. I can't really see where the problem lies as I have followed the examples closely, the only thing that I have different is that I am using a custom AuthenticationProvider.

    In my custom provider I have added a EhCacheBasedUserCache userCache object and added a getter and setter for it.

    If anyone can provide some direction that would be great.
    Thanks,
    Abu

    My application-Context is as follows:

    Code:
    <bean id="userCache"
    		class="org.acegisecurity.providers.dao.cache.EhCacheBasedUserCache">
    		<property name="cache">
    			<ref local="userCacheBackend" />
    		</property>
    	</bean>
    
    
    	<bean id="cacheManager"
    		class="org.springframework.cache.ehcache.EhCacheManagerFactoryBean">
    		<property name="configLocation">
    			<value>classpath:/ehcache.xml</value>
    		</property>
    	</bean>
    
    	<bean id="userCacheBackend"
    		class="org.springframework.cache.ehcache.EhCacheFactoryBean">
    		<property name="cacheManager">
    			<ref local="cacheManager" />
    		</property>
    		<property name="cacheName">
    			<value>eisMiddleTierCache</value>
    		</property>
    	</bean>
    
    
    	<bean id="authenticationManager"
    		class="org.acegisecurity.providers.ProviderManager">
    		<property name="providers">
    			<list>
    				<ref bean="janusAuthenticationProvider" />
    			</list>
    		</property>
    	</bean>
    
    	<bean id="janusAuthenticationProvider"
    		class="com.jpmorgan.eis.security.manager.JanusAuthenticationManager">
    		<property name="userCache">
    			<ref bean="userCache" />
    		</property>
    	</bean>
    My ehcache.xml is as follows:

    Code:
      <cache name="eisMiddleTierCache"
            maxElementsInMemory="5000"
            eternal="false"
            overflowToDisk="false"
            timeToIdleSeconds="3600"
            timeToLiveSeconds="1800"
            />

  • #2
    Does your authentication provider class extend AbstractUserDetailsAuthenticationProvider?

    If yes, you should not add an additional userCache property, as the abstract class already provides it. If you do not extend this class, maybe have a look at the sources and see how the cache is used there to find the differences to your code.

    Regards,
    Andreas

    Comment


    • #3
      I'm not extending the AbstractUserDetailsAuthenticationProvider, but implementing the authenticationprovider interface. It was a good hint to look at the code for the AbstractUserDetailsAuthenticationProvider, as I noticed the cache management is all done in there.

      I manged to solve my issues from there.

      Thanks for your reply.

      Cheers.
      Abu

      Comment

      Working...
      X