Hi All,
Hopefully someone can help me, or at least point me in the right direction. I have been working on this issue for 2 days now and have reached the point where I have no hair left to tear out.
My Setup:
Spring 3, using annotations.
Spring web mvc module using spring security
Hibernate persistence layer (perhaps not important to the issue being discussed)
My goal is to have a session scoped bean "UserProperties" that contains some information about the user currently logged into the system.
I have successfully created the session scoped bean.
@Scope("session")
@Named("userProperties")
public class UserProperties implements Serializable {
... bean properties
}
Using the following in the root context components of my webapp.
<bean id="userProperties" class="com.concord.security.UserProperties" scope="session">
<!-- This requires CGLIB -->
<aop:scoped-proxy/>
</bean>
I have a service "userPropertiesService" that I have setup to access the above bean.
I have a Manager class "SecurityManager" that i have autowired the "userPropertiesService" into in order to access the "UserProperties" bean from the session.
I have created a custom CustomSavedRequestAwareAuthenticationSuccessHandle r that extends the spring security SavedRequestAwareAuthenticationSuccessHandler. I have overridden the onAuthenticationSuccess method and Autowired the "SecurityManager" into it. I use the "SecurityManager" to call the "userPropertiesService" to get the bean from the session. Up to this point everything appears to work correctly. The Bean properties are changed and populated with data extracted from the hibernate layer based on the user who has logged in.
My problem comes when I try and access the bean in a controller. It tells me (everytime) that the bean is null. In order to access the bean I have Autowired in the "userPropertiesService" mentioned above, and called the "userPropertiesService.getUserProperties()" method (this is the same way i accessed the bean in the "CustomSavedRequestAwareAuthenticationSuccessHandl er").
From what I can see through my debug output. It appears that although the bean properties are changed through the CustomSavedRequestAwareAuthenticationSuccessHandle r, they are not persisted at this point in the session and that is why I cannot access them in the controller.
There is something else to note at this point. When I try and access the UserProperties from the controller they do not come back empty, they come back null, even though the UserProperties bean is instantiated during startup.
Perhaps I am doing something completely wrong, but I based my code on code in the link: http://wheelersoftware.com/articles/...ped-beans.html (its only 2 pages)
Thanks for your help (and taking the time to read this long issue)


Reply With Quote
((
