65162

Zend - external logout / ending other sessions

Question:

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.

Answer1:

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.

Answer2:

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 <a href="http://framework.zend.com/manual/1.12/en/zend.session.html" rel="nofollow">http://framework.zend.com/manual/1.12/en/zend.session.html</a> 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.

Recommend

  • Tensorflow: Custom operation used in two networks simultaneously produces nan
  • Send CTRL_C/SIGINT to a process from C#
  • InProc session data disapearing
  • Sending commands to stdin and sending end of transmit (Ctrl+D)
  • converting curl call to python requests
  • How does NodeAPI in Google Play Services work?
  • sscanf: get first and last token in a string
  • Code to disable magnifier, set wallpaper, and save image in Google Chrome?
  • Is there ever a reason to use is versus as? [duplicate]
  • How to show different validation messages for email validation in Angular2 using Validators class?
  • check if numbers have the same sign
  • How do I unit test for machine specific behaviour?
  • HSQL + Hibernate Exception: Wrong column type: Found: double, expected: float
  • PHP & cURL proxy - how to make multi-user cookie jar?
  • NodeJS - Disable JSONP on specific routes
  • Check all commands exit code within a bash script
  • How to count amount of elements in a row of a matrix in C
  • XSLT foreach repeating nodes to flat
  • C#: Import/Export Settings into/from a File
  • netsh acl setting (need alternative method - registry settings?)
  • Does Apple allow the usage of sysctl.h within iOS applications?
  • how to set variables in a php include file?
  • CERN ROOT exporting data to plain text
  • How can I set a binding to a Combox in a UserControl?
  • Django simple Captcha “No module named fields” error
  • How to add git credentials to the build so it would be able to be used within a shell code?
  • AJAX Html Editor Extender upload image appearing blank
  • Why does access(2) check for real and not effective UID?
  • Recording logins for password protected directories
  • Getting last autonumber in access
  • C# - Serializing and deserializing static member
  • Java applet as stand-alone Windows application?
  • In LanguageTool, how do you create a dictionary and use it for spell checking?
  • Delete MySQLi record without showing the id in the URL
  • GridView Sorting works once only
  • How do I rollback to a specific git commit
  • Is there a mandatory requirement to switch app.yaml?
  • Error creating VM instance in Google Compute Engine
  • Exception on Android 4.0 `android.os.StrictMode$AndroidBlockGuardPolicy.onNetwork(StrictMode)`
  • Busy indicator not showing up in wpf window [duplicate]