You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomee.apache.org by Olivier Paquet <ol...@atos.net> on 2014/09/04 11:06:52 UTC

Re: Principal in EJB returns always "guest" even with JAAS module

ejb-security.zip
<http://tomee-openejb.979440.n4.nabble.com/file/n4671591/ejb-security.zip>  

server.xml:

<Realm className="org.apache.catalina.realm.JAASRealm"
appName="PropertiesLogin"
         
userClassNames="org.apache.openejb.core.security.AbstractSecurityService$User"
         
roleClassNames="org.apache.openejb.core.security.AbstractSecurityService$Group">
      </Realm>

login.config
<http://tomee-openejb.979440.n4.nabble.com/file/n4671591/login.config>  
users.properties
<http://tomee-openejb.979440.n4.nabble.com/file/n4671591/users.properties>  
groups.properties
<http://tomee-openejb.979440.n4.nabble.com/file/n4671591/groups.properties>  

added "-Djava.security.auth.login.config=$CATALINA_BASE/conf/login.config"
to setenv.bat

After deploying both war archives, just call: 

http://localhost:TOMEE_PORT/ejb-client/clientservice?host=localhost&port=TOMEE_PORT&user=admin&pass=changeit

And you should see in the logs, that the remote EJB is called with a
principal named "guest" and not admin .

It would be very nice and helpful if you cna take a look at my examples, I
packaged both archives as maven projects, so you can also check the sources.

Our aim is that we need the name of the principal which call the EJB,
because we do some further checks on it.


Best regards, Olivier



--
View this message in context: http://tomee-openejb.979440.n4.nabble.com/Principal-in-EJB-returns-always-guest-even-with-JAAS-module-tp4670862p4671591.html
Sent from the TomEE Users mailing list archive at Nabble.com.

Re: Principal in EJB returns always "guest" even with JAAS module

Posted by Romain Manni-Bucau <rm...@gmail.com>.
actually once you created sample it was fast to run ;). Thanks you too
for it BTW


Romain Manni-Bucau
Twitter: @rmannibucau
Blog: http://rmannibucau.wordpress.com/
LinkedIn: http://fr.linkedin.com/in/rmannibucau
Github: https://github.com/rmannibucau


2014-09-04 17:54 GMT+02:00 Olivier Paquet <ol...@atos.net>:
> Oh my God  that's it! Thanks for the time you dedicated to this issue...
>
>
> Thank you Romain! You can close this thread now ;)
>
> Greetings, Olivier
>
>
>
> --
> View this message in context: http://tomee-openejb.979440.n4.nabble.com/Principal-in-EJB-returns-always-guest-even-with-JAAS-module-tp4670862p4671645.html
> Sent from the TomEE Users mailing list archive at Nabble.com.

Re: Principal in EJB returns always "guest" even with JAAS module

Posted by Olivier Paquet <ol...@atos.net>.
Oh my God  that's it! Thanks for the time you dedicated to this issue...  


Thank you Romain! You can close this thread now ;) 

Greetings, Olivier



--
View this message in context: http://tomee-openejb.979440.n4.nabble.com/Principal-in-EJB-returns-always-guest-even-with-JAAS-module-tp4670862p4671645.html
Sent from the TomEE Users mailing list archive at Nabble.com.

Re: Principal in EJB returns always "guest" even with JAAS module

Posted by Romain Manni-Bucau <rm...@gmail.com>.
PS: last sentence meant instead of java:global/.... use global/....
and it should work


Romain Manni-Bucau
Twitter: @rmannibucau
Blog: http://rmannibucau.wordpress.com/
LinkedIn: http://fr.linkedin.com/in/rmannibucau
Github: https://github.com/rmannibucau


2014-09-04 17:09 GMT+02:00 Romain Manni-Bucau <rm...@gmail.com>:
> Ok
>
> issue is you are in tomee and new InitialContext is not resolved to
> remote context but to local one cause the name starts with java:.
>
>
> Romain Manni-Bucau
> Twitter: @rmannibucau
> Blog: http://rmannibucau.wordpress.com/
> LinkedIn: http://fr.linkedin.com/in/rmannibucau
> Github: https://github.com/rmannibucau
>
>
> 2014-09-04 17:03 GMT+02:00 Romain Manni-Bucau <rm...@gmail.com>:
>> just curious: did you try 2 tomee instances?
>>
>>
>> Romain Manni-Bucau
>> Twitter: @rmannibucau
>> Blog: http://rmannibucau.wordpress.com/
>> LinkedIn: http://fr.linkedin.com/in/rmannibucau
>> Github: https://github.com/rmannibucau
>>
>>
>> 2014-09-04 14:55 GMT+02:00 Olivier Paquet <ol...@atos.net>:
>>> CATALINA_OPTS is also not working(Linux / Windows), I mean if I provide a bad
>>> password it fails, but principal is not handed over to the EJB.
>>>
>>> Any other hints?
>>> Bad Java version (using jdk1.7.0_51)...
>>>
>>>
>>>
>>>
>>>
>>> --
>>> View this message in context: http://tomee-openejb.979440.n4.nabble.com/Principal-in-EJB-returns-always-guest-even-with-JAAS-module-tp4670862p4671622.html
>>> Sent from the TomEE Users mailing list archive at Nabble.com.

Re: Principal in EJB returns always "guest" even with JAAS module

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

issue is you are in tomee and new InitialContext is not resolved to
remote context but to local one cause the name starts with java:.


Romain Manni-Bucau
Twitter: @rmannibucau
Blog: http://rmannibucau.wordpress.com/
LinkedIn: http://fr.linkedin.com/in/rmannibucau
Github: https://github.com/rmannibucau


2014-09-04 17:03 GMT+02:00 Romain Manni-Bucau <rm...@gmail.com>:
> just curious: did you try 2 tomee instances?
>
>
> Romain Manni-Bucau
> Twitter: @rmannibucau
> Blog: http://rmannibucau.wordpress.com/
> LinkedIn: http://fr.linkedin.com/in/rmannibucau
> Github: https://github.com/rmannibucau
>
>
> 2014-09-04 14:55 GMT+02:00 Olivier Paquet <ol...@atos.net>:
>> CATALINA_OPTS is also not working(Linux / Windows), I mean if I provide a bad
>> password it fails, but principal is not handed over to the EJB.
>>
>> Any other hints?
>> Bad Java version (using jdk1.7.0_51)...
>>
>>
>>
>>
>>
>> --
>> View this message in context: http://tomee-openejb.979440.n4.nabble.com/Principal-in-EJB-returns-always-guest-even-with-JAAS-module-tp4670862p4671622.html
>> Sent from the TomEE Users mailing list archive at Nabble.com.

Re: Principal in EJB returns always "guest" even with JAAS module

Posted by Romain Manni-Bucau <rm...@gmail.com>.
just curious: did you try 2 tomee instances?


Romain Manni-Bucau
Twitter: @rmannibucau
Blog: http://rmannibucau.wordpress.com/
LinkedIn: http://fr.linkedin.com/in/rmannibucau
Github: https://github.com/rmannibucau


2014-09-04 14:55 GMT+02:00 Olivier Paquet <ol...@atos.net>:
> CATALINA_OPTS is also not working(Linux / Windows), I mean if I provide a bad
> password it fails, but principal is not handed over to the EJB.
>
> Any other hints?
> Bad Java version (using jdk1.7.0_51)...
>
>
>
>
>
> --
> View this message in context: http://tomee-openejb.979440.n4.nabble.com/Principal-in-EJB-returns-always-guest-even-with-JAAS-module-tp4670862p4671622.html
> Sent from the TomEE Users mailing list archive at Nabble.com.

Re: Principal in EJB returns always "guest" even with JAAS module

Posted by Olivier Paquet <ol...@atos.net>.
CATALINA_OPTS is also not working(Linux / Windows), I mean if I provide a bad
password it fails, but principal is not handed over to the EJB. 

Any other hints?
Bad Java version (using jdk1.7.0_51)...





--
View this message in context: http://tomee-openejb.979440.n4.nabble.com/Principal-in-EJB-returns-always-guest-even-with-JAAS-module-tp4670862p4671622.html
Sent from the TomEE Users mailing list archive at Nabble.com.

Re: Principal in EJB returns always "guest" even with JAAS module

Posted by Romain Manni-Bucau <rm...@gmail.com>.
set CATALINA_OPTS instead of set JAVA_OPTS maybe ;)


Romain Manni-Bucau
Twitter: @rmannibucau
Blog: http://rmannibucau.wordpress.com/
LinkedIn: http://fr.linkedin.com/in/rmannibucau
Github: https://github.com/rmannibucau


2014-09-04 14:02 GMT+02:00 Olivier Paquet <ol...@atos.net>:
> And in catalina.out it logs "-sayHello invoked by [admin]" ? I also tried is
> now on a linux, but still the same result.
>
> I uploaded my TomEE : perhaps you can check it also?
>
> http://we.tl/oVg9302BKP  it's a exact copy , just add the setenv.sh and
> start it ;)
>
> Can you provide me the content of your setenv.sh pls?
>
>
>
>
>
> --
> View this message in context: http://tomee-openejb.979440.n4.nabble.com/Principal-in-EJB-returns-always-guest-even-with-JAAS-module-tp4670862p4671608.html
> Sent from the TomEE Users mailing list archive at Nabble.com.

Re: Principal in EJB returns always "guest" even with JAAS module

Posted by Olivier Paquet <ol...@atos.net>.
And in catalina.out it logs "-sayHello invoked by [admin]" ? I also tried is
now on a linux, but still the same result. 

I uploaded my TomEE : perhaps you can check it also?

http://we.tl/oVg9302BKP  it's a exact copy , just add the setenv.sh and
start it ;)

Can you provide me the content of your setenv.sh pls?





--
View this message in context: http://tomee-openejb.979440.n4.nabble.com/Principal-in-EJB-returns-always-guest-even-with-JAAS-module-tp4670862p4671608.html
Sent from the TomEE Users mailing list archive at Nabble.com.

Re: Principal in EJB returns always "guest" even with JAAS module

Posted by Romain Manni-Bucau <rm...@gmail.com>.
tested on linux with setenv.sh but otherwise no changes


Romain Manni-Bucau
Twitter: @rmannibucau
Blog: http://rmannibucau.wordpress.com/
LinkedIn: http://fr.linkedin.com/in/rmannibucau
Github: https://github.com/rmannibucau


2014-09-04 13:06 GMT+02:00 Olivier Paquet <ol...@atos.net>:
> Ok strange, I tested it with the new TomEE 1.7.0 plus but I still got guest,
> and you just configured it as I described in my Email or is there something
> I forgot?
>
>
>
> --
> View this message in context: http://tomee-openejb.979440.n4.nabble.com/Principal-in-EJB-returns-always-guest-even-with-JAAS-module-tp4670862p4671599.html
> Sent from the TomEE Users mailing list archive at Nabble.com.

Re: Principal in EJB returns always "guest" even with JAAS module

Posted by Olivier Paquet <ol...@atos.net>.
Ok strange, I tested it with the new TomEE 1.7.0 plus but I still got guest,
and you just configured it as I described in my Email or is there something
I forgot? 



--
View this message in context: http://tomee-openejb.979440.n4.nabble.com/Principal-in-EJB-returns-always-guest-even-with-JAAS-module-tp4670862p4671599.html
Sent from the TomEE Users mailing list archive at Nabble.com.

Re: Principal in EJB returns always "guest" even with JAAS module

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

your sample works in 1.7.0


Romain Manni-Bucau
Twitter: @rmannibucau
Blog: http://rmannibucau.wordpress.com/
LinkedIn: http://fr.linkedin.com/in/rmannibucau
Github: https://github.com/rmannibucau


2014-09-04 11:08 GMT+02:00 Olivier Paquet <ol...@atos.net>:
> I also uploaded the both war files ;)
>
> ejb-remote.war
> <http://tomee-openejb.979440.n4.nabble.com/file/n4671592/ejb-remote.war>
>
> and  ejb-client.war
> <http://tomee-openejb.979440.n4.nabble.com/file/n4671592/ejb-client.war>
>
>
>
> --
> View this message in context: http://tomee-openejb.979440.n4.nabble.com/Principal-in-EJB-returns-always-guest-even-with-JAAS-module-tp4670862p4671592.html
> Sent from the TomEE Users mailing list archive at Nabble.com.

Re: Principal in EJB returns always "guest" even with JAAS module

Posted by Olivier Paquet <ol...@atos.net>.
I also uploaded the both war files ;)

ejb-remote.war
<http://tomee-openejb.979440.n4.nabble.com/file/n4671592/ejb-remote.war>  

and  ejb-client.war
<http://tomee-openejb.979440.n4.nabble.com/file/n4671592/ejb-client.war>  



--
View this message in context: http://tomee-openejb.979440.n4.nabble.com/Principal-in-EJB-returns-always-guest-even-with-JAAS-module-tp4670862p4671592.html
Sent from the TomEE Users mailing list archive at Nabble.com.