Hi,
I have a persisted User object.
I would like to be able to make each Hibernate session have a default "User". My idea is that in my view, one the user authenticates, I will assign the Session to a particular User and every operation henceforth will be within that user's context. The session will be created with a default "UnAuthenticated" user, so that if no user has authenticated yet, then all operations will be performed in a unauthenticated context.
I realize there are additional frameworks that can get me better authentication, but can I get home-grown authentication working this way?
What design patterns are there for doing this?
With regards,
John
|