I have a login and a user info page which is displayed after login. How can I block user info page from direct access by user? How can I implement that with session?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
At login time, put the found
Userobject in the session.Then implement a
Filterwhich just checks the presence of the logged-in user in the session.Map this filter on an URL pattern of
/secured/*(or anything else whatever you want) and put the secured pages like the user info page in the same folder.To logout a user, just do
session.removeAttribute("user")or, more drastically,session.invalidate().