Announcement Announcement Module
Collapse
No announcement yet.
intermittent error: "An Authentication object was not found in the SecurityContext" Page Title Module
Move Remove Collapse
This topic is closed
X
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • intermittent error: "An Authentication object was not found in the SecurityContext"

    I get this error "An Authentication object was not found in the SecurityContext".

    I am logging in using BlazeDS with Spring integration and trying to leverage the Spring Security Framework, but no luck :-(

    My security-config.xml looks like:

    Code:
    <?xml version="1.0" encoding="UTF-8"?>
    <beans:beans xmlns="http://www.springframework.org/schema/security"
    	xmlns:beans="http://www.springframework.org/schema/beans" 
    	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    	xsi:schemaLocation="http://www.springframework.org/schema/beans 
    						http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
                            http://www.springframework.org/schema/security 
                            http://www.springframework.org/schema/security/spring-security-2.0.4.xsd">
    
    	<beans:bean id="userDetailsService" class="org.springframework.security.userdetails.jdbc.JdbcDaoImpl">
      		<beans:property name="dataSource" ref="dataSource"/>
    	</beans:bean>
    
    	<http entry-point-ref="preAuthenticatedEntryPoint" session-fixation-protection="newSession" />
        
        <beans:bean id="preAuthenticatedEntryPoint" class="org.springframework.security.ui.preauth.PreAuthenticatedProcessingFilterEntryPoint" />
    
    	<beans:bean id="preauthAuthProvider"
    		class="org.springframework.security.providers.preauth.PreAuthenticatedAuthenticationProvider">
    		<beans:property name="preAuthenticatedUserDetailsService">
    			<beans:bean id="userDetailsServiceWrapper"
    				class="org.springframework.security.userdetails.UserDetailsByNameServiceWrapper">
    				<beans:property name="userDetailsService"
    					ref="userDetailsService" />
    			</beans:bean>
    		</beans:property>
    	</beans:bean>
    
    	<beans:bean id="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource">
    	  <beans:property name="driverClassName" value="com.mysql.jdbc.Driver"/>
    	  <beans:property name="url" value="jdbc:mysql://localhost/consultant_db"/>
    	  <beans:property name="username" value="XXXXXXX"/>
    	  <beans:property name="password" value="XXXXXXX"/>
    	</beans:bean>
    	
    	<authentication-provider>
    		<jdbc-user-service data-source-ref="dataSource" />
    	</authentication-provider>
    </beans:beans>
    And my application-config.xml:

    Code:
    <?xml version="1.0" encoding="UTF-8"?>
    <beans xmlns="http://www.springframework.org/schema/beans"
    		xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
    		xmlns:flex="http://www.springframework.org/schema/flex" 
    		xmlns:security="http://www.springframework.org/schema/security"
    		xsi:schemaLocation="http://www.springframework.org/schema/beans 
    			http://www.springframework.org/schema/beans/spring-beans-2.5.xsd 
    			http://www.springframework.org/schema/flex 
    			http://www.springframework.org/schema/flex/spring-flex-1.0.xsd
    			http://www.springframework.org/schema/security
    			http://www.springframework.org/schema/security/spring-security-2.0.4.xsd">
    			
    	<!-- Simplest possible message broker -->
    	<flex:message-broker>
    		<flex:secured />
    	</flex:message-broker>
    
    	<!-- Spring Beansís --> 
    	<bean id="myService" class="MyServiceImpl">
    		<flex:remoting-destination/>
    		<security:intercept-methods>
    			<security:protect method="getMyEntities" access="ROLE_USER" />
    		</security:intercept-methods>
    	</bean>
    </beans>
    In the FAQ for spring (http://static.springsource.org/sprin...ials-not-found) I read that this error can be ignored, or possibly fixed using AnonymousProcessingFilter, but how?

    I cannot login when I get this error, no matter how many times I try it always gives this error - but only once it has been thrown once. Sometimes it works after a little while of inactivity?
Working...
X