The process of logging in, getting authenticated and then staying authenticated for subsequent data service calls is a common requirement, and there are few examples. I suspect it is because there are many parts to the process and thus very many possible solutions.
For example, in the links valdhor posted, one talks to PHB via remoteObject through WebOrb. One uses HTTPService to talk to Cold Fusion. And that is not even considering the options available withing Flex: Singleton data model? XML? ArrayCollection? ViewStack? States? Pop-up? So here is one more approach. Note, I am not a security expert, and cannot vouch for the level of security this provides. Any security folks out there are welcome to suggest alternatives. Note, a discussion of OOP coupling principles will not be helpful in this context. Flex: * Pop-Up prompts for User id and password, calls function on the main app, passing the values. * The main app hashes the password(MD5 library available), and sends credentials to server Via WebService. Dot.net: * WebService login method validates the credentials against a database. * If valid user, generates a session Id string, puts in a HashTable, and returns the sessionId and any other user info needed * If not valid an error node is generated and returned Flex: * A result handler examines the returned XML. If an error node then a message is displayed in the still visible pop-up, permitting retry. * If user is authenticated, a User object in a data model is populated, and the Login popup is closed. * All subsequent calls to the dot.net webservice include the session id. Dot net: * All calls, except for login, authorize the call by checking the session id in the hashtable. * If session id is found, a timestamp is checked for timeout. * If session has timed out, an error node is returned to the Flex client * Otherwise the call continuse to retrun the requested processing/data. * All returned data is wrapped in a known structure XML node, so it can be procesed properly in the Flex result handler. Tracy Spratt Lariat Services Flex development bandwidth available ________________________________ From: [email protected] [mailto:[email protected]] On Behalf Of valdhor Sent: Friday, January 30, 2009 9:38 AM To: [email protected] Subject: [flexcoders] Re: Login/Registration Page ? These threads should get you started... http://www.nabble.com/geting-info-of-a-user-who-has-loged-in-td21292230. html#a21352413 <http://www.nabble.com/geting-info-of-a-user-who-has-loged-in-td21292230 .html#a21352413> http://www.nabble.com/flex-login-popup-help-needed-pleaseeeeeeeee-td2077 2482.html#a20833766 <http://www.nabble.com/flex-login-popup-help-needed-pleaseeeeeeeee-td207 72482.html#a20833766> --- In [email protected] <mailto:flexcoders%40yahoogroups.com> , "Verdell" <dasle...@...> wrote: > > I have been searching all over the internet for something like a video > on how to create a Flex Login page and Registration page. So I > appreciate if someone could point me in the right direction on how to > do this type of project. I will be using it with ASP.NET and I will > be setting up a database with SQL Server 2008. > > This is the code/page I have so far: > > <?xml version="1.0" encoding="utf-8"?> > <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml <http://www.adobe.com/2006/mxml> " > layout="absolute" color="#060707"> > <mx:Label x="187" y="238" text="UserName:"/> > <mx:Label x="187" y="283" text="Password:"/> > <mx:Label x="187" y="179" text="Enter Your Username And Password" > fontWeight="bold" fontSize="14"/> > <mx:TextInput x="262" y="236" id="username"/> > <mx:TextInput x="262" y="281" id="password"/> > <mx:Button id="submit" > x="262" y="328" > label="submit" /> > <mx:Label x="187" y="376" text="You must register first before you > enter website."/> > <mx:Image x="187" y="20" width="150" height="113" autoLoad="true" > scaleContent="true"> > <mx:source>images/DjRuthless.jpg</mx:source> > </mx:Image> > <mx:Label x="350" y="65" text="Doc's Old School Jams" > fontWeight="bold" fontSize="26" fontFamily="Georgia" color="#000000"/> > > </mx:Application> >

