Home > FLEX, WEBORB > Windows Authentication using WebOrb and Flex Client

Windows Authentication using WebOrb and Flex Client

March 22nd, 2008

1) First make sure that the security level in IIS (at least for the WebOrb virtual Directory is set to Windows Integrated security)

2) CREATE A C# CLASS with the following function

public string getUsername()
{

System.Security.Principal

.WindowsPrincipal p = System.Threading.Thread.CurrentPrincipal as System.Security.Principal.WindowsPrincipal;
string strName = p.Identity.Name;
return strName;
}

Flex Client Code Action Script

<mx:Script>
<![CDATA[
import mx.rpc.events.ResultEvent;

//import mx.rpc.remoting.RemoteObject;
import flash.net.registerClassAlias;
import mx.controls.Alert;
import mx.messaging.config.ServerConfig;
private var nc:NetConnection;
private var so:SharedObject;

private function establishConnection():void
{

var ro:RemoteObject = new RemoteObject();
ro.destination = "PANO2";
ro.addEventListener(ResultEvent.RESULT, dataHandler);
ro.getUsername();

}
private function dataHandler( event:ResultEvent ):void
{
var uname:String = new String();
uname = event.result.toString();
//At this point you have uname as a string. Do what you want with it.
}

]]>

Greg FLEX, WEBORB

  1. tania
    October 5th, 2008 at 11:28 | #1

    Hi greg,
    I’ve been trying to use your example and followed the steps exactly the same way. But I do not get any result from this windows authentication.
    Is there anything that I am skipping?

    Thanks in advance!

  2. tania
    October 5th, 2008 at 13:28 | #2

    Not to worry! Taken care of! Thanks!

  1. No trackbacks yet.