[fusion-users] RE: Auto-authenticate when using Fusion Viewer
Chris Claydon
chris.claydon at autodesk.com
Wed Jan 7 11:44:27 EST 2009
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...
<?php
$fusionMGpath = './MapGuide/php/';
include $fusionMGpath . 'Common.php';
$locale = GetDefaultLocale();
$appdef = "";
$template = "";
$session = $siteConnection->GetSite()->CreateSession();
GetRequestParameters();
$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")
GetParameters($_POST);
else
GetParameters($_GET);
}
?>
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.
http://myserver/mapguide20xx/fusion/FlexViewer.php?APPLICATIONDEFINITION=Library%3a%2f%2fSheboyganSandbox.ApplicationDefinition&TEMPLATE=Slate
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.
Chris.
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
Hello,
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.
Regards,
Praveen
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/fusion-users/attachments/20090107/8ede945b/attachment.html
More information about the fusion-users
mailing list