1 person found this helpful
1. Authenticate user
2. Run code
Yeah you can do that with two trips to the server or one trip to the server.
1. Send authentication data, and function call
2. Server runs a authentication check, and you'll need a IF function based on the authentication check to either send back an error msg, or to execute code and send back data.
3. Flex side, you have resulthander to handle either a fail or a pass.
actually once authentication is done, how will i check if user is logged in before every server call. after successfully login i am putting user in flexsession. one option to validate user in every server call is to write the authentication logic in all method , actually i wanted to implement something like filter, so that i can check user in session before any server call and send a failure message to client if user is not in session and redirect client to home page.
Sorry, I haven't really looked at sessions...
1. use a boolean like loggedOn:Boolean = true
1b. then i store the username and password in a variable ( you don't have to do this, see step 3 on why i do it)
2. use different STATES for logged in users and guests
3. for anything that will be changing serverside database, i send the stored username and password in step 1b to be checked again before allowing changes to database.
all request for my application is passing through filter servlet, i am doing validation there, but if validation is failed , is it possible to redirect will server inform client to redirect to login screen.
You could have a loggedOn:Boolean,
have the application check to see status of that boolean, if it's true then do whatever, if it's false give the user a login screen.
validating user in session through filter is working. the problem is how do i inform client from filter servlet with error message that user is not logged in and redirect to login page