Did you try a redirect?
Le 6 juil. 2012 18:56, "Thiago Veronezi" <[email protected]> a écrit :

> Hi,
>
> I think something is wrong.
>
>
> http://svn.apache.org/repos/asf/openejb/trunk/openejb/examples/cdi-ejbcontext-jaas/
>
> This example does exactly what I am trying to do, but...
>
> http://localhost:8080/cdi-ejbcontext-jaas/ejbcontext
>
> ... returns "guest".
>
> []s,
> Thiago.
>
>
>
> On Fri, Jul 6, 2012 at 12:22 PM, Romain Manni-Bucau
> <[email protected]>wrote:
>
> > sounds familiar (already answered i guess)
> >
> > make a redirection after the login
> >
> > - Romain
> >
> >
> > 2012/7/6 Thiago Veronezi <[email protected]>
> >
> > > Hi guys!
> > >
> > > I am trying to handle the user "login" in a programmatic way.
> > >
> > > The command bellow is called by a Servlet...
> > >
> > > *************************************
> > > public class Login implements Command {
> > >
> > >     @Override
> > >     public Object execute(Params params) throws Exception {
> > >         final String user = params.getString("userName");
> > >         final String password = params.getString("userPassword");
> > >         params.getReq().login(user, password);
> > >         return null;
> > >     }
> > > }
> > > *************************************
> > >
> > > This is fine. I manage to login. The problem is that at the EJB side
> the
> > > Principal is still the "guest" user. See the EJB code below...
> > >
> > > *************************************
> > >     @Override
> > >     public Map<String, Object> getSystemStatus() {
> > >         final Map<String, Object> result = new HashMap<String,
> Object>();
> > >
> > >         result.put("isAdmin", this.context.isCallerInRole("admin"));
> > >         result.put("isUser", this.context.isCallerInRole("user"));
> > >         result.put("userName",
> > > this.context.getCallerPrincipal().getName());
> > >         result.put("currentDraw", getCurrentDraw());
> > >
> > >         return result;
> > >     }
> > > *************************************
> > >
> > > I have a feeling that Tomee does not manage manual logins like the one
> > > above. Can you guys give me a hint of where should I find this
> > integration
> > > code?
> > >
> > > []s,
> > >
> > > Thiago.
> > >
> >
>

Reply via email to