Hi
here is a sample initial context init:
final Context context = new InitialContext(new Properties() {{
put(Context.INITIAL_CONTEXT_FACTORY,
"org.apache.openejb.client.RemoteInitialContextFactory);
put(Context.PROVIDER_URL, "http://localhost:8080/tomee/ejb");
put("java.naming.security.principal", "foo");
put("java.naming.security.credentials", "bar");
put("openejb.authentication.realmName", "FooBar");
put("openejb.ejbd.authenticate-with-request", "true");
}});
Maybe you forget realmName property and then use the default realm?
Romain Manni-Bucau
Twitter: @rmannibucau
Blog: http://rmannibucau.wordpress.com/
LinkedIn: http://fr.linkedin.com/in/rmannibucau
Github: https://github.com/rmannibucau
2014-08-06 16:18 GMT+02:00 Jean-Louis Monteiro <[email protected]>:
> Can you provide us with the InitialContext creation?
>
> You should do before calling new InitialContext (...)
> And provide some properties.
>
> Jean-Louis
>
> --
> Jean-Louis Monteiro
> http://twitter.com/jlouismonteiro
> http://www.tomitribe.com
>
>
> On Wed, Aug 6, 2014 at 4:12 PM, Olivier Paquet <[email protected]>
> wrote:
>
>> Hi,
>>
>> Unfortunately even when following the way of other solutions found on this
>> forum, using JAAS or putting
>> p.put("openejb.ejbd.authenticate-with-request",
>> "true"); in remote lookup properties, I'm getting always the principal
>> "guest" in my EJB using EJBContext.getCallerPrincipal().
>>
>> I use the TomEE 1.7.0-SNAPSHOT version and I defined the JAAS module a
>> mentionned here
>> (http://rmannibucau.wordpress.com/2012/05/09/tomee-and-its-ssh-connector/)
>> ,
>> before I tried the JDBCRealm and so on, but result is still the same ->
>> guest
>>
>> I'm calling my remote EJB as follow:
>>
>>
>> It always works fine, I could see in the console(with JDBCRealm and
>> DatasourceRealm) that the correct EJB User has been authenticated, but in
>> my
>> EJB the user is always guest and my @RolesAllowed does not work.
>>
>> Any hints how to solve this issue?
>>
>>
>> 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-tp4670862.html
>> Sent from the TomEE Users mailing list archive at Nabble.com.
>>