4 Replies Latest reply on Feb 10, 2012 11:06 AM by sunsilk10

    Pass Http Header information to a Flex application

    sunsilk10

      Hi, in order to implement Single Sign On from the Intranet portal to my Flex application,

      I want to read the user credentials from the HTTP HEADER

       

      What is the best way to read Http Headers from a Flex App?

       

      Do I need to use Flash Vars. Is there a security risk in doing so?

       

      Any suggestions please

        • 1. Re: Pass Http Header information to a Flex application
          oldMster Level 3

          Are you indicating you need to read the HTTP headers from the page that loads the Flex application, or on subsequent HTTP Service calls?

          If the first, Flash Vars would probably work, or you could probably use external interface calls from within flex to retrieve them.  Without more information on what is you are retrieving, and how it is used for authentication through the portal, it isn't possible to to evaluate any security implications.

           

          Mark

          • 2. Re: Pass Http Header information to a Flex application
            sunsilk10 Level 1

            Yes, I need to read the Http headers from the page that calls the Flex Application.

             

            When user logs on the portal, Single Sign On allows him to open any application he needs.

            I want to retrieve the username and organisation from the HTTP header, so that I can use this information

            in my Flex application.

             

            I am trying to wrap my HTML code within a JSP to get the HTTPHeader from the server, then use flashvars to read the variable in my app.

            But it is not working

             

             

             

            However the alert statement returns < request.getHeader('REMOTE_USER')

            instead of the value. i.e. the script is not getting executed.

             

            Any ideas??

             

             

             

            flashvars.username = "<%= request.getHeader('REMOTE_USER')%>";

            In my mxml code, I am trying

            mx.controls.Alert.show("USER: " + FlexGlobals.topLevelApplication.parameters.username);

            • 3. Re: Pass Http Header information to a Flex application
              sunsilk10 Level 1

              Here are my files: 

               

              index.jsp

               

               

              <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

              <!-- saved from url=(0014)about:internet -->

               

              <%

              String username = (String) request.getParameter("REMOTE_USER");

              %>

               

              <html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">

              <head>

              <title>DynamicindexWrapper.jsp</title>

              <script type="text/javascript" src="swfobject.js"></script>

               

              <script type="text/javascript">

              var swfVersionStr = "0";

              var xiSwfUrlStr = "";

              var flashvars = {};

              flashvars.user = "<%= username %>";

              var params = {};

              params.quality = "high";

              params.bgcolor = "#ffffff";

              params.allowscriptaccess = "sameDomain";

              var attributes = {};

              attributes.id = "index";

              attributes.name = "index";

              attributes.align = "middle";

              swfobject.embedSWF(

              "index

               

              .swf", "flashContent",

              "100%", "100%",

              swfVersionStr, xiSwfUrlStr,

              flashvars, params, attributes);

              </script>

              </head>

               

              <body>

              <div id="flashContent"/>

              </body>

              </html>

               

               

               

              index.mxml

              <?xml version="1.0" encoding="utf-8"?>

              <s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"

              xmlns:s="library://ns.adobe.com/flex/spark"

              xmlns:mx="library://ns.adobe.com/flex/mx" minWidth="955" minHeight="600"

              initialize="init()">

              <fx:Declarations>

              <!-- Place non-visual elements (e.g., services, value objects) here -->

              </fx:Declarations>

               

              <fx:Script>

              <![CDATA[

               

               

              import mx.core.FlexGlobals;

              import spark.skins.spark.PanelSkin;

              import mx.controls.Alert;

               

              private function init():void

              {

              mx.controls.Alert.show(FlexGlobals.topLevelApplication.parameters.user);

              }

               

              ]]>

              </fx:Script>

               

               

               

              </s:Application>

              • 4. Re: Pass Http Header information to a Flex application
                sunsilk10 Level 1

                The reason why the JSP doesn't work is because I was using IIS without Tomcat.

                 

                Can an ASP wrapper be used instead?