Maciek
Maciek

Reputation: 3234

Zend - external logout / ending other sessions

I'm writing an app using Zend Framework and I need to be able to logout users on demand. The app will receive a request containing some kind of ID's that are mapped to SessionIds and it will end/expire those sessions. I know how to do the mapping, but what then? How do I end a session having its ID?

I see that there is Zend_Session::setId(), but I don't think this does what I want to do.

I have an idea to just delete files that are associated with given session, since they are named sess_[sessionId], but I guess that is an ugly way to do it.

Upvotes: 0

Views: 963

Answers (2)

RockyFord
RockyFord

Reputation: 8519

Depending on the structure of your sessions and what exactly you are trying to clear, there are a number of ways to destroy, expire and unset Zend_Sessions. Please refer to http://framework.zend.com/manual/1.12/en/zend.session.html for further information.

If in the future you could provide more detail and perhaps a bit of code illustrating your issue I'm sure the community would be more then happy to provide a better answer.

Good Luck.

Upvotes: 0

hopsey
hopsey

Reputation: 1513

You can save session info to the database. It would be related by session id. Then create a plugin that checks if the DB row still exists. If not, then execute Zend_Auth::getInstance()->clearIdentity()

The method that logs the user out would delete the session from DB.

Upvotes: 2

Related Questions