You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomee.apache.org by ymaraner <tp...@gmail.com> on 2012/08/07 21:23:53 UTC

EJBContext.isCallerInRole(String rolename) always returns false for EJB2.1 beans

I'm using the default authentication in TomEE+ 1.0.0 which uses the
tomcat-users.xml file:

<?xml version="1.0" encoding="UTF-8"?>
<tomcat-users>
  <role rolename="testrole"/>
  <user username="testuser" password="" roles="testrole"/>
</tomcat-users>

I log into my client application using "testuser".

Within an EJB 2.1 session bean, I make the call: 
   context.isCallerInRole("testrole");
   
This returns false

The client cannot connect to the application without specifying "testuser"
or with "testuser" removed from the tomcat-users.xml file so I am fairly
sure that the authentication is set up correctly.
Is there something that I need to do in my application to make it use the
roles defined in tomcat-users.xml? Are they not used by default?




--
View this message in context: http://openejb.979440.n4.nabble.com/EJBContext-isCallerInRole-String-rolename-always-returns-false-for-EJB2-1-beans-tp4656696.html
Sent from the OpenEJB User mailing list archive at Nabble.com.

Re: EJBContext.isCallerInRole(String rolename) always returns false for EJB2.1 beans

Posted by Romain Manni-Bucau <rm...@gmail.com>.
1.1.0-SNAPSHOT

- Romain


2012/8/8 ymaraner <tp...@gmail.com>

> Romain,
>
>  I'll try it out. Are you referring to the 1.0.1 snapshot or the 1.1.0
> snapshot?
>
> - Tim
>
>
>
> --
> View this message in context:
> http://openejb.979440.n4.nabble.com/EJBContext-isCallerInRole-String-rolename-always-returns-false-for-EJB2-1-beans-tp4656696p4656707.html
> Sent from the OpenEJB User mailing list archive at Nabble.com.
>

Re: EJBContext.isCallerInRole(String rolename) always returns false for EJB2.1 beans

Posted by ymaraner <tp...@gmail.com>.
Romain,

 I'll try it out. Are you referring to the 1.0.1 snapshot or the 1.1.0
snapshot?

- Tim



--
View this message in context: http://openejb.979440.n4.nabble.com/EJBContext-isCallerInRole-String-rolename-always-returns-false-for-EJB2-1-beans-tp4656696p4656707.html
Sent from the OpenEJB User mailing list archive at Nabble.com.

Re: EJBContext.isCallerInRole(String rolename) always returns false for EJB2.1 beans

Posted by Romain Manni-Bucau <rm...@gmail.com>.
if you are using the request login method, the info will be usable in the
next request in tomee 1.0.0.

BTW, the snapshot had some improvement about these features, giving a try
is probably a good idea.

- Romain


2012/8/7 ymaraner <tp...@gmail.com>

>
> Romain Manni-Bucau wrote
> > If it is done in a single request...
> I'm quite not sure what you mean by that; this is a remote java client, not
> a web client.
>
> Is there a Jira Issue associated with the fix in the snapshot?
>
>
>
>
> --
> View this message in context:
> http://openejb.979440.n4.nabble.com/EJBContext-isCallerInRole-String-rolename-always-returns-false-for-EJB2-1-beans-tp4656696p4656699.html
> Sent from the OpenEJB User mailing list archive at Nabble.com.
>

Re: EJBContext.isCallerInRole(String rolename) always returns false for EJB2.1 beans

Posted by ymaraner <tp...@gmail.com>.
Romain Manni-Bucau wrote
> If it is done in a single request...
I'm quite not sure what you mean by that; this is a remote java client, not
a web client.

Is there a Jira Issue associated with the fix in the snapshot? 




--
View this message in context: http://openejb.979440.n4.nabble.com/EJBContext-isCallerInRole-String-rolename-always-returns-false-for-EJB2-1-beans-tp4656696p4656699.html
Sent from the OpenEJB User mailing list archive at Nabble.com.

Re: EJBContext.isCallerInRole(String rolename) always returns false for EJB2.1 beans

Posted by Romain Manni-Bucau <rm...@gmail.com>.
If it is done in a single request i fear you need the snapshot.

Otherwise it should work.

- Romain
Le 7 août 2012 21:24, "ymaraner" <tp...@gmail.com> a écrit :

> I'm using the default authentication in TomEE+ 1.0.0 which uses the
> tomcat-users.xml file:
>
> <?xml version="1.0" encoding="UTF-8"?>
> <tomcat-users>
>   <role rolename="testrole"/>
>   <user username="testuser" password="" roles="testrole"/>
> </tomcat-users>
>
> I log into my client application using "testuser".
>
> Within an EJB 2.1 session bean, I make the call:
>    context.isCallerInRole("testrole");
>
> This returns false
>
> The client cannot connect to the application without specifying "testuser"
> or with "testuser" removed from the tomcat-users.xml file so I am fairly
> sure that the authentication is set up correctly.
> Is there something that I need to do in my application to make it use the
> roles defined in tomcat-users.xml? Are they not used by default?
>
>
>
>
> --
> View this message in context:
> http://openejb.979440.n4.nabble.com/EJBContext-isCallerInRole-String-rolename-always-returns-false-for-EJB2-1-beans-tp4656696.html
> Sent from the OpenEJB User mailing list archive at Nabble.com.
>