i am implementing IntranetMailServer using struts and i need to store the username in session to use it in future for fetching mails etc. but the problem is that from login page the request directly goes to the LoginAction class which is extended from the ActionSupport class so tell me where i do set the Attribute in session......... and also i need to track the session so noone can directlyy reach to the inbox without having login so how to achieve it as i tried it with
when i send the request 1st time it redirects me to the login.jsp with the particular message but when i again send the request it opens welcome.jsp please resolve it as i don't want user to go into inbox without having to login
You'd actually be a lot safer if instead of writing your own security system, you used the one that's part of the J2EE standard. I've never seen a DIY security system that was truly secure (most of them are VERY insecure). And you wouldn't have to store the userID anywhere, because it would be available from the HttpServletRequest getRemoteUser() and getUserPrincipal() methods.
Plus, your goal of guarding against people simply walking around the login URL (one of the most common ways to exploit DIY systems) is taken care of automatically by the server. You set the access controls in web.xml based on the incoming URL pattern match. If someone attempts to submit a protected URL, the server itself forces a login and they cannot exploit your code, because the server won't send the URL on to your app until they've logged in.
An IDE is no substitute for an Intelligent Developer.
Joined: Jun 18, 2013
Tim thanks for such a wonderfull explaination will you please also give me the example what you have explained above i mean that web.xml