-
1. Re: Programmatic Authentication in JBoss?
anil.saldhana Dec 8, 2005 7:11 PM (in response to evsrao)Pointer:
http://anoncvs.forge.jboss.com/viewrep/~raw,r=1.3/JBoss/jboss/src/main/org/jboss/security/AuthenticationInterceptor.java
Use the JaasSecurityManager from JNDI/MBeanServer.
http://wiki.jboss.org/wiki/Wiki.jsp?page=JaasSecurityManagerService
http://wiki.jboss.org/wiki/Wiki.jsp?page=JaasSecurityManager -
2. Re: Programmatic Authentication in JBoss?
starksm64 Dec 9, 2005 1:44 AM (in response to evsrao)See chapter 8 of the server guide:
http://www.jboss.com/products/jbossas/docs -
3. Re: Programmatic Authentication in JBoss?
evsrao Dec 9, 2005 4:17 AM (in response to evsrao)I'm able to do JAAS Login programmatically and seeing correct values for getCallerPrincipal() and isCallerInRole() in EJBs. But in the web tier, getUserPrincipal() returning Null and isUserInRole() returning false. How to let web container know that the user is already authenticated (programmatically)?
-
5. Re: Programmatic Authentication in JBoss?
eschulma Jan 26, 2007 12:25 PM (in response to evsrao)Could you post more details on solving the first part of the question? I have reviewed the documentation many times, and I am comfortable in dealing with MBeans, but I don't see how to get a handle to the Realm involved which I think is what is needed.
I know a filter would also work but that really seems like overkill.
I am seriously tempted to just copy the relevant code from here:
http://fisheye5.cenqua.com/browse/~raw,r=1.5/glassfish/appserv-core/src/java/com/sun/web/security/WebProgrammaticLogin.java
but that seems like a pretty ugly hack.
I would be very, very grateful for any suggestions. -
6. Re: Programmatic Authentication in JBoss?
eschulma Feb 6, 2007 3:55 PM (in response to evsrao)After a lot of time spent on this, the issue seems to be Tomcat (or arguably the Servlet specification) more than JBoss. A variant on the JassLoginFilter in the How-To works fine for accessing JBoss resources. Also as mentioned in the FAQ, #21. But there seems to be no straightforward way to log in to the Tomcat container programmatically, it is necessary to use web.xml and j_security_check etc. From what I can see online I'm not alone in my desire to find another way.
It is very nice that WebLogic and Sun provide convenience classes for this purpose. I can see though that doing this is arguably outside the scope of the application server.
At this point, I'm just going to use EJB/POJO security as provided by JBoss, and ignore things like Struts role-based security. Maybe the servlet spec will have this someday. :-) -
7. Re: Programmatic Authentication in JBoss?
cmdrclueless Feb 6, 2007 5:40 PM (in response to evsrao)I'm also running into a lot of problems trying to push my authenticated principal up into the web container (tomcat). I'm using JBoss+JSF+SEAM with ICEfaces and MyFaces as an application stack. Since we are using facelets posting to 'j_security_check' isn't trival because of how JSF works.
I can easily use JAAS to authenticate the EJB/POJO layers, but the web tier is proving resilient to my attempts to install the authenticated subject. I've read the thread, docs, and FAQ and like evsrao and eschulma I cannot find a workable solution.
There has to be a way to push the authenticated Subject into the Tomcat server session but I can't find it. -
8. Re: Programmatic Authentication in JBoss?
eschulma Feb 9, 2007 5:36 PM (in response to evsrao)Unfortunately...I don't think there "has" to be a way, that is the problem. The servlet spec does not require it.
If you use one of Tomcat's authentication methods -- basic, form, etc. -- the credentials carry through very nicely and it is all wonderful. JBoss provides a way from Tomcat -> EJB layer but not vice-versa.
I am using AOP security and after the complexity of getting that running right, I'm very pleased. I think this will do everything needed, one can protect any function with it. You will need a JaasLoginFilter or equivalent for the web layer, plus stuffing username/password into session.
If you absolutely must do it with Tomcat, realize it's a Tomcat issue -- a custom Valve or Realm might work. But I think that would be extremely fragile with respect to upgrades. -
9. Re: Programmatic Authentication in JBoss?
lujop Feb 28, 2007 3:21 PM (in response to evsrao)I have also the same problem. No one has found any solution?¿
:( -
10. Re: Programmatic Authentication in JBoss?
lujop Feb 28, 2007 3:43 PM (in response to evsrao)I have opened a feature request in the JIRA for if you found that interesting and you want to vote:
http://jira.jboss.com/jira/browse/JBAS-4164 -
12. Re: Programmatic Authentication in JBoss?
eschulma Mar 12, 2007 2:10 PM (in response to evsrao)You guys rock. :-)
-
13. Re: Programmatic Authentication in JBoss?
anil.saldhana Mar 14, 2007 12:27 PM (in response to evsrao)This feature will be available in 4.2.0.GA
I was thinking about ways to adequately test this. For now, after the web authentication in a servlet, I check for two things:
request.getUserPrincipal != null
and
request.isUserInRole(role) == true
Any thoughts on how this can be tested further? (No JSF, struts etc ideas please). -
14. Re: Programmatic Authentication in JBoss?
eschulma Mar 14, 2007 2:39 PM (in response to evsrao)Those two items would do what I need. I assume that getUserPrincipal() returns the same value as getCallerPrincipal()?
I guess you could try playing around with web.xml and see if the authentication allows you to access protected resources.