You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cactus-user@jakarta.apache.org by Horatiu Parfene <ho...@memiq.ro> on 2004/01/26 17:01:12 UTC

CACTUS + JBOSS + JAAS

Hello all,

I want to test my EJBs but I am unable to autehnticate against jboss my 
Cactus Test Classes. The login of the application uses j_security_check.


I could run my tests until authentication was introduced. Since then i 
am unable to perform any tests having the following error:

/[cactus] EJBException:; nested exception is:
[cactus]     javax.ejb.EJBException: checkSecurityAssociation; 
CausedByException is:
[cactus]     Authentication exception, principal=null
/
Here is my situation:
1. i have jboss jboss-3.2.1_tomcat-4.1.24
2. my EJBs are protected through user+password+role (obtained from a DB) 
using JAAS

I don't know how to pass jboss a user and a password from my Cactus classes.

Please help me.

Thank you,
Horatiu

Re: CACTUS + JBOSS + JAAS

Posted by Kazuhito SUGURI <su...@lab.ntt.co.jp>.
Hi Horatiu,

In article <40...@memiq.ro>,
Mon, 26 Jan 2004 18:01:12 +0200,
Horatiu Parfene <ho...@memiq.ro> wrote: 
horatiu.parfene> I want to test my EJBs but I am unable to autehnticate against jboss my 
horatiu.parfene> Cactus Test Classes. The login of the application uses j_security_check.

I have done it recentry.
# You may already solved this :-)

What I did is as follows:
1. configure Servlet Container and EJB Container
   to use the same security-domain.
2. define ServletRedirectSecure and its security in web.xml.
3. add authentication related statements in beginXXX() methods:
       public void beginXXX(WebRequest request){
           request.setRedirectorName("ServletRedirectorSecure");
           FormAuthentication auth = new FormAuthentication("usernam", "password");
           request.setAuthentication(auth);
       }
4. run test (as usual)

See also http://jakarta.apache.org/cactus/writing/howto_security.html 


In my testcase, Context is set in setUp() method like:
      private Context context;
      ...
      public void setUp(){
          super.setUp();
	  context = new InitialContext();
      }


As show above, I don't pass a Properties object
in the InitialContext constructor, however,
this works fine for me with JBoss-3.2.3.


For your informatin,
----
Kazuhito SUGURI
mailto:suguri.kazuhito@lab.ntt.co.jp

RE: CACTUS + JBOSS + JAAS

Posted by Vincent Massol <vm...@pivolis.com>.
Hi Horatiu,

> -----Original Message-----
> From: Horatiu Parfene [mailto:horatiu.parfene@memiq.ro]
> Sent: 26 January 2004 17:01
> To: cactus-user@jakarta.apache.org
> Subject: CACTUS + JBOSS + JAAS
> 
> Hello all,
> 
> I want to test my EJBs but I am unable to autehnticate against jboss
my
> Cactus Test Classes. The login of the application uses
j_security_check.
> 
> 
> I could run my tests until authentication was introduced. Since then i
> am unable to perform any tests having the following error:
> 
> /[cactus] EJBException:; nested exception is:
> [cactus]     javax.ejb.EJBException: checkSecurityAssociation;
> CausedByException is:
> [cactus]     Authentication exception, principal=null
> /
> Here is my situation:
> 1. i have jboss jboss-3.2.1_tomcat-4.1.24
> 2. my EJBs are protected through user+password+role (obtained from a
DB)
> using JAAS
> 
> I don't know how to pass jboss a user and a password from my Cactus
> classes.

Hmmm. I've never done this but I guess you simply need to pass the
credentials when you're creating the InitialContext you need to use to
perform your EJB lookup. You can pass a Properties object in the
InitialContext constructor. You need to pass the credentials in this
properties object. Note that I've never used JAAS before (I've only used
the standard container security), so I may be totally off base.

What's important to realize is that Cactus is completely transparent
when it comes to accessing EJBs (there is no EJB redirector).

Thanks
-Vincent

> 
> Please help me.
> 
> Thank you,
> Horatiu
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: cactus-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: cactus-user-help@jakarta.apache.org