[fusion-users] RE: Auto-authenticate when using Fusion Viewer

Praveen Rajendra Babu prbabu at openspatial.com.au
Wed Jan 7 17:54:12 EST 2009

Thanks Chris! Works sweet and fine!  Can you please let me know which section of the code is bringing up the user authentication prompt
on the browser.  The "fusion\MapGuide\php\Common.php" does n't seem to do so, atleast to my understanding.

Thanks again.


From: Chris Claydon [mailto:chris.claydon at autodesk.com]
Sent: Thursday, 8 January 2009 3:44 AM
To: Praveen Rajendra Babu; fusion-users at lists.osgeo.org
Subject: RE: Auto-authenticate when using Fusion Viewer

Ideally, the Fusion code would be updated to allow you to specify USERNAME and PASSWORD the same way that the AJAX Viewer does. Until that happens, there is a workaround...

Fusion allows you to authenticate with a session ID. Here's a simple php script that creates a session using the 'Anonymous' user and re-directs to the template of your choice...

    $fusionMGpath = './MapGuide/php/';
    include $fusionMGpath . 'Common.php';

    $locale = GetDefaultLocale();
    $appdef = "";
    $template = "";
    $session = $siteConnection->GetSite()->CreateSession();


    $viewerSrc = 'templates/mapguide/' . $template . '/index.html';
    $viewerSrc = $viewerSrc . '?APPLICATIONDEFINITION=' . $appdef;
    $viewerSrc = $viewerSrc . '&SESSION=' . $session;

    header( 'Location: ' . $viewerSrc ) ;

    function GetParameters($params)
        global $appdef, $template;

        $appdef = $params['APPLICATIONDEFINITION'];
        $template = $params['TEMPLATE'];

    function GetRequestParameters()
        if($_SERVER['REQUEST_METHOD'] == "POST")


Save this script in a file called something like FlexViewer.php, and drop it in the www/fusion folder in the MapGuide web tier. You can then link to it using a URL that includes the parameters APPLICATIONDEFINITION and TEMPLATE. E.g.


You should no longer need to authenticate.

Note that in MG 2010, the fusionMGpath parameter will change to './Layers/MapGuide/php/' but the rest of the script should still be fine.


From: fusion-users-bounces at lists.osgeo.org [mailto:fusion-users-bounces at lists.osgeo.org] On Behalf Of Praveen Rajendra Babu
Sent: Tuesday, January 06, 2009 6:28 PM
To: fusion-users at lists.osgeo.org
Subject: [fusion-users] Auto-authenticate when using Fusion Viewer

       I am working to do auto-authentication when using any off the Fusion templates. Can anyone direct me on the code to look at?
I was able to figure out with .NET AJAX viewer(mapviewernet\mainframe.aspx) but could n't see something similar to that under "fusion" sub-directory.
    Also, is there any code-level documentation one could look at to get a deeper understanding on Fusion's implementation?

Thanks again for your time. Appreciate it.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/fusion-users/attachments/20090108/0deb548e/attachment.html

More information about the fusion-users mailing list