| Joomla!: Pass Session Data to a Wrapper |
|
|
|
| Development - Joomla |
| Written by Rick |
| Monday, 23 February 2009 00:00 |
|
This information requires Joomla (1.5.x series) Global Configuration/System/Session Handler to be set to "database" and plugin "includePHP installed for the following information to be valid. Current and active user sessions are stored in a cookie on the user local drive. The cookies are domain related (i.e.; when you lookup a cookie on your local system it's stored by the site name then cookie name). The following functions provide access to the Joomla cookie created during log-in;
The variables can be passed to external applications via php's setcookie() function that can be retrieved inside a Joomla wrapper for authentication purposes. Cookie generation with php is as follows;
Note: Creating cookies with PHP is problematic. See http://microswamp.com/development/java/117-javascript-cookies to handle cookies with javascript. Once session data is captured in the wrapper, the session_id() can be used to lookup the user in the Joomla table jos_session to verify the user is still logged into the system and the session has not been terminated by log-off or time-out. Further jos_session stores the user ID. Retrieving the user ID allows additional lookup and manipulation of the table jos_users. Information retrieved from jos_users can be used for additional security restriction based on user name, user type or group id. While not exactly within the Joomla core, this logic can provide granular ACR to wrapper applications. The following code can be used to retrieve the stored cookie data;
If you are logged-in you can see a sample of the output for you session below;
|





