Auto-authenticate when using Fusion Viewer

5 messages Options
Embed this post
Permalink
prbabu

Auto-authenticate when using Fusion Viewer

Reply Threaded More More options
Print post
Permalink
Some javascript/style in this post has been disabled (why?)

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

 


_______________________________________________
fusion-users mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/fusion-users
Chris Claydon

RE: Auto-authenticate when using Fusion Viewer

Reply Threaded More More options
Print post
Permalink
Some javascript/style in this post has been disabled (why?)

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: [hidden email] [mailto:[hidden email]] On Behalf Of Praveen Rajendra Babu
Sent: Tuesday, January 06, 2009 6:28 PM
To: [hidden email]
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

 


_______________________________________________
fusion-users mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/fusion-users
prbabu

RE: Auto-authenticate when using Fusion Viewer

Reply Threaded More More options
Print post
Permalink
Some javascript/style in this post has been disabled (why?)

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.

 

Regards,

Praveen

 

From: Chris Claydon [mailto:[hidden email]]
Sent: Thursday, 8 January 2009 3:44 AM
To: Praveen Rajendra Babu; [hidden email]
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…

 

<?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: [hidden email] [mailto:[hidden email]] On Behalf Of Praveen Rajendra Babu
Sent: Tuesday, January 06, 2009 6:28 PM
To: [hidden email]
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

 


_______________________________________________
fusion-users mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/fusion-users
Chris Claydon

RE: Auto-authenticate when using Fusion Viewer

Reply Threaded More More options
Print post
Permalink
Some javascript/style in this post has been disabled (why?)

I’m not sure off hand exactly what causes the first authentication prompt – probably the first call to get the flexible web layout definition from the MG repository. If the initial request is sent with no authentication parameters, MG will send a response indicating that it requires credentials, and I believe that’s what causes the browser to prompt the user.

 

From: Praveen Rajendra Babu [mailto:[hidden email]]
Sent: Wednesday, January 07, 2009 3:54 PM
To: Chris Claydon; [hidden email]
Subject: RE: Auto-authenticate when using Fusion Viewer

 

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.

 

Regards,

Praveen

 

From: Chris Claydon [mailto:[hidden email]]
Sent: Thursday, 8 January 2009 3:44 AM
To: Praveen Rajendra Babu; [hidden email]
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…

 

<?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: [hidden email] [mailto:[hidden email]] On Behalf Of Praveen Rajendra Babu
Sent: Tuesday, January 06, 2009 6:28 PM
To: [hidden email]
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

 


_______________________________________________
fusion-users mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/fusion-users
hfonseca

RE: Auto-authenticate when using Fusion Viewer

Reply Threaded More More options
Print post
Permalink
In reply to this post by Chris Claydon
Hi all,

I'm newbie with fusion..but started to learn here at the forum how to setting up layouts.
my server is IIS and my fusion layout is *.html. When i run maestro i can preview my layout and map correctly.
If I type "http://myserver/mapguide/fusion/templates/mapguide/mylayout/index.html" on browser only see the html layout and not the map. Well the problem is the auto-authentication at the MG, ie, APPLICATIONDEFINITION and SESSION parameters.

I don't understand nothing of html or IIS servers....How can i add this script to my index.html in order to get my map at fusion layout? Or this can be made in other way?
 
hope someone can help me!!

thanks,
Hugo

Chris Claydon wrote:
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@lists.osgeo.org [mailto:fusion-users-bounces@lists.osgeo.org] On Behalf Of Praveen Rajendra Babu
Sent: Tuesday, January 06, 2009 6:28 PM
To: fusion-users@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


_______________________________________________
fusion-users mailing list
fusion-users@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/fusion-users