Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is session invalidation?

Tags:

servlets

Session invalidation means session destroying.So if session is destroyed,it indicates that server cant identify the client which has visited in previous.So now it creates a new session id for that client.

Is this right?If wrong tell me the correct procedure.

like image 252
user1286481 Avatar asked Oct 12 '25 08:10

user1286481


2 Answers

Calling HttpSession.invalidate() simply clears any object that is bound to it and marks it as invalid, so if you try to modify it afterward it will throw exceptions.

Once a session has been invalidated, the SessionID placed in a cookie on the client will be invalid too, and a new one will have to be created when a new session object is created. So the new Session will have a new ID.

This is usefull to handle for example login/logout. Sessions should always be invalidated at login to help prevent Session fixation attacks

like image 155
Jf Beaulac Avatar answered Oct 16 '25 07:10

Jf Beaulac


Yes, absolutely right. Invalidating a session will mark the session as invalid and will be destroyed. If the client comes with the session id which has been invalidated a new session will be created.

like image 30
Ramesh PVK Avatar answered Oct 16 '25 08:10

Ramesh PVK