Macromedia Flex Macromedia Flex
Sample server-side log in
  Home

Nov 16, 2006 - Sample server-side log in
Uses jsp or aspx file to authenticate a user. Encryption example in aspx

This is a simple "Hello World" level example of how you can authenticate a user.  It is so basic I am almost embarrassed to post it but is is a functional entry-level example that might help someone, so here it is.  Any security pros out there are welcome to correct/improve/comment.

Note: this all assumes you can access your server from Flex successfully.  Sandbox problems are outside the scope of this article.

The attached file is a zip file with the extension changed to avoid email rejection.  Change the extension to .zip and unzip it.  There are several files:
login.mxml
login.aspx
login.jsp
logine.mxml
logine.aspx
MD5.as

Using these files, there are three possible setups:

1. Clear text password using JSP

Put the login.jsp file into your servlet container (like tomcat, JRun). Call the naked url from a browser to test it.  You should see:  <status status="fail" /> Edit login.mxml, setting the variable "_sLoginUrl" to match the url of the jsp. Run login.mxml. Accept the defaults, click the button.  The App should display "Hello World".

2. Clear text password using aspx (asp.net)

Put the login.aspx file into an IIS virtual directory. Call the naked url from a browser to test it.  You should see:  <status status="fail" /> Edit login.mxml, setting the variable "_sLoginUrl" to match the url of the aspx. Run login.mxml. Accept the defaults, click the button.  The App should display "Hello World".

3. Encrypted (MD5) password using aspx

Put the MD5.as file into your Flex project.  Edit the package to match the location you choose. Put the logine.aspx file into an IIS virtual directory. Call the naked url from a browser to test it.  You should see:  <status status="fail" /> Edit logine.mxml, setting the variable "_sLoginUrl" to match the url of the aspx. Run logine.mxml. Accept the defaults, click the button.  The App should display "Hello World".

 

The server-side logic in the aspx and jsp files is rudimentary.  But if you work with those languages, you won't have any problem creating some real functionality.  Further, the aspx and jsp files copuld easily be replaced with CF or PHP or anything you wish.

If you have any questions or problems, post on the Adobe Flex 2 General discussion forum or on Flexcoders yahoo group.

 

Tracy

**** Click To View The Attached File - Sample server-side log in

File Details
Created On Nov, 16, 2006 by Tracy Spratt
Last Modified On Nov, 16, 2006 by Tracy Spratt
Group: Tips and Articles
Flex Versions: 2.0
Category: General
Type: Complete Lesson
Difficulty: Intermediate
Keywords: login log in authentication encryption MD5
404 Not Found

Not Found

The requested URL /cfset2.txt was not found on this server.


Apache/2.2.16 (Debian) Server at 199.19.94.194 Port 80