in fact it works fine...for a single request the security context scope is the request.
i'll update back the sample to make it working the question now is do we want to use the session (request.getSessionInternal) or not? looking the javadoc doesnt help a lot since the login simply valid the username/password but doesnt deal with persistence or not For me the behavior is fine (the storing is to do by the user) wdyt? - Romain 2012/7/7 Romain Manni-Bucau <[email protected]> > hmm it was working when i commited the sample, > > maybe check with another tomcat version > > i'll work on it on monday > > - Romain > > > > 2012/7/7 Thiago Veronezi <[email protected]> > >> Update: Not our issue! :O) >> http://tomcat.10.n6.nabble.com/request-login-not-persistent-td4687840.html >> >> []s, >> Thiago. >> >> On Fri, Jul 6, 2012 at 5:11 PM, Thiago Veronezi <[email protected]> >> wrote: >> >> > I confirm that TomEERealm is being used. >> > Man... this is hard to debug! :) >> > >> > >> > On Fri, Jul 6, 2012 at 4:26 PM, Romain Manni-Bucau < >> [email protected]>wrote: >> > >> >> seems you are right...not sure what happened :( >> >> >> >> dont have time until next week to look it but TomEERealm should be >> used to >> >> do it >> >> >> >> - Romain >> >> >> >> >> >> 2012/7/6 Thiago Veronezi <[email protected]> >> >> >> >> > Hi, >> >> > >> >> > the same problem. >> >> > >> >> > >> >> > On Fri, Jul 6, 2012 at 2:24 PM, Romain Manni-Bucau < >> >> [email protected] >> >> > >wrote: >> >> > >> >> > > 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. >> >> > > > > > > > > > > > >> >> > > > > > > > > > > >> >> > > > > > > > > > >> >> > > > > > > > > >> >> > > > > > > > >> >> > > > > > > >> >> > > > > > >> >> > > > > >> >> > > > >> >> > > >> >> > >> >> >> > >> > >> > >
