Sorry for the late response, but I got it working somehow (actually I understood how, but I'm not happy with the current implementation).
Basically what I have is an AccountServlet that performs the login (checks email/passwd combo etc). After validation, the Account is stored in servlet session. The original question was, how to approach user management for multiple servlets?
In a secondary servlet, I need the authentified user. Even more, I define a RemoteService that gets implemented in both the servlet and a delegate (much more useful for junit testing). How should I efficiently work with the Account in the implementation?
interface ISearchService {
Object doSearch (String query);
}
SearchServlet {
ISearchService impl = new SearchServiceImpl (); // parameterless constructor (DI).
public Object doSearch (String query) {
return impl.doSearch (query);
}
}
Assume the SearchServiceImpl requires the authentified account. I can successfully fetch it in Servlet. How do I serve it to the impl?
Thanks