Results 1 to 3 of 3

Thread: Custom Authentication manager and EhcacheBaseduser

  1. #1
    Join Date
    Mar 2006
    Posts
    7

    Default 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. #2
    Join Date
    Aug 2004
    Posts
    2,715

    Default

    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

  3. #3
    Join Date
    Mar 2006
    Posts
    7

    Default

    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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •