J2EE authentication FORM and Programmatic
Web Server forum
Back To The Forum Home!Search!Private Messaging System

Web Server Talk Web Server Talk > Web Servers reviews > WebSphere > WebSphere HTTP Server > J2EE authentication FORM and Programmatic




  Last Thread   Next Thread Next
  Show Printable Version Email this Page Subscribe to this Thread      Post New Thread    Post A Reply      

    J2EE authentication FORM and Programmatic  
Kevin


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
06-08-04 04:48 AM

I have an issue I cannot seem to solve with J2EE Authentication

Environment
- WASD 5.0/Websphere 5.0
- JDK 1.4.2
- Struts

Requirements
1. Currently Form-based authenitcation is in place with a login page
and error page using POST with j_securitycheck
2. I want to call a URL passing username and password on the URL
params and have the system silently login the user


Issue
1. The mechanism for FORM-based authentication and programmatic
authentication seem have different role information


Code snippet from LoginAction (works fine when going through login
page)

User user = new User();
Principal principal = request.getUserPrincipal();
if (request.isUserInRole("CasenetCalendarGlobal")) {
user.setRole(user.COURT_ROLE);
}
if (request.isUserInRole("CasenetCourt")) {
user.setRole(user.COURT_ROLE);
}
etc...

Code snippet from XXXXRPCAction (right from the IBM Help pages). I
ommitted the LoginCallbackHandler. It works.

LoginContext lc = null;

try {
lc = new LoginContext("WSLogin",
new LogonCallbackHandler(userName, criteria.getPassword()));

} catch (LoginException le) {
System.out.println("Cannot create LoginContext. " +
le.getMessage());
// insert error processing code
} catch(SecurityException se) {
System.out.println("Cannot create LoginContext." +
se.getMessage());
// Insert error processing
}

try {
lc.login();
} catch(LoginException le) {
System.out.println("Fails to create Subject. " +
le.getMessage());
// Insert error processing code
}



What happens
------------
FORM-authentication works file and roles are set. With programmatic
login, I cannot get a handle on any role information.
Note the request role processing in the FORM-based authentication.
And, the FORM-based authentication still does not
think there has been a successful login, yet the programmatic login
passed! Any help would be appreciated.


Kevin





[ Post a follow-up to this message ]



    Sponsored Links  




 





   All times are GMT. The time now is 03:24 AM.      Post New Thread    Post A Reply      
  Last Thread   Next Thread Next


Most Popular forums 

Forum Jump:
Rate This Thread:

Forum Rules:
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is OFF
vB code is ON
Smilies are ON
[IMG] code is OFF
 
Medical and Health forum | Computer Games Reviews | Graphics design forum

Back To The Top
Home | Usercp | Faq | Register