Use tomee trunk Le 6 juil. 2012 20:11, "Thiago Veronezi" <[email protected]> a écrit :
> the server here: > > http://www.apache.org/dyn/closer.cgi/openejb/openejb-4.0.0/apache-tomee-1.0.0-plus.tar.gz > the example here: > > http://svn.apache.org/repos/asf/openejb/trunk/openejb/examples/cdi-ejbcontext-jaas/ > > > On Fri, Jul 6, 2012 at 1:49 PM, Romain Manni-Bucau <[email protected] > >wrote: > > > Trunk? > > Le 6 juil. 2012 19:47, "Thiago Veronezi" <[email protected]> a écrit : > > > > > >>The sample was working > > > > > > Not for me. Now we can call the servlet this way... > > > > > > > > > http://localhost:8080/cdi-ejbcontext-jaas/ejbcontext?myUser=tomcat&myPass=tomcat > > > and it should redirect to the > > > http://localhost:8080/cdi-ejbcontext-jaas/user in > > > case of a successful login. > > > > > > >>is your realm the first one in server.xml > > > This is a brand new tomee from our download page. I just downloaded it > > and > > > drop the "cdi-ejbcontext-jaas.war". I was expecting to use the regular > > > "tomcat-users.xml". > > > > > > > > > > > > On Fri, Jul 6, 2012 at 1:28 PM, Romain Manni-Bucau < > > [email protected] > > > >wrote: > > > > > > > The sample was working, is your realm the first one in server.xml? > > > > > > > > Maybe check TomEERealm is added in TomcatSecurityService and used at > > > login > > > > time. > > > > Le 6 juil. 2012 19:26, "Thiago Veronezi" <[email protected]> a > > écrit : > > > > > > > > > Yeap.... same thing. > > > > > I just updated the example. > > > > > > > > > > Thanks! > > > > > > > > > > > > > > > On Fri, Jul 6, 2012 at 1:05 PM, Romain Manni-Bucau < > > > > [email protected] > > > > > >wrote: > > > > > > > > > > > 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. > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > >
