[fusion-dev] authenticate user within fusion

Paul Spencer pspencer at dmsolutions.ca
Thu Sep 11 08:21:43 EDT 2008


Hi Rémy,

you shouldn't need to create a new session id, you can associate new  
credentials with the existing session id.

We already do something like this in fusion/MapGuide/php/Common.php  
around line 93, if you pass a new username and password as GET or POST  
parameters to anything that includes Common.php it will authenticate  
as the new user and associate the current session id with the new user:

if (isset($_REQUEST['username']) && isset($_REQUEST['password'])) {
     $user = new MgUserInformation($_REQUEST['username'],  
$_REQUEST['password']);
     $user->SetClientIp(GetClientIp());
     $user->SetClientAgent(GetClientAgent());
     $user->SetMgSessionId($sessionID);
}

If you change the session ID, then the current state of the user's  
session will be discarded and quite a few things will be out of sync  
between the client and the server, although it may still work okay  
(selection would be lost I think, but that is not a huge deal).  The  
session id is managed through the Fusion.Map.MapGuide object, and all  
widgets should be getting the session id from there.  To update it in  
place, you would need to do something like:

//this is a bit weird, the mapguide map object is probably the first  
(and only)
//layer in the OpenLayers stack but we have to get at it this way now
var mgMap = this.getMap().getAllMaps()[0];
//we store the session id in an array because the array is actually  
shared by
//all Fusion.Map.MapGuide instances - a class variable if you like.
mgMap.session[0] = newSessionId;

Cheers

Paul

On 11-Sep-08, at 3:24 AM, web wrote:

> Hi all,
> I've almost done an Athentication widget. I would like to know how  
> should I "reinitialize" fusion with the new sessionId?
> -User enters in smooth jx box username, password.
> -AjaxRequest for creating a new session.
> -??? Tell Fusion the new session ID ??? how should I do that?
>
> I've tried to change session via php redirection with something like  
> this:
> ..template/slate/index.html? 
> ApplicationDefinition=...&SESSION=[myNewSessionID]
>
> It goes but it's quite ugly to change session via url.
>
> I wanted to ask if it's possible to change session via the Fusion  
> Api? Does someone knows something about how it could be accomplished?
>
> Thanks in advance,
>
> Rémy
>
> _______________________________________________
> fusion-dev mailing list
> fusion-dev at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/fusion-dev


__________________________________________

    Paul Spencer
    Chief Technology Officer
    DM Solutions Group Inc
    http://www.dmsolutions.ca/



More information about the fusion-dev mailing list