[jboss-user] [Security & JAAS/JBoss] - Calling LoginModule in JBoss

mstarzyk do-not-reply at jboss.com
Mon Oct 23 19:38:23 EDT 2006


Hi, 

I need some help in running authentication in JBoss. 
I have a custom JAAS login module that handles SAML SSO 
authentication. 
A servlet calls the LoginModule  upon receiving a SAML response 
After calling LoginContext.login() I have a successfully authenticated 
Subject. 
Then I need to assign this Subject to session. 

In WebLogic I can do: 

  | // weblogic.servlet.security.ServletAuthentication 
  | ServletAuthentication.runAs(subject, request); 
  | 

How can it be done in JBoss ? 
Here is a code snippet:


  | if (/* request has cert */) { 
  |     cert = request.getAttribute("cert"); 
  |     CallbackHandler handler = new CertCallbackHandler(cert); 
  |     LoginContext lc = new LoginContext("composer-saml-cert", handler); 
  |     try { 
  |         lc.login(); 
  |         Subject subject = lc.getSubject(); 
  | 
  | //      **** << assign subject to request >> ****   !!!!!!!!!!!!!!!!!! 
  | 
  |     } catch(LoginException e) { 
  |         // XXXX 
  |     } 
  | } 
  | 
Thanks for any pointers, 
Maciek

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3980229#3980229

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3980229



More information about the jboss-user mailing list