Archive

Archive for March, 2008

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