This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Servlets and the fly likes JAAS in AJAX mode Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "JAAS in AJAX mode" Watch "JAAS in AJAX mode" New topic

JAAS in AJAX mode

Rishat Valeye

Joined: Apr 26, 2011
Posts: 6
I have a question. Is it possible to use JAAS authorization in AJAX mode. I mean, can I use form authorization with j_security_check, without redirecting after login, but just stay at the same page..

I want to make user authorization on e-commerce web site, so I cant't make separate page for login.. All I need is login button on the main page, user press this button and some kind of popup window appears with login and password fields, user types in his credentials, press login and gets authorized via ajax request..and no redirect..
vinayak jog
Ranch Hand

Joined: Apr 01, 2011
Posts: 81

I think you can do it because once the ajax request is created and sent to the servlet then it is treated as a normal request you can do pretty much whatever you do with normal java.
Rob Spoor

Joined: Oct 27, 2005
Posts: 19655

I've done just this last week using HttpServletRequest.login, available since the Servlet 3.0 specification. I think it should also be possible by using AJAX to post to j_security_check but you'd have to check that out yourself.

How To Ask Questions How To Answer Questions
It is sorta covered in the JavaRanch Style Guide.
subject: JAAS in AJAX mode
Similar Threads
Migrating JAAS from JBoss to Websphere 6.1
suggestions for project
Windows Authentication
Swing client communication...
Force web app request/user through JAAS login (Bug in cache and timeout?)