You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomee.apache.org by José Luis Cetina <ma...@gmail.com> on 2012/05/31 20:14:26 UTC

Guest user

Hi i have this scenario:

I have a page login.xhtml, this page has a ManagedBean (@Named) this
managedbean use the request.login(user,pass) method.

When i do this:

managedbean class:

@Resource
private EJBContext ejbContext;
.
.
request.login(user,pass);
String name = ejbContext.getCallerPrincipal().getName();

I get "guest" as my user name. But i expect the name of my user (of course
is not guest)

If the login was successful my login page navigate to other page lets say
pageb.xhtml

If i create a managedbean (@Named) for pageb.xhtml and in that managedbean
i use again:
String name = ejbContext.getCallerPrincipal().getName();
then, here i get my "correct" name of the user (not guest).

I dont know if this is the desire behaviour or if this happend because the
http request isnt finished?

other question why if i call
the  ejbContext.getCallerPrincipal().getName(); before the request.login()
method i get again "guest", why not null?

If this question is for tomee(openejb) or tomcat?

Thanks


-------------------------------------------------------------------
*SCJA. José Luis Cetina*
-------------------------------------------------------------------

RE: Guest user

Posted by Robin <ro...@gmail.com>.
Please Remove me from the e-mail list.
Thank You
Robin

-----Original Message-----
From: José Luis Cetina [mailto:maxtorzito@gmail.com] 
Sent: Thursday, June 14, 2012 7:46 PM
To: users@openejb.apache.org
Subject: Re: Guest user

Hi Romain, well i have an other problem and i think is related to this same
reported issue.

We talked about if i login using request.login(user,pass) method and if the
credentials and login was successfull then when i get the user i get a guess
user:

request.login(user,pass);
String name = ejbContext.getCallerPrincipal().getName();

Ok, then this was fixed, and its ok now, now returns the valid user.

But now if i do this

@Inject
private MySessionBean mySessionBean;

public String login(){
   request.login(user,pass);
   mySessionBean.setName("My name is JOE");
   //then i do a redirect here
 return "next_page";
}

now in my managedbean of my next_page.xhtml i had:

@Named
public MyNextPageMBean implements Serializable{

@Inject
private MySessionBean mySessionBean;

 @PostConstruc
  public void test(){
    mySessionBean.getName(); <---HERE I GET NULL ALWAYS
   }

}


SessionBean:

import java.io.Serializable;
import javax.enterprise.context.SessionScoped;
import javax.inject.Named;

@Named
@SessionScoped
public class MySessionBean implements Serializable{

    private String name;

    public MySessionBean() {

    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }
}



As you can see i get null, mi login its ok, but when i saved something in my
sessionbean when i try to retrive what i saved before, i always get null,
like if i never set the value (and of course i did it) but this ONLY HAPPEND
when i try to set the any value just before request.login, if i set the
value in the second bean  like

mySessionBean.setName("My name is JOE"); then in other's page i can get the
value without any problem, i do a lot of test and the problem is when i only
set the values (in my session bean) just before request.login, then i
associated this with the "guest user problem" as you sayed this was
happening because the user was "recognized" only after the first request.

Again, is this the expected behaviour? it seem buggy

Im using:  apache-tomee-1.1.0-20120612.040829-22-webprofile


2012/6/1 José Luis Cetina <ma...@gmail.com>

> ok
>
>
> 2012/6/1 Romain Manni-Bucau <rm...@gmail.com>
>
>> deployment in progress:
>> http://ci.apache.org/builders/openejb-trunk-deploy/builds/378
>>
>> - Romain
>>
>>
>> 2012/6/1 José Luis Cetina <ma...@gmail.com>
>>
>> > Ok, in what tomee build this will be available?
>> >
>> > 2012/5/31 Romain Manni-Bucau <rm...@gmail.com>
>> >
>> > > yep
>> > >
>> > > just commited, a new commit will come where this class will
>> automatically
>> > > be added normally
>> > >
>> > > - Romain
>> > >
>> > >
>> > > 2012/6/1 José Luis Cetina <ma...@gmail.com>
>> > >
>> > > > im getting a ClassNotFound
>> > > >
>> > > > Caused by: java.lang.ClassNotFoundException:
>> > > > org.apache.tomee.catalina.TomEERealm
>> > > >
>> > > > 2012/5/31 Romain Manni-Bucau <rm...@gmail.com>
>> > > >
>> > > > > my sample is working, too late to add test but manually it 
>> > > > > works
>> > > > >
>> > > > > so i guess it should work for you
>> > > > >
>> > > > > the question now is should we add it automatically?
>> > > > >
>> > > > > - Romain
>> > > > >
>> > > > >
>> > > > > 2012/6/1 José Luis Cetina <ma...@gmail.com>
>> > > > >
>> > > > > > Oooh great, with this i can get the principal user in the 
>> > > > > > first
>> > > > request?
>> > > > > or
>> > > > > > this is something that you gonna fix?
>> > > > > >
>> > > > > > 2012/5/31 Romain Manni-Bucau <rm...@gmail.com>
>> > > > > >
>> > > > > > > that's brand new ;)
>> > > > > > >
>> > > > > > > just added it, it mainly delegate to the real realm but 
>> > > > > > > add
>> the
>> > > > > principal
>> > > > > > > info to openejb/tomee security service which is used in
>> > ejbcontext
>> > > > impl
>> > > > > > (to
>> > > > > > > make it short)
>> > > > > > >
>> > > > > > > - Romain
>> > > > > > >
>> > > > > > >
>> > > > > > > 2012/6/1 José Luis Cetina <ma...@gmail.com>
>> > > > > > >
>> > > > > > > > I have this in my context.xml
>> > > > > > > >
>> > > > > > > > <Realm className="MyExtendedDataSourceRealm"
>> > > > > > > >  dataSourceName="MyDataSource"
>> > > > > > > > digest="SHA-256"
>> > > > > > > > encodePassword="Base64"
>> > > > > > > > queryRealmRolesUser="SELECT rol FROM xxxx WHERE user=?"
>> > > > > > > > queryRealmUsers="SELECT pass FROM xxx WHERE user=?"/>
>> > > > > > > >
>> > > > > > > > As you can see i extend the datasource realm, i have 
>> > > > > > > > this
>> realm
>> > > > > config
>> > > > > > in
>> > > > > > > > the context.xml in my webapp (not context.xml TomEE).
>> > > > > > > >
>> > > > > > > > But, as i can see in your example, you surround your 
>> > > > > > > > realm
>> with
>> > > > > > > TomEERealm,
>> > > > > > > > if this necessary?. I didn't know this
>> > > > > > > >
>> > > > > > > >
>> > > > > > > >
>> > > > > > > > 2012/5/31 Romain Manni-Bucau <rm...@gmail.com>
>> > > > > > > >
>> > > > > > > > > in my test i used:
>> > > > > > > > >
>> > > > > > > > >    <Realm
>> className="org.apache.tomee.catalina.TomEERealm">
>> > > > > > > > >        <Realm
>> className="org.apache.catalina.realm.JAASRealm"
>> > > > > > > > > appName="PropertiesLoginModule"
>> > > > > > > > >
>> > > > > > > > >
>> > > > > > > > >
>> > > > > > > >
>> > > > > > >
>> > > > > >
>> > > > >
>> > > >
>> > >
>> >
>>
userClassNames="org.apache.openejb.core.security.AbstractSecurityService$Use
r"
>> > > > > > > > >
>> > > > > > > > >
>> > > > > > > > >
>> > > > > > > >
>> > > > > > >
>> > > > > >
>> > > > >
>> > > >
>> > >
>> >
>>  
>> roleClassNames="org.apache.openejb.core.security.AbstractSecurityServ
>> ice$Group">
>> > > > > > > > >        </Realm>
>> > > > > > > > >       </Realm>
>> > > > > > > > >
>> > > > > > > > > but i guess you can replace the jaasrealm by your 
>> > > > > > > > > dsrealm
>> > > > > > > > >
>> > > > > > > > > - Romain
>> > > > > > > > >
>> > > > > > > > >
>> > > > > > > > > 2012/6/1 José Luis Cetina <ma...@gmail.com>
>> > > > > > > > >
>> > > > > > > > > > Yes, it seems buggy.
>> > > > > > > > > >
>> > > > > > > > > > Where i have to replace?
>> > > > > > > > > >
>> > > > > > > > > > Remember im using DataSourceRealm
>> > > > > > > > > >
>> > > > > > > > > > 2012/5/31 Romain Manni-Bucau 
>> > > > > > > > > > <rm...@gmail.com>
>> > > > > > > > > >
>> > > > > > > > > > > this is the current status,
>> > > > > > > > > > >
>> > > > > > > > > > > but IMO it is buggy,
>> > > > > > > > > > >
>> > > > > > > > > > > i'll commit soon a TomEEJAASRealm to make it 
>> > > > > > > > > > > working
>> > > (replace
>> > > > > > > > JAASRealm
>> > > > > > > > > > in
>> > > > > > > > > > > the conf)
>> > > > > > > > > > >
>> > > > > > > > > > > - Romain
>> > > > > > > > > > >
>> > > > > > > > > > >
>> > > > > > > > > > > 2012/6/1 José Luis Cetina <ma...@gmail.com>
>> > > > > > > > > > >
>> > > > > > > > > > > > i think we are getting confused.
>> > > > > > > > > > > >
>> > > > > > > > > > > > If i resume all, this what i asked (the final 
>> > > > > > > > > > > > of the
>> > > first
>> > > > > > post)
>> > > > > > > > > > > >
>> > > > > > > > > > > > I dont know if this is the desire behavior or 
>> > > > > > > > > > > > if
>> this
>> > > > happend
>> > > > > > > > becase
>> > > > > > > > > > the
>> > > > > > > > > > > > httr request isnt finished?
>> > > > > > > > > > > > Then you answer me:
>> > > > > > > > > > > >
>> > > > > > > > > > > > in fact info from ejbcontext are taken in our
>> > > > securitymodule
>> > > > > > > > > > > >
>> > > > > > > > > > > > in tomee we set/unset it from a valve so at the
>> > > > beginning/end
>> > > > > > of
>> > > > > > > > the
>> > > > > > > > > > > > request...all between is currently ignored so 
>> > > > > > > > > > > > when
>> you
>> > > log
>> > > > > you
>> > > > > > > need
>> > > > > > > > > > > another
>> > > > > > > > > > > > request to get the updated information (from 
>> > > > > > > > > > > > the
>> tomcat
>> > > > > realm)
>> > > > > > > > > > > >
>> > > > > > > > > > > > "so when you log you need another request to 
>> > > > > > > > > > > > get the
>> > > > updated
>> > > > > > > > > > information
>> > > > > > > > > > > > (from the tomcat realm)
>> > > > > > > > > > > >
>> > > > > > > > > > > > Then i get guest because is the desire 
>> > > > > > > > > > > > behaviour,
>> after
>> > > the
>> > > > > > first
>> > > > > > > > > > > request i
>> > > > > > > > > > > > can get the user i expected.
>> > > > > > > > > > > >
>> > > > > > > > > > > > Then i resume, this is the default behaviour, 
>> > > > > > > > > > > > and
>> works
>> > > but
>> > > > > you
>> > > > > > > > need
>> > > > > > > > > a
>> > > > > > > > > > > > second request.
>> > > > > > > > > > > >
>> > > > > > > > > > > >
>> > > > > > > > > > > >
>> > > > > > > > > > > > 2012/5/31 Romain Manni-Bucau 
>> > > > > > > > > > > > <rmannibucau@gmail.com
>> >
>> > > > > > > > > > > >
>> > > > > > > > > > > > > i think it should work
>> > > > > > > > > > > > >
>> > > > > > > > > > > > > - Romain
>> > > > > > > > > > > > >
>> > > > > > > > > > > > >
>> > > > > > > > > > > > > 2012/6/1 José Luis Cetina 
>> > > > > > > > > > > > > <ma...@gmail.com>
>> > > > > > > > > > > > >
>> > > > > > > > > > > > > > I mean this:
>> > > > > > > > > > > > > >
>> > > > > > > > > > > > > > I dont know if this is the desire behaviour 
>> > > > > > > > > > > > > > or
>> if
>> > > this
>> > > > > > > happend
>> > > > > > > > > > > because
>> > > > > > > > > > > > > the
>> > > > > > > > > > > > > > http request isnt finished?
>> > > > > > > > > > > > > >
>> > > > > > > > > > > > > >
>> > > > > > > > > > > > > >
>> > > > > > > > > > > > > > 2012/5/31 José Luis Cetina <
>> maxtorzito@gmail.com>
>> > > > > > > > > > > > > >
>> > > > > > > > > > > > > > > Ok, the what i asked is correct??
>> > > > > > > > > > > > > > >
>> > > > > > > > > > > > > > > "I dont know if this is the desire 
>> > > > > > > > > > > > > > > behaviour
>> or
>> > if
>> > > > this
>> > > > > > > > happend
>> > > > > > > > > > > > because
>> > > > > > > > > > > > > > > the http request isnt finished?"
>> > > > > > > > > > > > > > >
>> > > > > > > > > > > > > > > 2012/5/31 Romain Manni-Bucau <
>> > > rmannibucau@gmail.com>
>> > > > > > > > > > > > > > >
>> > > > > > > > > > > > > > >> ok,
>> > > > > > > > > > > > > > >>
>> > > > > > > > > > > > > > >> in fact info from ejbcontext are taken 
>> > > > > > > > > > > > > > >> in our
>> > > > > > > securitymodule
>> > > > > > > > > > > > > > >>
>> > > > > > > > > > > > > > >> in tomee we set/unset it from a valve so 
>> > > > > > > > > > > > > > >> at
>> the
>> > > > > > > > beginning/end
>> > > > > > > > > of
>> > > > > > > > > > > the
>> > > > > > > > > > > > > > >> request...all between is currently 
>> > > > > > > > > > > > > > >> ignored so
>> > when
>> > > > you
>> > > > > > log
>> > > > > > > > you
>> > > > > > > > > > > need
>> > > > > > > > > > > > > > >> another
>> > > > > > > > > > > > > > >> request to get the updated information 
>> > > > > > > > > > > > > > >> (from
>> the
>> > > > > tomcat
>> > > > > > > > realm)
>> > > > > > > > > > > > > > >>
>> > > > > > > > > > > > > > >> - Romain
>> > > > > > > > > > > > > > >>
>> > > > > > > > > > > > > > >>
>> > > > > > > > > > > > > > >> 2012/6/1 José Luis Cetina <
>> maxtorzito@gmail.com
>> > >
>> > > > > > > > > > > > > > >>
>> > > > > > > > > > > > > > >> > Yes, it work
>> > > > > > > > > > > > > > >> >
>> > > > > > > > > > > > > > >> > 1) Login (form login) using 
>> > > > > > > > > > > > > > >> > DataSourceRealm
>> > > > > > > > > > > > > > >> >
>> > > > > > > > > > > > > > >> >
>> > > > > > > > > > > > > > >> > 2) Redirect to page2 from my 
>> > > > > > > > > > > > > > >> > managedbean
>> > > > > > > > > > > > > > >> >
>> > > > > > > > > > > > > > >> > 2012/5/31 Romain Manni-Bucau <
>> > > > rmannibucau@gmail.com
>> > > > > >
>> > > > > > > > > > > > > > >> >
>> > > > > > > > > > > > > > >> > > so you mean using the flow i 
>> > > > > > > > > > > > > > >> > > described
>> > before
>> > > it
>> > > > > > > works?
>> > > > > > > > > > > (sorry,
>> > > > > > > > > > > > > just
>> > > > > > > > > > > > > > >> to
>> > > > > > > > > > > > > > >> > be
>> > > > > > > > > > > > > > >> > > sure to understand)
>> > > > > > > > > > > > > > >> > >
>> > > > > > > > > > > > > > >> > > - Romain
>> > > > > > > > > > > > > > >> > >
>> > > > > > > > > > > > > > >> > >
>> > > > > > > > > > > > > > >> > > 2012/6/1 José Luis Cetina <
>> > > maxtorzito@gmail.com
>> > > > >
>> > > > > > > > > > > > > > >> > >
>> > > > > > > > > > > > > > >> > > > Hi i can login and i can navigate
>> > (redirect)
>> > > > to
>> > > > > my
>> > > > > > > > other
>> > > > > > > > > > > page,
>> > > > > > > > > > > > > > but i
>> > > > > > > > > > > > > > >> > dont
>> > > > > > > > > > > > > > >> > > > know why im getting guest user in 
>> > > > > > > > > > > > > > >> > > > the
>> > login
>> > > > > mbean,
>> > > > > > > > after
>> > > > > > > > > > > that
>> > > > > > > > > > > > in
>> > > > > > > > > > > > > > >> other
>> > > > > > > > > > > > > > >> > > > mbean  i get my "real" user.
>> > > > > > > > > > > > > > >> > > >
>> > > > > > > > > > > > > > >> > > >
>> > > > > > > > > > > > > > >> > > > 2012/5/31 Romain Manni-Bucau <
>> > > > > > rmannibucau@gmail.com
>> > > > > > > >
>> > > > > > > > > > > > > > >> > > >
>> > > > > > > > > > > > > > >> > > > > maybe
>> > > > > > > > > > > > > > >> > > > >
>> > > > > > > > > > > > > > >> > > >
>> > > > > > > > > > > > > > >> > >
>> > > > > > > > > > > > > > >> >
>> > > > > > > > > > > > > > >>
>> > > > > > > > > > > > > >
>> > > > > > > > > > > > >
>> > > > > > > > > > > >
>> > > > > > > > > > >
>> > > > > > > > > >
>> > > > > > > > >
>> > > > > > > >
>> > > > > > >
>> > > > > >
>> > > > >
>> > > >
>> > >
>> >
>> http://rmannibucau.wordpress.com/2012/05/09/tomee-and-its-ssh-connect
>> or/but
>> > > > > > > > > > > > > > >> > > > > it uses properties file, it just
>> need a
>> > > > custom
>> > > > > > > login
>> > > > > > > > > > > module
>> > > > > > > > > > > > > > >> > > > implementation
>> > > > > > > > > > > > > > >> > > > > to use a db.
>> > > > > > > > > > > > > > >> > > > >
>> > > > > > > > > > > > > > >> > > > > well,
>> > > > > > > > > > > > > > >> > > > >
>> > > > > > > > > > > > > > >> > > > > before can you test it please?
>> > > > > > > > > > > > > > >> > > > > 1) login
>> > > > > > > > > > > > > > >> > > > > 2) redirect to your page using 
>> > > > > > > > > > > > > > >> > > > > your
>> bean
>> > > > > > > > > > > > > > >> > > > >
>> > > > > > > > > > > > > > >> > > > > - Romain
>> > > > > > > > > > > > > > >> > > > >
>> > > > > > > > > > > > > > >> > > > >
>> > > > > > > > > > > > > > >> > > > > 2012/6/1 José Luis Cetina <
>> > > > > maxtorzito@gmail.com
>> > > > > > >
>> > > > > > > > > > > > > > >> > > > >
>> > > > > > > > > > > > > > >> > > > > > I have to read and know how to 
>> > > > > > > > > > > > > > >> > > > > > use
>> > > this, i
>> > > > > > > always
>> > > > > > > > > use
>> > > > > > > > > > > > > > >> DataSource or
>> > > > > > > > > > > > > > >> > > > > > JDBCRealm. (with glassfish).
>> > > > > > > > > > > > > > >> > > > > > im reading now, do you have
>> something
>> > > for
>> > > > a
>> > > > > > > > > > quickstart?
>> > > > > > > > > > > > for
>> > > > > > > > > > > > > > >> share
>> > > > > > > > > > > > > > >> > me
>> > > > > > > > > > > > > > >> > > > > >
>> > > > > > > > > > > > > > >> > > > > > 2012/5/31 Romain Manni-Bucau <
>> > > > > > > > rmannibucau@gmail.com
>> > > > > > > > > >
>> > > > > > > > > > > > > > >> > > > > >
>> > > > > > > > > > > > > > >> > > > > > > having your password in a db 
>> > > > > > > > > > > > > > >> > > > > > > is
>> not
>> > an
>> > > > > issue
>> > > > > > > > but i
>> > > > > > > > > > > think
>> > > > > > > > > > > > > you
>> > > > > > > > > > > > > > >> > should
>> > > > > > > > > > > > > > >> > > > > > > use
>> > > org.apache.catalina.realm.JAASRealm
>> > > > > > > > > > > > > > >> > > > > > >
>> > > > > > > > > > > > > > >> > > > > > > for instance:
>> > > > > > > > > > > > > > >> > > > > > >
>> > > > > > > > > > > > > > >> > > > > > >     <Realm
>> > > > > > > > > > > > className="org.apache.catalina.realm.JAASRealm"
>> > > > > > > > > > > > > > >> > > > > > > appName="MyDBLoginModule"
>> > > > > > > > > > > > > > >> > > > > > >
>> > > > > > > > > > > > > > >> > > > > > >
>> > > > > > > > > > > > > > >> > > > > > >
>> > > > > > > > > > > > > > >> > > > > >
>> > > > > > > > > > > > > > >> > > > >
>> > > > > > > > > > > > > > >> > > >
>> > > > > > > > > > > > > > >> > >
>> > > > > > > > > > > > > > >> >
>> > > > > > > > > > > > > > >>
>> > > > > > > > > > > > > >
>> > > > > > > > > > > > >
>> > > > > > > > > > > >
>> > > > > > > > > > >
>> > > > > > > > > >
>> > > > > > > > >
>> > > > > > > >
>> > > > > > >
>> > > > > >
>> > > > >
>> > > >
>> > >
>> >
>>
userClassNames="org.apache.openejb.core.security.AbstractSecurityService$Use
r"
>> > > > > > > > > > > > > > >> > > > > > >
>> > > > > > > > > > > > > > >> > > > > > >
>> > > > > > > > > > > > > > >> > > > > > >
>> > > > > > > > > > > > > > >> > > > > >
>> > > > > > > > > > > > > > >> > > > >
>> > > > > > > > > > > > > > >> > > >
>> > > > > > > > > > > > > > >> > >
>> > > > > > > > > > > > > > >> >
>> > > > > > > > > > > > > > >>
>> > > > > > > > > > > > > >
>> > > > > > > > > > > > >
>> > > > > > > > > > > >
>> > > > > > > > > > >
>> > > > > > > > > >
>> > > > > > > > >
>> > > > > > > >
>> > > > > > >
>> > > > > >
>> > > > >
>> > > >
>> > >
>> >
>>  
>> roleClassNames="org.apache.openejb.core.security.AbstractSecurityServ
>> ice$Group">
>> > > > > > > > > > > > > > >> > > > > > >      </Realm>
>> > > > > > > > > > > > > > >> > > > > > >
>> > > > > > > > > > > > > > >> > > > > > > so simply implement a custom
>> > > LoginModule
>> > > > > > > instead
>> > > > > > > > > of
>> > > > > > > > > > a
>> > > > > > > > > > > > > realm
>> > > > > > > > > > > > > > >> > > > > > >
>> > > > > > > > > > > > > > >> > > > > > > wdyt?
>> > > > > > > > > > > > > > >> > > > > > >
>> > > > > > > > > > > > > > >> > > > > > > - Romain
>> > > > > > > > > > > > > > >> > > > > > >
>> > > > > > > > > > > > > > >> > > > > > >
>> > > > > > > > > > > > > > >> > > > > > > 2012/6/1 José Luis Cetina <
>> > > > > > > maxtorzito@gmail.com
>> > > > > > > > >
>> > > > > > > > > > > > > > >> > > > > > >
>> > > > > > > > > > > > > > >> > > > > > > > Sorry, i use 
>> > > > > > > > > > > > > > >> > > > > > > > DataSourceRealm, i
>> > have
>> > > > my
>> > > > > > > > > > > > user/pass/roles
>> > > > > > > > > > > > > in
>> > > > > > > > > > > > > > >> the
>> > > > > > > > > > > > > > >> > > DB.
>> > > > > > > > > > > > > > >> > > > > > > >
>> > > > > > > > > > > > > > >> > > > > > > >
>> > > > > > > > > > > > > > >> > > > > > > >
>> > > > > > > > > > > > > > >> > > > > > > > 2012/5/31 Romain 
>> > > > > > > > > > > > > > >> > > > > > > > Manni-Bucau <
>> > > > > > > > > > rmannibucau@gmail.com
>> > > > > > > > > > > >
>> > > > > > > > > > > > > > >> > > > > > > >
>> > > > > > > > > > > > > > >> > > > > > > > > can't you do it with an
>> embedded
>> > > > one?
>> > > > > > > > > > > > > > >> > > > > > > > >
>> > > > > > > > > > > > > > >> > > > > > > > > well DataSourceRealm 
>> > > > > > > > > > > > > > >> > > > > > > > > doesn't
>> use
>> > > > JAAS
>> > > > > by
>> > > > > > > > > > default i
>> > > > > > > > > > > > > > think,
>> > > > > > > > > > > > > > >> > maybe
>> > > > > > > > > > > > > > >> > > > > > that's
>> > > > > > > > > > > > > > >> > > > > > > > the
>> > > > > > > > > > > > > > >> > > > > > > > > issue
>> > > > > > > > > > > > > > >> > > > > > > > >
>> > > > > > > > > > > > > > >> > > > > > > > > - Romain
>> > > > > > > > > > > > > > >> > > > > > > > >
>> > > > > > > > > > > > > > >> > > > > > > > >
>> > > > > > > > > > > > > > >> > > > > > > > > 2012/6/1 José Luis 
>> > > > > > > > > > > > > > >> > > > > > > > > Cetina <
>> > > > > > > > > maxtorzito@gmail.com
>> > > > > > > > > > >
>> > > > > > > > > > > > > > >> > > > > > > > >
>> > > > > > > > > > > > > > >> > > > > > > > > > OK, i can create a 
>> > > > > > > > > > > > > > >> > > > > > > > > > sample,
>> > but i
>> > > > use
>> > > > > > > > > > > > > DataSourceRealm,
>> > > > > > > > > > > > > > >> are
>> > > > > > > > > > > > > > >> > you
>> > > > > > > > > > > > > > >> > > > > gonna
>> > > > > > > > > > > > > > >> > > > > > > > > > configure your database?
>> > > > > > > > > > > > > > >> > > > > > > > > >
>> > > > > > > > > > > > > > >> > > > > > > > > > 2012/5/31 Romain
>> Manni-Bucau <
>> > > > > > > > > > > > rmannibucau@gmail.com
>> > > > > > > > > > > > > >
>> > > > > > > > > > > > > > >> > > > > > > > > >
>> > > > > > > > > > > > > > >> > > > > > > > > > > can you have a try 
>> > > > > > > > > > > > > > >> > > > > > > > > > > in an
>> EJB
>> > > > > please?
>> > > > > > > > (just
>> > > > > > > > > > try
>> > > > > > > > > > > > to
>> > > > > > > > > > > > > > add
>> > > > > > > > > > > > > > >> > > > > @Stateless
>> > > > > > > > > > > > > > >> > > > > > on
>> > > > > > > > > > > > > > >> > > > > > > > > your
>> > > > > > > > > > > > > > >> > > > > > > > > > > managed bean for
>> instance)
>> > > > > > > > > > > > > > >> > > > > > > > > > >
>> > > > > > > > > > > > > > >> > > > > > > > > > > can you share a 
>> > > > > > > > > > > > > > >> > > > > > > > > > > sample
>> easy
>> > to
>> > > > > run?
>> > > > > > > > > > > > > > >> > > > > > > > > > >
>> > > > > > > > > > > > > > >> > > > > > > > > > > - Romain
>> > > > > > > > > > > > > > >> > > > > > > > > > >
>> > > > > > > > > > > > > > >> > > > > > > > > > >
>> > > > > > > > > > > > > > >> > > > > > > > > > > 2012/6/1 José Luis
>> Cetina <
>> > > > > > > > > > > maxtorzito@gmail.com
>> > > > > > > > > > > > >
>> > > > > > > > > > > > > > >> > > > > > > > > > >
>> > > > > > > > > > > > > > >> > > > > > > > > > > > Yes, im using JAAS
>> > > > > > > > > > > > > > >> > > > > > > > > > > >
>> > > > > > > > > > > > > > >> > > > > > > > > > > > 2012/5/31 Romain
>> > > Manni-Bucau <
>> > > > > > > > > > > > > > rmannibucau@gmail.com
>> > > > > > > > > > > > > > >> >
>> > > > > > > > > > > > > > >> > > > > > > > > > > >
>> > > > > > > > > > > > > > >> > > > > > > > > > > > > Hi,
>> > > > > > > > > > > > > > >> > > > > > > > > > > > >
>> > > > > > > > > > > > > > >> > > > > > > > > > > > > Do you use jaas?
>> > > > > > > > > > > > > > >> > > > > > > > > > > > >
>> > > > > > > > > > > > > > >> > > > > > > > > > > > > - Romain Le 31 
>> > > > > > > > > > > > > > >> > > > > > > > > > > > > mai 2012 20:14,
>> > > "José
>> > > > > Luis
>> > > > > > > > > > Cetina" <
>> > > > > > > > > > > > > > >> > > > > > maxtorzito@gmail.com
>> > > > > > > > > > > > > > >> > > > > > > >
>> > > > > > > > > > > > > > >> > > > > > > > a
>> > > > > > > > > > > > > > >> > > > > > > > > > > écrit
>> > > > > > > > > > > > > > >> > > > > > > > > > > > :
>> > > > > > > > > > > > > > >> > > > > > > > > > > > >
>> > > > > > > > > > > > > > >> > > > > > > > > > > > > > Hi i have this
>> > scenario:
>> > > > > > > > > > > > > > >> > > > > > > > > > > > > >
>> > > > > > > > > > > > > > >> > > > > > > > > > > > > > I have a page
>> > > login.xhtml,
>> > > > > > this
>> > > > > > > > page
>> > > > > > > > > > > has a
>> > > > > > > > > > > > > > >> > > ManagedBean
>> > > > > > > > > > > > > > >> > > > > > > (@Named)
>> > > > > > > > > > > > > > >> > > > > > > > > > this
>> > > > > > > > > > > > > > >> > > > > > > > > > > > > > managedbean 
>> > > > > > > > > > > > > > >> > > > > > > > > > > > > > use the
>> > > > > > > > > > > > request.login(user,pass)
>> > > > > > > > > > > > > > >> > method.
>> > > > > > > > > > > > > > >> > > > > > > > > > > > > >
>> > > > > > > > > > > > > > >> > > > > > > > > > > > > > When i do this:
>> > > > > > > > > > > > > > >> > > > > > > > > > > > > >
>> > > > > > > > > > > > > > >> > > > > > > > > > > > > > managedbean class:
>> > > > > > > > > > > > > > >> > > > > > > > > > > > > >
>> > > > > > > > > > > > > > >> > > > > > > > > > > > > > @Resource 
>> > > > > > > > > > > > > > >> > > > > > > > > > > > > > private 
>> > > > > > > > > > > > > > >> > > > > > > > > > > > > > EJBContext
>> > > > > ejbContext;
>> > > > > > > > > > > > > > >> > > > > > > > > > > > > > .
>> > > > > > > > > > > > > > >> > > > > > > > > > > > > > .
>> > > > > > > > > > > > > > >> > > > > > > > > > > > > >
>> > > request.login(user,pass);
>> > > > > > > > > > > > > > >> > > > > > > > > > > > > > String name =
>> > > > > > > > > > > > > > >> > > >
>> ejbContext.getCallerPrincipal().getName();
>> > > > > > > > > > > > > > >> > > > > > > > > > > > > >
>> > > > > > > > > > > > > > >> > > > > > > > > > > > > > I get "guest" 
>> > > > > > > > > > > > > > >> > > > > > > > > > > > > > as my
>> > user
>> > > > > name.
>> > > > > > > > But i
>> > > > > > > > > > > > expect
>> > > > > > > > > > > > > > the
>> > > > > > > > > > > > > > >> > name
>> > > > > > > > > > > > > > >> > > of
>> > > > > > > > > > > > > > >> > > > > my
>> > > > > > > > > > > > > > >> > > > > > > user
>> > > > > > > > > > > > > > >> > > > > > > > > (of
>> > > > > > > > > > > > > > >> > > > > > > > > > > > > course
>> > > > > > > > > > > > > > >> > > > > > > > > > > > > > is not guest)
>> > > > > > > > > > > > > > >> > > > > > > > > > > > > >
>> > > > > > > > > > > > > > >> > > > > > > > > > > > > > If the login 
>> > > > > > > > > > > > > > >> > > > > > > > > > > > > > was
>> > > > successful
>> > > > > my
>> > > > > > > > login
>> > > > > > > > > > > page
>> > > > > > > > > > > > > > >> navigate
>> > > > > > > > > > > > > > >> > to
>> > > > > > > > > > > > > > >> > > > > other
>> > > > > > > > > > > > > > >> > > > > > > > page
>> > > > > > > > > > > > > > >> > > > > > > > > > lets
>> > > > > > > > > > > > > > >> > > > > > > > > > > > say
>> > > > > > > > > > > > > > >> > > > > > > > > > > > > > pageb.xhtml
>> > > > > > > > > > > > > > >> > > > > > > > > > > > > >
>> > > > > > > > > > > > > > >> > > > > > > > > > > > > > If i create a
>> > > managedbean
>> > > > > > > (@Named)
>> > > > > > > > > for
>> > > > > > > > > > > > > > >> pageb.xhtml
>> > > > > > > > > > > > > > >> > > and
>> > > > > > > > > > > > > > >> > > > in
>> > > > > > > > > > > > > > >> > > > > > > that
>> > > > > > > > > > > > > > >> > > > > > > > > > > > > managedbean
>> > > > > > > > > > > > > > >> > > > > > > > > > > > > > i use again:
>> > > > > > > > > > > > > > >> > > > > > > > > > > > > > String name =
>> > > > > > > > > > > > > > >> > > >
>> ejbContext.getCallerPrincipal().getName();
>> > > > > > > > > > > > > > >> > > > > > > > > > > > > > then, here i 
>> > > > > > > > > > > > > > >> > > > > > > > > > > > > > get my
>> > > > > "correct"
>> > > > > > > name
>> > > > > > > > > of
>> > > > > > > > > > > the
>> > > > > > > > > > > > > user
>> > > > > > > > > > > > > > >> (not
>> > > > > > > > > > > > > > >> > > > > guest).
>> > > > > > > > > > > > > > >> > > > > > > > > > > > > >
>> > > > > > > > > > > > > > >> > > > > > > > > > > > > > I dont know if
>> this is
>> > > the
>> > > > > > > desire
>> > > > > > > > > > > > behaviour
>> > > > > > > > > > > > > or
>> > > > > > > > > > > > > > >> if
>> > > > > > > > > > > > > > >> > > this
>> > > > > > > > > > > > > > >> > > > > > > happend
>> > > > > > > > > > > > > > >> > > > > > > > > > > because
>> > > > > > > > > > > > > > >> > > > > > > > > > > > > the
>> > > > > > > > > > > > > > >> > > > > > > > > > > > > > http request 
>> > > > > > > > > > > > > > >> > > > > > > > > > > > > > isnt
>> > > > finished?
>> > > > > > > > > > > > > > >> > > > > > > > > > > > > >
>> > > > > > > > > > > > > > >> > > > > > > > > > > > > > other question 
>> > > > > > > > > > > > > > >> > > > > > > > > > > > > > why
>> if
>> > i
>> > > > call
>> > > > > > > > > > > > > > >> > > > > > > > > > > > > > the
>> > > > > > > > > > > > > >  ejbContext.getCallerPrincipal().getName();
>> > > > > > > > > > > > > > >> > > before
>> > > > > > > > > > > > > > >> > > > > the
>> > > > > > > > > > > > > > >> > > > > > > > > > > > > request.login()
>> > > > > > > > > > > > > > >> > > > > > > > > > > > > > method i get 
>> > > > > > > > > > > > > > >> > > > > > > > > > > > > > again
>> > > > "guest",
>> > > > > > why
>> > > > > > > > not
>> > > > > > > > > > > null?
>> > > > > > > > > > > > > > >> > > > > > > > > > > > > >
>> > > > > > > > > > > > > > >> > > > > > > > > > > > > > If this 
>> > > > > > > > > > > > > > >> > > > > > > > > > > > > > question is
>> > for
>> > > > > > > > > tomee(openejb)
>> > > > > > > > > > > or
>> > > > > > > > > > > > > > >> tomcat?
>> > > > > > > > > > > > > > >> > > > > > > > > > > > > >
>> > > > > > > > > > > > > > >> > > > > > > > > > > > > > Thanks
>> > > > > > > > > > > > > > >> > > > > > > > > > > > > >
>> > > > > > > > > > > > > > >> > > > > > > > > > > > > >
>> > > > > > > > > > > > > > >> > > > > > > > > > > > > >
>> > > > > > > > > > > > > > >> > > > > > > > >
>> > > > > > > > > > > > > > >> > > >
>> > > > > > > > > > > > > >
>> > > > > > > > >
>> > > > ---------------------------------------------------------------
>> > > > ----
>> > > > > > > > > > > > > > >> > > > > > > > > > > > > > *SCJA. José 
>> > > > > > > > > > > > > > >> > > > > > > > > > > > > > Luis
>> > Cetina*
>> > > > > > > > > > > > > > >> > > > > > > > > > > > > >
>> > > > > > > > > > > > > > >> > > > > > > > >
>> > > > > > > > > > > > > > >> > > >
>> > > > > > > > > > > > > >
>> > > > > > > > >
>> > > > ---------------------------------------------------------------
>> > > > ----
>> > > > > > > > > > > > > > >> > > > > > > > > > > > > >
>> > > > > > > > > > > > > > >> > > > > > > > > > > > >
>> > > > > > > > > > > > > > >> > > > > > > > > > > >
>> > > > > > > > > > > > > > >> > > > > > > > > > > >
>> > > > > > > > > > > > > > >> > > > > > > > > > > >
>> > > > > > > > > > > > > > >> > > > > > > > > > > > --
>> > > > > > > > > > > > > > >> > > > > > > > > > > >
>> > > > > > > > > > > > > > >> > > > > > >
>> > > > > > > > > > > > > > >> >
>> > > > > > > > > > > >
>> > > > > > >
>> > -------------------------------------------------------------------
>> > > > > > > > > > > > > > >> > > > > > > > > > > > *SCJA. José Luis
>> Cetina*
>> > > > > > > > > > > > > > >> > > > > > > > > > > >
>> > > > > > > > > > > > > > >> > > > > > >
>> > > > > > > > > > > > > > >> >
>> > > > > > > > > > > >
>> > > > > > >
>> > -------------------------------------------------------------------
>> > > > > > > > > > > > > > >> > > > > > > > > > > >
>> > > > > > > > > > > > > > >> > > > > > > > > > >
>> > > > > > > > > > > > > > >> > > > > > > > > >
>> > > > > > > > > > > > > > >> > > > > > > > > >
>> > > > > > > > > > > > > > >> > > > > > > > > >
>> > > > > > > > > > > > > > >> > > > > > > > > > --
>> > > > > > > > > > > > > > >> > > > > > > > > >
>> > > > > > > > > > > > > > >> > > > >
>> > > > > > > > > > > > > > >>
>> > > > > > > > > > >
>> > > > > >
>> -------------------------------------------------------------------
>> > > > > > > > > > > > > > >> > > > > > > > > > *SCJA. José Luis 
>> > > > > > > > > > > > > > >> > > > > > > > > > Cetina*
>> > > > > > > > > > > > > > >> > > > > > > > > >
>> > > > > > > > > > > > > > >> > > > >
>> > > > > > > > > > > > > > >>
>> > > > > > > > > > >
>> > > > > >
>> -------------------------------------------------------------------
>> > > > > > > > > > > > > > >> > > > > > > > > >
>> > > > > > > > > > > > > > >> > > > > > > > >
>> > > > > > > > > > > > > > >> > > > > > > >
>> > > > > > > > > > > > > > >> > > > > > > >
>> > > > > > > > > > > > > > >> > > > > > > >
>> > > > > > > > > > > > > > >> > > > > > > > --
>> > > > > > > > > > > > > > >> > > > > > > >
>> > > > > > > > > > > > > > >> > >
>> > > > > > > > > > > > >
>> > > > > > > >
>> > > -----------------------------------------------------------------
>> > > --
>> > > > > > > > > > > > > > >> > > > > > > > *SCJA. José Luis Cetina*
>> > > > > > > > > > > > > > >> > > > > > > >
>> > > > > > > > > > > > > > >> > >
>> > > > > > > > > > > > >
>> > > > > > > >
>> > > -----------------------------------------------------------------
>> > > --
>> > > > > > > > > > > > > > >> > > > > > > >
>> > > > > > > > > > > > > > >> > > > > > >
>> > > > > > > > > > > > > > >> > > > > >
>> > > > > > > > > > > > > > >> > > > > >
>> > > > > > > > > > > > > > >> > > > > >
>> > > > > > > > > > > > > > >> > > > > > --
>> > > > > > > > > > > > > > >> > > > > >
>> > > > > > > > > > > > > > >>
>> > > > > > > > > > >
>> > > > > >
>> -------------------------------------------------------------------
>> > > > > > > > > > > > > > >> > > > > > *SCJA. José Luis Cetina*
>> > > > > > > > > > > > > > >> > > > > >
>> > > > > > > > > > > > > > >>
>> > > > > > > > > > >
>> > > > > >
>> -------------------------------------------------------------------
>> > > > > > > > > > > > > > >> > > > > >
>> > > > > > > > > > > > > > >> > > > >
>> > > > > > > > > > > > > > >> > > >
>> > > > > > > > > > > > > > >> > > >
>> > > > > > > > > > > > > > >> > > >
>> > > > > > > > > > > > > > >> > > > --
>> > > > > > > > > > > > > > >> > > >
>> > > > > > > > > > > > > >
>> > > > > > > > >
>> > > > ---------------------------------------------------------------
>> > > > ----
>> > > > > > > > > > > > > > >> > > > *SCJA. José Luis Cetina*
>> > > > > > > > > > > > > > >> > > >
>> > > > > > > > > > > > > >
>> > > > > > > > >
>> > > > ---------------------------------------------------------------
>> > > > ----
>> > > > > > > > > > > > > > >> > > >
>> > > > > > > > > > > > > > >> > >
>> > > > > > > > > > > > > > >> >
>> > > > > > > > > > > > > > >> >
>> > > > > > > > > > > > > > >> >
>> > > > > > > > > > > > > > >> > --
>> > > > > > > > > > > > > > >> >
>> > > > > > > > > > > >
>> > > > > > >
>> > -------------------------------------------------------------------
>> > > > > > > > > > > > > > >> > *SCJA. José Luis Cetina*
>> > > > > > > > > > > > > > >> >
>> > > > > > > > > > > >
>> > > > > > >
>> > -------------------------------------------------------------------
>> > > > > > > > > > > > > > >> >
>> > > > > > > > > > > > > > >>
>> > > > > > > > > > > > > > >
>> > > > > > > > > > > > > > >
>> > > > > > > > > > > > > > >
>> > > > > > > > > > > > > > > --
>> > > > > > > > > > > > > > >
>> > > > > > > > > >
>> > > > >
>> -------------------------------------------------------------------
>> > > > > > > > > > > > > > > *SCJA. José Luis Cetina*
>> > > > > > > > > > > > > > >
>> > > > > > > > > >
>> > > > >
>> -------------------------------------------------------------------
>> > > > > > > > > > > > > > >
>> > > > > > > > > > > > > > >
>> > > > > > > > > > > > > >
>> > > > > > > > > > > > > >
>> > > > > > > > > > > > > > --
>> > > > > > > > > > > > > >
>> > > > > > > > >
>> > > > ---------------------------------------------------------------
>> > > > ----
>> > > > > > > > > > > > > > *SCJA. José Luis Cetina*
>> > > > > > > > > > > > > >
>> > > > > > > > >
>> > > > ---------------------------------------------------------------
>> > > > ----
>> > > > > > > > > > > > > >
>> > > > > > > > > > > > >
>> > > > > > > > > > > >
>> > > > > > > > > > > >
>> > > > > > > > > > > >
>> > > > > > > > > > > > --
>> > > > > > > > > > > >
>> > > > > > >
>> > -------------------------------------------------------------------
>> > > > > > > > > > > > *SCJA. José Luis Cetina*
>> > > > > > > > > > > >
>> > > > > > >
>> > -------------------------------------------------------------------
>> > > > > > > > > > > >
>> > > > > > > > > > >
>> > > > > > > > > >
>> > > > > > > > > >
>> > > > > > > > > >
>> > > > > > > > > > --
>> > > > > > > > > >
>> > > > >
>> -------------------------------------------------------------------
>> > > > > > > > > > *SCJA. José Luis Cetina*
>> > > > > > > > > >
>> > > > >
>> -------------------------------------------------------------------
>> > > > > > > > > >
>> > > > > > > > >
>> > > > > > > >
>> > > > > > > >
>> > > > > > > >
>> > > > > > > > --
>> > > > > > > >
>> > > -----------------------------------------------------------------
>> > > --
>> > > > > > > > *SCJA. José Luis Cetina*
>> > > > > > > >
>> > > -----------------------------------------------------------------
>> > > --
>> > > > > > > >
>> > > > > > >
>> > > > > >
>> > > > > >
>> > > > > >
>> > > > > > --
>> > > > > >
>> -------------------------------------------------------------------
>> > > > > > *SCJA. José Luis Cetina*
>> > > > > >
>> -------------------------------------------------------------------
>> > > > > >
>> > > > >
>> > > >
>> > > >
>> > > >
>> > > > --
>> > > > ---------------------------------------------------------------
>> > > > ----
>> > > > *SCJA. José Luis Cetina*
>> > > > ---------------------------------------------------------------
>> > > > ----
>> > > >
>> > >
>> >
>> >
>> >
>> > --
>> > -------------------------------------------------------------------
>> > *SCJA. José Luis Cetina*
>> > -------------------------------------------------------------------
>> >
>>
>
>
>
> --
> -------------------------------------------------------------------
> *SCJA. José Luis Cetina*
> -------------------------------------------------------------------
>
>


--
-------------------------------------------------------------------
*SCJA. José Luis Cetina*
-------------------------------------------------------------------


RE: Guest user

Posted by Robin <ro...@gmail.com>.
Please Remove me from the e-mail list.
Thank You
Robin

-----Original Message-----
From: Romain Manni-Bucau [mailto:rmannibucau@gmail.com] 
Sent: Friday, June 15, 2012 5:40 AM
To: users@openejb.apache.org
Subject: Re: Guest user

Hi,

i didnt test with the login but it seems it works

but please add @RequestScoped to MyNextPageMBean or don't use postconstrutct
otherwise you have a kind of cache effect depending on the moment when the
bean is created.

here a sample:
http://svn.apache.org/repos/asf/openejb/trunk/openejb/examples/cdi-session-s
cope/

- Romain


2012/6/15 José Luis Cetina <ma...@gmail.com>

> Hi Romain, well i have an other problem and i think is related to this 
> same reported issue.
>
> We talked about if i login using request.login(user,pass) method and 
> if the credentials and login was successfull then when i get the user 
> i get a guess user:
>
> request.login(user,pass);
> String name = ejbContext.getCallerPrincipal().getName();
>
> Ok, then this was fixed, and its ok now, now returns the valid user.
>
> But now if i do this
>
> @Inject
> private MySessionBean mySessionBean;
>
> public String login(){
>   request.login(user,pass);
>   mySessionBean.setName("My name is JOE");
>   //then i do a redirect here
>  return "next_page";
> }
>
> now in my managedbean of my next_page.xhtml i had:
>
> @Named
> public MyNextPageMBean implements Serializable{
>
> @Inject
> private MySessionBean mySessionBean;
>
>  @PostConstruc
>  public void test(){
>    mySessionBean.getName(); <---HERE I GET NULL ALWAYS
>   }
>
> }
>
>
> SessionBean:
>
> import java.io.Serializable;
> import javax.enterprise.context.SessionScoped;
> import javax.inject.Named;
>
> @Named
> @SessionScoped
> public class MySessionBean implements Serializable{
>
>    private String name;
>
>    public MySessionBean() {
>
>    }
>
>    public String getName() {
>        return name;
>    }
>
>    public void setName(String name) {
>        this.name = name;
>    }
> }
>
>
>
> As you can see i get null, mi login its ok, but when i saved something 
> in my sessionbean when i try to retrive what i saved before, i always 
> get null, like if i never set the value (and of course i did it) but 
> this ONLY HAPPEND when i try to set the any value just before 
> request.login, if i set the value in the second bean  like
>
> mySessionBean.setName("My name is JOE"); then in other's page i can 
> get the value without any problem, i do a lot of test and the problem 
> is when i only set the values (in my session bean) just before 
> request.login, then i associated this with the "guest user problem" as 
> you sayed this was happening because the user was "recognized" only after
the first request.
>
> Again, is this the expected behaviour? it seem buggy
>
> Im using:  apache-tomee-1.1.0-20120612.040829-22-webprofile
>
>
> 2012/6/1 José Luis Cetina <ma...@gmail.com>
>
> > ok
> >
> >
> > 2012/6/1 Romain Manni-Bucau <rm...@gmail.com>
> >
> >> deployment in progress:
> >> http://ci.apache.org/builders/openejb-trunk-deploy/builds/378
> >>
> >> - Romain
> >>
> >>
> >> 2012/6/1 José Luis Cetina <ma...@gmail.com>
> >>
> >> > Ok, in what tomee build this will be available?
> >> >
> >> > 2012/5/31 Romain Manni-Bucau <rm...@gmail.com>
> >> >
> >> > > yep
> >> > >
> >> > > just commited, a new commit will come where this class will
> >> automatically
> >> > > be added normally
> >> > >
> >> > > - Romain
> >> > >
> >> > >
> >> > > 2012/6/1 José Luis Cetina <ma...@gmail.com>
> >> > >
> >> > > > im getting a ClassNotFound
> >> > > >
> >> > > > Caused by: java.lang.ClassNotFoundException:
> >> > > > org.apache.tomee.catalina.TomEERealm
> >> > > >
> >> > > > 2012/5/31 Romain Manni-Bucau <rm...@gmail.com>
> >> > > >
> >> > > > > my sample is working, too late to add test but manually it 
> >> > > > > works
> >> > > > >
> >> > > > > so i guess it should work for you
> >> > > > >
> >> > > > > the question now is should we add it automatically?
> >> > > > >
> >> > > > > - Romain
> >> > > > >
> >> > > > >
> >> > > > > 2012/6/1 José Luis Cetina <ma...@gmail.com>
> >> > > > >
> >> > > > > > Oooh great, with this i can get the principal user in the
> first
> >> > > > request?
> >> > > > > or
> >> > > > > > this is something that you gonna fix?
> >> > > > > >
> >> > > > > > 2012/5/31 Romain Manni-Bucau <rm...@gmail.com>
> >> > > > > >
> >> > > > > > > that's brand new ;)
> >> > > > > > >
> >> > > > > > > just added it, it mainly delegate to the real realm but 
> >> > > > > > > add
> >> the
> >> > > > > principal
> >> > > > > > > info to openejb/tomee security service which is used in
> >> > ejbcontext
> >> > > > impl
> >> > > > > > (to
> >> > > > > > > make it short)
> >> > > > > > >
> >> > > > > > > - Romain
> >> > > > > > >
> >> > > > > > >
> >> > > > > > > 2012/6/1 José Luis Cetina <ma...@gmail.com>
> >> > > > > > >
> >> > > > > > > > I have this in my context.xml
> >> > > > > > > >
> >> > > > > > > > <Realm className="MyExtendedDataSourceRealm"
> >> > > > > > > >  dataSourceName="MyDataSource"
> >> > > > > > > > digest="SHA-256"
> >> > > > > > > > encodePassword="Base64"
> >> > > > > > > > queryRealmRolesUser="SELECT rol FROM xxxx WHERE user=?"
> >> > > > > > > > queryRealmUsers="SELECT pass FROM xxx WHERE user=?"/>
> >> > > > > > > >
> >> > > > > > > > As you can see i extend the datasource realm, i have 
> >> > > > > > > > this
> >> realm
> >> > > > > config
> >> > > > > > in
> >> > > > > > > > the context.xml in my webapp (not context.xml TomEE).
> >> > > > > > > >
> >> > > > > > > > But, as i can see in your example, you surround your 
> >> > > > > > > > realm
> >> with
> >> > > > > > > TomEERealm,
> >> > > > > > > > if this necessary?. I didn't know this
> >> > > > > > > >
> >> > > > > > > >
> >> > > > > > > >
> >> > > > > > > > 2012/5/31 Romain Manni-Bucau <rm...@gmail.com>
> >> > > > > > > >
> >> > > > > > > > > in my test i used:
> >> > > > > > > > >
> >> > > > > > > > >    <Realm
> >> className="org.apache.tomee.catalina.TomEERealm">
> >> > > > > > > > >        <Realm
> >> className="org.apache.catalina.realm.JAASRealm"
> >> > > > > > > > > appName="PropertiesLoginModule"
> >> > > > > > > > >
> >> > > > > > > > >
> >> > > > > > > > >
> >> > > > > > > >
> >> > > > > > >
> >> > > > > >
> >> > > > >
> >> > > >
> >> > >
> >> >
> >>
>
userClassNames="org.apache.openejb.core.security.AbstractSecurityService$Use
r"
> >> > > > > > > > >
> >> > > > > > > > >
> >> > > > > > > > >
> >> > > > > > > >
> >> > > > > > >
> >> > > > > >
> >> > > > >
> >> > > >
> >> > >
> >> >
> >>
>  
> roleClassNames="org.apache.openejb.core.security.AbstractSecurityServi
> ce$Group">
> >> > > > > > > > >        </Realm>
> >> > > > > > > > >       </Realm>
> >> > > > > > > > >
> >> > > > > > > > > but i guess you can replace the jaasrealm by your
> dsrealm
> >> > > > > > > > >
> >> > > > > > > > > - Romain
> >> > > > > > > > >
> >> > > > > > > > >
> >> > > > > > > > > 2012/6/1 José Luis Cetina <ma...@gmail.com>
> >> > > > > > > > >
> >> > > > > > > > > > Yes, it seems buggy.
> >> > > > > > > > > >
> >> > > > > > > > > > Where i have to replace?
> >> > > > > > > > > >
> >> > > > > > > > > > Remember im using DataSourceRealm
> >> > > > > > > > > >
> >> > > > > > > > > > 2012/5/31 Romain Manni-Bucau 
> >> > > > > > > > > > <rm...@gmail.com>
> >> > > > > > > > > >
> >> > > > > > > > > > > this is the current status,
> >> > > > > > > > > > >
> >> > > > > > > > > > > but IMO it is buggy,
> >> > > > > > > > > > >
> >> > > > > > > > > > > i'll commit soon a TomEEJAASRealm to make it 
> >> > > > > > > > > > > working
> >> > > (replace
> >> > > > > > > > JAASRealm
> >> > > > > > > > > > in
> >> > > > > > > > > > > the conf)
> >> > > > > > > > > > >
> >> > > > > > > > > > > - Romain
> >> > > > > > > > > > >
> >> > > > > > > > > > >
> >> > > > > > > > > > > 2012/6/1 José Luis Cetina 
> >> > > > > > > > > > > <ma...@gmail.com>
> >> > > > > > > > > > >
> >> > > > > > > > > > > > i think we are getting confused.
> >> > > > > > > > > > > >
> >> > > > > > > > > > > > If i resume all, this what i asked (the final 
> >> > > > > > > > > > > > of
> the
> >> > > first
> >> > > > > > post)
> >> > > > > > > > > > > >
> >> > > > > > > > > > > > I dont know if this is the desire behavior or 
> >> > > > > > > > > > > > if
> >> this
> >> > > > happend
> >> > > > > > > > becase
> >> > > > > > > > > > the
> >> > > > > > > > > > > > httr request isnt finished?
> >> > > > > > > > > > > > Then you answer me:
> >> > > > > > > > > > > >
> >> > > > > > > > > > > > in fact info from ejbcontext are taken in our
> >> > > > securitymodule
> >> > > > > > > > > > > >
> >> > > > > > > > > > > > in tomee we set/unset it from a valve so at 
> >> > > > > > > > > > > > the
> >> > > > beginning/end
> >> > > > > > of
> >> > > > > > > > the
> >> > > > > > > > > > > > request...all between is currently ignored so 
> >> > > > > > > > > > > > when
> >> you
> >> > > log
> >> > > > > you
> >> > > > > > > need
> >> > > > > > > > > > > another
> >> > > > > > > > > > > > request to get the updated information (from 
> >> > > > > > > > > > > > the
> >> tomcat
> >> > > > > realm)
> >> > > > > > > > > > > >
> >> > > > > > > > > > > > "so when you log you need another request to 
> >> > > > > > > > > > > > get
> the
> >> > > > updated
> >> > > > > > > > > > information
> >> > > > > > > > > > > > (from the tomcat realm)
> >> > > > > > > > > > > >
> >> > > > > > > > > > > > Then i get guest because is the desire 
> >> > > > > > > > > > > > behaviour,
> >> after
> >> > > the
> >> > > > > > first
> >> > > > > > > > > > > request i
> >> > > > > > > > > > > > can get the user i expected.
> >> > > > > > > > > > > >
> >> > > > > > > > > > > > Then i resume, this is the default behaviour, 
> >> > > > > > > > > > > > and
> >> works
> >> > > but
> >> > > > > you
> >> > > > > > > > need
> >> > > > > > > > > a
> >> > > > > > > > > > > > second request.
> >> > > > > > > > > > > >
> >> > > > > > > > > > > >
> >> > > > > > > > > > > >
> >> > > > > > > > > > > > 2012/5/31 Romain Manni-Bucau <
> rmannibucau@gmail.com
> >> >
> >> > > > > > > > > > > >
> >> > > > > > > > > > > > > i think it should work
> >> > > > > > > > > > > > >
> >> > > > > > > > > > > > > - Romain
> >> > > > > > > > > > > > >
> >> > > > > > > > > > > > >
> >> > > > > > > > > > > > > 2012/6/1 José Luis Cetina 
> >> > > > > > > > > > > > > <maxtorzito@gmail.com
> >
> >> > > > > > > > > > > > >
> >> > > > > > > > > > > > > > I mean this:
> >> > > > > > > > > > > > > >
> >> > > > > > > > > > > > > > I dont know if this is the desire 
> >> > > > > > > > > > > > > > behaviour or
> >> if
> >> > > this
> >> > > > > > > happend
> >> > > > > > > > > > > because
> >> > > > > > > > > > > > > the
> >> > > > > > > > > > > > > > http request isnt finished?
> >> > > > > > > > > > > > > >
> >> > > > > > > > > > > > > >
> >> > > > > > > > > > > > > >
> >> > > > > > > > > > > > > > 2012/5/31 José Luis Cetina <
> >> maxtorzito@gmail.com>
> >> > > > > > > > > > > > > >
> >> > > > > > > > > > > > > > > Ok, the what i asked is correct??
> >> > > > > > > > > > > > > > >
> >> > > > > > > > > > > > > > > "I dont know if this is the desire 
> >> > > > > > > > > > > > > > > behaviour
> >> or
> >> > if
> >> > > > this
> >> > > > > > > > happend
> >> > > > > > > > > > > > because
> >> > > > > > > > > > > > > > > the http request isnt finished?"
> >> > > > > > > > > > > > > > >
> >> > > > > > > > > > > > > > > 2012/5/31 Romain Manni-Bucau <
> >> > > rmannibucau@gmail.com>
> >> > > > > > > > > > > > > > >
> >> > > > > > > > > > > > > > >> ok,
> >> > > > > > > > > > > > > > >>
> >> > > > > > > > > > > > > > >> in fact info from ejbcontext are taken 
> >> > > > > > > > > > > > > > >> in
> our
> >> > > > > > > securitymodule
> >> > > > > > > > > > > > > > >>
> >> > > > > > > > > > > > > > >> in tomee we set/unset it from a valve 
> >> > > > > > > > > > > > > > >> so at
> >> the
> >> > > > > > > > beginning/end
> >> > > > > > > > > of
> >> > > > > > > > > > > the
> >> > > > > > > > > > > > > > >> request...all between is currently 
> >> > > > > > > > > > > > > > >> ignored
> so
> >> > when
> >> > > > you
> >> > > > > > log
> >> > > > > > > > you
> >> > > > > > > > > > > need
> >> > > > > > > > > > > > > > >> another request to get the updated 
> >> > > > > > > > > > > > > > >> information
> (from
> >> the
> >> > > > > tomcat
> >> > > > > > > > realm)
> >> > > > > > > > > > > > > > >>
> >> > > > > > > > > > > > > > >> - Romain
> >> > > > > > > > > > > > > > >>
> >> > > > > > > > > > > > > > >>
> >> > > > > > > > > > > > > > >> 2012/6/1 José Luis Cetina <
> >> maxtorzito@gmail.com
> >> > >
> >> > > > > > > > > > > > > > >>
> >> > > > > > > > > > > > > > >> > Yes, it work
> >> > > > > > > > > > > > > > >> >
> >> > > > > > > > > > > > > > >> > 1) Login (form login) using
> DataSourceRealm
> >> > > > > > > > > > > > > > >> >
> >> > > > > > > > > > > > > > >> >
> >> > > > > > > > > > > > > > >> > 2) Redirect to page2 from my 
> >> > > > > > > > > > > > > > >> > managedbean
> >> > > > > > > > > > > > > > >> >
> >> > > > > > > > > > > > > > >> > 2012/5/31 Romain Manni-Bucau <
> >> > > > rmannibucau@gmail.com
> >> > > > > >
> >> > > > > > > > > > > > > > >> >
> >> > > > > > > > > > > > > > >> > > so you mean using the flow i 
> >> > > > > > > > > > > > > > >> > > described
> >> > before
> >> > > it
> >> > > > > > > works?
> >> > > > > > > > > > > (sorry,
> >> > > > > > > > > > > > > just
> >> > > > > > > > > > > > > > >> to
> >> > > > > > > > > > > > > > >> > be
> >> > > > > > > > > > > > > > >> > > sure to understand)
> >> > > > > > > > > > > > > > >> > >
> >> > > > > > > > > > > > > > >> > > - Romain
> >> > > > > > > > > > > > > > >> > >
> >> > > > > > > > > > > > > > >> > >
> >> > > > > > > > > > > > > > >> > > 2012/6/1 José Luis Cetina <
> >> > > maxtorzito@gmail.com
> >> > > > >
> >> > > > > > > > > > > > > > >> > >
> >> > > > > > > > > > > > > > >> > > > Hi i can login and i can 
> >> > > > > > > > > > > > > > >> > > > navigate
> >> > (redirect)
> >> > > > to
> >> > > > > my
> >> > > > > > > > other
> >> > > > > > > > > > > page,
> >> > > > > > > > > > > > > > but i
> >> > > > > > > > > > > > > > >> > dont
> >> > > > > > > > > > > > > > >> > > > know why im getting guest user 
> >> > > > > > > > > > > > > > >> > > > in the
> >> > login
> >> > > > > mbean,
> >> > > > > > > > after
> >> > > > > > > > > > > that
> >> > > > > > > > > > > > in
> >> > > > > > > > > > > > > > >> other
> >> > > > > > > > > > > > > > >> > > > mbean  i get my "real" user.
> >> > > > > > > > > > > > > > >> > > >
> >> > > > > > > > > > > > > > >> > > >
> >> > > > > > > > > > > > > > >> > > > 2012/5/31 Romain Manni-Bucau <
> >> > > > > > rmannibucau@gmail.com
> >> > > > > > > >
> >> > > > > > > > > > > > > > >> > > >
> >> > > > > > > > > > > > > > >> > > > > maybe
> >> > > > > > > > > > > > > > >> > > > >
> >> > > > > > > > > > > > > > >> > > >
> >> > > > > > > > > > > > > > >> > >
> >> > > > > > > > > > > > > > >> >
> >> > > > > > > > > > > > > > >>
> >> > > > > > > > > > > > > >
> >> > > > > > > > > > > > >
> >> > > > > > > > > > > >
> >> > > > > > > > > > >
> >> > > > > > > > > >
> >> > > > > > > > >
> >> > > > > > > >
> >> > > > > > >
> >> > > > > >
> >> > > > >
> >> > > >
> >> > >
> >> >
> >>
> http://rmannibucau.wordpress.com/2012/05/09/tomee-and-its-ssh-connecto
> r/but
> >> > > > > > > > > > > > > > >> > > > > it uses properties file, it 
> >> > > > > > > > > > > > > > >> > > > > just
> >> need a
> >> > > > custom
> >> > > > > > > login
> >> > > > > > > > > > > module
> >> > > > > > > > > > > > > > >> > > > implementation
> >> > > > > > > > > > > > > > >> > > > > to use a db.
> >> > > > > > > > > > > > > > >> > > > >
> >> > > > > > > > > > > > > > >> > > > > well,
> >> > > > > > > > > > > > > > >> > > > >
> >> > > > > > > > > > > > > > >> > > > > before can you test it please?
> >> > > > > > > > > > > > > > >> > > > > 1) login
> >> > > > > > > > > > > > > > >> > > > > 2) redirect to your page using 
> >> > > > > > > > > > > > > > >> > > > > your
> >> bean
> >> > > > > > > > > > > > > > >> > > > >
> >> > > > > > > > > > > > > > >> > > > > - Romain
> >> > > > > > > > > > > > > > >> > > > >
> >> > > > > > > > > > > > > > >> > > > >
> >> > > > > > > > > > > > > > >> > > > > 2012/6/1 José Luis Cetina <
> >> > > > > maxtorzito@gmail.com
> >> > > > > > >
> >> > > > > > > > > > > > > > >> > > > >
> >> > > > > > > > > > > > > > >> > > > > > I have to read and know how 
> >> > > > > > > > > > > > > > >> > > > > > to
> use
> >> > > this, i
> >> > > > > > > always
> >> > > > > > > > > use
> >> > > > > > > > > > > > > > >> DataSource or
> >> > > > > > > > > > > > > > >> > > > > > JDBCRealm. (with glassfish).
> >> > > > > > > > > > > > > > >> > > > > > im reading now, do you have
> >> something
> >> > > for
> >> > > > a
> >> > > > > > > > > > quickstart?
> >> > > > > > > > > > > > for
> >> > > > > > > > > > > > > > >> share
> >> > > > > > > > > > > > > > >> > me
> >> > > > > > > > > > > > > > >> > > > > >
> >> > > > > > > > > > > > > > >> > > > > > 2012/5/31 Romain Manni-Bucau 
> >> > > > > > > > > > > > > > >> > > > > > <
> >> > > > > > > > rmannibucau@gmail.com
> >> > > > > > > > > >
> >> > > > > > > > > > > > > > >> > > > > >
> >> > > > > > > > > > > > > > >> > > > > > > having your password in a 
> >> > > > > > > > > > > > > > >> > > > > > > db is
> >> not
> >> > an
> >> > > > > issue
> >> > > > > > > > but i
> >> > > > > > > > > > > think
> >> > > > > > > > > > > > > you
> >> > > > > > > > > > > > > > >> > should
> >> > > > > > > > > > > > > > >> > > > > > > use
> >> > > org.apache.catalina.realm.JAASRealm
> >> > > > > > > > > > > > > > >> > > > > > >
> >> > > > > > > > > > > > > > >> > > > > > > for instance:
> >> > > > > > > > > > > > > > >> > > > > > >
> >> > > > > > > > > > > > > > >> > > > > > >     <Realm
> >> > > > > > > > > > > > className="org.apache.catalina.realm.JAASRealm"
> >> > > > > > > > > > > > > > >> > > > > > > appName="MyDBLoginModule"
> >> > > > > > > > > > > > > > >> > > > > > >
> >> > > > > > > > > > > > > > >> > > > > > >
> >> > > > > > > > > > > > > > >> > > > > > >
> >> > > > > > > > > > > > > > >> > > > > >
> >> > > > > > > > > > > > > > >> > > > >
> >> > > > > > > > > > > > > > >> > > >
> >> > > > > > > > > > > > > > >> > >
> >> > > > > > > > > > > > > > >> >
> >> > > > > > > > > > > > > > >>
> >> > > > > > > > > > > > > >
> >> > > > > > > > > > > > >
> >> > > > > > > > > > > >
> >> > > > > > > > > > >
> >> > > > > > > > > >
> >> > > > > > > > >
> >> > > > > > > >
> >> > > > > > >
> >> > > > > >
> >> > > > >
> >> > > >
> >> > >
> >> >
> >>
>
userClassNames="org.apache.openejb.core.security.AbstractSecurityService$Use
r"
> >> > > > > > > > > > > > > > >> > > > > > >
> >> > > > > > > > > > > > > > >> > > > > > >
> >> > > > > > > > > > > > > > >> > > > > > >
> >> > > > > > > > > > > > > > >> > > > > >
> >> > > > > > > > > > > > > > >> > > > >
> >> > > > > > > > > > > > > > >> > > >
> >> > > > > > > > > > > > > > >> > >
> >> > > > > > > > > > > > > > >> >
> >> > > > > > > > > > > > > > >>
> >> > > > > > > > > > > > > >
> >> > > > > > > > > > > > >
> >> > > > > > > > > > > >
> >> > > > > > > > > > >
> >> > > > > > > > > >
> >> > > > > > > > >
> >> > > > > > > >
> >> > > > > > >
> >> > > > > >
> >> > > > >
> >> > > >
> >> > >
> >> >
> >>
>  
> roleClassNames="org.apache.openejb.core.security.AbstractSecurityServi
> ce$Group">
> >> > > > > > > > > > > > > > >> > > > > > >      </Realm>
> >> > > > > > > > > > > > > > >> > > > > > >
> >> > > > > > > > > > > > > > >> > > > > > > so simply implement a 
> >> > > > > > > > > > > > > > >> > > > > > > custom
> >> > > LoginModule
> >> > > > > > > instead
> >> > > > > > > > > of
> >> > > > > > > > > > a
> >> > > > > > > > > > > > > realm
> >> > > > > > > > > > > > > > >> > > > > > >
> >> > > > > > > > > > > > > > >> > > > > > > wdyt?
> >> > > > > > > > > > > > > > >> > > > > > >
> >> > > > > > > > > > > > > > >> > > > > > > - Romain
> >> > > > > > > > > > > > > > >> > > > > > >
> >> > > > > > > > > > > > > > >> > > > > > >
> >> > > > > > > > > > > > > > >> > > > > > > 2012/6/1 José Luis Cetina 
> >> > > > > > > > > > > > > > >> > > > > > > <
> >> > > > > > > maxtorzito@gmail.com
> >> > > > > > > > >
> >> > > > > > > > > > > > > > >> > > > > > >
> >> > > > > > > > > > > > > > >> > > > > > > > Sorry, i use
> DataSourceRealm, i
> >> > have
> >> > > > my
> >> > > > > > > > > > > > user/pass/roles
> >> > > > > > > > > > > > > in
> >> > > > > > > > > > > > > > >> the
> >> > > > > > > > > > > > > > >> > > DB.
> >> > > > > > > > > > > > > > >> > > > > > > >
> >> > > > > > > > > > > > > > >> > > > > > > >
> >> > > > > > > > > > > > > > >> > > > > > > >
> >> > > > > > > > > > > > > > >> > > > > > > > 2012/5/31 Romain 
> >> > > > > > > > > > > > > > >> > > > > > > > Manni-Bucau
> <
> >> > > > > > > > > > rmannibucau@gmail.com
> >> > > > > > > > > > > >
> >> > > > > > > > > > > > > > >> > > > > > > >
> >> > > > > > > > > > > > > > >> > > > > > > > > can't you do it with 
> >> > > > > > > > > > > > > > >> > > > > > > > > an
> >> embedded
> >> > > > one?
> >> > > > > > > > > > > > > > >> > > > > > > > >
> >> > > > > > > > > > > > > > >> > > > > > > > > well DataSourceRealm
> doesn't
> >> use
> >> > > > JAAS
> >> > > > > by
> >> > > > > > > > > > default i
> >> > > > > > > > > > > > > > think,
> >> > > > > > > > > > > > > > >> > maybe
> >> > > > > > > > > > > > > > >> > > > > > that's
> >> > > > > > > > > > > > > > >> > > > > > > > the
> >> > > > > > > > > > > > > > >> > > > > > > > > issue
> >> > > > > > > > > > > > > > >> > > > > > > > >
> >> > > > > > > > > > > > > > >> > > > > > > > > - Romain
> >> > > > > > > > > > > > > > >> > > > > > > > >
> >> > > > > > > > > > > > > > >> > > > > > > > >
> >> > > > > > > > > > > > > > >> > > > > > > > > 2012/6/1 José Luis 
> >> > > > > > > > > > > > > > >> > > > > > > > > Cetina <
> >> > > > > > > > > maxtorzito@gmail.com
> >> > > > > > > > > > >
> >> > > > > > > > > > > > > > >> > > > > > > > >
> >> > > > > > > > > > > > > > >> > > > > > > > > > OK, i can create a
> sample,
> >> > but i
> >> > > > use
> >> > > > > > > > > > > > > DataSourceRealm,
> >> > > > > > > > > > > > > > >> are
> >> > > > > > > > > > > > > > >> > you
> >> > > > > > > > > > > > > > >> > > > > gonna
> >> > > > > > > > > > > > > > >> > > > > > > > > > configure your database?
> >> > > > > > > > > > > > > > >> > > > > > > > > >
> >> > > > > > > > > > > > > > >> > > > > > > > > > 2012/5/31 Romain
> >> Manni-Bucau <
> >> > > > > > > > > > > > rmannibucau@gmail.com
> >> > > > > > > > > > > > > >
> >> > > > > > > > > > > > > > >> > > > > > > > > >
> >> > > > > > > > > > > > > > >> > > > > > > > > > > can you have a try 
> >> > > > > > > > > > > > > > >> > > > > > > > > > > in
> an
> >> EJB
> >> > > > > please?
> >> > > > > > > > (just
> >> > > > > > > > > > try
> >> > > > > > > > > > > > to
> >> > > > > > > > > > > > > > add
> >> > > > > > > > > > > > > > >> > > > > @Stateless
> >> > > > > > > > > > > > > > >> > > > > > on
> >> > > > > > > > > > > > > > >> > > > > > > > > your
> >> > > > > > > > > > > > > > >> > > > > > > > > > > managed bean for
> >> instance)
> >> > > > > > > > > > > > > > >> > > > > > > > > > >
> >> > > > > > > > > > > > > > >> > > > > > > > > > > can you share a 
> >> > > > > > > > > > > > > > >> > > > > > > > > > > sample
> >> easy
> >> > to
> >> > > > > run?
> >> > > > > > > > > > > > > > >> > > > > > > > > > >
> >> > > > > > > > > > > > > > >> > > > > > > > > > > - Romain
> >> > > > > > > > > > > > > > >> > > > > > > > > > >
> >> > > > > > > > > > > > > > >> > > > > > > > > > >
> >> > > > > > > > > > > > > > >> > > > > > > > > > > 2012/6/1 José Luis
> >> Cetina <
> >> > > > > > > > > > > maxtorzito@gmail.com
> >> > > > > > > > > > > > >
> >> > > > > > > > > > > > > > >> > > > > > > > > > >
> >> > > > > > > > > > > > > > >> > > > > > > > > > > > Yes, im using 
> >> > > > > > > > > > > > > > >> > > > > > > > > > > > JAAS
> >> > > > > > > > > > > > > > >> > > > > > > > > > > >
> >> > > > > > > > > > > > > > >> > > > > > > > > > > > 2012/5/31 Romain
> >> > > Manni-Bucau <
> >> > > > > > > > > > > > > > rmannibucau@gmail.com
> >> > > > > > > > > > > > > > >> >
> >> > > > > > > > > > > > > > >> > > > > > > > > > > >
> >> > > > > > > > > > > > > > >> > > > > > > > > > > > > Hi,
> >> > > > > > > > > > > > > > >> > > > > > > > > > > > >
> >> > > > > > > > > > > > > > >> > > > > > > > > > > > > Do you use jaas?
> >> > > > > > > > > > > > > > >> > > > > > > > > > > > >
> >> > > > > > > > > > > > > > >> > > > > > > > > > > > > - Romain Le 31 
> >> > > > > > > > > > > > > > >> > > > > > > > > > > > > mai 2012
> 20:14,
> >> > > "José
> >> > > > > Luis
> >> > > > > > > > > > Cetina" <
> >> > > > > > > > > > > > > > >> > > > > > maxtorzito@gmail.com
> >> > > > > > > > > > > > > > >> > > > > > > >
> >> > > > > > > > > > > > > > >> > > > > > > > a
> >> > > > > > > > > > > > > > >> > > > > > > > > > > écrit
> >> > > > > > > > > > > > > > >> > > > > > > > > > > > :
> >> > > > > > > > > > > > > > >> > > > > > > > > > > > >
> >> > > > > > > > > > > > > > >> > > > > > > > > > > > > > Hi i have 
> >> > > > > > > > > > > > > > >> > > > > > > > > > > > > > this
> >> > scenario:
> >> > > > > > > > > > > > > > >> > > > > > > > > > > > > >
> >> > > > > > > > > > > > > > >> > > > > > > > > > > > > > I have a 
> >> > > > > > > > > > > > > > >> > > > > > > > > > > > > > page
> >> > > login.xhtml,
> >> > > > > > this
> >> > > > > > > > page
> >> > > > > > > > > > > has a
> >> > > > > > > > > > > > > > >> > > ManagedBean
> >> > > > > > > > > > > > > > >> > > > > > > (@Named)
> >> > > > > > > > > > > > > > >> > > > > > > > > > this
> >> > > > > > > > > > > > > > >> > > > > > > > > > > > > > managedbean 
> >> > > > > > > > > > > > > > >> > > > > > > > > > > > > > use
> the
> >> > > > > > > > > > > > request.login(user,pass)
> >> > > > > > > > > > > > > > >> > method.
> >> > > > > > > > > > > > > > >> > > > > > > > > > > > > >
> >> > > > > > > > > > > > > > >> > > > > > > > > > > > > > When i do this:
> >> > > > > > > > > > > > > > >> > > > > > > > > > > > > >
> >> > > > > > > > > > > > > > >> > > > > > > > > > > > > > managedbean
> class:
> >> > > > > > > > > > > > > > >> > > > > > > > > > > > > >
> >> > > > > > > > > > > > > > >> > > > > > > > > > > > > > @Resource 
> >> > > > > > > > > > > > > > >> > > > > > > > > > > > > > private
> EJBContext
> >> > > > > ejbContext;
> >> > > > > > > > > > > > > > >> > > > > > > > > > > > > > .
> >> > > > > > > > > > > > > > >> > > > > > > > > > > > > > .
> >> > > > > > > > > > > > > > >> > > > > > > > > > > > > >
> >> > > request.login(user,pass);
> >> > > > > > > > > > > > > > >> > > > > > > > > > > > > > String name 
> >> > > > > > > > > > > > > > >> > > > > > > > > > > > > > =
> >> > > > > > > > > > > > > > >> > > >
> >> ejbContext.getCallerPrincipal().getName();
> >> > > > > > > > > > > > > > >> > > > > > > > > > > > > >
> >> > > > > > > > > > > > > > >> > > > > > > > > > > > > > I get 
> >> > > > > > > > > > > > > > >> > > > > > > > > > > > > > "guest" as
> my
> >> > user
> >> > > > > name.
> >> > > > > > > > But i
> >> > > > > > > > > > > > expect
> >> > > > > > > > > > > > > > the
> >> > > > > > > > > > > > > > >> > name
> >> > > > > > > > > > > > > > >> > > of
> >> > > > > > > > > > > > > > >> > > > > my
> >> > > > > > > > > > > > > > >> > > > > > > user
> >> > > > > > > > > > > > > > >> > > > > > > > > (of
> >> > > > > > > > > > > > > > >> > > > > > > > > > > > > course
> >> > > > > > > > > > > > > > >> > > > > > > > > > > > > > is not 
> >> > > > > > > > > > > > > > >> > > > > > > > > > > > > > guest)
> >> > > > > > > > > > > > > > >> > > > > > > > > > > > > >
> >> > > > > > > > > > > > > > >> > > > > > > > > > > > > > If the login 
> >> > > > > > > > > > > > > > >> > > > > > > > > > > > > > was
> >> > > > successful
> >> > > > > my
> >> > > > > > > > login
> >> > > > > > > > > > > page
> >> > > > > > > > > > > > > > >> navigate
> >> > > > > > > > > > > > > > >> > to
> >> > > > > > > > > > > > > > >> > > > > other
> >> > > > > > > > > > > > > > >> > > > > > > > page
> >> > > > > > > > > > > > > > >> > > > > > > > > > lets
> >> > > > > > > > > > > > > > >> > > > > > > > > > > > say
> >> > > > > > > > > > > > > > >> > > > > > > > > > > > > > pageb.xhtml
> >> > > > > > > > > > > > > > >> > > > > > > > > > > > > >
> >> > > > > > > > > > > > > > >> > > > > > > > > > > > > > If i create 
> >> > > > > > > > > > > > > > >> > > > > > > > > > > > > > a
> >> > > managedbean
> >> > > > > > > (@Named)
> >> > > > > > > > > for
> >> > > > > > > > > > > > > > >> pageb.xhtml
> >> > > > > > > > > > > > > > >> > > and
> >> > > > > > > > > > > > > > >> > > > in
> >> > > > > > > > > > > > > > >> > > > > > > that
> >> > > > > > > > > > > > > > >> > > > > > > > > > > > > managedbean
> >> > > > > > > > > > > > > > >> > > > > > > > > > > > > > i use again:
> >> > > > > > > > > > > > > > >> > > > > > > > > > > > > > String name 
> >> > > > > > > > > > > > > > >> > > > > > > > > > > > > > =
> >> > > > > > > > > > > > > > >> > > >
> >> ejbContext.getCallerPrincipal().getName();
> >> > > > > > > > > > > > > > >> > > > > > > > > > > > > > then, here i 
> >> > > > > > > > > > > > > > >> > > > > > > > > > > > > > get
> my
> >> > > > > "correct"
> >> > > > > > > name
> >> > > > > > > > > of
> >> > > > > > > > > > > the
> >> > > > > > > > > > > > > user
> >> > > > > > > > > > > > > > >> (not
> >> > > > > > > > > > > > > > >> > > > > guest).
> >> > > > > > > > > > > > > > >> > > > > > > > > > > > > >
> >> > > > > > > > > > > > > > >> > > > > > > > > > > > > > I dont know 
> >> > > > > > > > > > > > > > >> > > > > > > > > > > > > > if
> >> this is
> >> > > the
> >> > > > > > > desire
> >> > > > > > > > > > > > behaviour
> >> > > > > > > > > > > > > or
> >> > > > > > > > > > > > > > >> if
> >> > > > > > > > > > > > > > >> > > this
> >> > > > > > > > > > > > > > >> > > > > > > happend
> >> > > > > > > > > > > > > > >> > > > > > > > > > > because
> >> > > > > > > > > > > > > > >> > > > > > > > > > > > > the
> >> > > > > > > > > > > > > > >> > > > > > > > > > > > > > http request 
> >> > > > > > > > > > > > > > >> > > > > > > > > > > > > > isnt
> >> > > > finished?
> >> > > > > > > > > > > > > > >> > > > > > > > > > > > > >
> >> > > > > > > > > > > > > > >> > > > > > > > > > > > > > other 
> >> > > > > > > > > > > > > > >> > > > > > > > > > > > > > question
> why
> >> if
> >> > i
> >> > > > call
> >> > > > > > > > > > > > > > >> > > > > > > > > > > > > > the
> >> > > > > > > > > > > > > >  
> >> > > > > > > > > > > > > > ejbContext.getCallerPrincipal().getName()
> >> > > > > > > > > > > > > > ;
> >> > > > > > > > > > > > > > >> > > before
> >> > > > > > > > > > > > > > >> > > > > the
> >> > > > > > > > > > > > > > >> > > > > > > > > > > > > request.login(
> >> > > > > > > > > > > > > > >> > > > > > > > > > > > > )
> >> > > > > > > > > > > > > > >> > > > > > > > > > > > > > method i get
> again
> >> > > > "guest",
> >> > > > > > why
> >> > > > > > > > not
> >> > > > > > > > > > > null?
> >> > > > > > > > > > > > > > >> > > > > > > > > > > > > >
> >> > > > > > > > > > > > > > >> > > > > > > > > > > > > > If this 
> >> > > > > > > > > > > > > > >> > > > > > > > > > > > > > question
> is
> >> > for
> >> > > > > > > > > tomee(openejb)
> >> > > > > > > > > > > or
> >> > > > > > > > > > > > > > >> tomcat?
> >> > > > > > > > > > > > > > >> > > > > > > > > > > > > >
> >> > > > > > > > > > > > > > >> > > > > > > > > > > > > > Thanks
> >> > > > > > > > > > > > > > >> > > > > > > > > > > > > >
> >> > > > > > > > > > > > > > >> > > > > > > > > > > > > >
> >> > > > > > > > > > > > > > >> > > > > > > > > > > > > >
> >> > > > > > > > > > > > > > >> > > > > > > > >
> >> > > > > > > > > > > > > > >> > > >
> >> > > > > > > > > > > > > >
> >> > > > > > > > >
> >> > > >
> -------------------------------------------------------------------
> >> > > > > > > > > > > > > > >> > > > > > > > > > > > > > *SCJA. José 
> >> > > > > > > > > > > > > > >> > > > > > > > > > > > > > Luis
> >> > Cetina*
> >> > > > > > > > > > > > > > >> > > > > > > > > > > > > >
> >> > > > > > > > > > > > > > >> > > > > > > > >
> >> > > > > > > > > > > > > > >> > > >
> >> > > > > > > > > > > > > >
> >> > > > > > > > >
> >> > > >
> -------------------------------------------------------------------
> >> > > > > > > > > > > > > > >> > > > > > > > > > > > > >
> >> > > > > > > > > > > > > > >> > > > > > > > > > > > >
> >> > > > > > > > > > > > > > >> > > > > > > > > > > >
> >> > > > > > > > > > > > > > >> > > > > > > > > > > >
> >> > > > > > > > > > > > > > >> > > > > > > > > > > >
> >> > > > > > > > > > > > > > >> > > > > > > > > > > > --
> >> > > > > > > > > > > > > > >> > > > > > > > > > > >
> >> > > > > > > > > > > > > > >> > > > > > >
> >> > > > > > > > > > > > > > >> >
> >> > > > > > > > > > > >
> >> > > > > > >
> >> > -----------------------------------------------------------------
> >> > --
> >> > > > > > > > > > > > > > >> > > > > > > > > > > > *SCJA. José Luis
> >> Cetina*
> >> > > > > > > > > > > > > > >> > > > > > > > > > > >
> >> > > > > > > > > > > > > > >> > > > > > >
> >> > > > > > > > > > > > > > >> >
> >> > > > > > > > > > > >
> >> > > > > > >
> >> > -----------------------------------------------------------------
> >> > --
> >> > > > > > > > > > > > > > >> > > > > > > > > > > >
> >> > > > > > > > > > > > > > >> > > > > > > > > > >
> >> > > > > > > > > > > > > > >> > > > > > > > > >
> >> > > > > > > > > > > > > > >> > > > > > > > > >
> >> > > > > > > > > > > > > > >> > > > > > > > > >
> >> > > > > > > > > > > > > > >> > > > > > > > > > --
> >> > > > > > > > > > > > > > >> > > > > > > > > >
> >> > > > > > > > > > > > > > >> > > > >
> >> > > > > > > > > > > > > > >>
> >> > > > > > > > > > >
> >> > > > > >
> >> -------------------------------------------------------------------
> >> > > > > > > > > > > > > > >> > > > > > > > > > *SCJA. José Luis 
> >> > > > > > > > > > > > > > >> > > > > > > > > > Cetina*
> >> > > > > > > > > > > > > > >> > > > > > > > > >
> >> > > > > > > > > > > > > > >> > > > >
> >> > > > > > > > > > > > > > >>
> >> > > > > > > > > > >
> >> > > > > >
> >> -------------------------------------------------------------------
> >> > > > > > > > > > > > > > >> > > > > > > > > >
> >> > > > > > > > > > > > > > >> > > > > > > > >
> >> > > > > > > > > > > > > > >> > > > > > > >
> >> > > > > > > > > > > > > > >> > > > > > > >
> >> > > > > > > > > > > > > > >> > > > > > > >
> >> > > > > > > > > > > > > > >> > > > > > > > --
> >> > > > > > > > > > > > > > >> > > > > > > >
> >> > > > > > > > > > > > > > >> > >
> >> > > > > > > > > > > > >
> >> > > > > > > >
> >> > > ---------------------------------------------------------------
> >> > > ----
> >> > > > > > > > > > > > > > >> > > > > > > > *SCJA. José Luis Cetina*
> >> > > > > > > > > > > > > > >> > > > > > > >
> >> > > > > > > > > > > > > > >> > >
> >> > > > > > > > > > > > >
> >> > > > > > > >
> >> > > ---------------------------------------------------------------
> >> > > ----
> >> > > > > > > > > > > > > > >> > > > > > > >
> >> > > > > > > > > > > > > > >> > > > > > >
> >> > > > > > > > > > > > > > >> > > > > >
> >> > > > > > > > > > > > > > >> > > > > >
> >> > > > > > > > > > > > > > >> > > > > >
> >> > > > > > > > > > > > > > >> > > > > > --
> >> > > > > > > > > > > > > > >> > > > > >
> >> > > > > > > > > > > > > > >>
> >> > > > > > > > > > >
> >> > > > > >
> >> -------------------------------------------------------------------
> >> > > > > > > > > > > > > > >> > > > > > *SCJA. José Luis Cetina*
> >> > > > > > > > > > > > > > >> > > > > >
> >> > > > > > > > > > > > > > >>
> >> > > > > > > > > > >
> >> > > > > >
> >> -------------------------------------------------------------------
> >> > > > > > > > > > > > > > >> > > > > >
> >> > > > > > > > > > > > > > >> > > > >
> >> > > > > > > > > > > > > > >> > > >
> >> > > > > > > > > > > > > > >> > > >
> >> > > > > > > > > > > > > > >> > > >
> >> > > > > > > > > > > > > > >> > > > --
> >> > > > > > > > > > > > > > >> > > >
> >> > > > > > > > > > > > > >
> >> > > > > > > > >
> >> > > >
> -------------------------------------------------------------------
> >> > > > > > > > > > > > > > >> > > > *SCJA. José Luis Cetina*
> >> > > > > > > > > > > > > > >> > > >
> >> > > > > > > > > > > > > >
> >> > > > > > > > >
> >> > > >
> -------------------------------------------------------------------
> >> > > > > > > > > > > > > > >> > > >
> >> > > > > > > > > > > > > > >> > >
> >> > > > > > > > > > > > > > >> >
> >> > > > > > > > > > > > > > >> >
> >> > > > > > > > > > > > > > >> >
> >> > > > > > > > > > > > > > >> > --
> >> > > > > > > > > > > > > > >> >
> >> > > > > > > > > > > >
> >> > > > > > >
> >> > -----------------------------------------------------------------
> >> > --
> >> > > > > > > > > > > > > > >> > *SCJA. José Luis Cetina*
> >> > > > > > > > > > > > > > >> >
> >> > > > > > > > > > > >
> >> > > > > > >
> >> > -----------------------------------------------------------------
> >> > --
> >> > > > > > > > > > > > > > >> >
> >> > > > > > > > > > > > > > >>
> >> > > > > > > > > > > > > > >
> >> > > > > > > > > > > > > > >
> >> > > > > > > > > > > > > > >
> >> > > > > > > > > > > > > > > --
> >> > > > > > > > > > > > > > >
> >> > > > > > > > > >
> >> > > > >
> >> -------------------------------------------------------------------
> >> > > > > > > > > > > > > > > *SCJA. José Luis Cetina*
> >> > > > > > > > > > > > > > >
> >> > > > > > > > > >
> >> > > > >
> >> -------------------------------------------------------------------
> >> > > > > > > > > > > > > > >
> >> > > > > > > > > > > > > > >
> >> > > > > > > > > > > > > >
> >> > > > > > > > > > > > > >
> >> > > > > > > > > > > > > > --
> >> > > > > > > > > > > > > >
> >> > > > > > > > >
> >> > > >
> -------------------------------------------------------------------
> >> > > > > > > > > > > > > > *SCJA. José Luis Cetina*
> >> > > > > > > > > > > > > >
> >> > > > > > > > >
> >> > > >
> -------------------------------------------------------------------
> >> > > > > > > > > > > > > >
> >> > > > > > > > > > > > >
> >> > > > > > > > > > > >
> >> > > > > > > > > > > >
> >> > > > > > > > > > > >
> >> > > > > > > > > > > > --
> >> > > > > > > > > > > >
> >> > > > > > >
> >> > -----------------------------------------------------------------
> >> > --
> >> > > > > > > > > > > > *SCJA. José Luis Cetina*
> >> > > > > > > > > > > >
> >> > > > > > >
> >> > -----------------------------------------------------------------
> >> > --
> >> > > > > > > > > > > >
> >> > > > > > > > > > >
> >> > > > > > > > > >
> >> > > > > > > > > >
> >> > > > > > > > > >
> >> > > > > > > > > > --
> >> > > > > > > > > >
> >> > > > >
> >> -------------------------------------------------------------------
> >> > > > > > > > > > *SCJA. José Luis Cetina*
> >> > > > > > > > > >
> >> > > > >
> >> -------------------------------------------------------------------
> >> > > > > > > > > >
> >> > > > > > > > >
> >> > > > > > > >
> >> > > > > > > >
> >> > > > > > > >
> >> > > > > > > > --
> >> > > > > > > >
> >> > > ---------------------------------------------------------------
> >> > > ----
> >> > > > > > > > *SCJA. José Luis Cetina*
> >> > > > > > > >
> >> > > ---------------------------------------------------------------
> >> > > ----
> >> > > > > > > >
> >> > > > > > >
> >> > > > > >
> >> > > > > >
> >> > > > > >
> >> > > > > > --
> >> > > > > >
> >> -------------------------------------------------------------------
> >> > > > > > *SCJA. José Luis Cetina*
> >> > > > > >
> >> -------------------------------------------------------------------
> >> > > > > >
> >> > > > >
> >> > > >
> >> > > >
> >> > > >
> >> > > > --
> >> > > >
> -------------------------------------------------------------------
> >> > > > *SCJA. José Luis Cetina*
> >> > > >
> -------------------------------------------------------------------
> >> > > >
> >> > >
> >> >
> >> >
> >> >
> >> > --
> >> > -----------------------------------------------------------------
> >> > --
> >> > *SCJA. José Luis Cetina*
> >> > -----------------------------------------------------------------
> >> > --
> >> >
> >>
> >
> >
> >
> > --
> > -------------------------------------------------------------------
> > *SCJA. José Luis Cetina*
> > -------------------------------------------------------------------
> >
> >
>
>
> --
> -------------------------------------------------------------------
> *SCJA. José Luis Cetina*
> -------------------------------------------------------------------
>


RE: Guest user

Posted by Robin <ro...@gmail.com>.
Please Remove me from the e-mail list.
Thank You
Robin

-----Original Message-----
From: Romain Manni-Bucau [mailto:rmannibucau@gmail.com] 
Sent: Friday, June 15, 2012 10:02 AM
To: users@openejb.apache.org
Subject: Re: Guest user

Np,

thanks you to take time to share the information :)

- Romain


2012/6/15 José Luis Cetina <ma...@gmail.com>

> Well i readed what you say, and i see the topic is: Session Fixation 
> Protection and talk about a "security feature" then i decide to set 
> the values in my second request after the login.
>
> Session Fixation Protection says:
>
> "Essentially, when a user authenticates their session, Tomcat will 
> change the session ID. It does not destroy the previous session, 
> rather it renames it so it is no longer found by that ID. So in our 
> example above, Bob would try and log on with that session, and he would
not be able to find it."
>
>
> I decied not set the changeSessionIdOnAuthentication to false because 
> i can change the behaviour of my app without any problem, but the 
> people who are migrating from other Application Servers to TomEE have to
know this.
>
>
> References:
> http://tomcat.apache.org/tomcat-7.0-doc/config/valve.html
> http://www.tomcatexpert.com/blog/2011/04/25/session-fixation-protectio
> n http://java.dzone.com/tips/turning-session-fixation
>
>
> Thanks again.
>
>
> 2012/6/15 Romain Manni-Bucau <rm...@gmail.com>
>
> > that's because in your authenticator you have the attribute 
> > "changeSessionIdOnAuthentication" set to true.
> >
> > - Romain
> >
> >
> > 2012/6/15 José Luis Cetina <ma...@gmail.com>
> >
> > > Hi Romain, let me tell you, the problem only occurs when you use 
> > > login method and try to set something in the session bean just 
> > > after the next line of request.login, if I comment the login 
> > > method, then it works ok, please give a try with a simple test 
> > > with login method and you will see
> > the
> > > problem, I tested many times
> > >  El 15/06/2012 04:40, "Romain Manni-Bucau" <rm...@gmail.com>
> > > escribió:
> > >
> > > > Hi,
> > > >
> > > > i didnt test with the login but it seems it works
> > > >
> > > > but please add @RequestScoped to MyNextPageMBean or don't use 
> > > > postconstrutct otherwise you have a kind of cache effect 
> > > > depending on
> > the
> > > > moment when the bean is created.
> > > >
> > > > here a sample:
> > > >
> > > >
> > >
> >
> http://svn.apache.org/repos/asf/openejb/trunk/openejb/examples/cdi-ses
> sion-scope/
> > > >
> > > > - Romain
> > > >
> > > >
> > > > 2012/6/15 José Luis Cetina <ma...@gmail.com>
> > > >
> > > > > Hi Romain, well i have an other problem and i think is related 
> > > > > to
> > this
> > > > same
> > > > > reported issue.
> > > > >
> > > > > We talked about if i login using request.login(user,pass) 
> > > > > method
> and
> > if
> > > > the
> > > > > credentials and login was successfull then when i get the user 
> > > > > i
> get
> > a
> > > > > guess user:
> > > > >
> > > > > request.login(user,pass);
> > > > > String name = ejbContext.getCallerPrincipal().getName();
> > > > >
> > > > > Ok, then this was fixed, and its ok now, now returns the valid
> user.
> > > > >
> > > > > But now if i do this
> > > > >
> > > > > @Inject
> > > > > private MySessionBean mySessionBean;
> > > > >
> > > > > public String login(){
> > > > >   request.login(user,pass);
> > > > >   mySessionBean.setName("My name is JOE");
> > > > >   //then i do a redirect here
> > > > >  return "next_page";
> > > > > }
> > > > >
> > > > > now in my managedbean of my next_page.xhtml i had:
> > > > >
> > > > > @Named
> > > > > public MyNextPageMBean implements Serializable{
> > > > >
> > > > > @Inject
> > > > > private MySessionBean mySessionBean;
> > > > >
> > > > >  @PostConstruc
> > > > >  public void test(){
> > > > >    mySessionBean.getName(); <---HERE I GET NULL ALWAYS
> > > > >   }
> > > > >
> > > > > }
> > > > >
> > > > >
> > > > > SessionBean:
> > > > >
> > > > > import java.io.Serializable;
> > > > > import javax.enterprise.context.SessionScoped;
> > > > > import javax.inject.Named;
> > > > >
> > > > > @Named
> > > > > @SessionScoped
> > > > > public class MySessionBean implements Serializable{
> > > > >
> > > > >    private String name;
> > > > >
> > > > >    public MySessionBean() {
> > > > >
> > > > >    }
> > > > >
> > > > >    public String getName() {
> > > > >        return name;
> > > > >    }
> > > > >
> > > > >    public void setName(String name) {
> > > > >        this.name = name;
> > > > >    }
> > > > > }
> > > > >
> > > > >
> > > > >
> > > > > As you can see i get null, mi login its ok, but when i saved
> > something
> > > in
> > > > > my sessionbean when i try to retrive what i saved before, i 
> > > > > always
> > get
> > > > > null, like if i never set the value (and of course i did it) 
> > > > > but
> this
> > > > ONLY
> > > > > HAPPEND when i try to set the any value just before 
> > > > > request.login,
> > if i
> > > > set
> > > > > the value in the second bean  like
> > > > >
> > > > > mySessionBean.setName("My name is JOE"); then in other's page 
> > > > > i can
> > get
> > > > the
> > > > > value without any problem, i do a lot of test and the problem 
> > > > > is
> > when i
> > > > > only set the values (in my session bean) just before 
> > > > > request.login,
> > > then
> > > > i
> > > > > associated this with the "guest user problem" as you sayed 
> > > > > this was happening because the user was "recognized" only 
> > > > > after the first
> > > request.
> > > > >
> > > > > Again, is this the expected behaviour? it seem buggy
> > > > >
> > > > > Im using:  apache-tomee-1.1.0-20120612.040829-22-webprofile
> > > > >
> > > > >
> > > > > 2012/6/1 José Luis Cetina <ma...@gmail.com>
> > > > >
> > > > > > ok
> > > > > >
> > > > > >
> > > > > > 2012/6/1 Romain Manni-Bucau <rm...@gmail.com>
> > > > > >
> > > > > >> deployment in progress:
> > > > > >> http://ci.apache.org/builders/openejb-trunk-deploy/builds/3
> > > > > >> 78
> > > > > >>
> > > > > >> - Romain
> > > > > >>
> > > > > >>
> > > > > >> 2012/6/1 José Luis Cetina <ma...@gmail.com>
> > > > > >>
> > > > > >> > Ok, in what tomee build this will be available?
> > > > > >> >
> > > > > >> > 2012/5/31 Romain Manni-Bucau <rm...@gmail.com>
> > > > > >> >
> > > > > >> > > yep
> > > > > >> > >
> > > > > >> > > just commited, a new commit will come where this class 
> > > > > >> > > will
> > > > > >> automatically
> > > > > >> > > be added normally
> > > > > >> > >
> > > > > >> > > - Romain
> > > > > >> > >
> > > > > >> > >
> > > > > >> > > 2012/6/1 José Luis Cetina <ma...@gmail.com>
> > > > > >> > >
> > > > > >> > > > im getting a ClassNotFound
> > > > > >> > > >
> > > > > >> > > > Caused by: java.lang.ClassNotFoundException:
> > > > > >> > > > org.apache.tomee.catalina.TomEERealm
> > > > > >> > > >
> > > > > >> > > > 2012/5/31 Romain Manni-Bucau <rm...@gmail.com>
> > > > > >> > > >
> > > > > >> > > > > my sample is working, too late to add test but 
> > > > > >> > > > > manually
> it
> > > > works
> > > > > >> > > > >
> > > > > >> > > > > so i guess it should work for you
> > > > > >> > > > >
> > > > > >> > > > > the question now is should we add it automatically?
> > > > > >> > > > >
> > > > > >> > > > > - Romain
> > > > > >> > > > >
> > > > > >> > > > >
> > > > > >> > > > > 2012/6/1 José Luis Cetina <ma...@gmail.com>
> > > > > >> > > > >
> > > > > >> > > > > > Oooh great, with this i can get the principal 
> > > > > >> > > > > > user in
> > the
> > > > > first
> > > > > >> > > > request?
> > > > > >> > > > > or
> > > > > >> > > > > > this is something that you gonna fix?
> > > > > >> > > > > >
> > > > > >> > > > > > 2012/5/31 Romain Manni-Bucau 
> > > > > >> > > > > > <rm...@gmail.com>
> > > > > >> > > > > >
> > > > > >> > > > > > > that's brand new ;)
> > > > > >> > > > > > >
> > > > > >> > > > > > > just added it, it mainly delegate to the real 
> > > > > >> > > > > > > realm
> > but
> > > > add
> > > > > >> the
> > > > > >> > > > > principal
> > > > > >> > > > > > > info to openejb/tomee security service which is 
> > > > > >> > > > > > > used
> > in
> > > > > >> > ejbcontext
> > > > > >> > > > impl
> > > > > >> > > > > > (to
> > > > > >> > > > > > > make it short)
> > > > > >> > > > > > >
> > > > > >> > > > > > > - Romain
> > > > > >> > > > > > >
> > > > > >> > > > > > >
> > > > > >> > > > > > > 2012/6/1 José Luis Cetina 
> > > > > >> > > > > > > <ma...@gmail.com>
> > > > > >> > > > > > >
> > > > > >> > > > > > > > I have this in my context.xml
> > > > > >> > > > > > > >
> > > > > >> > > > > > > > <Realm className="MyExtendedDataSourceRealm"
> > > > > >> > > > > > > >  dataSourceName="MyDataSource"
> > > > > >> > > > > > > > digest="SHA-256"
> > > > > >> > > > > > > > encodePassword="Base64"
> > > > > >> > > > > > > > queryRealmRolesUser="SELECT rol FROM xxxx 
> > > > > >> > > > > > > > WHERE
> > > user=?"
> > > > > >> > > > > > > > queryRealmUsers="SELECT pass FROM xxx WHERE
> > user=?"/>
> > > > > >> > > > > > > >
> > > > > >> > > > > > > > As you can see i extend the datasource realm, 
> > > > > >> > > > > > > > i
> have
> > > > this
> > > > > >> realm
> > > > > >> > > > > config
> > > > > >> > > > > > in
> > > > > >> > > > > > > > the context.xml in my webapp (not context.xml
> > TomEE).
> > > > > >> > > > > > > >
> > > > > >> > > > > > > > But, as i can see in your example, you 
> > > > > >> > > > > > > > surround
> your
> > > > realm
> > > > > >> with
> > > > > >> > > > > > > TomEERealm,
> > > > > >> > > > > > > > if this necessary?. I didn't know this
> > > > > >> > > > > > > >
> > > > > >> > > > > > > >
> > > > > >> > > > > > > >
> > > > > >> > > > > > > > 2012/5/31 Romain Manni-Bucau <
> rmannibucau@gmail.com
> > >
> > > > > >> > > > > > > >
> > > > > >> > > > > > > > > in my test i used:
> > > > > >> > > > > > > > >
> > > > > >> > > > > > > > >    <Realm
> > > > > >> className="org.apache.tomee.catalina.TomEERealm">
> > > > > >> > > > > > > > >        <Realm
> > > > > >> className="org.apache.catalina.realm.JAASRealm"
> > > > > >> > > > > > > > > appName="PropertiesLoginModule"
> > > > > >> > > > > > > > >
> > > > > >> > > > > > > > >
> > > > > >> > > > > > > > >
> > > > > >> > > > > > > >
> > > > > >> > > > > > >
> > > > > >> > > > > >
> > > > > >> > > > >
> > > > > >> > > >
> > > > > >> > >
> > > > > >> >
> > > > > >>
> > > > >
> > > >
> > >
> >
>
userClassNames="org.apache.openejb.core.security.AbstractSecurityService$Use
r"
> > > > > >> > > > > > > > >
> > > > > >> > > > > > > > >
> > > > > >> > > > > > > > >
> > > > > >> > > > > > > >
> > > > > >> > > > > > >
> > > > > >> > > > > >
> > > > > >> > > > >
> > > > > >> > > >
> > > > > >> > >
> > > > > >> >
> > > > > >>
> > > > >
> > > >
> > >
> >
>  
> roleClassNames="org.apache.openejb.core.security.AbstractSecurityServi
> ce$Group">
> > > > > >> > > > > > > > >        </Realm>
> > > > > >> > > > > > > > >       </Realm>
> > > > > >> > > > > > > > >
> > > > > >> > > > > > > > > but i guess you can replace the jaasrealm 
> > > > > >> > > > > > > > > by
> your
> > > > > dsrealm
> > > > > >> > > > > > > > >
> > > > > >> > > > > > > > > - Romain
> > > > > >> > > > > > > > >
> > > > > >> > > > > > > > >
> > > > > >> > > > > > > > > 2012/6/1 José Luis Cetina 
> > > > > >> > > > > > > > > <maxtorzito@gmail.com
> >
> > > > > >> > > > > > > > >
> > > > > >> > > > > > > > > > Yes, it seems buggy.
> > > > > >> > > > > > > > > >
> > > > > >> > > > > > > > > > Where i have to replace?
> > > > > >> > > > > > > > > >
> > > > > >> > > > > > > > > > Remember im using DataSourceRealm
> > > > > >> > > > > > > > > >
> > > > > >> > > > > > > > > > 2012/5/31 Romain Manni-Bucau <
> > > rmannibucau@gmail.com
> > > > >
> > > > > >> > > > > > > > > >
> > > > > >> > > > > > > > > > > this is the current status,
> > > > > >> > > > > > > > > > >
> > > > > >> > > > > > > > > > > but IMO it is buggy,
> > > > > >> > > > > > > > > > >
> > > > > >> > > > > > > > > > > i'll commit soon a TomEEJAASRealm to 
> > > > > >> > > > > > > > > > > make it
> > > > working
> > > > > >> > > (replace
> > > > > >> > > > > > > > JAASRealm
> > > > > >> > > > > > > > > > in
> > > > > >> > > > > > > > > > > the conf)
> > > > > >> > > > > > > > > > >
> > > > > >> > > > > > > > > > > - Romain
> > > > > >> > > > > > > > > > >
> > > > > >> > > > > > > > > > >
> > > > > >> > > > > > > > > > > 2012/6/1 José Luis Cetina <
> > maxtorzito@gmail.com
> > > >
> > > > > >> > > > > > > > > > >
> > > > > >> > > > > > > > > > > > i think we are getting confused.
> > > > > >> > > > > > > > > > > >
> > > > > >> > > > > > > > > > > > If i resume all, this what i asked 
> > > > > >> > > > > > > > > > > > (the
> > final
> > > of
> > > > > the
> > > > > >> > > first
> > > > > >> > > > > > post)
> > > > > >> > > > > > > > > > > >
> > > > > >> > > > > > > > > > > > I dont know if this is the desire 
> > > > > >> > > > > > > > > > > > behavior
> > or
> > > if
> > > > > >> this
> > > > > >> > > > happend
> > > > > >> > > > > > > > becase
> > > > > >> > > > > > > > > > the
> > > > > >> > > > > > > > > > > > httr request isnt finished?
> > > > > >> > > > > > > > > > > > Then you answer me:
> > > > > >> > > > > > > > > > > >
> > > > > >> > > > > > > > > > > > in fact info from ejbcontext are 
> > > > > >> > > > > > > > > > > > taken in
> > our
> > > > > >> > > > securitymodule
> > > > > >> > > > > > > > > > > >
> > > > > >> > > > > > > > > > > > in tomee we set/unset it from a valve 
> > > > > >> > > > > > > > > > > > so
> at
> > > the
> > > > > >> > > > beginning/end
> > > > > >> > > > > > of
> > > > > >> > > > > > > > the
> > > > > >> > > > > > > > > > > > request...all between is currently 
> > > > > >> > > > > > > > > > > > ignored
> > so
> > > > when
> > > > > >> you
> > > > > >> > > log
> > > > > >> > > > > you
> > > > > >> > > > > > > need
> > > > > >> > > > > > > > > > > another
> > > > > >> > > > > > > > > > > > request to get the updated 
> > > > > >> > > > > > > > > > > > information
> (from
> > > the
> > > > > >> tomcat
> > > > > >> > > > > realm)
> > > > > >> > > > > > > > > > > >
> > > > > >> > > > > > > > > > > > "so when you log you need another 
> > > > > >> > > > > > > > > > > > request
> to
> > > get
> > > > > the
> > > > > >> > > > updated
> > > > > >> > > > > > > > > > information
> > > > > >> > > > > > > > > > > > (from the tomcat realm)
> > > > > >> > > > > > > > > > > >
> > > > > >> > > > > > > > > > > > Then i get guest because is the 
> > > > > >> > > > > > > > > > > > desire
> > > > behaviour,
> > > > > >> after
> > > > > >> > > the
> > > > > >> > > > > > first
> > > > > >> > > > > > > > > > > request i
> > > > > >> > > > > > > > > > > > can get the user i expected.
> > > > > >> > > > > > > > > > > >
> > > > > >> > > > > > > > > > > > Then i resume, this is the default
> > behaviour,
> > > > and
> > > > > >> works
> > > > > >> > > but
> > > > > >> > > > > you
> > > > > >> > > > > > > > need
> > > > > >> > > > > > > > > a
> > > > > >> > > > > > > > > > > > second request.
> > > > > >> > > > > > > > > > > >
> > > > > >> > > > > > > > > > > >
> > > > > >> > > > > > > > > > > >
> > > > > >> > > > > > > > > > > > 2012/5/31 Romain Manni-Bucau <
> > > > > rmannibucau@gmail.com
> > > > > >> >
> > > > > >> > > > > > > > > > > >
> > > > > >> > > > > > > > > > > > > i think it should work
> > > > > >> > > > > > > > > > > > >
> > > > > >> > > > > > > > > > > > > - Romain
> > > > > >> > > > > > > > > > > > >
> > > > > >> > > > > > > > > > > > >
> > > > > >> > > > > > > > > > > > > 2012/6/1 José Luis Cetina <
> > > > maxtorzito@gmail.com
> > > > > >
> > > > > >> > > > > > > > > > > > >
> > > > > >> > > > > > > > > > > > > > I mean this:
> > > > > >> > > > > > > > > > > > > >
> > > > > >> > > > > > > > > > > > > > I dont know if this is the desire
> > > behaviour
> > > > or
> > > > > >> if
> > > > > >> > > this
> > > > > >> > > > > > > happend
> > > > > >> > > > > > > > > > > because
> > > > > >> > > > > > > > > > > > > the
> > > > > >> > > > > > > > > > > > > > http request isnt finished?
> > > > > >> > > > > > > > > > > > > >
> > > > > >> > > > > > > > > > > > > >
> > > > > >> > > > > > > > > > > > > >
> > > > > >> > > > > > > > > > > > > > 2012/5/31 José Luis Cetina <
> > > > > >> maxtorzito@gmail.com>
> > > > > >> > > > > > > > > > > > > >
> > > > > >> > > > > > > > > > > > > > > Ok, the what i asked is correct??
> > > > > >> > > > > > > > > > > > > > >
> > > > > >> > > > > > > > > > > > > > > "I dont know if this is the 
> > > > > >> > > > > > > > > > > > > > > desire
> > > > behaviour
> > > > > >> or
> > > > > >> > if
> > > > > >> > > > this
> > > > > >> > > > > > > > happend
> > > > > >> > > > > > > > > > > > because
> > > > > >> > > > > > > > > > > > > > > the http request isnt finished?"
> > > > > >> > > > > > > > > > > > > > >
> > > > > >> > > > > > > > > > > > > > > 2012/5/31 Romain Manni-Bucau <
> > > > > >> > > rmannibucau@gmail.com>
> > > > > >> > > > > > > > > > > > > > >
> > > > > >> > > > > > > > > > > > > > >> ok,
> > > > > >> > > > > > > > > > > > > > >>
> > > > > >> > > > > > > > > > > > > > >> in fact info from ejbcontext 
> > > > > >> > > > > > > > > > > > > > >> are
> > taken
> > > in
> > > > > our
> > > > > >> > > > > > > securitymodule
> > > > > >> > > > > > > > > > > > > > >>
> > > > > >> > > > > > > > > > > > > > >> in tomee we set/unset it from 
> > > > > >> > > > > > > > > > > > > > >> a
> valve
> > > so
> > > > at
> > > > > >> the
> > > > > >> > > > > > > > beginning/end
> > > > > >> > > > > > > > > of
> > > > > >> > > > > > > > > > > the
> > > > > >> > > > > > > > > > > > > > >> request...all between is 
> > > > > >> > > > > > > > > > > > > > >> currently
> > > > ignored
> > > > > so
> > > > > >> > when
> > > > > >> > > > you
> > > > > >> > > > > > log
> > > > > >> > > > > > > > you
> > > > > >> > > > > > > > > > > need
> > > > > >> > > > > > > > > > > > > > >> another request to get the 
> > > > > >> > > > > > > > > > > > > > >> updated
> > information
> > > > > (from
> > > > > >> the
> > > > > >> > > > > tomcat
> > > > > >> > > > > > > > realm)
> > > > > >> > > > > > > > > > > > > > >>
> > > > > >> > > > > > > > > > > > > > >> - Romain
> > > > > >> > > > > > > > > > > > > > >>
> > > > > >> > > > > > > > > > > > > > >>
> > > > > >> > > > > > > > > > > > > > >> 2012/6/1 José Luis Cetina <
> > > > > >> maxtorzito@gmail.com
> > > > > >> > >
> > > > > >> > > > > > > > > > > > > > >>
> > > > > >> > > > > > > > > > > > > > >> > Yes, it work
> > > > > >> > > > > > > > > > > > > > >> >
> > > > > >> > > > > > > > > > > > > > >> > 1) Login (form login) using
> > > > > DataSourceRealm
> > > > > >> > > > > > > > > > > > > > >> >
> > > > > >> > > > > > > > > > > > > > >> >
> > > > > >> > > > > > > > > > > > > > >> > 2) Redirect to page2 from my
> > > > managedbean
> > > > > >> > > > > > > > > > > > > > >> >
> > > > > >> > > > > > > > > > > > > > >> > 2012/5/31 Romain Manni-Bucau 
> > > > > >> > > > > > > > > > > > > > >> > <
> > > > > >> > > > rmannibucau@gmail.com
> > > > > >> > > > > >
> > > > > >> > > > > > > > > > > > > > >> >
> > > > > >> > > > > > > > > > > > > > >> > > so you mean using the flow 
> > > > > >> > > > > > > > > > > > > > >> > > i
> > > > described
> > > > > >> > before
> > > > > >> > > it
> > > > > >> > > > > > > works?
> > > > > >> > > > > > > > > > > (sorry,
> > > > > >> > > > > > > > > > > > > just
> > > > > >> > > > > > > > > > > > > > >> to
> > > > > >> > > > > > > > > > > > > > >> > be
> > > > > >> > > > > > > > > > > > > > >> > > sure to understand)
> > > > > >> > > > > > > > > > > > > > >> > >
> > > > > >> > > > > > > > > > > > > > >> > > - Romain
> > > > > >> > > > > > > > > > > > > > >> > >
> > > > > >> > > > > > > > > > > > > > >> > >
> > > > > >> > > > > > > > > > > > > > >> > > 2012/6/1 José Luis Cetina 
> > > > > >> > > > > > > > > > > > > > >> > > <
> > > > > >> > > maxtorzito@gmail.com
> > > > > >> > > > >
> > > > > >> > > > > > > > > > > > > > >> > >
> > > > > >> > > > > > > > > > > > > > >> > > > Hi i can login and i can
> > navigate
> > > > > >> > (redirect)
> > > > > >> > > > to
> > > > > >> > > > > my
> > > > > >> > > > > > > > other
> > > > > >> > > > > > > > > > > page,
> > > > > >> > > > > > > > > > > > > > but i
> > > > > >> > > > > > > > > > > > > > >> > dont
> > > > > >> > > > > > > > > > > > > > >> > > > know why im getting 
> > > > > >> > > > > > > > > > > > > > >> > > > guest
> user
> > in
> > > > the
> > > > > >> > login
> > > > > >> > > > > mbean,
> > > > > >> > > > > > > > after
> > > > > >> > > > > > > > > > > that
> > > > > >> > > > > > > > > > > > in
> > > > > >> > > > > > > > > > > > > > >> other
> > > > > >> > > > > > > > > > > > > > >> > > > mbean  i get my "real" user.
> > > > > >> > > > > > > > > > > > > > >> > > >
> > > > > >> > > > > > > > > > > > > > >> > > >
> > > > > >> > > > > > > > > > > > > > >> > > > 2012/5/31 Romain 
> > > > > >> > > > > > > > > > > > > > >> > > > Manni-Bucau
> <
> > > > > >> > > > > > rmannibucau@gmail.com
> > > > > >> > > > > > > >
> > > > > >> > > > > > > > > > > > > > >> > > >
> > > > > >> > > > > > > > > > > > > > >> > > > > maybe
> > > > > >> > > > > > > > > > > > > > >> > > > >
> > > > > >> > > > > > > > > > > > > > >> > > >
> > > > > >> > > > > > > > > > > > > > >> > >
> > > > > >> > > > > > > > > > > > > > >> >
> > > > > >> > > > > > > > > > > > > > >>
> > > > > >> > > > > > > > > > > > > >
> > > > > >> > > > > > > > > > > > >
> > > > > >> > > > > > > > > > > >
> > > > > >> > > > > > > > > > >
> > > > > >> > > > > > > > > >
> > > > > >> > > > > > > > >
> > > > > >> > > > > > > >
> > > > > >> > > > > > >
> > > > > >> > > > > >
> > > > > >> > > > >
> > > > > >> > > >
> > > > > >> > >
> > > > > >> >
> > > > > >>
> > > > >
> > > >
> > >
> >
> http://rmannibucau.wordpress.com/2012/05/09/tomee-and-its-ssh-connecto
> r/but
> > > > > >> > > > > > > > > > > > > > >> > > > > it uses properties 
> > > > > >> > > > > > > > > > > > > > >> > > > > file, it
> > > just
> > > > > >> need a
> > > > > >> > > > custom
> > > > > >> > > > > > > login
> > > > > >> > > > > > > > > > > module
> > > > > >> > > > > > > > > > > > > > >> > > > implementation
> > > > > >> > > > > > > > > > > > > > >> > > > > to use a db.
> > > > > >> > > > > > > > > > > > > > >> > > > >
> > > > > >> > > > > > > > > > > > > > >> > > > > well,
> > > > > >> > > > > > > > > > > > > > >> > > > >
> > > > > >> > > > > > > > > > > > > > >> > > > > before can you test it
> > please?
> > > > > >> > > > > > > > > > > > > > >> > > > > 1) login
> > > > > >> > > > > > > > > > > > > > >> > > > > 2) redirect to your 
> > > > > >> > > > > > > > > > > > > > >> > > > > page
> > using
> > > > your
> > > > > >> bean
> > > > > >> > > > > > > > > > > > > > >> > > > >
> > > > > >> > > > > > > > > > > > > > >> > > > > - Romain
> > > > > >> > > > > > > > > > > > > > >> > > > >
> > > > > >> > > > > > > > > > > > > > >> > > > >
> > > > > >> > > > > > > > > > > > > > >> > > > > 2012/6/1 José Luis 
> > > > > >> > > > > > > > > > > > > > >> > > > > Cetina <
> > > > > >> > > > > maxtorzito@gmail.com
> > > > > >> > > > > > >
> > > > > >> > > > > > > > > > > > > > >> > > > >
> > > > > >> > > > > > > > > > > > > > >> > > > > > I have to read and 
> > > > > >> > > > > > > > > > > > > > >> > > > > > know
> how
> > > to
> > > > > use
> > > > > >> > > this, i
> > > > > >> > > > > > > always
> > > > > >> > > > > > > > > use
> > > > > >> > > > > > > > > > > > > > >> DataSource or
> > > > > >> > > > > > > > > > > > > > >> > > > > > JDBCRealm. (with
> > glassfish).
> > > > > >> > > > > > > > > > > > > > >> > > > > > im reading now, do 
> > > > > >> > > > > > > > > > > > > > >> > > > > > you
> have
> > > > > >> something
> > > > > >> > > for
> > > > > >> > > > a
> > > > > >> > > > > > > > > > quickstart?
> > > > > >> > > > > > > > > > > > for
> > > > > >> > > > > > > > > > > > > > >> share
> > > > > >> > > > > > > > > > > > > > >> > me
> > > > > >> > > > > > > > > > > > > > >> > > > > >
> > > > > >> > > > > > > > > > > > > > >> > > > > > 2012/5/31 Romain
> > Manni-Bucau
> > > <
> > > > > >> > > > > > > > rmannibucau@gmail.com
> > > > > >> > > > > > > > > >
> > > > > >> > > > > > > > > > > > > > >> > > > > >
> > > > > >> > > > > > > > > > > > > > >> > > > > > > having your 
> > > > > >> > > > > > > > > > > > > > >> > > > > > > password
> in a
> > > db
> > > > is
> > > > > >> not
> > > > > >> > an
> > > > > >> > > > > issue
> > > > > >> > > > > > > > but i
> > > > > >> > > > > > > > > > > think
> > > > > >> > > > > > > > > > > > > you
> > > > > >> > > > > > > > > > > > > > >> > should
> > > > > >> > > > > > > > > > > > > > >> > > > > > > use
> > > > > >> > > org.apache.catalina.realm.JAASRealm
> > > > > >> > > > > > > > > > > > > > >> > > > > > >
> > > > > >> > > > > > > > > > > > > > >> > > > > > > for instance:
> > > > > >> > > > > > > > > > > > > > >> > > > > > >
> > > > > >> > > > > > > > > > > > > > >> > > > > > >     <Realm
> > > > > >> > > > > > > > > > > >
> > > className="org.apache.catalina.realm.JAASRealm"
> > > > > >> > > > > > > > > > > > > > >> > > > > > >
> appName="MyDBLoginModule"
> > > > > >> > > > > > > > > > > > > > >> > > > > > >
> > > > > >> > > > > > > > > > > > > > >> > > > > > >
> > > > > >> > > > > > > > > > > > > > >> > > > > > >
> > > > > >> > > > > > > > > > > > > > >> > > > > >
> > > > > >> > > > > > > > > > > > > > >> > > > >
> > > > > >> > > > > > > > > > > > > > >> > > >
> > > > > >> > > > > > > > > > > > > > >> > >
> > > > > >> > > > > > > > > > > > > > >> >
> > > > > >> > > > > > > > > > > > > > >>
> > > > > >> > > > > > > > > > > > > >
> > > > > >> > > > > > > > > > > > >
> > > > > >> > > > > > > > > > > >
> > > > > >> > > > > > > > > > >
> > > > > >> > > > > > > > > >
> > > > > >> > > > > > > > >
> > > > > >> > > > > > > >
> > > > > >> > > > > > >
> > > > > >> > > > > >
> > > > > >> > > > >
> > > > > >> > > >
> > > > > >> > >
> > > > > >> >
> > > > > >>
> > > > >
> > > >
> > >
> >
>
userClassNames="org.apache.openejb.core.security.AbstractSecurityService$Use
r"
> > > > > >> > > > > > > > > > > > > > >> > > > > > >
> > > > > >> > > > > > > > > > > > > > >> > > > > > >
> > > > > >> > > > > > > > > > > > > > >> > > > > > >
> > > > > >> > > > > > > > > > > > > > >> > > > > >
> > > > > >> > > > > > > > > > > > > > >> > > > >
> > > > > >> > > > > > > > > > > > > > >> > > >
> > > > > >> > > > > > > > > > > > > > >> > >
> > > > > >> > > > > > > > > > > > > > >> >
> > > > > >> > > > > > > > > > > > > > >>
> > > > > >> > > > > > > > > > > > > >
> > > > > >> > > > > > > > > > > > >
> > > > > >> > > > > > > > > > > >
> > > > > >> > > > > > > > > > >
> > > > > >> > > > > > > > > >
> > > > > >> > > > > > > > >
> > > > > >> > > > > > > >
> > > > > >> > > > > > >
> > > > > >> > > > > >
> > > > > >> > > > >
> > > > > >> > > >
> > > > > >> > >
> > > > > >> >
> > > > > >>
> > > > >
> > > >
> > >
> >
>  
> roleClassNames="org.apache.openejb.core.security.AbstractSecurityServi
> ce$Group">
> > > > > >> > > > > > > > > > > > > > >> > > > > > >      </Realm>
> > > > > >> > > > > > > > > > > > > > >> > > > > > >
> > > > > >> > > > > > > > > > > > > > >> > > > > > > so simply 
> > > > > >> > > > > > > > > > > > > > >> > > > > > > implement a
> > > custom
> > > > > >> > > LoginModule
> > > > > >> > > > > > > instead
> > > > > >> > > > > > > > > of
> > > > > >> > > > > > > > > > a
> > > > > >> > > > > > > > > > > > > realm
> > > > > >> > > > > > > > > > > > > > >> > > > > > >
> > > > > >> > > > > > > > > > > > > > >> > > > > > > wdyt?
> > > > > >> > > > > > > > > > > > > > >> > > > > > >
> > > > > >> > > > > > > > > > > > > > >> > > > > > > - Romain
> > > > > >> > > > > > > > > > > > > > >> > > > > > >
> > > > > >> > > > > > > > > > > > > > >> > > > > > >
> > > > > >> > > > > > > > > > > > > > >> > > > > > > 2012/6/1 José Luis
> > Cetina <
> > > > > >> > > > > > > maxtorzito@gmail.com
> > > > > >> > > > > > > > >
> > > > > >> > > > > > > > > > > > > > >> > > > > > >
> > > > > >> > > > > > > > > > > > > > >> > > > > > > > Sorry, i use
> > > > > DataSourceRealm, i
> > > > > >> > have
> > > > > >> > > > my
> > > > > >> > > > > > > > > > > > user/pass/roles
> > > > > >> > > > > > > > > > > > > in
> > > > > >> > > > > > > > > > > > > > >> the
> > > > > >> > > > > > > > > > > > > > >> > > DB.
> > > > > >> > > > > > > > > > > > > > >> > > > > > > >
> > > > > >> > > > > > > > > > > > > > >> > > > > > > >
> > > > > >> > > > > > > > > > > > > > >> > > > > > > >
> > > > > >> > > > > > > > > > > > > > >> > > > > > > > 2012/5/31 Romain
> > > > Manni-Bucau
> > > > > <
> > > > > >> > > > > > > > > > rmannibucau@gmail.com
> > > > > >> > > > > > > > > > > >
> > > > > >> > > > > > > > > > > > > > >> > > > > > > >
> > > > > >> > > > > > > > > > > > > > >> > > > > > > > > can't you do 
> > > > > >> > > > > > > > > > > > > > >> > > > > > > > > it
> with
> > an
> > > > > >> embedded
> > > > > >> > > > one?
> > > > > >> > > > > > > > > > > > > > >> > > > > > > > >
> > > > > >> > > > > > > > > > > > > > >> > > > > > > > > well
> DataSourceRealm
> > > > > doesn't
> > > > > >> use
> > > > > >> > > > JAAS
> > > > > >> > > > > by
> > > > > >> > > > > > > > > > default i
> > > > > >> > > > > > > > > > > > > > think,
> > > > > >> > > > > > > > > > > > > > >> > maybe
> > > > > >> > > > > > > > > > > > > > >> > > > > > that's
> > > > > >> > > > > > > > > > > > > > >> > > > > > > > the
> > > > > >> > > > > > > > > > > > > > >> > > > > > > > > issue
> > > > > >> > > > > > > > > > > > > > >> > > > > > > > >
> > > > > >> > > > > > > > > > > > > > >> > > > > > > > > - Romain
> > > > > >> > > > > > > > > > > > > > >> > > > > > > > >
> > > > > >> > > > > > > > > > > > > > >> > > > > > > > >
> > > > > >> > > > > > > > > > > > > > >> > > > > > > > > 2012/6/1 José 
> > > > > >> > > > > > > > > > > > > > >> > > > > > > > > Luis
> > > > Cetina <
> > > > > >> > > > > > > > > maxtorzito@gmail.com
> > > > > >> > > > > > > > > > >
> > > > > >> > > > > > > > > > > > > > >> > > > > > > > >
> > > > > >> > > > > > > > > > > > > > >> > > > > > > > > > OK, i can 
> > > > > >> > > > > > > > > > > > > > >> > > > > > > > > > create
> a
> > > > > sample,
> > > > > >> > but i
> > > > > >> > > > use
> > > > > >> > > > > > > > > > > > > DataSourceRealm,
> > > > > >> > > > > > > > > > > > > > >> are
> > > > > >> > > > > > > > > > > > > > >> > you
> > > > > >> > > > > > > > > > > > > > >> > > > > gonna
> > > > > >> > > > > > > > > > > > > > >> > > > > > > > > > configure 
> > > > > >> > > > > > > > > > > > > > >> > > > > > > > > > your
> > > > database?
> > > > > >> > > > > > > > > > > > > > >> > > > > > > > > >
> > > > > >> > > > > > > > > > > > > > >> > > > > > > > > > 2012/5/31 
> > > > > >> > > > > > > > > > > > > > >> > > > > > > > > > Romain
> > > > > >> Manni-Bucau <
> > > > > >> > > > > > > > > > > > rmannibucau@gmail.com
> > > > > >> > > > > > > > > > > > > >
> > > > > >> > > > > > > > > > > > > > >> > > > > > > > > >
> > > > > >> > > > > > > > > > > > > > >> > > > > > > > > > > can you 
> > > > > >> > > > > > > > > > > > > > >> > > > > > > > > > > have a
> > try
> > > in
> > > > > an
> > > > > >> EJB
> > > > > >> > > > > please?
> > > > > >> > > > > > > > (just
> > > > > >> > > > > > > > > > try
> > > > > >> > > > > > > > > > > > to
> > > > > >> > > > > > > > > > > > > > add
> > > > > >> > > > > > > > > > > > > > >> > > > > @Stateless
> > > > > >> > > > > > > > > > > > > > >> > > > > > on
> > > > > >> > > > > > > > > > > > > > >> > > > > > > > > your
> > > > > >> > > > > > > > > > > > > > >> > > > > > > > > > > managed 
> > > > > >> > > > > > > > > > > > > > >> > > > > > > > > > > bean
> for
> > > > > >> instance)
> > > > > >> > > > > > > > > > > > > > >> > > > > > > > > > >
> > > > > >> > > > > > > > > > > > > > >> > > > > > > > > > > can you 
> > > > > >> > > > > > > > > > > > > > >> > > > > > > > > > > share a
> > > > sample
> > > > > >> easy
> > > > > >> > to
> > > > > >> > > > > run?
> > > > > >> > > > > > > > > > > > > > >> > > > > > > > > > >
> > > > > >> > > > > > > > > > > > > > >> > > > > > > > > > > - Romain
> > > > > >> > > > > > > > > > > > > > >> > > > > > > > > > >
> > > > > >> > > > > > > > > > > > > > >> > > > > > > > > > >
> > > > > >> > > > > > > > > > > > > > >> > > > > > > > > > > 2012/6/1 
> > > > > >> > > > > > > > > > > > > > >> > > > > > > > > > > José
> > Luis
> > > > > >> Cetina <
> > > > > >> > > > > > > > > > > maxtorzito@gmail.com
> > > > > >> > > > > > > > > > > > >
> > > > > >> > > > > > > > > > > > > > >> > > > > > > > > > >
> > > > > >> > > > > > > > > > > > > > >> > > > > > > > > > > > Yes, im 
> > > > > >> > > > > > > > > > > > > > >> > > > > > > > > > > > using
> > > JAAS
> > > > > >> > > > > > > > > > > > > > >> > > > > > > > > > > >
> > > > > >> > > > > > > > > > > > > > >> > > > > > > > > > > > 2012/5/3
> > > > > >> > > > > > > > > > > > > > >> > > > > > > > > > > > 1
> > Romain
> > > > > >> > > Manni-Bucau <
> > > > > >> > > > > > > > > > > > > > rmannibucau@gmail.com
> > > > > >> > > > > > > > > > > > > > >> >
> > > > > >> > > > > > > > > > > > > > >> > > > > > > > > > > >
> > > > > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > Hi,
> > > > > >> > > > > > > > > > > > > > >> > > > > > > > > > > > >
> > > > > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > Do you 
> > > > > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > use
> > > jaas?
> > > > > >> > > > > > > > > > > > > > >> > > > > > > > > > > > >
> > > > > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > - 
> > > > > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > Romain 
> > > > > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > Le 31 
> > > > > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > mai
> > 2012
> > > > > 20:14,
> > > > > >> > > "José
> > > > > >> > > > > Luis
> > > > > >> > > > > > > > > > Cetina" <
> > > > > >> > > > > > > > > > > > > > >> > > > > > maxtorzito@gmail.com
> > > > > >> > > > > > > > > > > > > > >> > > > > > > >
> > > > > >> > > > > > > > > > > > > > >> > > > > > > > a
> > > > > >> > > > > > > > > > > > > > >> > > > > > > > > > > écrit
> > > > > >> > > > > > > > > > > > > > >> > > > > > > > > > > > :
> > > > > >> > > > > > > > > > > > > > >> > > > > > > > > > > > >
> > > > > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > > Hi i 
> > > > > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > > have
> > > this
> > > > > >> > scenario:
> > > > > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > >
> > > > > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > > I 
> > > > > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > > have 
> > > > > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > > a
> > page
> > > > > >> > > login.xhtml,
> > > > > >> > > > > > this
> > > > > >> > > > > > > > page
> > > > > >> > > > > > > > > > > has a
> > > > > >> > > > > > > > > > > > > > >> > > ManagedBean
> > > > > >> > > > > > > > > > > > > > >> > > > > > > (@Named)
> > > > > >> > > > > > > > > > > > > > >> > > > > > > > > > this
> > > > > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > >
> managedbean
> > > use
> > > > > the
> > > > > >> > > > > > > > > > > > request.login(user,pass)
> > > > > >> > > > > > > > > > > > > > >> > method.
> > > > > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > >
> > > > > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > > When 
> > > > > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > > i do
> > > this:
> > > > > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > >
> > > > > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > >
> managedbean
> > > > > class:
> > > > > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > >
> > > > > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > > @Res
> > > > > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > > ourc
> > > > > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > > e 
> > > > > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > > priv
> > > > > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > > ate
> > > > > EJBContext
> > > > > >> > > > > ejbContext;
> > > > > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > > .
> > > > > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > > .
> > > > > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > >
> > > > > >> > > request.login(user,pass);
> > > > > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > > Stri
> > > > > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > > ng
> > name =
> > > > > >> > > > > > > > > > > > > > >> > > >
> > > > > >> ejbContext.getCallerPrincipal().getName();
> > > > > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > >
> > > > > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > > I 
> > > > > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > > get
> > "guest"
> > > > as
> > > > > my
> > > > > >> > user
> > > > > >> > > > > name.
> > > > > >> > > > > > > > But i
> > > > > >> > > > > > > > > > > > expect
> > > > > >> > > > > > > > > > > > > > the
> > > > > >> > > > > > > > > > > > > > >> > name
> > > > > >> > > > > > > > > > > > > > >> > > of
> > > > > >> > > > > > > > > > > > > > >> > > > > my
> > > > > >> > > > > > > > > > > > > > >> > > > > > > user
> > > > > >> > > > > > > > > > > > > > >> > > > > > > > > (of
> > > > > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > course
> > > > > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > > is 
> > > > > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > > not
> > guest)
> > > > > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > >
> > > > > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > > If 
> > > > > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > > the
> > login
> > > > was
> > > > > >> > > > successful
> > > > > >> > > > > my
> > > > > >> > > > > > > > login
> > > > > >> > > > > > > > > > > page
> > > > > >> > > > > > > > > > > > > > >> navigate
> > > > > >> > > > > > > > > > > > > > >> > to
> > > > > >> > > > > > > > > > > > > > >> > > > > other
> > > > > >> > > > > > > > > > > > > > >> > > > > > > > page
> > > > > >> > > > > > > > > > > > > > >> > > > > > > > > > lets
> > > > > >> > > > > > > > > > > > > > >> > > > > > > > > > > > say
> > > > > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > >
> pageb.xhtml
> > > > > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > >
> > > > > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > > If i
> > create a
> > > > > >> > > managedbean
> > > > > >> > > > > > > (@Named)
> > > > > >> > > > > > > > > for
> > > > > >> > > > > > > > > > > > > > >> pageb.xhtml
> > > > > >> > > > > > > > > > > > > > >> > > and
> > > > > >> > > > > > > > > > > > > > >> > > > in
> > > > > >> > > > > > > > > > > > > > >> > > > > > > that
> > > > > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > manage
> > > > > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > dbean
> > > > > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > > i 
> > > > > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > > use
> > again:
> > > > > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > > Stri
> > > > > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > > ng
> > name =
> > > > > >> > > > > > > > > > > > > > >> > > >
> > > > > >> ejbContext.getCallerPrincipal().getName();
> > > > > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > > then
> > > > > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > > ,
> here
> > i
> > > > get
> > > > > my
> > > > > >> > > > > "correct"
> > > > > >> > > > > > > name
> > > > > >> > > > > > > > > of
> > > > > >> > > > > > > > > > > the
> > > > > >> > > > > > > > > > > > > user
> > > > > >> > > > > > > > > > > > > > >> (not
> > > > > >> > > > > > > > > > > > > > >> > > > > guest).
> > > > > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > >
> > > > > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > > I 
> > > > > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > > dont
> know
> > > if
> > > > > >> this is
> > > > > >> > > the
> > > > > >> > > > > > > desire
> > > > > >> > > > > > > > > > > > behaviour
> > > > > >> > > > > > > > > > > > > or
> > > > > >> > > > > > > > > > > > > > >> if
> > > > > >> > > > > > > > > > > > > > >> > > this
> > > > > >> > > > > > > > > > > > > > >> > > > > > > happend
> > > > > >> > > > > > > > > > > > > > >> > > > > > > > > > > because
> > > > > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > the
> > > > > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > > http
> > request
> > > > isnt
> > > > > >> > > > finished?
> > > > > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > >
> > > > > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > > othe
> > > > > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > > r
> > > question
> > > > > why
> > > > > >> if
> > > > > >> > i
> > > > > >> > > > call
> > > > > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > > the
> > > > > >> > > > > > > > > > > > > >
> > >  ejbContext.getCallerPrincipal().getName();
> > > > > >> > > > > > > > > > > > > > >> > > before
> > > > > >> > > > > > > > > > > > > > >> > > > > the
> > > > > >> > > > > > > > > > > > > > >> > > > > > > > > > > > >
> > request.login()
> > > > > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > > meth
> > > > > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > > od i
> > get
> > > > > again
> > > > > >> > > > "guest",
> > > > > >> > > > > > why
> > > > > >> > > > > > > > not
> > > > > >> > > > > > > > > > > null?
> > > > > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > >
> > > > > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > > If 
> > > > > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > > this
> > > > question
> > > > > is
> > > > > >> > for
> > > > > >> > > > > > > > > tomee(openejb)
> > > > > >> > > > > > > > > > > or
> > > > > >> > > > > > > > > > > > > > >> tomcat?
> > > > > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > >
> > > > > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > > Than
> > > > > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > > ks
> > > > > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > >
> > > > > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > >
> > > > > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > >
> > > > > >> > > > > > > > > > > > > > >> > > > > > > > >
> > > > > >> > > > > > > > > > > > > > >> > > >
> > > > > >> > > > > > > > > > > > > >
> > > > > >> > > > > > > > >
> > > > > >> > > >
> > > > > --------------------------------------------------------------
> > > > > -----
> > > > > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > > *SCJA.
> José
> > > > Luis
> > > > > >> > Cetina*
> > > > > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > >
> > > > > >> > > > > > > > > > > > > > >> > > > > > > > >
> > > > > >> > > > > > > > > > > > > > >> > > >
> > > > > >> > > > > > > > > > > > > >
> > > > > >> > > > > > > > >
> > > > > >> > > >
> > > > > --------------------------------------------------------------
> > > > > -----
> > > > > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > >
> > > > > >> > > > > > > > > > > > > > >> > > > > > > > > > > > >
> > > > > >> > > > > > > > > > > > > > >> > > > > > > > > > > >
> > > > > >> > > > > > > > > > > > > > >> > > > > > > > > > > >
> > > > > >> > > > > > > > > > > > > > >> > > > > > > > > > > >
> > > > > >> > > > > > > > > > > > > > >> > > > > > > > > > > > --
> > > > > >> > > > > > > > > > > > > > >> > > > > > > > > > > >
> > > > > >> > > > > > > > > > > > > > >> > > > > > >
> > > > > >> > > > > > > > > > > > > > >> >
> > > > > >> > > > > > > > > > > >
> > > > > >> > > > > > >
> > > > > >> >
> > > ------------------------------------------------------------------
> > > -
> > > > > >> > > > > > > > > > > > > > >> > > > > > > > > > > > *SCJA. 
> > > > > >> > > > > > > > > > > > > > >> > > > > > > > > > > > José
> > Luis
> > > > > >> Cetina*
> > > > > >> > > > > > > > > > > > > > >> > > > > > > > > > > >
> > > > > >> > > > > > > > > > > > > > >> > > > > > >
> > > > > >> > > > > > > > > > > > > > >> >
> > > > > >> > > > > > > > > > > >
> > > > > >> > > > > > >
> > > > > >> >
> > > ------------------------------------------------------------------
> > > -
> > > > > >> > > > > > > > > > > > > > >> > > > > > > > > > > >
> > > > > >> > > > > > > > > > > > > > >> > > > > > > > > > >
> > > > > >> > > > > > > > > > > > > > >> > > > > > > > > >
> > > > > >> > > > > > > > > > > > > > >> > > > > > > > > >
> > > > > >> > > > > > > > > > > > > > >> > > > > > > > > >
> > > > > >> > > > > > > > > > > > > > >> > > > > > > > > > --
> > > > > >> > > > > > > > > > > > > > >> > > > > > > > > >
> > > > > >> > > > > > > > > > > > > > >> > > > >
> > > > > >> > > > > > > > > > > > > > >>
> > > > > >> > > > > > > > > > >
> > > > > >> > > > > >
> > > > > >>
> > -------------------------------------------------------------------
> > > > > >> > > > > > > > > > > > > > >> > > > > > > > > > *SCJA. José 
> > > > > >> > > > > > > > > > > > > > >> > > > > > > > > > Luis
> > > > Cetina*
> > > > > >> > > > > > > > > > > > > > >> > > > > > > > > >
> > > > > >> > > > > > > > > > > > > > >> > > > >
> > > > > >> > > > > > > > > > > > > > >>
> > > > > >> > > > > > > > > > >
> > > > > >> > > > > >
> > > > > >>
> > -------------------------------------------------------------------
> > > > > >> > > > > > > > > > > > > > >> > > > > > > > > >
> > > > > >> > > > > > > > > > > > > > >> > > > > > > > >
> > > > > >> > > > > > > > > > > > > > >> > > > > > > >
> > > > > >> > > > > > > > > > > > > > >> > > > > > > >
> > > > > >> > > > > > > > > > > > > > >> > > > > > > >
> > > > > >> > > > > > > > > > > > > > >> > > > > > > > --
> > > > > >> > > > > > > > > > > > > > >> > > > > > > >
> > > > > >> > > > > > > > > > > > > > >> > >
> > > > > >> > > > > > > > > > > > >
> > > > > >> > > > > > > >
> > > > > >> > >
> > > > ----------------------------------------------------------------
> > > > ---
> > > > > >> > > > > > > > > > > > > > >> > > > > > > > *SCJA. José Luis
> > Cetina*
> > > > > >> > > > > > > > > > > > > > >> > > > > > > >
> > > > > >> > > > > > > > > > > > > > >> > >
> > > > > >> > > > > > > > > > > > >
> > > > > >> > > > > > > >
> > > > > >> > >
> > > > ----------------------------------------------------------------
> > > > ---
> > > > > >> > > > > > > > > > > > > > >> > > > > > > >
> > > > > >> > > > > > > > > > > > > > >> > > > > > >
> > > > > >> > > > > > > > > > > > > > >> > > > > >
> > > > > >> > > > > > > > > > > > > > >> > > > > >
> > > > > >> > > > > > > > > > > > > > >> > > > > >
> > > > > >> > > > > > > > > > > > > > >> > > > > > --
> > > > > >> > > > > > > > > > > > > > >> > > > > >
> > > > > >> > > > > > > > > > > > > > >>
> > > > > >> > > > > > > > > > >
> > > > > >> > > > > >
> > > > > >>
> > -------------------------------------------------------------------
> > > > > >> > > > > > > > > > > > > > >> > > > > > *SCJA. José Luis 
> > > > > >> > > > > > > > > > > > > > >> > > > > > Cetina*
> > > > > >> > > > > > > > > > > > > > >> > > > > >
> > > > > >> > > > > > > > > > > > > > >>
> > > > > >> > > > > > > > > > >
> > > > > >> > > > > >
> > > > > >>
> > -------------------------------------------------------------------
> > > > > >> > > > > > > > > > > > > > >> > > > > >
> > > > > >> > > > > > > > > > > > > > >> > > > >
> > > > > >> > > > > > > > > > > > > > >> > > >
> > > > > >> > > > > > > > > > > > > > >> > > >
> > > > > >> > > > > > > > > > > > > > >> > > >
> > > > > >> > > > > > > > > > > > > > >> > > > --
> > > > > >> > > > > > > > > > > > > > >> > > >
> > > > > >> > > > > > > > > > > > > >
> > > > > >> > > > > > > > >
> > > > > >> > > >
> > > > > --------------------------------------------------------------
> > > > > -----
> > > > > >> > > > > > > > > > > > > > >> > > > *SCJA. José Luis Cetina*
> > > > > >> > > > > > > > > > > > > > >> > > >
> > > > > >> > > > > > > > > > > > > >
> > > > > >> > > > > > > > >
> > > > > >> > > >
> > > > > --------------------------------------------------------------
> > > > > -----
> > > > > >> > > > > > > > > > > > > > >> > > >
> > > > > >> > > > > > > > > > > > > > >> > >
> > > > > >> > > > > > > > > > > > > > >> >
> > > > > >> > > > > > > > > > > > > > >> >
> > > > > >> > > > > > > > > > > > > > >> >
> > > > > >> > > > > > > > > > > > > > >> > --
> > > > > >> > > > > > > > > > > > > > >> >
> > > > > >> > > > > > > > > > > >
> > > > > >> > > > > > >
> > > > > >> >
> > > ------------------------------------------------------------------
> > > -
> > > > > >> > > > > > > > > > > > > > >> > *SCJA. José Luis Cetina*
> > > > > >> > > > > > > > > > > > > > >> >
> > > > > >> > > > > > > > > > > >
> > > > > >> > > > > > >
> > > > > >> >
> > > ------------------------------------------------------------------
> > > -
> > > > > >> > > > > > > > > > > > > > >> >
> > > > > >> > > > > > > > > > > > > > >>
> > > > > >> > > > > > > > > > > > > > >
> > > > > >> > > > > > > > > > > > > > >
> > > > > >> > > > > > > > > > > > > > >
> > > > > >> > > > > > > > > > > > > > > --
> > > > > >> > > > > > > > > > > > > > >
> > > > > >> > > > > > > > > >
> > > > > >> > > > >
> > > > > >>
> > -------------------------------------------------------------------
> > > > > >> > > > > > > > > > > > > > > *SCJA. José Luis Cetina*
> > > > > >> > > > > > > > > > > > > > >
> > > > > >> > > > > > > > > >
> > > > > >> > > > >
> > > > > >>
> > -------------------------------------------------------------------
> > > > > >> > > > > > > > > > > > > > >
> > > > > >> > > > > > > > > > > > > > >
> > > > > >> > > > > > > > > > > > > >
> > > > > >> > > > > > > > > > > > > >
> > > > > >> > > > > > > > > > > > > > --
> > > > > >> > > > > > > > > > > > > >
> > > > > >> > > > > > > > >
> > > > > >> > > >
> > > > > --------------------------------------------------------------
> > > > > -----
> > > > > >> > > > > > > > > > > > > > *SCJA. José Luis Cetina*
> > > > > >> > > > > > > > > > > > > >
> > > > > >> > > > > > > > >
> > > > > >> > > >
> > > > > --------------------------------------------------------------
> > > > > -----
> > > > > >> > > > > > > > > > > > > >
> > > > > >> > > > > > > > > > > > >
> > > > > >> > > > > > > > > > > >
> > > > > >> > > > > > > > > > > >
> > > > > >> > > > > > > > > > > >
> > > > > >> > > > > > > > > > > > --
> > > > > >> > > > > > > > > > > >
> > > > > >> > > > > > >
> > > > > >> >
> > > ------------------------------------------------------------------
> > > -
> > > > > >> > > > > > > > > > > > *SCJA. José Luis Cetina*
> > > > > >> > > > > > > > > > > >
> > > > > >> > > > > > >
> > > > > >> >
> > > ------------------------------------------------------------------
> > > -
> > > > > >> > > > > > > > > > > >
> > > > > >> > > > > > > > > > >
> > > > > >> > > > > > > > > >
> > > > > >> > > > > > > > > >
> > > > > >> > > > > > > > > >
> > > > > >> > > > > > > > > > --
> > > > > >> > > > > > > > > >
> > > > > >> > > > >
> > > > > >>
> > -------------------------------------------------------------------
> > > > > >> > > > > > > > > > *SCJA. José Luis Cetina*
> > > > > >> > > > > > > > > >
> > > > > >> > > > >
> > > > > >>
> > -------------------------------------------------------------------
> > > > > >> > > > > > > > > >
> > > > > >> > > > > > > > >
> > > > > >> > > > > > > >
> > > > > >> > > > > > > >
> > > > > >> > > > > > > >
> > > > > >> > > > > > > > --
> > > > > >> > > > > > > >
> > > > > >> > >
> > > > ----------------------------------------------------------------
> > > > ---
> > > > > >> > > > > > > > *SCJA. José Luis Cetina*
> > > > > >> > > > > > > >
> > > > > >> > >
> > > > ----------------------------------------------------------------
> > > > ---
> > > > > >> > > > > > > >
> > > > > >> > > > > > >
> > > > > >> > > > > >
> > > > > >> > > > > >
> > > > > >> > > > > >
> > > > > >> > > > > > --
> > > > > >> > > > > >
> > > > > >>
> > -------------------------------------------------------------------
> > > > > >> > > > > > *SCJA. José Luis Cetina*
> > > > > >> > > > > >
> > > > > >>
> > -------------------------------------------------------------------
> > > > > >> > > > > >
> > > > > >> > > > >
> > > > > >> > > >
> > > > > >> > > >
> > > > > >> > > >
> > > > > >> > > > --
> > > > > >> > > >
> > > > > --------------------------------------------------------------
> > > > > -----
> > > > > >> > > > *SCJA. José Luis Cetina*
> > > > > >> > > >
> > > > > --------------------------------------------------------------
> > > > > -----
> > > > > >> > > >
> > > > > >> > >
> > > > > >> >
> > > > > >> >
> > > > > >> >
> > > > > >> > --
> > > > > >> >
> > > ------------------------------------------------------------------
> > > -
> > > > > >> > *SCJA. José Luis Cetina*
> > > > > >> >
> > > ------------------------------------------------------------------
> > > -
> > > > > >> >
> > > > > >>
> > > > > >
> > > > > >
> > > > > >
> > > > > > --
> > > > > >
> -------------------------------------------------------------------
> > > > > > *SCJA. José Luis Cetina*
> > > > > >
> -------------------------------------------------------------------
> > > > > >
> > > > > >
> > > > >
> > > > >
> > > > > --
> > > > > --------------------------------------------------------------
> > > > > -----
> > > > > *SCJA. José Luis Cetina*
> > > > > --------------------------------------------------------------
> > > > > -----
> > > > >
> > > >
> > >
> >
>
>
>
> --
> -------------------------------------------------------------------
> *SCJA. José Luis Cetina*
> -------------------------------------------------------------------
>


Re: Guest user

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

thanks you to take time to share the information :)

- Romain


2012/6/15 José Luis Cetina <ma...@gmail.com>

> Well i readed what you say, and i see the topic is: Session Fixation
> Protection and talk about a "security feature" then i decide to set the
> values in my second request after the login.
>
> Session Fixation Protection says:
>
> "Essentially, when a user authenticates their session, Tomcat will change
> the session ID. It does not destroy the previous session, rather it renames
> it so it is no longer found by that ID. So in our example above, Bob would
> try and log on with that session, and he would not be able to find it."
>
>
> I decied not set the changeSessionIdOnAuthentication to false because i can
> change the behaviour of my app without any problem, but the people who are
> migrating from other Application Servers to TomEE have to know this.
>
>
> References:
> http://tomcat.apache.org/tomcat-7.0-doc/config/valve.html
> http://www.tomcatexpert.com/blog/2011/04/25/session-fixation-protection
> http://java.dzone.com/tips/turning-session-fixation
>
>
> Thanks again.
>
>
> 2012/6/15 Romain Manni-Bucau <rm...@gmail.com>
>
> > that's because in your authenticator you have the attribute
> > "changeSessionIdOnAuthentication" set to true.
> >
> > - Romain
> >
> >
> > 2012/6/15 José Luis Cetina <ma...@gmail.com>
> >
> > > Hi Romain, let me tell you, the problem only occurs when you use login
> > > method and try to set something in the session bean just after the next
> > > line of request.login, if I comment the login method, then it works ok,
> > > please give a try with a simple test with login method and you will see
> > the
> > > problem, I tested many times
> > >  El 15/06/2012 04:40, "Romain Manni-Bucau" <rm...@gmail.com>
> > > escribió:
> > >
> > > > Hi,
> > > >
> > > > i didnt test with the login but it seems it works
> > > >
> > > > but please add @RequestScoped to MyNextPageMBean or don't use
> > > > postconstrutct otherwise you have a kind of cache effect depending on
> > the
> > > > moment when the bean is created.
> > > >
> > > > here a sample:
> > > >
> > > >
> > >
> >
> http://svn.apache.org/repos/asf/openejb/trunk/openejb/examples/cdi-session-scope/
> > > >
> > > > - Romain
> > > >
> > > >
> > > > 2012/6/15 José Luis Cetina <ma...@gmail.com>
> > > >
> > > > > Hi Romain, well i have an other problem and i think is related to
> > this
> > > > same
> > > > > reported issue.
> > > > >
> > > > > We talked about if i login using request.login(user,pass) method
> and
> > if
> > > > the
> > > > > credentials and login was successfull then when i get the user i
> get
> > a
> > > > > guess user:
> > > > >
> > > > > request.login(user,pass);
> > > > > String name = ejbContext.getCallerPrincipal().getName();
> > > > >
> > > > > Ok, then this was fixed, and its ok now, now returns the valid
> user.
> > > > >
> > > > > But now if i do this
> > > > >
> > > > > @Inject
> > > > > private MySessionBean mySessionBean;
> > > > >
> > > > > public String login(){
> > > > >   request.login(user,pass);
> > > > >   mySessionBean.setName("My name is JOE");
> > > > >   //then i do a redirect here
> > > > >  return "next_page";
> > > > > }
> > > > >
> > > > > now in my managedbean of my next_page.xhtml i had:
> > > > >
> > > > > @Named
> > > > > public MyNextPageMBean implements Serializable{
> > > > >
> > > > > @Inject
> > > > > private MySessionBean mySessionBean;
> > > > >
> > > > >  @PostConstruc
> > > > >  public void test(){
> > > > >    mySessionBean.getName(); <---HERE I GET NULL ALWAYS
> > > > >   }
> > > > >
> > > > > }
> > > > >
> > > > >
> > > > > SessionBean:
> > > > >
> > > > > import java.io.Serializable;
> > > > > import javax.enterprise.context.SessionScoped;
> > > > > import javax.inject.Named;
> > > > >
> > > > > @Named
> > > > > @SessionScoped
> > > > > public class MySessionBean implements Serializable{
> > > > >
> > > > >    private String name;
> > > > >
> > > > >    public MySessionBean() {
> > > > >
> > > > >    }
> > > > >
> > > > >    public String getName() {
> > > > >        return name;
> > > > >    }
> > > > >
> > > > >    public void setName(String name) {
> > > > >        this.name = name;
> > > > >    }
> > > > > }
> > > > >
> > > > >
> > > > >
> > > > > As you can see i get null, mi login its ok, but when i saved
> > something
> > > in
> > > > > my sessionbean when i try to retrive what i saved before, i always
> > get
> > > > > null, like if i never set the value (and of course i did it) but
> this
> > > > ONLY
> > > > > HAPPEND when i try to set the any value just before request.login,
> > if i
> > > > set
> > > > > the value in the second bean  like
> > > > >
> > > > > mySessionBean.setName("My name is JOE"); then in other's page i can
> > get
> > > > the
> > > > > value without any problem, i do a lot of test and the problem is
> > when i
> > > > > only set the values (in my session bean) just before request.login,
> > > then
> > > > i
> > > > > associated this with the "guest user problem" as you sayed this was
> > > > > happening because the user was "recognized" only after the first
> > > request.
> > > > >
> > > > > Again, is this the expected behaviour? it seem buggy
> > > > >
> > > > > Im using:  apache-tomee-1.1.0-20120612.040829-22-webprofile
> > > > >
> > > > >
> > > > > 2012/6/1 José Luis Cetina <ma...@gmail.com>
> > > > >
> > > > > > ok
> > > > > >
> > > > > >
> > > > > > 2012/6/1 Romain Manni-Bucau <rm...@gmail.com>
> > > > > >
> > > > > >> deployment in progress:
> > > > > >> http://ci.apache.org/builders/openejb-trunk-deploy/builds/378
> > > > > >>
> > > > > >> - Romain
> > > > > >>
> > > > > >>
> > > > > >> 2012/6/1 José Luis Cetina <ma...@gmail.com>
> > > > > >>
> > > > > >> > Ok, in what tomee build this will be available?
> > > > > >> >
> > > > > >> > 2012/5/31 Romain Manni-Bucau <rm...@gmail.com>
> > > > > >> >
> > > > > >> > > yep
> > > > > >> > >
> > > > > >> > > just commited, a new commit will come where this class will
> > > > > >> automatically
> > > > > >> > > be added normally
> > > > > >> > >
> > > > > >> > > - Romain
> > > > > >> > >
> > > > > >> > >
> > > > > >> > > 2012/6/1 José Luis Cetina <ma...@gmail.com>
> > > > > >> > >
> > > > > >> > > > im getting a ClassNotFound
> > > > > >> > > >
> > > > > >> > > > Caused by: java.lang.ClassNotFoundException:
> > > > > >> > > > org.apache.tomee.catalina.TomEERealm
> > > > > >> > > >
> > > > > >> > > > 2012/5/31 Romain Manni-Bucau <rm...@gmail.com>
> > > > > >> > > >
> > > > > >> > > > > my sample is working, too late to add test but manually
> it
> > > > works
> > > > > >> > > > >
> > > > > >> > > > > so i guess it should work for you
> > > > > >> > > > >
> > > > > >> > > > > the question now is should we add it automatically?
> > > > > >> > > > >
> > > > > >> > > > > - Romain
> > > > > >> > > > >
> > > > > >> > > > >
> > > > > >> > > > > 2012/6/1 José Luis Cetina <ma...@gmail.com>
> > > > > >> > > > >
> > > > > >> > > > > > Oooh great, with this i can get the principal user in
> > the
> > > > > first
> > > > > >> > > > request?
> > > > > >> > > > > or
> > > > > >> > > > > > this is something that you gonna fix?
> > > > > >> > > > > >
> > > > > >> > > > > > 2012/5/31 Romain Manni-Bucau <rm...@gmail.com>
> > > > > >> > > > > >
> > > > > >> > > > > > > that's brand new ;)
> > > > > >> > > > > > >
> > > > > >> > > > > > > just added it, it mainly delegate to the real realm
> > but
> > > > add
> > > > > >> the
> > > > > >> > > > > principal
> > > > > >> > > > > > > info to openejb/tomee security service which is used
> > in
> > > > > >> > ejbcontext
> > > > > >> > > > impl
> > > > > >> > > > > > (to
> > > > > >> > > > > > > make it short)
> > > > > >> > > > > > >
> > > > > >> > > > > > > - Romain
> > > > > >> > > > > > >
> > > > > >> > > > > > >
> > > > > >> > > > > > > 2012/6/1 José Luis Cetina <ma...@gmail.com>
> > > > > >> > > > > > >
> > > > > >> > > > > > > > I have this in my context.xml
> > > > > >> > > > > > > >
> > > > > >> > > > > > > > <Realm className="MyExtendedDataSourceRealm"
> > > > > >> > > > > > > >  dataSourceName="MyDataSource"
> > > > > >> > > > > > > > digest="SHA-256"
> > > > > >> > > > > > > > encodePassword="Base64"
> > > > > >> > > > > > > > queryRealmRolesUser="SELECT rol FROM xxxx WHERE
> > > user=?"
> > > > > >> > > > > > > > queryRealmUsers="SELECT pass FROM xxx WHERE
> > user=?"/>
> > > > > >> > > > > > > >
> > > > > >> > > > > > > > As you can see i extend the datasource realm, i
> have
> > > > this
> > > > > >> realm
> > > > > >> > > > > config
> > > > > >> > > > > > in
> > > > > >> > > > > > > > the context.xml in my webapp (not context.xml
> > TomEE).
> > > > > >> > > > > > > >
> > > > > >> > > > > > > > But, as i can see in your example, you surround
> your
> > > > realm
> > > > > >> with
> > > > > >> > > > > > > TomEERealm,
> > > > > >> > > > > > > > if this necessary?. I didn't know this
> > > > > >> > > > > > > >
> > > > > >> > > > > > > >
> > > > > >> > > > > > > >
> > > > > >> > > > > > > > 2012/5/31 Romain Manni-Bucau <
> rmannibucau@gmail.com
> > >
> > > > > >> > > > > > > >
> > > > > >> > > > > > > > > in my test i used:
> > > > > >> > > > > > > > >
> > > > > >> > > > > > > > >    <Realm
> > > > > >> className="org.apache.tomee.catalina.TomEERealm">
> > > > > >> > > > > > > > >        <Realm
> > > > > >> className="org.apache.catalina.realm.JAASRealm"
> > > > > >> > > > > > > > > appName="PropertiesLoginModule"
> > > > > >> > > > > > > > >
> > > > > >> > > > > > > > >
> > > > > >> > > > > > > > >
> > > > > >> > > > > > > >
> > > > > >> > > > > > >
> > > > > >> > > > > >
> > > > > >> > > > >
> > > > > >> > > >
> > > > > >> > >
> > > > > >> >
> > > > > >>
> > > > >
> > > >
> > >
> >
>  userClassNames="org.apache.openejb.core.security.AbstractSecurityService$User"
> > > > > >> > > > > > > > >
> > > > > >> > > > > > > > >
> > > > > >> > > > > > > > >
> > > > > >> > > > > > > >
> > > > > >> > > > > > >
> > > > > >> > > > > >
> > > > > >> > > > >
> > > > > >> > > >
> > > > > >> > >
> > > > > >> >
> > > > > >>
> > > > >
> > > >
> > >
> >
>  roleClassNames="org.apache.openejb.core.security.AbstractSecurityService$Group">
> > > > > >> > > > > > > > >        </Realm>
> > > > > >> > > > > > > > >       </Realm>
> > > > > >> > > > > > > > >
> > > > > >> > > > > > > > > but i guess you can replace the jaasrealm by
> your
> > > > > dsrealm
> > > > > >> > > > > > > > >
> > > > > >> > > > > > > > > - Romain
> > > > > >> > > > > > > > >
> > > > > >> > > > > > > > >
> > > > > >> > > > > > > > > 2012/6/1 José Luis Cetina <maxtorzito@gmail.com
> >
> > > > > >> > > > > > > > >
> > > > > >> > > > > > > > > > Yes, it seems buggy.
> > > > > >> > > > > > > > > >
> > > > > >> > > > > > > > > > Where i have to replace?
> > > > > >> > > > > > > > > >
> > > > > >> > > > > > > > > > Remember im using DataSourceRealm
> > > > > >> > > > > > > > > >
> > > > > >> > > > > > > > > > 2012/5/31 Romain Manni-Bucau <
> > > rmannibucau@gmail.com
> > > > >
> > > > > >> > > > > > > > > >
> > > > > >> > > > > > > > > > > this is the current status,
> > > > > >> > > > > > > > > > >
> > > > > >> > > > > > > > > > > but IMO it is buggy,
> > > > > >> > > > > > > > > > >
> > > > > >> > > > > > > > > > > i'll commit soon a TomEEJAASRealm to make it
> > > > working
> > > > > >> > > (replace
> > > > > >> > > > > > > > JAASRealm
> > > > > >> > > > > > > > > > in
> > > > > >> > > > > > > > > > > the conf)
> > > > > >> > > > > > > > > > >
> > > > > >> > > > > > > > > > > - Romain
> > > > > >> > > > > > > > > > >
> > > > > >> > > > > > > > > > >
> > > > > >> > > > > > > > > > > 2012/6/1 José Luis Cetina <
> > maxtorzito@gmail.com
> > > >
> > > > > >> > > > > > > > > > >
> > > > > >> > > > > > > > > > > > i think we are getting confused.
> > > > > >> > > > > > > > > > > >
> > > > > >> > > > > > > > > > > > If i resume all, this what i asked (the
> > final
> > > of
> > > > > the
> > > > > >> > > first
> > > > > >> > > > > > post)
> > > > > >> > > > > > > > > > > >
> > > > > >> > > > > > > > > > > > I dont know if this is the desire behavior
> > or
> > > if
> > > > > >> this
> > > > > >> > > > happend
> > > > > >> > > > > > > > becase
> > > > > >> > > > > > > > > > the
> > > > > >> > > > > > > > > > > > httr request isnt finished?
> > > > > >> > > > > > > > > > > > Then you answer me:
> > > > > >> > > > > > > > > > > >
> > > > > >> > > > > > > > > > > > in fact info from ejbcontext are taken in
> > our
> > > > > >> > > > securitymodule
> > > > > >> > > > > > > > > > > >
> > > > > >> > > > > > > > > > > > in tomee we set/unset it from a valve so
> at
> > > the
> > > > > >> > > > beginning/end
> > > > > >> > > > > > of
> > > > > >> > > > > > > > the
> > > > > >> > > > > > > > > > > > request...all between is currently ignored
> > so
> > > > when
> > > > > >> you
> > > > > >> > > log
> > > > > >> > > > > you
> > > > > >> > > > > > > need
> > > > > >> > > > > > > > > > > another
> > > > > >> > > > > > > > > > > > request to get the updated information
> (from
> > > the
> > > > > >> tomcat
> > > > > >> > > > > realm)
> > > > > >> > > > > > > > > > > >
> > > > > >> > > > > > > > > > > > "so when you log you need another request
> to
> > > get
> > > > > the
> > > > > >> > > > updated
> > > > > >> > > > > > > > > > information
> > > > > >> > > > > > > > > > > > (from the tomcat realm)
> > > > > >> > > > > > > > > > > >
> > > > > >> > > > > > > > > > > > Then i get guest because is the desire
> > > > behaviour,
> > > > > >> after
> > > > > >> > > the
> > > > > >> > > > > > first
> > > > > >> > > > > > > > > > > request i
> > > > > >> > > > > > > > > > > > can get the user i expected.
> > > > > >> > > > > > > > > > > >
> > > > > >> > > > > > > > > > > > Then i resume, this is the default
> > behaviour,
> > > > and
> > > > > >> works
> > > > > >> > > but
> > > > > >> > > > > you
> > > > > >> > > > > > > > need
> > > > > >> > > > > > > > > a
> > > > > >> > > > > > > > > > > > second request.
> > > > > >> > > > > > > > > > > >
> > > > > >> > > > > > > > > > > >
> > > > > >> > > > > > > > > > > >
> > > > > >> > > > > > > > > > > > 2012/5/31 Romain Manni-Bucau <
> > > > > rmannibucau@gmail.com
> > > > > >> >
> > > > > >> > > > > > > > > > > >
> > > > > >> > > > > > > > > > > > > i think it should work
> > > > > >> > > > > > > > > > > > >
> > > > > >> > > > > > > > > > > > > - Romain
> > > > > >> > > > > > > > > > > > >
> > > > > >> > > > > > > > > > > > >
> > > > > >> > > > > > > > > > > > > 2012/6/1 José Luis Cetina <
> > > > maxtorzito@gmail.com
> > > > > >
> > > > > >> > > > > > > > > > > > >
> > > > > >> > > > > > > > > > > > > > I mean this:
> > > > > >> > > > > > > > > > > > > >
> > > > > >> > > > > > > > > > > > > > I dont know if this is the desire
> > > behaviour
> > > > or
> > > > > >> if
> > > > > >> > > this
> > > > > >> > > > > > > happend
> > > > > >> > > > > > > > > > > because
> > > > > >> > > > > > > > > > > > > the
> > > > > >> > > > > > > > > > > > > > http request isnt finished?
> > > > > >> > > > > > > > > > > > > >
> > > > > >> > > > > > > > > > > > > >
> > > > > >> > > > > > > > > > > > > >
> > > > > >> > > > > > > > > > > > > > 2012/5/31 José Luis Cetina <
> > > > > >> maxtorzito@gmail.com>
> > > > > >> > > > > > > > > > > > > >
> > > > > >> > > > > > > > > > > > > > > Ok, the what i asked is correct??
> > > > > >> > > > > > > > > > > > > > >
> > > > > >> > > > > > > > > > > > > > > "I dont know if this is the desire
> > > > behaviour
> > > > > >> or
> > > > > >> > if
> > > > > >> > > > this
> > > > > >> > > > > > > > happend
> > > > > >> > > > > > > > > > > > because
> > > > > >> > > > > > > > > > > > > > > the http request isnt finished?"
> > > > > >> > > > > > > > > > > > > > >
> > > > > >> > > > > > > > > > > > > > > 2012/5/31 Romain Manni-Bucau <
> > > > > >> > > rmannibucau@gmail.com>
> > > > > >> > > > > > > > > > > > > > >
> > > > > >> > > > > > > > > > > > > > >> ok,
> > > > > >> > > > > > > > > > > > > > >>
> > > > > >> > > > > > > > > > > > > > >> in fact info from ejbcontext are
> > taken
> > > in
> > > > > our
> > > > > >> > > > > > > securitymodule
> > > > > >> > > > > > > > > > > > > > >>
> > > > > >> > > > > > > > > > > > > > >> in tomee we set/unset it from a
> valve
> > > so
> > > > at
> > > > > >> the
> > > > > >> > > > > > > > beginning/end
> > > > > >> > > > > > > > > of
> > > > > >> > > > > > > > > > > the
> > > > > >> > > > > > > > > > > > > > >> request...all between is currently
> > > > ignored
> > > > > so
> > > > > >> > when
> > > > > >> > > > you
> > > > > >> > > > > > log
> > > > > >> > > > > > > > you
> > > > > >> > > > > > > > > > > need
> > > > > >> > > > > > > > > > > > > > >> another
> > > > > >> > > > > > > > > > > > > > >> request to get the updated
> > information
> > > > > (from
> > > > > >> the
> > > > > >> > > > > tomcat
> > > > > >> > > > > > > > realm)
> > > > > >> > > > > > > > > > > > > > >>
> > > > > >> > > > > > > > > > > > > > >> - Romain
> > > > > >> > > > > > > > > > > > > > >>
> > > > > >> > > > > > > > > > > > > > >>
> > > > > >> > > > > > > > > > > > > > >> 2012/6/1 José Luis Cetina <
> > > > > >> maxtorzito@gmail.com
> > > > > >> > >
> > > > > >> > > > > > > > > > > > > > >>
> > > > > >> > > > > > > > > > > > > > >> > Yes, it work
> > > > > >> > > > > > > > > > > > > > >> >
> > > > > >> > > > > > > > > > > > > > >> > 1) Login (form login) using
> > > > > DataSourceRealm
> > > > > >> > > > > > > > > > > > > > >> >
> > > > > >> > > > > > > > > > > > > > >> >
> > > > > >> > > > > > > > > > > > > > >> > 2) Redirect to page2 from my
> > > > managedbean
> > > > > >> > > > > > > > > > > > > > >> >
> > > > > >> > > > > > > > > > > > > > >> > 2012/5/31 Romain Manni-Bucau <
> > > > > >> > > > rmannibucau@gmail.com
> > > > > >> > > > > >
> > > > > >> > > > > > > > > > > > > > >> >
> > > > > >> > > > > > > > > > > > > > >> > > so you mean using the flow i
> > > > described
> > > > > >> > before
> > > > > >> > > it
> > > > > >> > > > > > > works?
> > > > > >> > > > > > > > > > > (sorry,
> > > > > >> > > > > > > > > > > > > just
> > > > > >> > > > > > > > > > > > > > >> to
> > > > > >> > > > > > > > > > > > > > >> > be
> > > > > >> > > > > > > > > > > > > > >> > > sure to understand)
> > > > > >> > > > > > > > > > > > > > >> > >
> > > > > >> > > > > > > > > > > > > > >> > > - Romain
> > > > > >> > > > > > > > > > > > > > >> > >
> > > > > >> > > > > > > > > > > > > > >> > >
> > > > > >> > > > > > > > > > > > > > >> > > 2012/6/1 José Luis Cetina <
> > > > > >> > > maxtorzito@gmail.com
> > > > > >> > > > >
> > > > > >> > > > > > > > > > > > > > >> > >
> > > > > >> > > > > > > > > > > > > > >> > > > Hi i can login and i can
> > navigate
> > > > > >> > (redirect)
> > > > > >> > > > to
> > > > > >> > > > > my
> > > > > >> > > > > > > > other
> > > > > >> > > > > > > > > > > page,
> > > > > >> > > > > > > > > > > > > > but i
> > > > > >> > > > > > > > > > > > > > >> > dont
> > > > > >> > > > > > > > > > > > > > >> > > > know why im getting guest
> user
> > in
> > > > the
> > > > > >> > login
> > > > > >> > > > > mbean,
> > > > > >> > > > > > > > after
> > > > > >> > > > > > > > > > > that
> > > > > >> > > > > > > > > > > > in
> > > > > >> > > > > > > > > > > > > > >> other
> > > > > >> > > > > > > > > > > > > > >> > > > mbean  i get my "real" user.
> > > > > >> > > > > > > > > > > > > > >> > > >
> > > > > >> > > > > > > > > > > > > > >> > > >
> > > > > >> > > > > > > > > > > > > > >> > > > 2012/5/31 Romain Manni-Bucau
> <
> > > > > >> > > > > > rmannibucau@gmail.com
> > > > > >> > > > > > > >
> > > > > >> > > > > > > > > > > > > > >> > > >
> > > > > >> > > > > > > > > > > > > > >> > > > > maybe
> > > > > >> > > > > > > > > > > > > > >> > > > >
> > > > > >> > > > > > > > > > > > > > >> > > >
> > > > > >> > > > > > > > > > > > > > >> > >
> > > > > >> > > > > > > > > > > > > > >> >
> > > > > >> > > > > > > > > > > > > > >>
> > > > > >> > > > > > > > > > > > > >
> > > > > >> > > > > > > > > > > > >
> > > > > >> > > > > > > > > > > >
> > > > > >> > > > > > > > > > >
> > > > > >> > > > > > > > > >
> > > > > >> > > > > > > > >
> > > > > >> > > > > > > >
> > > > > >> > > > > > >
> > > > > >> > > > > >
> > > > > >> > > > >
> > > > > >> > > >
> > > > > >> > >
> > > > > >> >
> > > > > >>
> > > > >
> > > >
> > >
> >
> http://rmannibucau.wordpress.com/2012/05/09/tomee-and-its-ssh-connector/but
> > > > > >> > > > > > > > > > > > > > >> > > > > it uses properties file, it
> > > just
> > > > > >> need a
> > > > > >> > > > custom
> > > > > >> > > > > > > login
> > > > > >> > > > > > > > > > > module
> > > > > >> > > > > > > > > > > > > > >> > > > implementation
> > > > > >> > > > > > > > > > > > > > >> > > > > to use a db.
> > > > > >> > > > > > > > > > > > > > >> > > > >
> > > > > >> > > > > > > > > > > > > > >> > > > > well,
> > > > > >> > > > > > > > > > > > > > >> > > > >
> > > > > >> > > > > > > > > > > > > > >> > > > > before can you test it
> > please?
> > > > > >> > > > > > > > > > > > > > >> > > > > 1) login
> > > > > >> > > > > > > > > > > > > > >> > > > > 2) redirect to your page
> > using
> > > > your
> > > > > >> bean
> > > > > >> > > > > > > > > > > > > > >> > > > >
> > > > > >> > > > > > > > > > > > > > >> > > > > - Romain
> > > > > >> > > > > > > > > > > > > > >> > > > >
> > > > > >> > > > > > > > > > > > > > >> > > > >
> > > > > >> > > > > > > > > > > > > > >> > > > > 2012/6/1 José Luis Cetina <
> > > > > >> > > > > maxtorzito@gmail.com
> > > > > >> > > > > > >
> > > > > >> > > > > > > > > > > > > > >> > > > >
> > > > > >> > > > > > > > > > > > > > >> > > > > > I have to read and know
> how
> > > to
> > > > > use
> > > > > >> > > this, i
> > > > > >> > > > > > > always
> > > > > >> > > > > > > > > use
> > > > > >> > > > > > > > > > > > > > >> DataSource or
> > > > > >> > > > > > > > > > > > > > >> > > > > > JDBCRealm. (with
> > glassfish).
> > > > > >> > > > > > > > > > > > > > >> > > > > > im reading now, do you
> have
> > > > > >> something
> > > > > >> > > for
> > > > > >> > > > a
> > > > > >> > > > > > > > > > quickstart?
> > > > > >> > > > > > > > > > > > for
> > > > > >> > > > > > > > > > > > > > >> share
> > > > > >> > > > > > > > > > > > > > >> > me
> > > > > >> > > > > > > > > > > > > > >> > > > > >
> > > > > >> > > > > > > > > > > > > > >> > > > > > 2012/5/31 Romain
> > Manni-Bucau
> > > <
> > > > > >> > > > > > > > rmannibucau@gmail.com
> > > > > >> > > > > > > > > >
> > > > > >> > > > > > > > > > > > > > >> > > > > >
> > > > > >> > > > > > > > > > > > > > >> > > > > > > having your password
> in a
> > > db
> > > > is
> > > > > >> not
> > > > > >> > an
> > > > > >> > > > > issue
> > > > > >> > > > > > > > but i
> > > > > >> > > > > > > > > > > think
> > > > > >> > > > > > > > > > > > > you
> > > > > >> > > > > > > > > > > > > > >> > should
> > > > > >> > > > > > > > > > > > > > >> > > > > > > use
> > > > > >> > > org.apache.catalina.realm.JAASRealm
> > > > > >> > > > > > > > > > > > > > >> > > > > > >
> > > > > >> > > > > > > > > > > > > > >> > > > > > > for instance:
> > > > > >> > > > > > > > > > > > > > >> > > > > > >
> > > > > >> > > > > > > > > > > > > > >> > > > > > >     <Realm
> > > > > >> > > > > > > > > > > >
> > > className="org.apache.catalina.realm.JAASRealm"
> > > > > >> > > > > > > > > > > > > > >> > > > > > >
> appName="MyDBLoginModule"
> > > > > >> > > > > > > > > > > > > > >> > > > > > >
> > > > > >> > > > > > > > > > > > > > >> > > > > > >
> > > > > >> > > > > > > > > > > > > > >> > > > > > >
> > > > > >> > > > > > > > > > > > > > >> > > > > >
> > > > > >> > > > > > > > > > > > > > >> > > > >
> > > > > >> > > > > > > > > > > > > > >> > > >
> > > > > >> > > > > > > > > > > > > > >> > >
> > > > > >> > > > > > > > > > > > > > >> >
> > > > > >> > > > > > > > > > > > > > >>
> > > > > >> > > > > > > > > > > > > >
> > > > > >> > > > > > > > > > > > >
> > > > > >> > > > > > > > > > > >
> > > > > >> > > > > > > > > > >
> > > > > >> > > > > > > > > >
> > > > > >> > > > > > > > >
> > > > > >> > > > > > > >
> > > > > >> > > > > > >
> > > > > >> > > > > >
> > > > > >> > > > >
> > > > > >> > > >
> > > > > >> > >
> > > > > >> >
> > > > > >>
> > > > >
> > > >
> > >
> >
>  userClassNames="org.apache.openejb.core.security.AbstractSecurityService$User"
> > > > > >> > > > > > > > > > > > > > >> > > > > > >
> > > > > >> > > > > > > > > > > > > > >> > > > > > >
> > > > > >> > > > > > > > > > > > > > >> > > > > > >
> > > > > >> > > > > > > > > > > > > > >> > > > > >
> > > > > >> > > > > > > > > > > > > > >> > > > >
> > > > > >> > > > > > > > > > > > > > >> > > >
> > > > > >> > > > > > > > > > > > > > >> > >
> > > > > >> > > > > > > > > > > > > > >> >
> > > > > >> > > > > > > > > > > > > > >>
> > > > > >> > > > > > > > > > > > > >
> > > > > >> > > > > > > > > > > > >
> > > > > >> > > > > > > > > > > >
> > > > > >> > > > > > > > > > >
> > > > > >> > > > > > > > > >
> > > > > >> > > > > > > > >
> > > > > >> > > > > > > >
> > > > > >> > > > > > >
> > > > > >> > > > > >
> > > > > >> > > > >
> > > > > >> > > >
> > > > > >> > >
> > > > > >> >
> > > > > >>
> > > > >
> > > >
> > >
> >
>  roleClassNames="org.apache.openejb.core.security.AbstractSecurityService$Group">
> > > > > >> > > > > > > > > > > > > > >> > > > > > >      </Realm>
> > > > > >> > > > > > > > > > > > > > >> > > > > > >
> > > > > >> > > > > > > > > > > > > > >> > > > > > > so simply implement a
> > > custom
> > > > > >> > > LoginModule
> > > > > >> > > > > > > instead
> > > > > >> > > > > > > > > of
> > > > > >> > > > > > > > > > a
> > > > > >> > > > > > > > > > > > > realm
> > > > > >> > > > > > > > > > > > > > >> > > > > > >
> > > > > >> > > > > > > > > > > > > > >> > > > > > > wdyt?
> > > > > >> > > > > > > > > > > > > > >> > > > > > >
> > > > > >> > > > > > > > > > > > > > >> > > > > > > - Romain
> > > > > >> > > > > > > > > > > > > > >> > > > > > >
> > > > > >> > > > > > > > > > > > > > >> > > > > > >
> > > > > >> > > > > > > > > > > > > > >> > > > > > > 2012/6/1 José Luis
> > Cetina <
> > > > > >> > > > > > > maxtorzito@gmail.com
> > > > > >> > > > > > > > >
> > > > > >> > > > > > > > > > > > > > >> > > > > > >
> > > > > >> > > > > > > > > > > > > > >> > > > > > > > Sorry, i use
> > > > > DataSourceRealm, i
> > > > > >> > have
> > > > > >> > > > my
> > > > > >> > > > > > > > > > > > user/pass/roles
> > > > > >> > > > > > > > > > > > > in
> > > > > >> > > > > > > > > > > > > > >> the
> > > > > >> > > > > > > > > > > > > > >> > > DB.
> > > > > >> > > > > > > > > > > > > > >> > > > > > > >
> > > > > >> > > > > > > > > > > > > > >> > > > > > > >
> > > > > >> > > > > > > > > > > > > > >> > > > > > > >
> > > > > >> > > > > > > > > > > > > > >> > > > > > > > 2012/5/31 Romain
> > > > Manni-Bucau
> > > > > <
> > > > > >> > > > > > > > > > rmannibucau@gmail.com
> > > > > >> > > > > > > > > > > >
> > > > > >> > > > > > > > > > > > > > >> > > > > > > >
> > > > > >> > > > > > > > > > > > > > >> > > > > > > > > can't you do it
> with
> > an
> > > > > >> embedded
> > > > > >> > > > one?
> > > > > >> > > > > > > > > > > > > > >> > > > > > > > >
> > > > > >> > > > > > > > > > > > > > >> > > > > > > > > well
> DataSourceRealm
> > > > > doesn't
> > > > > >> use
> > > > > >> > > > JAAS
> > > > > >> > > > > by
> > > > > >> > > > > > > > > > default i
> > > > > >> > > > > > > > > > > > > > think,
> > > > > >> > > > > > > > > > > > > > >> > maybe
> > > > > >> > > > > > > > > > > > > > >> > > > > > that's
> > > > > >> > > > > > > > > > > > > > >> > > > > > > > the
> > > > > >> > > > > > > > > > > > > > >> > > > > > > > > issue
> > > > > >> > > > > > > > > > > > > > >> > > > > > > > >
> > > > > >> > > > > > > > > > > > > > >> > > > > > > > > - Romain
> > > > > >> > > > > > > > > > > > > > >> > > > > > > > >
> > > > > >> > > > > > > > > > > > > > >> > > > > > > > >
> > > > > >> > > > > > > > > > > > > > >> > > > > > > > > 2012/6/1 José Luis
> > > > Cetina <
> > > > > >> > > > > > > > > maxtorzito@gmail.com
> > > > > >> > > > > > > > > > >
> > > > > >> > > > > > > > > > > > > > >> > > > > > > > >
> > > > > >> > > > > > > > > > > > > > >> > > > > > > > > > OK, i can create
> a
> > > > > sample,
> > > > > >> > but i
> > > > > >> > > > use
> > > > > >> > > > > > > > > > > > > DataSourceRealm,
> > > > > >> > > > > > > > > > > > > > >> are
> > > > > >> > > > > > > > > > > > > > >> > you
> > > > > >> > > > > > > > > > > > > > >> > > > > gonna
> > > > > >> > > > > > > > > > > > > > >> > > > > > > > > > configure your
> > > > database?
> > > > > >> > > > > > > > > > > > > > >> > > > > > > > > >
> > > > > >> > > > > > > > > > > > > > >> > > > > > > > > > 2012/5/31 Romain
> > > > > >> Manni-Bucau <
> > > > > >> > > > > > > > > > > > rmannibucau@gmail.com
> > > > > >> > > > > > > > > > > > > >
> > > > > >> > > > > > > > > > > > > > >> > > > > > > > > >
> > > > > >> > > > > > > > > > > > > > >> > > > > > > > > > > can you have a
> > try
> > > in
> > > > > an
> > > > > >> EJB
> > > > > >> > > > > please?
> > > > > >> > > > > > > > (just
> > > > > >> > > > > > > > > > try
> > > > > >> > > > > > > > > > > > to
> > > > > >> > > > > > > > > > > > > > add
> > > > > >> > > > > > > > > > > > > > >> > > > > @Stateless
> > > > > >> > > > > > > > > > > > > > >> > > > > > on
> > > > > >> > > > > > > > > > > > > > >> > > > > > > > > your
> > > > > >> > > > > > > > > > > > > > >> > > > > > > > > > > managed bean
> for
> > > > > >> instance)
> > > > > >> > > > > > > > > > > > > > >> > > > > > > > > > >
> > > > > >> > > > > > > > > > > > > > >> > > > > > > > > > > can you share a
> > > > sample
> > > > > >> easy
> > > > > >> > to
> > > > > >> > > > > run?
> > > > > >> > > > > > > > > > > > > > >> > > > > > > > > > >
> > > > > >> > > > > > > > > > > > > > >> > > > > > > > > > > - Romain
> > > > > >> > > > > > > > > > > > > > >> > > > > > > > > > >
> > > > > >> > > > > > > > > > > > > > >> > > > > > > > > > >
> > > > > >> > > > > > > > > > > > > > >> > > > > > > > > > > 2012/6/1 José
> > Luis
> > > > > >> Cetina <
> > > > > >> > > > > > > > > > > maxtorzito@gmail.com
> > > > > >> > > > > > > > > > > > >
> > > > > >> > > > > > > > > > > > > > >> > > > > > > > > > >
> > > > > >> > > > > > > > > > > > > > >> > > > > > > > > > > > Yes, im using
> > > JAAS
> > > > > >> > > > > > > > > > > > > > >> > > > > > > > > > > >
> > > > > >> > > > > > > > > > > > > > >> > > > > > > > > > > > 2012/5/31
> > Romain
> > > > > >> > > Manni-Bucau <
> > > > > >> > > > > > > > > > > > > > rmannibucau@gmail.com
> > > > > >> > > > > > > > > > > > > > >> >
> > > > > >> > > > > > > > > > > > > > >> > > > > > > > > > > >
> > > > > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > Hi,
> > > > > >> > > > > > > > > > > > > > >> > > > > > > > > > > > >
> > > > > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > Do you use
> > > jaas?
> > > > > >> > > > > > > > > > > > > > >> > > > > > > > > > > > >
> > > > > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > - Romain
> > > > > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > Le 31 mai
> > 2012
> > > > > 20:14,
> > > > > >> > > "José
> > > > > >> > > > > Luis
> > > > > >> > > > > > > > > > Cetina" <
> > > > > >> > > > > > > > > > > > > > >> > > > > > maxtorzito@gmail.com
> > > > > >> > > > > > > > > > > > > > >> > > > > > > >
> > > > > >> > > > > > > > > > > > > > >> > > > > > > > a
> > > > > >> > > > > > > > > > > > > > >> > > > > > > > > > > écrit
> > > > > >> > > > > > > > > > > > > > >> > > > > > > > > > > > :
> > > > > >> > > > > > > > > > > > > > >> > > > > > > > > > > > >
> > > > > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > > Hi i have
> > > this
> > > > > >> > scenario:
> > > > > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > >
> > > > > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > > I have a
> > page
> > > > > >> > > login.xhtml,
> > > > > >> > > > > > this
> > > > > >> > > > > > > > page
> > > > > >> > > > > > > > > > > has a
> > > > > >> > > > > > > > > > > > > > >> > > ManagedBean
> > > > > >> > > > > > > > > > > > > > >> > > > > > > (@Named)
> > > > > >> > > > > > > > > > > > > > >> > > > > > > > > > this
> > > > > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > >
> managedbean
> > > use
> > > > > the
> > > > > >> > > > > > > > > > > > request.login(user,pass)
> > > > > >> > > > > > > > > > > > > > >> > method.
> > > > > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > >
> > > > > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > > When i do
> > > this:
> > > > > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > >
> > > > > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > >
> managedbean
> > > > > class:
> > > > > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > >
> > > > > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > > @Resource
> > > > > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > > private
> > > > > EJBContext
> > > > > >> > > > > ejbContext;
> > > > > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > > .
> > > > > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > > .
> > > > > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > >
> > > > > >> > > request.login(user,pass);
> > > > > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > > String
> > name =
> > > > > >> > > > > > > > > > > > > > >> > > >
> > > > > >> ejbContext.getCallerPrincipal().getName();
> > > > > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > >
> > > > > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > > I get
> > "guest"
> > > > as
> > > > > my
> > > > > >> > user
> > > > > >> > > > > name.
> > > > > >> > > > > > > > But i
> > > > > >> > > > > > > > > > > > expect
> > > > > >> > > > > > > > > > > > > > the
> > > > > >> > > > > > > > > > > > > > >> > name
> > > > > >> > > > > > > > > > > > > > >> > > of
> > > > > >> > > > > > > > > > > > > > >> > > > > my
> > > > > >> > > > > > > > > > > > > > >> > > > > > > user
> > > > > >> > > > > > > > > > > > > > >> > > > > > > > > (of
> > > > > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > course
> > > > > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > > is not
> > guest)
> > > > > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > >
> > > > > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > > If the
> > login
> > > > was
> > > > > >> > > > successful
> > > > > >> > > > > my
> > > > > >> > > > > > > > login
> > > > > >> > > > > > > > > > > page
> > > > > >> > > > > > > > > > > > > > >> navigate
> > > > > >> > > > > > > > > > > > > > >> > to
> > > > > >> > > > > > > > > > > > > > >> > > > > other
> > > > > >> > > > > > > > > > > > > > >> > > > > > > > page
> > > > > >> > > > > > > > > > > > > > >> > > > > > > > > > lets
> > > > > >> > > > > > > > > > > > > > >> > > > > > > > > > > > say
> > > > > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > >
> pageb.xhtml
> > > > > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > >
> > > > > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > > If i
> > create a
> > > > > >> > > managedbean
> > > > > >> > > > > > > (@Named)
> > > > > >> > > > > > > > > for
> > > > > >> > > > > > > > > > > > > > >> pageb.xhtml
> > > > > >> > > > > > > > > > > > > > >> > > and
> > > > > >> > > > > > > > > > > > > > >> > > > in
> > > > > >> > > > > > > > > > > > > > >> > > > > > > that
> > > > > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > managedbean
> > > > > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > > i use
> > again:
> > > > > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > > String
> > name =
> > > > > >> > > > > > > > > > > > > > >> > > >
> > > > > >> ejbContext.getCallerPrincipal().getName();
> > > > > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > > then,
> here
> > i
> > > > get
> > > > > my
> > > > > >> > > > > "correct"
> > > > > >> > > > > > > name
> > > > > >> > > > > > > > > of
> > > > > >> > > > > > > > > > > the
> > > > > >> > > > > > > > > > > > > user
> > > > > >> > > > > > > > > > > > > > >> (not
> > > > > >> > > > > > > > > > > > > > >> > > > > guest).
> > > > > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > >
> > > > > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > > I dont
> know
> > > if
> > > > > >> this is
> > > > > >> > > the
> > > > > >> > > > > > > desire
> > > > > >> > > > > > > > > > > > behaviour
> > > > > >> > > > > > > > > > > > > or
> > > > > >> > > > > > > > > > > > > > >> if
> > > > > >> > > > > > > > > > > > > > >> > > this
> > > > > >> > > > > > > > > > > > > > >> > > > > > > happend
> > > > > >> > > > > > > > > > > > > > >> > > > > > > > > > > because
> > > > > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > the
> > > > > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > > http
> > request
> > > > isnt
> > > > > >> > > > finished?
> > > > > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > >
> > > > > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > > other
> > > question
> > > > > why
> > > > > >> if
> > > > > >> > i
> > > > > >> > > > call
> > > > > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > > the
> > > > > >> > > > > > > > > > > > > >
> > >  ejbContext.getCallerPrincipal().getName();
> > > > > >> > > > > > > > > > > > > > >> > > before
> > > > > >> > > > > > > > > > > > > > >> > > > > the
> > > > > >> > > > > > > > > > > > > > >> > > > > > > > > > > > >
> > request.login()
> > > > > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > > method i
> > get
> > > > > again
> > > > > >> > > > "guest",
> > > > > >> > > > > > why
> > > > > >> > > > > > > > not
> > > > > >> > > > > > > > > > > null?
> > > > > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > >
> > > > > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > > If this
> > > > question
> > > > > is
> > > > > >> > for
> > > > > >> > > > > > > > > tomee(openejb)
> > > > > >> > > > > > > > > > > or
> > > > > >> > > > > > > > > > > > > > >> tomcat?
> > > > > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > >
> > > > > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > > Thanks
> > > > > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > >
> > > > > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > >
> > > > > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > >
> > > > > >> > > > > > > > > > > > > > >> > > > > > > > >
> > > > > >> > > > > > > > > > > > > > >> > > >
> > > > > >> > > > > > > > > > > > > >
> > > > > >> > > > > > > > >
> > > > > >> > > >
> > > > > -------------------------------------------------------------------
> > > > > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > > *SCJA.
> José
> > > > Luis
> > > > > >> > Cetina*
> > > > > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > >
> > > > > >> > > > > > > > > > > > > > >> > > > > > > > >
> > > > > >> > > > > > > > > > > > > > >> > > >
> > > > > >> > > > > > > > > > > > > >
> > > > > >> > > > > > > > >
> > > > > >> > > >
> > > > > -------------------------------------------------------------------
> > > > > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > >
> > > > > >> > > > > > > > > > > > > > >> > > > > > > > > > > > >
> > > > > >> > > > > > > > > > > > > > >> > > > > > > > > > > >
> > > > > >> > > > > > > > > > > > > > >> > > > > > > > > > > >
> > > > > >> > > > > > > > > > > > > > >> > > > > > > > > > > >
> > > > > >> > > > > > > > > > > > > > >> > > > > > > > > > > > --
> > > > > >> > > > > > > > > > > > > > >> > > > > > > > > > > >
> > > > > >> > > > > > > > > > > > > > >> > > > > > >
> > > > > >> > > > > > > > > > > > > > >> >
> > > > > >> > > > > > > > > > > >
> > > > > >> > > > > > >
> > > > > >> >
> > > -------------------------------------------------------------------
> > > > > >> > > > > > > > > > > > > > >> > > > > > > > > > > > *SCJA. José
> > Luis
> > > > > >> Cetina*
> > > > > >> > > > > > > > > > > > > > >> > > > > > > > > > > >
> > > > > >> > > > > > > > > > > > > > >> > > > > > >
> > > > > >> > > > > > > > > > > > > > >> >
> > > > > >> > > > > > > > > > > >
> > > > > >> > > > > > >
> > > > > >> >
> > > -------------------------------------------------------------------
> > > > > >> > > > > > > > > > > > > > >> > > > > > > > > > > >
> > > > > >> > > > > > > > > > > > > > >> > > > > > > > > > >
> > > > > >> > > > > > > > > > > > > > >> > > > > > > > > >
> > > > > >> > > > > > > > > > > > > > >> > > > > > > > > >
> > > > > >> > > > > > > > > > > > > > >> > > > > > > > > >
> > > > > >> > > > > > > > > > > > > > >> > > > > > > > > > --
> > > > > >> > > > > > > > > > > > > > >> > > > > > > > > >
> > > > > >> > > > > > > > > > > > > > >> > > > >
> > > > > >> > > > > > > > > > > > > > >>
> > > > > >> > > > > > > > > > >
> > > > > >> > > > > >
> > > > > >>
> > -------------------------------------------------------------------
> > > > > >> > > > > > > > > > > > > > >> > > > > > > > > > *SCJA. José Luis
> > > > Cetina*
> > > > > >> > > > > > > > > > > > > > >> > > > > > > > > >
> > > > > >> > > > > > > > > > > > > > >> > > > >
> > > > > >> > > > > > > > > > > > > > >>
> > > > > >> > > > > > > > > > >
> > > > > >> > > > > >
> > > > > >>
> > -------------------------------------------------------------------
> > > > > >> > > > > > > > > > > > > > >> > > > > > > > > >
> > > > > >> > > > > > > > > > > > > > >> > > > > > > > >
> > > > > >> > > > > > > > > > > > > > >> > > > > > > >
> > > > > >> > > > > > > > > > > > > > >> > > > > > > >
> > > > > >> > > > > > > > > > > > > > >> > > > > > > >
> > > > > >> > > > > > > > > > > > > > >> > > > > > > > --
> > > > > >> > > > > > > > > > > > > > >> > > > > > > >
> > > > > >> > > > > > > > > > > > > > >> > >
> > > > > >> > > > > > > > > > > > >
> > > > > >> > > > > > > >
> > > > > >> > >
> > > > -------------------------------------------------------------------
> > > > > >> > > > > > > > > > > > > > >> > > > > > > > *SCJA. José Luis
> > Cetina*
> > > > > >> > > > > > > > > > > > > > >> > > > > > > >
> > > > > >> > > > > > > > > > > > > > >> > >
> > > > > >> > > > > > > > > > > > >
> > > > > >> > > > > > > >
> > > > > >> > >
> > > > -------------------------------------------------------------------
> > > > > >> > > > > > > > > > > > > > >> > > > > > > >
> > > > > >> > > > > > > > > > > > > > >> > > > > > >
> > > > > >> > > > > > > > > > > > > > >> > > > > >
> > > > > >> > > > > > > > > > > > > > >> > > > > >
> > > > > >> > > > > > > > > > > > > > >> > > > > >
> > > > > >> > > > > > > > > > > > > > >> > > > > > --
> > > > > >> > > > > > > > > > > > > > >> > > > > >
> > > > > >> > > > > > > > > > > > > > >>
> > > > > >> > > > > > > > > > >
> > > > > >> > > > > >
> > > > > >>
> > -------------------------------------------------------------------
> > > > > >> > > > > > > > > > > > > > >> > > > > > *SCJA. José Luis Cetina*
> > > > > >> > > > > > > > > > > > > > >> > > > > >
> > > > > >> > > > > > > > > > > > > > >>
> > > > > >> > > > > > > > > > >
> > > > > >> > > > > >
> > > > > >>
> > -------------------------------------------------------------------
> > > > > >> > > > > > > > > > > > > > >> > > > > >
> > > > > >> > > > > > > > > > > > > > >> > > > >
> > > > > >> > > > > > > > > > > > > > >> > > >
> > > > > >> > > > > > > > > > > > > > >> > > >
> > > > > >> > > > > > > > > > > > > > >> > > >
> > > > > >> > > > > > > > > > > > > > >> > > > --
> > > > > >> > > > > > > > > > > > > > >> > > >
> > > > > >> > > > > > > > > > > > > >
> > > > > >> > > > > > > > >
> > > > > >> > > >
> > > > > -------------------------------------------------------------------
> > > > > >> > > > > > > > > > > > > > >> > > > *SCJA. José Luis Cetina*
> > > > > >> > > > > > > > > > > > > > >> > > >
> > > > > >> > > > > > > > > > > > > >
> > > > > >> > > > > > > > >
> > > > > >> > > >
> > > > > -------------------------------------------------------------------
> > > > > >> > > > > > > > > > > > > > >> > > >
> > > > > >> > > > > > > > > > > > > > >> > >
> > > > > >> > > > > > > > > > > > > > >> >
> > > > > >> > > > > > > > > > > > > > >> >
> > > > > >> > > > > > > > > > > > > > >> >
> > > > > >> > > > > > > > > > > > > > >> > --
> > > > > >> > > > > > > > > > > > > > >> >
> > > > > >> > > > > > > > > > > >
> > > > > >> > > > > > >
> > > > > >> >
> > > -------------------------------------------------------------------
> > > > > >> > > > > > > > > > > > > > >> > *SCJA. José Luis Cetina*
> > > > > >> > > > > > > > > > > > > > >> >
> > > > > >> > > > > > > > > > > >
> > > > > >> > > > > > >
> > > > > >> >
> > > -------------------------------------------------------------------
> > > > > >> > > > > > > > > > > > > > >> >
> > > > > >> > > > > > > > > > > > > > >>
> > > > > >> > > > > > > > > > > > > > >
> > > > > >> > > > > > > > > > > > > > >
> > > > > >> > > > > > > > > > > > > > >
> > > > > >> > > > > > > > > > > > > > > --
> > > > > >> > > > > > > > > > > > > > >
> > > > > >> > > > > > > > > >
> > > > > >> > > > >
> > > > > >>
> > -------------------------------------------------------------------
> > > > > >> > > > > > > > > > > > > > > *SCJA. José Luis Cetina*
> > > > > >> > > > > > > > > > > > > > >
> > > > > >> > > > > > > > > >
> > > > > >> > > > >
> > > > > >>
> > -------------------------------------------------------------------
> > > > > >> > > > > > > > > > > > > > >
> > > > > >> > > > > > > > > > > > > > >
> > > > > >> > > > > > > > > > > > > >
> > > > > >> > > > > > > > > > > > > >
> > > > > >> > > > > > > > > > > > > > --
> > > > > >> > > > > > > > > > > > > >
> > > > > >> > > > > > > > >
> > > > > >> > > >
> > > > > -------------------------------------------------------------------
> > > > > >> > > > > > > > > > > > > > *SCJA. José Luis Cetina*
> > > > > >> > > > > > > > > > > > > >
> > > > > >> > > > > > > > >
> > > > > >> > > >
> > > > > -------------------------------------------------------------------
> > > > > >> > > > > > > > > > > > > >
> > > > > >> > > > > > > > > > > > >
> > > > > >> > > > > > > > > > > >
> > > > > >> > > > > > > > > > > >
> > > > > >> > > > > > > > > > > >
> > > > > >> > > > > > > > > > > > --
> > > > > >> > > > > > > > > > > >
> > > > > >> > > > > > >
> > > > > >> >
> > > -------------------------------------------------------------------
> > > > > >> > > > > > > > > > > > *SCJA. José Luis Cetina*
> > > > > >> > > > > > > > > > > >
> > > > > >> > > > > > >
> > > > > >> >
> > > -------------------------------------------------------------------
> > > > > >> > > > > > > > > > > >
> > > > > >> > > > > > > > > > >
> > > > > >> > > > > > > > > >
> > > > > >> > > > > > > > > >
> > > > > >> > > > > > > > > >
> > > > > >> > > > > > > > > > --
> > > > > >> > > > > > > > > >
> > > > > >> > > > >
> > > > > >>
> > -------------------------------------------------------------------
> > > > > >> > > > > > > > > > *SCJA. José Luis Cetina*
> > > > > >> > > > > > > > > >
> > > > > >> > > > >
> > > > > >>
> > -------------------------------------------------------------------
> > > > > >> > > > > > > > > >
> > > > > >> > > > > > > > >
> > > > > >> > > > > > > >
> > > > > >> > > > > > > >
> > > > > >> > > > > > > >
> > > > > >> > > > > > > > --
> > > > > >> > > > > > > >
> > > > > >> > >
> > > > -------------------------------------------------------------------
> > > > > >> > > > > > > > *SCJA. José Luis Cetina*
> > > > > >> > > > > > > >
> > > > > >> > >
> > > > -------------------------------------------------------------------
> > > > > >> > > > > > > >
> > > > > >> > > > > > >
> > > > > >> > > > > >
> > > > > >> > > > > >
> > > > > >> > > > > >
> > > > > >> > > > > > --
> > > > > >> > > > > >
> > > > > >>
> > -------------------------------------------------------------------
> > > > > >> > > > > > *SCJA. José Luis Cetina*
> > > > > >> > > > > >
> > > > > >>
> > -------------------------------------------------------------------
> > > > > >> > > > > >
> > > > > >> > > > >
> > > > > >> > > >
> > > > > >> > > >
> > > > > >> > > >
> > > > > >> > > > --
> > > > > >> > > >
> > > > > -------------------------------------------------------------------
> > > > > >> > > > *SCJA. José Luis Cetina*
> > > > > >> > > >
> > > > > -------------------------------------------------------------------
> > > > > >> > > >
> > > > > >> > >
> > > > > >> >
> > > > > >> >
> > > > > >> >
> > > > > >> > --
> > > > > >> >
> > > -------------------------------------------------------------------
> > > > > >> > *SCJA. José Luis Cetina*
> > > > > >> >
> > > -------------------------------------------------------------------
> > > > > >> >
> > > > > >>
> > > > > >
> > > > > >
> > > > > >
> > > > > > --
> > > > > >
> -------------------------------------------------------------------
> > > > > > *SCJA. José Luis Cetina*
> > > > > >
> -------------------------------------------------------------------
> > > > > >
> > > > > >
> > > > >
> > > > >
> > > > > --
> > > > > -------------------------------------------------------------------
> > > > > *SCJA. José Luis Cetina*
> > > > > -------------------------------------------------------------------
> > > > >
> > > >
> > >
> >
>
>
>
> --
> -------------------------------------------------------------------
> *SCJA. José Luis Cetina*
> -------------------------------------------------------------------
>

RE: Guest user

Posted by Robin <ro...@gmail.com>.
Please Remove me from the e-mail list.
Thank You
Robin

-----Original Message-----
From: José Luis Cetina [mailto:maxtorzito@gmail.com] 
Sent: Friday, June 15, 2012 9:46 AM
To: users@openejb.apache.org
Subject: Re: Guest user

Well i readed what you say, and i see the topic is: Session Fixation
Protection and talk about a "security feature" then i decide to set the
values in my second request after the login.

Session Fixation Protection says:

"Essentially, when a user authenticates their session, Tomcat will change
the session ID. It does not destroy the previous session, rather it renames
it so it is no longer found by that ID. So in our example above, Bob would
try and log on with that session, and he would not be able to find it."


I decied not set the changeSessionIdOnAuthentication to false because i can
change the behaviour of my app without any problem, but the people who are
migrating from other Application Servers to TomEE have to know this.


References:
http://tomcat.apache.org/tomcat-7.0-doc/config/valve.html
http://www.tomcatexpert.com/blog/2011/04/25/session-fixation-protection
http://java.dzone.com/tips/turning-session-fixation


Thanks again.


2012/6/15 Romain Manni-Bucau <rm...@gmail.com>

> that's because in your authenticator you have the attribute 
> "changeSessionIdOnAuthentication" set to true.
>
> - Romain
>
>
> 2012/6/15 José Luis Cetina <ma...@gmail.com>
>
> > Hi Romain, let me tell you, the problem only occurs when you use 
> > login method and try to set something in the session bean just after 
> > the next line of request.login, if I comment the login method, then 
> > it works ok, please give a try with a simple test with login method 
> > and you will see
> the
> > problem, I tested many times
> >  El 15/06/2012 04:40, "Romain Manni-Bucau" <rm...@gmail.com>
> > escribió:
> >
> > > Hi,
> > >
> > > i didnt test with the login but it seems it works
> > >
> > > but please add @RequestScoped to MyNextPageMBean or don't use 
> > > postconstrutct otherwise you have a kind of cache effect depending 
> > > on
> the
> > > moment when the bean is created.
> > >
> > > here a sample:
> > >
> > >
> >
> http://svn.apache.org/repos/asf/openejb/trunk/openejb/examples/cdi-ses
> sion-scope/
> > >
> > > - Romain
> > >
> > >
> > > 2012/6/15 José Luis Cetina <ma...@gmail.com>
> > >
> > > > Hi Romain, well i have an other problem and i think is related 
> > > > to
> this
> > > same
> > > > reported issue.
> > > >
> > > > We talked about if i login using request.login(user,pass) method 
> > > > and
> if
> > > the
> > > > credentials and login was successfull then when i get the user i 
> > > > get
> a
> > > > guess user:
> > > >
> > > > request.login(user,pass);
> > > > String name = ejbContext.getCallerPrincipal().getName();
> > > >
> > > > Ok, then this was fixed, and its ok now, now returns the valid user.
> > > >
> > > > But now if i do this
> > > >
> > > > @Inject
> > > > private MySessionBean mySessionBean;
> > > >
> > > > public String login(){
> > > >   request.login(user,pass);
> > > >   mySessionBean.setName("My name is JOE");
> > > >   //then i do a redirect here
> > > >  return "next_page";
> > > > }
> > > >
> > > > now in my managedbean of my next_page.xhtml i had:
> > > >
> > > > @Named
> > > > public MyNextPageMBean implements Serializable{
> > > >
> > > > @Inject
> > > > private MySessionBean mySessionBean;
> > > >
> > > >  @PostConstruc
> > > >  public void test(){
> > > >    mySessionBean.getName(); <---HERE I GET NULL ALWAYS
> > > >   }
> > > >
> > > > }
> > > >
> > > >
> > > > SessionBean:
> > > >
> > > > import java.io.Serializable;
> > > > import javax.enterprise.context.SessionScoped;
> > > > import javax.inject.Named;
> > > >
> > > > @Named
> > > > @SessionScoped
> > > > public class MySessionBean implements Serializable{
> > > >
> > > >    private String name;
> > > >
> > > >    public MySessionBean() {
> > > >
> > > >    }
> > > >
> > > >    public String getName() {
> > > >        return name;
> > > >    }
> > > >
> > > >    public void setName(String name) {
> > > >        this.name = name;
> > > >    }
> > > > }
> > > >
> > > >
> > > >
> > > > As you can see i get null, mi login its ok, but when i saved
> something
> > in
> > > > my sessionbean when i try to retrive what i saved before, i 
> > > > always
> get
> > > > null, like if i never set the value (and of course i did it) but 
> > > > this
> > > ONLY
> > > > HAPPEND when i try to set the any value just before 
> > > > request.login,
> if i
> > > set
> > > > the value in the second bean  like
> > > >
> > > > mySessionBean.setName("My name is JOE"); then in other's page i 
> > > > can
> get
> > > the
> > > > value without any problem, i do a lot of test and the problem is
> when i
> > > > only set the values (in my session bean) just before 
> > > > request.login,
> > then
> > > i
> > > > associated this with the "guest user problem" as you sayed this 
> > > > was happening because the user was "recognized" only after the 
> > > > first
> > request.
> > > >
> > > > Again, is this the expected behaviour? it seem buggy
> > > >
> > > > Im using:  apache-tomee-1.1.0-20120612.040829-22-webprofile
> > > >
> > > >
> > > > 2012/6/1 José Luis Cetina <ma...@gmail.com>
> > > >
> > > > > ok
> > > > >
> > > > >
> > > > > 2012/6/1 Romain Manni-Bucau <rm...@gmail.com>
> > > > >
> > > > >> deployment in progress:
> > > > >> http://ci.apache.org/builders/openejb-trunk-deploy/builds/378
> > > > >>
> > > > >> - Romain
> > > > >>
> > > > >>
> > > > >> 2012/6/1 José Luis Cetina <ma...@gmail.com>
> > > > >>
> > > > >> > Ok, in what tomee build this will be available?
> > > > >> >
> > > > >> > 2012/5/31 Romain Manni-Bucau <rm...@gmail.com>
> > > > >> >
> > > > >> > > yep
> > > > >> > >
> > > > >> > > just commited, a new commit will come where this class 
> > > > >> > > will
> > > > >> automatically
> > > > >> > > be added normally
> > > > >> > >
> > > > >> > > - Romain
> > > > >> > >
> > > > >> > >
> > > > >> > > 2012/6/1 José Luis Cetina <ma...@gmail.com>
> > > > >> > >
> > > > >> > > > im getting a ClassNotFound
> > > > >> > > >
> > > > >> > > > Caused by: java.lang.ClassNotFoundException:
> > > > >> > > > org.apache.tomee.catalina.TomEERealm
> > > > >> > > >
> > > > >> > > > 2012/5/31 Romain Manni-Bucau <rm...@gmail.com>
> > > > >> > > >
> > > > >> > > > > my sample is working, too late to add test but 
> > > > >> > > > > manually it
> > > works
> > > > >> > > > >
> > > > >> > > > > so i guess it should work for you
> > > > >> > > > >
> > > > >> > > > > the question now is should we add it automatically?
> > > > >> > > > >
> > > > >> > > > > - Romain
> > > > >> > > > >
> > > > >> > > > >
> > > > >> > > > > 2012/6/1 José Luis Cetina <ma...@gmail.com>
> > > > >> > > > >
> > > > >> > > > > > Oooh great, with this i can get the principal user 
> > > > >> > > > > > in
> the
> > > > first
> > > > >> > > > request?
> > > > >> > > > > or
> > > > >> > > > > > this is something that you gonna fix?
> > > > >> > > > > >
> > > > >> > > > > > 2012/5/31 Romain Manni-Bucau 
> > > > >> > > > > > <rm...@gmail.com>
> > > > >> > > > > >
> > > > >> > > > > > > that's brand new ;)
> > > > >> > > > > > >
> > > > >> > > > > > > just added it, it mainly delegate to the real 
> > > > >> > > > > > > realm
> but
> > > add
> > > > >> the
> > > > >> > > > > principal
> > > > >> > > > > > > info to openejb/tomee security service which is 
> > > > >> > > > > > > used
> in
> > > > >> > ejbcontext
> > > > >> > > > impl
> > > > >> > > > > > (to
> > > > >> > > > > > > make it short)
> > > > >> > > > > > >
> > > > >> > > > > > > - Romain
> > > > >> > > > > > >
> > > > >> > > > > > >
> > > > >> > > > > > > 2012/6/1 José Luis Cetina <ma...@gmail.com>
> > > > >> > > > > > >
> > > > >> > > > > > > > I have this in my context.xml
> > > > >> > > > > > > >
> > > > >> > > > > > > > <Realm className="MyExtendedDataSourceRealm"
> > > > >> > > > > > > >  dataSourceName="MyDataSource"
> > > > >> > > > > > > > digest="SHA-256"
> > > > >> > > > > > > > encodePassword="Base64"
> > > > >> > > > > > > > queryRealmRolesUser="SELECT rol FROM xxxx WHERE
> > user=?"
> > > > >> > > > > > > > queryRealmUsers="SELECT pass FROM xxx WHERE
> user=?"/>
> > > > >> > > > > > > >
> > > > >> > > > > > > > As you can see i extend the datasource realm, i 
> > > > >> > > > > > > > have
> > > this
> > > > >> realm
> > > > >> > > > > config
> > > > >> > > > > > in
> > > > >> > > > > > > > the context.xml in my webapp (not context.xml
> TomEE).
> > > > >> > > > > > > >
> > > > >> > > > > > > > But, as i can see in your example, you surround 
> > > > >> > > > > > > > your
> > > realm
> > > > >> with
> > > > >> > > > > > > TomEERealm,
> > > > >> > > > > > > > if this necessary?. I didn't know this
> > > > >> > > > > > > >
> > > > >> > > > > > > >
> > > > >> > > > > > > >
> > > > >> > > > > > > > 2012/5/31 Romain Manni-Bucau 
> > > > >> > > > > > > > <rmannibucau@gmail.com
> >
> > > > >> > > > > > > >
> > > > >> > > > > > > > > in my test i used:
> > > > >> > > > > > > > >
> > > > >> > > > > > > > >    <Realm
> > > > >> className="org.apache.tomee.catalina.TomEERealm">
> > > > >> > > > > > > > >        <Realm
> > > > >> className="org.apache.catalina.realm.JAASRealm"
> > > > >> > > > > > > > > appName="PropertiesLoginModule"
> > > > >> > > > > > > > >
> > > > >> > > > > > > > >
> > > > >> > > > > > > > >
> > > > >> > > > > > > >
> > > > >> > > > > > >
> > > > >> > > > > >
> > > > >> > > > >
> > > > >> > > >
> > > > >> > >
> > > > >> >
> > > > >>
> > > >
> > >
> >
>
userClassNames="org.apache.openejb.core.security.AbstractSecurityService$Use
r"
> > > > >> > > > > > > > >
> > > > >> > > > > > > > >
> > > > >> > > > > > > > >
> > > > >> > > > > > > >
> > > > >> > > > > > >
> > > > >> > > > > >
> > > > >> > > > >
> > > > >> > > >
> > > > >> > >
> > > > >> >
> > > > >>
> > > >
> > >
> >
>  
> roleClassNames="org.apache.openejb.core.security.AbstractSecurityServi
> ce$Group">
> > > > >> > > > > > > > >        </Realm>
> > > > >> > > > > > > > >       </Realm>
> > > > >> > > > > > > > >
> > > > >> > > > > > > > > but i guess you can replace the jaasrealm by 
> > > > >> > > > > > > > > your
> > > > dsrealm
> > > > >> > > > > > > > >
> > > > >> > > > > > > > > - Romain
> > > > >> > > > > > > > >
> > > > >> > > > > > > > >
> > > > >> > > > > > > > > 2012/6/1 José Luis Cetina 
> > > > >> > > > > > > > > <ma...@gmail.com>
> > > > >> > > > > > > > >
> > > > >> > > > > > > > > > Yes, it seems buggy.
> > > > >> > > > > > > > > >
> > > > >> > > > > > > > > > Where i have to replace?
> > > > >> > > > > > > > > >
> > > > >> > > > > > > > > > Remember im using DataSourceRealm
> > > > >> > > > > > > > > >
> > > > >> > > > > > > > > > 2012/5/31 Romain Manni-Bucau <
> > rmannibucau@gmail.com
> > > >
> > > > >> > > > > > > > > >
> > > > >> > > > > > > > > > > this is the current status,
> > > > >> > > > > > > > > > >
> > > > >> > > > > > > > > > > but IMO it is buggy,
> > > > >> > > > > > > > > > >
> > > > >> > > > > > > > > > > i'll commit soon a TomEEJAASRealm to make 
> > > > >> > > > > > > > > > > it
> > > working
> > > > >> > > (replace
> > > > >> > > > > > > > JAASRealm
> > > > >> > > > > > > > > > in
> > > > >> > > > > > > > > > > the conf)
> > > > >> > > > > > > > > > >
> > > > >> > > > > > > > > > > - Romain
> > > > >> > > > > > > > > > >
> > > > >> > > > > > > > > > >
> > > > >> > > > > > > > > > > 2012/6/1 José Luis Cetina <
> maxtorzito@gmail.com
> > >
> > > > >> > > > > > > > > > >
> > > > >> > > > > > > > > > > > i think we are getting confused.
> > > > >> > > > > > > > > > > >
> > > > >> > > > > > > > > > > > If i resume all, this what i asked (the
> final
> > of
> > > > the
> > > > >> > > first
> > > > >> > > > > > post)
> > > > >> > > > > > > > > > > >
> > > > >> > > > > > > > > > > > I dont know if this is the desire 
> > > > >> > > > > > > > > > > > behavior
> or
> > if
> > > > >> this
> > > > >> > > > happend
> > > > >> > > > > > > > becase
> > > > >> > > > > > > > > > the
> > > > >> > > > > > > > > > > > httr request isnt finished?
> > > > >> > > > > > > > > > > > Then you answer me:
> > > > >> > > > > > > > > > > >
> > > > >> > > > > > > > > > > > in fact info from ejbcontext are taken 
> > > > >> > > > > > > > > > > > in
> our
> > > > >> > > > securitymodule
> > > > >> > > > > > > > > > > >
> > > > >> > > > > > > > > > > > in tomee we set/unset it from a valve 
> > > > >> > > > > > > > > > > > so at
> > the
> > > > >> > > > beginning/end
> > > > >> > > > > > of
> > > > >> > > > > > > > the
> > > > >> > > > > > > > > > > > request...all between is currently 
> > > > >> > > > > > > > > > > > ignored
> so
> > > when
> > > > >> you
> > > > >> > > log
> > > > >> > > > > you
> > > > >> > > > > > > need
> > > > >> > > > > > > > > > > another
> > > > >> > > > > > > > > > > > request to get the updated information 
> > > > >> > > > > > > > > > > > (from
> > the
> > > > >> tomcat
> > > > >> > > > > realm)
> > > > >> > > > > > > > > > > >
> > > > >> > > > > > > > > > > > "so when you log you need another 
> > > > >> > > > > > > > > > > > request to
> > get
> > > > the
> > > > >> > > > updated
> > > > >> > > > > > > > > > information
> > > > >> > > > > > > > > > > > (from the tomcat realm)
> > > > >> > > > > > > > > > > >
> > > > >> > > > > > > > > > > > Then i get guest because is the desire
> > > behaviour,
> > > > >> after
> > > > >> > > the
> > > > >> > > > > > first
> > > > >> > > > > > > > > > > request i
> > > > >> > > > > > > > > > > > can get the user i expected.
> > > > >> > > > > > > > > > > >
> > > > >> > > > > > > > > > > > Then i resume, this is the default
> behaviour,
> > > and
> > > > >> works
> > > > >> > > but
> > > > >> > > > > you
> > > > >> > > > > > > > need
> > > > >> > > > > > > > > a
> > > > >> > > > > > > > > > > > second request.
> > > > >> > > > > > > > > > > >
> > > > >> > > > > > > > > > > >
> > > > >> > > > > > > > > > > >
> > > > >> > > > > > > > > > > > 2012/5/31 Romain Manni-Bucau <
> > > > rmannibucau@gmail.com
> > > > >> >
> > > > >> > > > > > > > > > > >
> > > > >> > > > > > > > > > > > > i think it should work
> > > > >> > > > > > > > > > > > >
> > > > >> > > > > > > > > > > > > - Romain
> > > > >> > > > > > > > > > > > >
> > > > >> > > > > > > > > > > > >
> > > > >> > > > > > > > > > > > > 2012/6/1 José Luis Cetina <
> > > maxtorzito@gmail.com
> > > > >
> > > > >> > > > > > > > > > > > >
> > > > >> > > > > > > > > > > > > > I mean this:
> > > > >> > > > > > > > > > > > > >
> > > > >> > > > > > > > > > > > > > I dont know if this is the desire
> > behaviour
> > > or
> > > > >> if
> > > > >> > > this
> > > > >> > > > > > > happend
> > > > >> > > > > > > > > > > because
> > > > >> > > > > > > > > > > > > the
> > > > >> > > > > > > > > > > > > > http request isnt finished?
> > > > >> > > > > > > > > > > > > >
> > > > >> > > > > > > > > > > > > >
> > > > >> > > > > > > > > > > > > >
> > > > >> > > > > > > > > > > > > > 2012/5/31 José Luis Cetina <
> > > > >> maxtorzito@gmail.com>
> > > > >> > > > > > > > > > > > > >
> > > > >> > > > > > > > > > > > > > > Ok, the what i asked is correct??
> > > > >> > > > > > > > > > > > > > >
> > > > >> > > > > > > > > > > > > > > "I dont know if this is the 
> > > > >> > > > > > > > > > > > > > > desire
> > > behaviour
> > > > >> or
> > > > >> > if
> > > > >> > > > this
> > > > >> > > > > > > > happend
> > > > >> > > > > > > > > > > > because
> > > > >> > > > > > > > > > > > > > > the http request isnt finished?"
> > > > >> > > > > > > > > > > > > > >
> > > > >> > > > > > > > > > > > > > > 2012/5/31 Romain Manni-Bucau <
> > > > >> > > rmannibucau@gmail.com>
> > > > >> > > > > > > > > > > > > > >
> > > > >> > > > > > > > > > > > > > >> ok,
> > > > >> > > > > > > > > > > > > > >>
> > > > >> > > > > > > > > > > > > > >> in fact info from ejbcontext are
> taken
> > in
> > > > our
> > > > >> > > > > > > securitymodule
> > > > >> > > > > > > > > > > > > > >>
> > > > >> > > > > > > > > > > > > > >> in tomee we set/unset it from a 
> > > > >> > > > > > > > > > > > > > >> valve
> > so
> > > at
> > > > >> the
> > > > >> > > > > > > > beginning/end
> > > > >> > > > > > > > > of
> > > > >> > > > > > > > > > > the
> > > > >> > > > > > > > > > > > > > >> request...all between is 
> > > > >> > > > > > > > > > > > > > >> currently
> > > ignored
> > > > so
> > > > >> > when
> > > > >> > > > you
> > > > >> > > > > > log
> > > > >> > > > > > > > you
> > > > >> > > > > > > > > > > need
> > > > >> > > > > > > > > > > > > > >> another request to get the 
> > > > >> > > > > > > > > > > > > > >> updated
> information
> > > > (from
> > > > >> the
> > > > >> > > > > tomcat
> > > > >> > > > > > > > realm)
> > > > >> > > > > > > > > > > > > > >>
> > > > >> > > > > > > > > > > > > > >> - Romain
> > > > >> > > > > > > > > > > > > > >>
> > > > >> > > > > > > > > > > > > > >>
> > > > >> > > > > > > > > > > > > > >> 2012/6/1 José Luis Cetina <
> > > > >> maxtorzito@gmail.com
> > > > >> > >
> > > > >> > > > > > > > > > > > > > >>
> > > > >> > > > > > > > > > > > > > >> > Yes, it work
> > > > >> > > > > > > > > > > > > > >> >
> > > > >> > > > > > > > > > > > > > >> > 1) Login (form login) using
> > > > DataSourceRealm
> > > > >> > > > > > > > > > > > > > >> >
> > > > >> > > > > > > > > > > > > > >> >
> > > > >> > > > > > > > > > > > > > >> > 2) Redirect to page2 from my
> > > managedbean
> > > > >> > > > > > > > > > > > > > >> >
> > > > >> > > > > > > > > > > > > > >> > 2012/5/31 Romain Manni-Bucau <
> > > > >> > > > rmannibucau@gmail.com
> > > > >> > > > > >
> > > > >> > > > > > > > > > > > > > >> >
> > > > >> > > > > > > > > > > > > > >> > > so you mean using the flow i
> > > described
> > > > >> > before
> > > > >> > > it
> > > > >> > > > > > > works?
> > > > >> > > > > > > > > > > (sorry,
> > > > >> > > > > > > > > > > > > just
> > > > >> > > > > > > > > > > > > > >> to
> > > > >> > > > > > > > > > > > > > >> > be
> > > > >> > > > > > > > > > > > > > >> > > sure to understand)
> > > > >> > > > > > > > > > > > > > >> > >
> > > > >> > > > > > > > > > > > > > >> > > - Romain
> > > > >> > > > > > > > > > > > > > >> > >
> > > > >> > > > > > > > > > > > > > >> > >
> > > > >> > > > > > > > > > > > > > >> > > 2012/6/1 José Luis Cetina <
> > > > >> > > maxtorzito@gmail.com
> > > > >> > > > >
> > > > >> > > > > > > > > > > > > > >> > >
> > > > >> > > > > > > > > > > > > > >> > > > Hi i can login and i can
> navigate
> > > > >> > (redirect)
> > > > >> > > > to
> > > > >> > > > > my
> > > > >> > > > > > > > other
> > > > >> > > > > > > > > > > page,
> > > > >> > > > > > > > > > > > > > but i
> > > > >> > > > > > > > > > > > > > >> > dont
> > > > >> > > > > > > > > > > > > > >> > > > know why im getting guest 
> > > > >> > > > > > > > > > > > > > >> > > > user
> in
> > > the
> > > > >> > login
> > > > >> > > > > mbean,
> > > > >> > > > > > > > after
> > > > >> > > > > > > > > > > that
> > > > >> > > > > > > > > > > > in
> > > > >> > > > > > > > > > > > > > >> other
> > > > >> > > > > > > > > > > > > > >> > > > mbean  i get my "real" user.
> > > > >> > > > > > > > > > > > > > >> > > >
> > > > >> > > > > > > > > > > > > > >> > > >
> > > > >> > > > > > > > > > > > > > >> > > > 2012/5/31 Romain 
> > > > >> > > > > > > > > > > > > > >> > > > Manni-Bucau <
> > > > >> > > > > > rmannibucau@gmail.com
> > > > >> > > > > > > >
> > > > >> > > > > > > > > > > > > > >> > > >
> > > > >> > > > > > > > > > > > > > >> > > > > maybe
> > > > >> > > > > > > > > > > > > > >> > > > >
> > > > >> > > > > > > > > > > > > > >> > > >
> > > > >> > > > > > > > > > > > > > >> > >
> > > > >> > > > > > > > > > > > > > >> >
> > > > >> > > > > > > > > > > > > > >>
> > > > >> > > > > > > > > > > > > >
> > > > >> > > > > > > > > > > > >
> > > > >> > > > > > > > > > > >
> > > > >> > > > > > > > > > >
> > > > >> > > > > > > > > >
> > > > >> > > > > > > > >
> > > > >> > > > > > > >
> > > > >> > > > > > >
> > > > >> > > > > >
> > > > >> > > > >
> > > > >> > > >
> > > > >> > >
> > > > >> >
> > > > >>
> > > >
> > >
> >
> http://rmannibucau.wordpress.com/2012/05/09/tomee-and-its-ssh-connecto
> r/but
> > > > >> > > > > > > > > > > > > > >> > > > > it uses properties file, 
> > > > >> > > > > > > > > > > > > > >> > > > > it
> > just
> > > > >> need a
> > > > >> > > > custom
> > > > >> > > > > > > login
> > > > >> > > > > > > > > > > module
> > > > >> > > > > > > > > > > > > > >> > > > implementation
> > > > >> > > > > > > > > > > > > > >> > > > > to use a db.
> > > > >> > > > > > > > > > > > > > >> > > > >
> > > > >> > > > > > > > > > > > > > >> > > > > well,
> > > > >> > > > > > > > > > > > > > >> > > > >
> > > > >> > > > > > > > > > > > > > >> > > > > before can you test it
> please?
> > > > >> > > > > > > > > > > > > > >> > > > > 1) login
> > > > >> > > > > > > > > > > > > > >> > > > > 2) redirect to your page
> using
> > > your
> > > > >> bean
> > > > >> > > > > > > > > > > > > > >> > > > >
> > > > >> > > > > > > > > > > > > > >> > > > > - Romain
> > > > >> > > > > > > > > > > > > > >> > > > >
> > > > >> > > > > > > > > > > > > > >> > > > >
> > > > >> > > > > > > > > > > > > > >> > > > > 2012/6/1 José Luis 
> > > > >> > > > > > > > > > > > > > >> > > > > Cetina <
> > > > >> > > > > maxtorzito@gmail.com
> > > > >> > > > > > >
> > > > >> > > > > > > > > > > > > > >> > > > >
> > > > >> > > > > > > > > > > > > > >> > > > > > I have to read and 
> > > > >> > > > > > > > > > > > > > >> > > > > > know how
> > to
> > > > use
> > > > >> > > this, i
> > > > >> > > > > > > always
> > > > >> > > > > > > > > use
> > > > >> > > > > > > > > > > > > > >> DataSource or
> > > > >> > > > > > > > > > > > > > >> > > > > > JDBCRealm. (with
> glassfish).
> > > > >> > > > > > > > > > > > > > >> > > > > > im reading now, do you 
> > > > >> > > > > > > > > > > > > > >> > > > > > have
> > > > >> something
> > > > >> > > for
> > > > >> > > > a
> > > > >> > > > > > > > > > quickstart?
> > > > >> > > > > > > > > > > > for
> > > > >> > > > > > > > > > > > > > >> share
> > > > >> > > > > > > > > > > > > > >> > me
> > > > >> > > > > > > > > > > > > > >> > > > > >
> > > > >> > > > > > > > > > > > > > >> > > > > > 2012/5/31 Romain
> Manni-Bucau
> > <
> > > > >> > > > > > > > rmannibucau@gmail.com
> > > > >> > > > > > > > > >
> > > > >> > > > > > > > > > > > > > >> > > > > >
> > > > >> > > > > > > > > > > > > > >> > > > > > > having your password 
> > > > >> > > > > > > > > > > > > > >> > > > > > > in a
> > db
> > > is
> > > > >> not
> > > > >> > an
> > > > >> > > > > issue
> > > > >> > > > > > > > but i
> > > > >> > > > > > > > > > > think
> > > > >> > > > > > > > > > > > > you
> > > > >> > > > > > > > > > > > > > >> > should
> > > > >> > > > > > > > > > > > > > >> > > > > > > use
> > > > >> > > org.apache.catalina.realm.JAASRealm
> > > > >> > > > > > > > > > > > > > >> > > > > > >
> > > > >> > > > > > > > > > > > > > >> > > > > > > for instance:
> > > > >> > > > > > > > > > > > > > >> > > > > > >
> > > > >> > > > > > > > > > > > > > >> > > > > > >     <Realm
> > > > >> > > > > > > > > > > >
> > className="org.apache.catalina.realm.JAASRealm"
> > > > >> > > > > > > > > > > > > > >> > > > > > >
appName="MyDBLoginModule"
> > > > >> > > > > > > > > > > > > > >> > > > > > >
> > > > >> > > > > > > > > > > > > > >> > > > > > >
> > > > >> > > > > > > > > > > > > > >> > > > > > >
> > > > >> > > > > > > > > > > > > > >> > > > > >
> > > > >> > > > > > > > > > > > > > >> > > > >
> > > > >> > > > > > > > > > > > > > >> > > >
> > > > >> > > > > > > > > > > > > > >> > >
> > > > >> > > > > > > > > > > > > > >> >
> > > > >> > > > > > > > > > > > > > >>
> > > > >> > > > > > > > > > > > > >
> > > > >> > > > > > > > > > > > >
> > > > >> > > > > > > > > > > >
> > > > >> > > > > > > > > > >
> > > > >> > > > > > > > > >
> > > > >> > > > > > > > >
> > > > >> > > > > > > >
> > > > >> > > > > > >
> > > > >> > > > > >
> > > > >> > > > >
> > > > >> > > >
> > > > >> > >
> > > > >> >
> > > > >>
> > > >
> > >
> >
>
userClassNames="org.apache.openejb.core.security.AbstractSecurityService$Use
r"
> > > > >> > > > > > > > > > > > > > >> > > > > > >
> > > > >> > > > > > > > > > > > > > >> > > > > > >
> > > > >> > > > > > > > > > > > > > >> > > > > > >
> > > > >> > > > > > > > > > > > > > >> > > > > >
> > > > >> > > > > > > > > > > > > > >> > > > >
> > > > >> > > > > > > > > > > > > > >> > > >
> > > > >> > > > > > > > > > > > > > >> > >
> > > > >> > > > > > > > > > > > > > >> >
> > > > >> > > > > > > > > > > > > > >>
> > > > >> > > > > > > > > > > > > >
> > > > >> > > > > > > > > > > > >
> > > > >> > > > > > > > > > > >
> > > > >> > > > > > > > > > >
> > > > >> > > > > > > > > >
> > > > >> > > > > > > > >
> > > > >> > > > > > > >
> > > > >> > > > > > >
> > > > >> > > > > >
> > > > >> > > > >
> > > > >> > > >
> > > > >> > >
> > > > >> >
> > > > >>
> > > >
> > >
> >
>  
> roleClassNames="org.apache.openejb.core.security.AbstractSecurityServi
> ce$Group">
> > > > >> > > > > > > > > > > > > > >> > > > > > >      </Realm>
> > > > >> > > > > > > > > > > > > > >> > > > > > >
> > > > >> > > > > > > > > > > > > > >> > > > > > > so simply implement 
> > > > >> > > > > > > > > > > > > > >> > > > > > > a
> > custom
> > > > >> > > LoginModule
> > > > >> > > > > > > instead
> > > > >> > > > > > > > > of
> > > > >> > > > > > > > > > a
> > > > >> > > > > > > > > > > > > realm
> > > > >> > > > > > > > > > > > > > >> > > > > > >
> > > > >> > > > > > > > > > > > > > >> > > > > > > wdyt?
> > > > >> > > > > > > > > > > > > > >> > > > > > >
> > > > >> > > > > > > > > > > > > > >> > > > > > > - Romain
> > > > >> > > > > > > > > > > > > > >> > > > > > >
> > > > >> > > > > > > > > > > > > > >> > > > > > >
> > > > >> > > > > > > > > > > > > > >> > > > > > > 2012/6/1 José Luis
> Cetina <
> > > > >> > > > > > > maxtorzito@gmail.com
> > > > >> > > > > > > > >
> > > > >> > > > > > > > > > > > > > >> > > > > > >
> > > > >> > > > > > > > > > > > > > >> > > > > > > > Sorry, i use
> > > > DataSourceRealm, i
> > > > >> > have
> > > > >> > > > my
> > > > >> > > > > > > > > > > > user/pass/roles
> > > > >> > > > > > > > > > > > > in
> > > > >> > > > > > > > > > > > > > >> the
> > > > >> > > > > > > > > > > > > > >> > > DB.
> > > > >> > > > > > > > > > > > > > >> > > > > > > >
> > > > >> > > > > > > > > > > > > > >> > > > > > > >
> > > > >> > > > > > > > > > > > > > >> > > > > > > >
> > > > >> > > > > > > > > > > > > > >> > > > > > > > 2012/5/31 Romain
> > > Manni-Bucau
> > > > <
> > > > >> > > > > > > > > > rmannibucau@gmail.com
> > > > >> > > > > > > > > > > >
> > > > >> > > > > > > > > > > > > > >> > > > > > > >
> > > > >> > > > > > > > > > > > > > >> > > > > > > > > can't you do it 
> > > > >> > > > > > > > > > > > > > >> > > > > > > > > with
> an
> > > > >> embedded
> > > > >> > > > one?
> > > > >> > > > > > > > > > > > > > >> > > > > > > > >
> > > > >> > > > > > > > > > > > > > >> > > > > > > > > well 
> > > > >> > > > > > > > > > > > > > >> > > > > > > > > DataSourceRealm
> > > > doesn't
> > > > >> use
> > > > >> > > > JAAS
> > > > >> > > > > by
> > > > >> > > > > > > > > > default i
> > > > >> > > > > > > > > > > > > > think,
> > > > >> > > > > > > > > > > > > > >> > maybe
> > > > >> > > > > > > > > > > > > > >> > > > > > that's
> > > > >> > > > > > > > > > > > > > >> > > > > > > > the
> > > > >> > > > > > > > > > > > > > >> > > > > > > > > issue
> > > > >> > > > > > > > > > > > > > >> > > > > > > > >
> > > > >> > > > > > > > > > > > > > >> > > > > > > > > - Romain
> > > > >> > > > > > > > > > > > > > >> > > > > > > > >
> > > > >> > > > > > > > > > > > > > >> > > > > > > > >
> > > > >> > > > > > > > > > > > > > >> > > > > > > > > 2012/6/1 José 
> > > > >> > > > > > > > > > > > > > >> > > > > > > > > Luis
> > > Cetina <
> > > > >> > > > > > > > > maxtorzito@gmail.com
> > > > >> > > > > > > > > > >
> > > > >> > > > > > > > > > > > > > >> > > > > > > > >
> > > > >> > > > > > > > > > > > > > >> > > > > > > > > > OK, i can 
> > > > >> > > > > > > > > > > > > > >> > > > > > > > > > create a
> > > > sample,
> > > > >> > but i
> > > > >> > > > use
> > > > >> > > > > > > > > > > > > DataSourceRealm,
> > > > >> > > > > > > > > > > > > > >> are
> > > > >> > > > > > > > > > > > > > >> > you
> > > > >> > > > > > > > > > > > > > >> > > > > gonna
> > > > >> > > > > > > > > > > > > > >> > > > > > > > > > configure your
> > > database?
> > > > >> > > > > > > > > > > > > > >> > > > > > > > > >
> > > > >> > > > > > > > > > > > > > >> > > > > > > > > > 2012/5/31 
> > > > >> > > > > > > > > > > > > > >> > > > > > > > > > Romain
> > > > >> Manni-Bucau <
> > > > >> > > > > > > > > > > > rmannibucau@gmail.com
> > > > >> > > > > > > > > > > > > >
> > > > >> > > > > > > > > > > > > > >> > > > > > > > > >
> > > > >> > > > > > > > > > > > > > >> > > > > > > > > > > can you have 
> > > > >> > > > > > > > > > > > > > >> > > > > > > > > > > a
> try
> > in
> > > > an
> > > > >> EJB
> > > > >> > > > > please?
> > > > >> > > > > > > > (just
> > > > >> > > > > > > > > > try
> > > > >> > > > > > > > > > > > to
> > > > >> > > > > > > > > > > > > > add
> > > > >> > > > > > > > > > > > > > >> > > > > @Stateless
> > > > >> > > > > > > > > > > > > > >> > > > > > on
> > > > >> > > > > > > > > > > > > > >> > > > > > > > > your
> > > > >> > > > > > > > > > > > > > >> > > > > > > > > > > managed bean 
> > > > >> > > > > > > > > > > > > > >> > > > > > > > > > > for
> > > > >> instance)
> > > > >> > > > > > > > > > > > > > >> > > > > > > > > > >
> > > > >> > > > > > > > > > > > > > >> > > > > > > > > > > can you 
> > > > >> > > > > > > > > > > > > > >> > > > > > > > > > > share a
> > > sample
> > > > >> easy
> > > > >> > to
> > > > >> > > > > run?
> > > > >> > > > > > > > > > > > > > >> > > > > > > > > > >
> > > > >> > > > > > > > > > > > > > >> > > > > > > > > > > - Romain
> > > > >> > > > > > > > > > > > > > >> > > > > > > > > > >
> > > > >> > > > > > > > > > > > > > >> > > > > > > > > > >
> > > > >> > > > > > > > > > > > > > >> > > > > > > > > > > 2012/6/1 
> > > > >> > > > > > > > > > > > > > >> > > > > > > > > > > José
> Luis
> > > > >> Cetina <
> > > > >> > > > > > > > > > > maxtorzito@gmail.com
> > > > >> > > > > > > > > > > > >
> > > > >> > > > > > > > > > > > > > >> > > > > > > > > > >
> > > > >> > > > > > > > > > > > > > >> > > > > > > > > > > > Yes, im 
> > > > >> > > > > > > > > > > > > > >> > > > > > > > > > > > using
> > JAAS
> > > > >> > > > > > > > > > > > > > >> > > > > > > > > > > >
> > > > >> > > > > > > > > > > > > > >> > > > > > > > > > > > 2012/5/31
> Romain
> > > > >> > > Manni-Bucau <
> > > > >> > > > > > > > > > > > > > rmannibucau@gmail.com
> > > > >> > > > > > > > > > > > > > >> >
> > > > >> > > > > > > > > > > > > > >> > > > > > > > > > > >
> > > > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > Hi,
> > > > >> > > > > > > > > > > > > > >> > > > > > > > > > > > >
> > > > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > Do you 
> > > > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > use
> > jaas?
> > > > >> > > > > > > > > > > > > > >> > > > > > > > > > > > >
> > > > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > - Romain 
> > > > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > Le 31 
> > > > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > mai
> 2012
> > > > 20:14,
> > > > >> > > "José
> > > > >> > > > > Luis
> > > > >> > > > > > > > > > Cetina" <
> > > > >> > > > > > > > > > > > > > >> > > > > > maxtorzito@gmail.com
> > > > >> > > > > > > > > > > > > > >> > > > > > > >
> > > > >> > > > > > > > > > > > > > >> > > > > > > > a
> > > > >> > > > > > > > > > > > > > >> > > > > > > > > > > écrit
> > > > >> > > > > > > > > > > > > > >> > > > > > > > > > > > :
> > > > >> > > > > > > > > > > > > > >> > > > > > > > > > > > >
> > > > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > > Hi i 
> > > > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > > have
> > this
> > > > >> > scenario:
> > > > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > >
> > > > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > > I have 
> > > > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > > a
> page
> > > > >> > > login.xhtml,
> > > > >> > > > > > this
> > > > >> > > > > > > > page
> > > > >> > > > > > > > > > > has a
> > > > >> > > > > > > > > > > > > > >> > > ManagedBean
> > > > >> > > > > > > > > > > > > > >> > > > > > > (@Named)
> > > > >> > > > > > > > > > > > > > >> > > > > > > > > > this
> > > > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > > manage
> > > > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > > dbean
> > use
> > > > the
> > > > >> > > > > > > > > > > > request.login(user,pass)
> > > > >> > > > > > > > > > > > > > >> > method.
> > > > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > >
> > > > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > > When i 
> > > > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > > do
> > this:
> > > > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > >
> > > > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > > manage
> > > > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > > dbean
> > > > class:
> > > > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > >
> > > > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > > @Resou
> > > > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > > rce 
> > > > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > > privat
> > > > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > > e
> > > > EJBContext
> > > > >> > > > > ejbContext;
> > > > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > > .
> > > > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > > .
> > > > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > >
> > > > >> > > request.login(user,pass);
> > > > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > > String
> name =
> > > > >> > > > > > > > > > > > > > >> > > >
> > > > >> ejbContext.getCallerPrincipal().getName();
> > > > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > >
> > > > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > > I get
> "guest"
> > > as
> > > > my
> > > > >> > user
> > > > >> > > > > name.
> > > > >> > > > > > > > But i
> > > > >> > > > > > > > > > > > expect
> > > > >> > > > > > > > > > > > > > the
> > > > >> > > > > > > > > > > > > > >> > name
> > > > >> > > > > > > > > > > > > > >> > > of
> > > > >> > > > > > > > > > > > > > >> > > > > my
> > > > >> > > > > > > > > > > > > > >> > > > > > > user
> > > > >> > > > > > > > > > > > > > >> > > > > > > > > (of
> > > > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > course
> > > > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > > is not
> guest)
> > > > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > >
> > > > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > > If the
> login
> > > was
> > > > >> > > > successful
> > > > >> > > > > my
> > > > >> > > > > > > > login
> > > > >> > > > > > > > > > > page
> > > > >> > > > > > > > > > > > > > >> navigate
> > > > >> > > > > > > > > > > > > > >> > to
> > > > >> > > > > > > > > > > > > > >> > > > > other
> > > > >> > > > > > > > > > > > > > >> > > > > > > > page
> > > > >> > > > > > > > > > > > > > >> > > > > > > > > > lets
> > > > >> > > > > > > > > > > > > > >> > > > > > > > > > > > say
> > > > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > > pageb.
> > > > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > > xhtml
> > > > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > >
> > > > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > > If i
> create a
> > > > >> > > managedbean
> > > > >> > > > > > > (@Named)
> > > > >> > > > > > > > > for
> > > > >> > > > > > > > > > > > > > >> pageb.xhtml
> > > > >> > > > > > > > > > > > > > >> > > and
> > > > >> > > > > > > > > > > > > > >> > > > in
> > > > >> > > > > > > > > > > > > > >> > > > > > > that
> > > > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > managedb
> > > > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > ean
> > > > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > > i use
> again:
> > > > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > > String
> name =
> > > > >> > > > > > > > > > > > > > >> > > >
> > > > >> ejbContext.getCallerPrincipal().getName();
> > > > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > > then, 
> > > > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > > here
> i
> > > get
> > > > my
> > > > >> > > > > "correct"
> > > > >> > > > > > > name
> > > > >> > > > > > > > > of
> > > > >> > > > > > > > > > > the
> > > > >> > > > > > > > > > > > > user
> > > > >> > > > > > > > > > > > > > >> (not
> > > > >> > > > > > > > > > > > > > >> > > > > guest).
> > > > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > >
> > > > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > > I dont 
> > > > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > > know
> > if
> > > > >> this is
> > > > >> > > the
> > > > >> > > > > > > desire
> > > > >> > > > > > > > > > > > behaviour
> > > > >> > > > > > > > > > > > > or
> > > > >> > > > > > > > > > > > > > >> if
> > > > >> > > > > > > > > > > > > > >> > > this
> > > > >> > > > > > > > > > > > > > >> > > > > > > happend
> > > > >> > > > > > > > > > > > > > >> > > > > > > > > > > because
> > > > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > the
> > > > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > > http
> request
> > > isnt
> > > > >> > > > finished?
> > > > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > >
> > > > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > > other
> > question
> > > > why
> > > > >> if
> > > > >> > i
> > > > >> > > > call
> > > > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > > the
> > > > >> > > > > > > > > > > > > >
> >  ejbContext.getCallerPrincipal().getName();
> > > > >> > > > > > > > > > > > > > >> > > before
> > > > >> > > > > > > > > > > > > > >> > > > > the
> > > > >> > > > > > > > > > > > > > >> > > > > > > > > > > > >
> request.login()
> > > > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > > method 
> > > > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > > i
> get
> > > > again
> > > > >> > > > "guest",
> > > > >> > > > > > why
> > > > >> > > > > > > > not
> > > > >> > > > > > > > > > > null?
> > > > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > >
> > > > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > > If 
> > > > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > > this
> > > question
> > > > is
> > > > >> > for
> > > > >> > > > > > > > > tomee(openejb)
> > > > >> > > > > > > > > > > or
> > > > >> > > > > > > > > > > > > > >> tomcat?
> > > > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > >
> > > > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > > Thanks
> > > > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > >
> > > > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > >
> > > > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > >
> > > > >> > > > > > > > > > > > > > >> > > > > > > > >
> > > > >> > > > > > > > > > > > > > >> > > >
> > > > >> > > > > > > > > > > > > >
> > > > >> > > > > > > > >
> > > > >> > > >
> > > > ----------------------------------------------------------------
> > > > ---
> > > > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > > *SCJA. 
> > > > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > > José
> > > Luis
> > > > >> > Cetina*
> > > > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > >
> > > > >> > > > > > > > > > > > > > >> > > > > > > > >
> > > > >> > > > > > > > > > > > > > >> > > >
> > > > >> > > > > > > > > > > > > >
> > > > >> > > > > > > > >
> > > > >> > > >
> > > > ----------------------------------------------------------------
> > > > ---
> > > > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > >
> > > > >> > > > > > > > > > > > > > >> > > > > > > > > > > > >
> > > > >> > > > > > > > > > > > > > >> > > > > > > > > > > >
> > > > >> > > > > > > > > > > > > > >> > > > > > > > > > > >
> > > > >> > > > > > > > > > > > > > >> > > > > > > > > > > >
> > > > >> > > > > > > > > > > > > > >> > > > > > > > > > > > --
> > > > >> > > > > > > > > > > > > > >> > > > > > > > > > > >
> > > > >> > > > > > > > > > > > > > >> > > > > > >
> > > > >> > > > > > > > > > > > > > >> >
> > > > >> > > > > > > > > > > >
> > > > >> > > > > > >
> > > > >> >
> > -------------------------------------------------------------------
> > > > >> > > > > > > > > > > > > > >> > > > > > > > > > > > *SCJA. 
> > > > >> > > > > > > > > > > > > > >> > > > > > > > > > > > José
> Luis
> > > > >> Cetina*
> > > > >> > > > > > > > > > > > > > >> > > > > > > > > > > >
> > > > >> > > > > > > > > > > > > > >> > > > > > >
> > > > >> > > > > > > > > > > > > > >> >
> > > > >> > > > > > > > > > > >
> > > > >> > > > > > >
> > > > >> >
> > -------------------------------------------------------------------
> > > > >> > > > > > > > > > > > > > >> > > > > > > > > > > >
> > > > >> > > > > > > > > > > > > > >> > > > > > > > > > >
> > > > >> > > > > > > > > > > > > > >> > > > > > > > > >
> > > > >> > > > > > > > > > > > > > >> > > > > > > > > >
> > > > >> > > > > > > > > > > > > > >> > > > > > > > > >
> > > > >> > > > > > > > > > > > > > >> > > > > > > > > > --
> > > > >> > > > > > > > > > > > > > >> > > > > > > > > >
> > > > >> > > > > > > > > > > > > > >> > > > >
> > > > >> > > > > > > > > > > > > > >>
> > > > >> > > > > > > > > > >
> > > > >> > > > > >
> > > > >>
> -------------------------------------------------------------------
> > > > >> > > > > > > > > > > > > > >> > > > > > > > > > *SCJA. José 
> > > > >> > > > > > > > > > > > > > >> > > > > > > > > > Luis
> > > Cetina*
> > > > >> > > > > > > > > > > > > > >> > > > > > > > > >
> > > > >> > > > > > > > > > > > > > >> > > > >
> > > > >> > > > > > > > > > > > > > >>
> > > > >> > > > > > > > > > >
> > > > >> > > > > >
> > > > >>
> -------------------------------------------------------------------
> > > > >> > > > > > > > > > > > > > >> > > > > > > > > >
> > > > >> > > > > > > > > > > > > > >> > > > > > > > >
> > > > >> > > > > > > > > > > > > > >> > > > > > > >
> > > > >> > > > > > > > > > > > > > >> > > > > > > >
> > > > >> > > > > > > > > > > > > > >> > > > > > > >
> > > > >> > > > > > > > > > > > > > >> > > > > > > > --
> > > > >> > > > > > > > > > > > > > >> > > > > > > >
> > > > >> > > > > > > > > > > > > > >> > >
> > > > >> > > > > > > > > > > > >
> > > > >> > > > > > > >
> > > > >> > >
> > > ------------------------------------------------------------------
> > > -
> > > > >> > > > > > > > > > > > > > >> > > > > > > > *SCJA. José Luis
> Cetina*
> > > > >> > > > > > > > > > > > > > >> > > > > > > >
> > > > >> > > > > > > > > > > > > > >> > >
> > > > >> > > > > > > > > > > > >
> > > > >> > > > > > > >
> > > > >> > >
> > > ------------------------------------------------------------------
> > > -
> > > > >> > > > > > > > > > > > > > >> > > > > > > >
> > > > >> > > > > > > > > > > > > > >> > > > > > >
> > > > >> > > > > > > > > > > > > > >> > > > > >
> > > > >> > > > > > > > > > > > > > >> > > > > >
> > > > >> > > > > > > > > > > > > > >> > > > > >
> > > > >> > > > > > > > > > > > > > >> > > > > > --
> > > > >> > > > > > > > > > > > > > >> > > > > >
> > > > >> > > > > > > > > > > > > > >>
> > > > >> > > > > > > > > > >
> > > > >> > > > > >
> > > > >>
> -------------------------------------------------------------------
> > > > >> > > > > > > > > > > > > > >> > > > > > *SCJA. José Luis 
> > > > >> > > > > > > > > > > > > > >> > > > > > Cetina*
> > > > >> > > > > > > > > > > > > > >> > > > > >
> > > > >> > > > > > > > > > > > > > >>
> > > > >> > > > > > > > > > >
> > > > >> > > > > >
> > > > >>
> -------------------------------------------------------------------
> > > > >> > > > > > > > > > > > > > >> > > > > >
> > > > >> > > > > > > > > > > > > > >> > > > >
> > > > >> > > > > > > > > > > > > > >> > > >
> > > > >> > > > > > > > > > > > > > >> > > >
> > > > >> > > > > > > > > > > > > > >> > > >
> > > > >> > > > > > > > > > > > > > >> > > > --
> > > > >> > > > > > > > > > > > > > >> > > >
> > > > >> > > > > > > > > > > > > >
> > > > >> > > > > > > > >
> > > > >> > > >
> > > > ----------------------------------------------------------------
> > > > ---
> > > > >> > > > > > > > > > > > > > >> > > > *SCJA. José Luis Cetina*
> > > > >> > > > > > > > > > > > > > >> > > >
> > > > >> > > > > > > > > > > > > >
> > > > >> > > > > > > > >
> > > > >> > > >
> > > > ----------------------------------------------------------------
> > > > ---
> > > > >> > > > > > > > > > > > > > >> > > >
> > > > >> > > > > > > > > > > > > > >> > >
> > > > >> > > > > > > > > > > > > > >> >
> > > > >> > > > > > > > > > > > > > >> >
> > > > >> > > > > > > > > > > > > > >> >
> > > > >> > > > > > > > > > > > > > >> > --
> > > > >> > > > > > > > > > > > > > >> >
> > > > >> > > > > > > > > > > >
> > > > >> > > > > > >
> > > > >> >
> > -------------------------------------------------------------------
> > > > >> > > > > > > > > > > > > > >> > *SCJA. José Luis Cetina*
> > > > >> > > > > > > > > > > > > > >> >
> > > > >> > > > > > > > > > > >
> > > > >> > > > > > >
> > > > >> >
> > -------------------------------------------------------------------
> > > > >> > > > > > > > > > > > > > >> >
> > > > >> > > > > > > > > > > > > > >>
> > > > >> > > > > > > > > > > > > > >
> > > > >> > > > > > > > > > > > > > >
> > > > >> > > > > > > > > > > > > > >
> > > > >> > > > > > > > > > > > > > > --
> > > > >> > > > > > > > > > > > > > >
> > > > >> > > > > > > > > >
> > > > >> > > > >
> > > > >>
> -------------------------------------------------------------------
> > > > >> > > > > > > > > > > > > > > *SCJA. José Luis Cetina*
> > > > >> > > > > > > > > > > > > > >
> > > > >> > > > > > > > > >
> > > > >> > > > >
> > > > >>
> -------------------------------------------------------------------
> > > > >> > > > > > > > > > > > > > >
> > > > >> > > > > > > > > > > > > > >
> > > > >> > > > > > > > > > > > > >
> > > > >> > > > > > > > > > > > > >
> > > > >> > > > > > > > > > > > > > --
> > > > >> > > > > > > > > > > > > >
> > > > >> > > > > > > > >
> > > > >> > > >
> > > > ----------------------------------------------------------------
> > > > ---
> > > > >> > > > > > > > > > > > > > *SCJA. José Luis Cetina*
> > > > >> > > > > > > > > > > > > >
> > > > >> > > > > > > > >
> > > > >> > > >
> > > > ----------------------------------------------------------------
> > > > ---
> > > > >> > > > > > > > > > > > > >
> > > > >> > > > > > > > > > > > >
> > > > >> > > > > > > > > > > >
> > > > >> > > > > > > > > > > >
> > > > >> > > > > > > > > > > >
> > > > >> > > > > > > > > > > > --
> > > > >> > > > > > > > > > > >
> > > > >> > > > > > >
> > > > >> >
> > -------------------------------------------------------------------
> > > > >> > > > > > > > > > > > *SCJA. José Luis Cetina*
> > > > >> > > > > > > > > > > >
> > > > >> > > > > > >
> > > > >> >
> > -------------------------------------------------------------------
> > > > >> > > > > > > > > > > >
> > > > >> > > > > > > > > > >
> > > > >> > > > > > > > > >
> > > > >> > > > > > > > > >
> > > > >> > > > > > > > > >
> > > > >> > > > > > > > > > --
> > > > >> > > > > > > > > >
> > > > >> > > > >
> > > > >>
> -------------------------------------------------------------------
> > > > >> > > > > > > > > > *SCJA. José Luis Cetina*
> > > > >> > > > > > > > > >
> > > > >> > > > >
> > > > >>
> -------------------------------------------------------------------
> > > > >> > > > > > > > > >
> > > > >> > > > > > > > >
> > > > >> > > > > > > >
> > > > >> > > > > > > >
> > > > >> > > > > > > >
> > > > >> > > > > > > > --
> > > > >> > > > > > > >
> > > > >> > >
> > > ------------------------------------------------------------------
> > > -
> > > > >> > > > > > > > *SCJA. José Luis Cetina*
> > > > >> > > > > > > >
> > > > >> > >
> > > ------------------------------------------------------------------
> > > -
> > > > >> > > > > > > >
> > > > >> > > > > > >
> > > > >> > > > > >
> > > > >> > > > > >
> > > > >> > > > > >
> > > > >> > > > > > --
> > > > >> > > > > >
> > > > >>
> -------------------------------------------------------------------
> > > > >> > > > > > *SCJA. José Luis Cetina*
> > > > >> > > > > >
> > > > >>
> -------------------------------------------------------------------
> > > > >> > > > > >
> > > > >> > > > >
> > > > >> > > >
> > > > >> > > >
> > > > >> > > >
> > > > >> > > > --
> > > > >> > > >
> > > > ----------------------------------------------------------------
> > > > ---
> > > > >> > > > *SCJA. José Luis Cetina*
> > > > >> > > >
> > > > ----------------------------------------------------------------
> > > > ---
> > > > >> > > >
> > > > >> > >
> > > > >> >
> > > > >> >
> > > > >> >
> > > > >> > --
> > > > >> >
> > -------------------------------------------------------------------
> > > > >> > *SCJA. José Luis Cetina*
> > > > >> >
> > -------------------------------------------------------------------
> > > > >> >
> > > > >>
> > > > >
> > > > >
> > > > >
> > > > > --
> > > > > --------------------------------------------------------------
> > > > > -----
> > > > > *SCJA. José Luis Cetina*
> > > > > --------------------------------------------------------------
> > > > > -----
> > > > >
> > > > >
> > > >
> > > >
> > > > --
> > > > ----------------------------------------------------------------
> > > > ---
> > > > *SCJA. José Luis Cetina*
> > > > ----------------------------------------------------------------
> > > > ---
> > > >
> > >
> >
>



--
-------------------------------------------------------------------
*SCJA. José Luis Cetina*
-------------------------------------------------------------------


Re: Guest user

Posted by José Luis Cetina <ma...@gmail.com>.
Well i readed what you say, and i see the topic is: Session Fixation
Protection and talk about a "security feature" then i decide to set the
values in my second request after the login.

Session Fixation Protection says:

"Essentially, when a user authenticates their session, Tomcat will change
the session ID. It does not destroy the previous session, rather it renames
it so it is no longer found by that ID. So in our example above, Bob would
try and log on with that session, and he would not be able to find it."


I decied not set the changeSessionIdOnAuthentication to false because i can
change the behaviour of my app without any problem, but the people who are
migrating from other Application Servers to TomEE have to know this.


References:
http://tomcat.apache.org/tomcat-7.0-doc/config/valve.html
http://www.tomcatexpert.com/blog/2011/04/25/session-fixation-protection
http://java.dzone.com/tips/turning-session-fixation


Thanks again.


2012/6/15 Romain Manni-Bucau <rm...@gmail.com>

> that's because in your authenticator you have the attribute
> "changeSessionIdOnAuthentication" set to true.
>
> - Romain
>
>
> 2012/6/15 José Luis Cetina <ma...@gmail.com>
>
> > Hi Romain, let me tell you, the problem only occurs when you use login
> > method and try to set something in the session bean just after the next
> > line of request.login, if I comment the login method, then it works ok,
> > please give a try with a simple test with login method and you will see
> the
> > problem, I tested many times
> >  El 15/06/2012 04:40, "Romain Manni-Bucau" <rm...@gmail.com>
> > escribió:
> >
> > > Hi,
> > >
> > > i didnt test with the login but it seems it works
> > >
> > > but please add @RequestScoped to MyNextPageMBean or don't use
> > > postconstrutct otherwise you have a kind of cache effect depending on
> the
> > > moment when the bean is created.
> > >
> > > here a sample:
> > >
> > >
> >
> http://svn.apache.org/repos/asf/openejb/trunk/openejb/examples/cdi-session-scope/
> > >
> > > - Romain
> > >
> > >
> > > 2012/6/15 José Luis Cetina <ma...@gmail.com>
> > >
> > > > Hi Romain, well i have an other problem and i think is related to
> this
> > > same
> > > > reported issue.
> > > >
> > > > We talked about if i login using request.login(user,pass) method and
> if
> > > the
> > > > credentials and login was successfull then when i get the user i get
> a
> > > > guess user:
> > > >
> > > > request.login(user,pass);
> > > > String name = ejbContext.getCallerPrincipal().getName();
> > > >
> > > > Ok, then this was fixed, and its ok now, now returns the valid user.
> > > >
> > > > But now if i do this
> > > >
> > > > @Inject
> > > > private MySessionBean mySessionBean;
> > > >
> > > > public String login(){
> > > >   request.login(user,pass);
> > > >   mySessionBean.setName("My name is JOE");
> > > >   //then i do a redirect here
> > > >  return "next_page";
> > > > }
> > > >
> > > > now in my managedbean of my next_page.xhtml i had:
> > > >
> > > > @Named
> > > > public MyNextPageMBean implements Serializable{
> > > >
> > > > @Inject
> > > > private MySessionBean mySessionBean;
> > > >
> > > >  @PostConstruc
> > > >  public void test(){
> > > >    mySessionBean.getName(); <---HERE I GET NULL ALWAYS
> > > >   }
> > > >
> > > > }
> > > >
> > > >
> > > > SessionBean:
> > > >
> > > > import java.io.Serializable;
> > > > import javax.enterprise.context.SessionScoped;
> > > > import javax.inject.Named;
> > > >
> > > > @Named
> > > > @SessionScoped
> > > > public class MySessionBean implements Serializable{
> > > >
> > > >    private String name;
> > > >
> > > >    public MySessionBean() {
> > > >
> > > >    }
> > > >
> > > >    public String getName() {
> > > >        return name;
> > > >    }
> > > >
> > > >    public void setName(String name) {
> > > >        this.name = name;
> > > >    }
> > > > }
> > > >
> > > >
> > > >
> > > > As you can see i get null, mi login its ok, but when i saved
> something
> > in
> > > > my sessionbean when i try to retrive what i saved before, i always
> get
> > > > null, like if i never set the value (and of course i did it) but this
> > > ONLY
> > > > HAPPEND when i try to set the any value just before request.login,
> if i
> > > set
> > > > the value in the second bean  like
> > > >
> > > > mySessionBean.setName("My name is JOE"); then in other's page i can
> get
> > > the
> > > > value without any problem, i do a lot of test and the problem is
> when i
> > > > only set the values (in my session bean) just before request.login,
> > then
> > > i
> > > > associated this with the "guest user problem" as you sayed this was
> > > > happening because the user was "recognized" only after the first
> > request.
> > > >
> > > > Again, is this the expected behaviour? it seem buggy
> > > >
> > > > Im using:  apache-tomee-1.1.0-20120612.040829-22-webprofile
> > > >
> > > >
> > > > 2012/6/1 José Luis Cetina <ma...@gmail.com>
> > > >
> > > > > ok
> > > > >
> > > > >
> > > > > 2012/6/1 Romain Manni-Bucau <rm...@gmail.com>
> > > > >
> > > > >> deployment in progress:
> > > > >> http://ci.apache.org/builders/openejb-trunk-deploy/builds/378
> > > > >>
> > > > >> - Romain
> > > > >>
> > > > >>
> > > > >> 2012/6/1 José Luis Cetina <ma...@gmail.com>
> > > > >>
> > > > >> > Ok, in what tomee build this will be available?
> > > > >> >
> > > > >> > 2012/5/31 Romain Manni-Bucau <rm...@gmail.com>
> > > > >> >
> > > > >> > > yep
> > > > >> > >
> > > > >> > > just commited, a new commit will come where this class will
> > > > >> automatically
> > > > >> > > be added normally
> > > > >> > >
> > > > >> > > - Romain
> > > > >> > >
> > > > >> > >
> > > > >> > > 2012/6/1 José Luis Cetina <ma...@gmail.com>
> > > > >> > >
> > > > >> > > > im getting a ClassNotFound
> > > > >> > > >
> > > > >> > > > Caused by: java.lang.ClassNotFoundException:
> > > > >> > > > org.apache.tomee.catalina.TomEERealm
> > > > >> > > >
> > > > >> > > > 2012/5/31 Romain Manni-Bucau <rm...@gmail.com>
> > > > >> > > >
> > > > >> > > > > my sample is working, too late to add test but manually it
> > > works
> > > > >> > > > >
> > > > >> > > > > so i guess it should work for you
> > > > >> > > > >
> > > > >> > > > > the question now is should we add it automatically?
> > > > >> > > > >
> > > > >> > > > > - Romain
> > > > >> > > > >
> > > > >> > > > >
> > > > >> > > > > 2012/6/1 José Luis Cetina <ma...@gmail.com>
> > > > >> > > > >
> > > > >> > > > > > Oooh great, with this i can get the principal user in
> the
> > > > first
> > > > >> > > > request?
> > > > >> > > > > or
> > > > >> > > > > > this is something that you gonna fix?
> > > > >> > > > > >
> > > > >> > > > > > 2012/5/31 Romain Manni-Bucau <rm...@gmail.com>
> > > > >> > > > > >
> > > > >> > > > > > > that's brand new ;)
> > > > >> > > > > > >
> > > > >> > > > > > > just added it, it mainly delegate to the real realm
> but
> > > add
> > > > >> the
> > > > >> > > > > principal
> > > > >> > > > > > > info to openejb/tomee security service which is used
> in
> > > > >> > ejbcontext
> > > > >> > > > impl
> > > > >> > > > > > (to
> > > > >> > > > > > > make it short)
> > > > >> > > > > > >
> > > > >> > > > > > > - Romain
> > > > >> > > > > > >
> > > > >> > > > > > >
> > > > >> > > > > > > 2012/6/1 José Luis Cetina <ma...@gmail.com>
> > > > >> > > > > > >
> > > > >> > > > > > > > I have this in my context.xml
> > > > >> > > > > > > >
> > > > >> > > > > > > > <Realm className="MyExtendedDataSourceRealm"
> > > > >> > > > > > > >  dataSourceName="MyDataSource"
> > > > >> > > > > > > > digest="SHA-256"
> > > > >> > > > > > > > encodePassword="Base64"
> > > > >> > > > > > > > queryRealmRolesUser="SELECT rol FROM xxxx WHERE
> > user=?"
> > > > >> > > > > > > > queryRealmUsers="SELECT pass FROM xxx WHERE
> user=?"/>
> > > > >> > > > > > > >
> > > > >> > > > > > > > As you can see i extend the datasource realm, i have
> > > this
> > > > >> realm
> > > > >> > > > > config
> > > > >> > > > > > in
> > > > >> > > > > > > > the context.xml in my webapp (not context.xml
> TomEE).
> > > > >> > > > > > > >
> > > > >> > > > > > > > But, as i can see in your example, you surround your
> > > realm
> > > > >> with
> > > > >> > > > > > > TomEERealm,
> > > > >> > > > > > > > if this necessary?. I didn't know this
> > > > >> > > > > > > >
> > > > >> > > > > > > >
> > > > >> > > > > > > >
> > > > >> > > > > > > > 2012/5/31 Romain Manni-Bucau <rmannibucau@gmail.com
> >
> > > > >> > > > > > > >
> > > > >> > > > > > > > > in my test i used:
> > > > >> > > > > > > > >
> > > > >> > > > > > > > >    <Realm
> > > > >> className="org.apache.tomee.catalina.TomEERealm">
> > > > >> > > > > > > > >        <Realm
> > > > >> className="org.apache.catalina.realm.JAASRealm"
> > > > >> > > > > > > > > appName="PropertiesLoginModule"
> > > > >> > > > > > > > >
> > > > >> > > > > > > > >
> > > > >> > > > > > > > >
> > > > >> > > > > > > >
> > > > >> > > > > > >
> > > > >> > > > > >
> > > > >> > > > >
> > > > >> > > >
> > > > >> > >
> > > > >> >
> > > > >>
> > > >
> > >
> >
>  userClassNames="org.apache.openejb.core.security.AbstractSecurityService$User"
> > > > >> > > > > > > > >
> > > > >> > > > > > > > >
> > > > >> > > > > > > > >
> > > > >> > > > > > > >
> > > > >> > > > > > >
> > > > >> > > > > >
> > > > >> > > > >
> > > > >> > > >
> > > > >> > >
> > > > >> >
> > > > >>
> > > >
> > >
> >
>  roleClassNames="org.apache.openejb.core.security.AbstractSecurityService$Group">
> > > > >> > > > > > > > >        </Realm>
> > > > >> > > > > > > > >       </Realm>
> > > > >> > > > > > > > >
> > > > >> > > > > > > > > but i guess you can replace the jaasrealm by your
> > > > dsrealm
> > > > >> > > > > > > > >
> > > > >> > > > > > > > > - Romain
> > > > >> > > > > > > > >
> > > > >> > > > > > > > >
> > > > >> > > > > > > > > 2012/6/1 José Luis Cetina <ma...@gmail.com>
> > > > >> > > > > > > > >
> > > > >> > > > > > > > > > Yes, it seems buggy.
> > > > >> > > > > > > > > >
> > > > >> > > > > > > > > > Where i have to replace?
> > > > >> > > > > > > > > >
> > > > >> > > > > > > > > > Remember im using DataSourceRealm
> > > > >> > > > > > > > > >
> > > > >> > > > > > > > > > 2012/5/31 Romain Manni-Bucau <
> > rmannibucau@gmail.com
> > > >
> > > > >> > > > > > > > > >
> > > > >> > > > > > > > > > > this is the current status,
> > > > >> > > > > > > > > > >
> > > > >> > > > > > > > > > > but IMO it is buggy,
> > > > >> > > > > > > > > > >
> > > > >> > > > > > > > > > > i'll commit soon a TomEEJAASRealm to make it
> > > working
> > > > >> > > (replace
> > > > >> > > > > > > > JAASRealm
> > > > >> > > > > > > > > > in
> > > > >> > > > > > > > > > > the conf)
> > > > >> > > > > > > > > > >
> > > > >> > > > > > > > > > > - Romain
> > > > >> > > > > > > > > > >
> > > > >> > > > > > > > > > >
> > > > >> > > > > > > > > > > 2012/6/1 José Luis Cetina <
> maxtorzito@gmail.com
> > >
> > > > >> > > > > > > > > > >
> > > > >> > > > > > > > > > > > i think we are getting confused.
> > > > >> > > > > > > > > > > >
> > > > >> > > > > > > > > > > > If i resume all, this what i asked (the
> final
> > of
> > > > the
> > > > >> > > first
> > > > >> > > > > > post)
> > > > >> > > > > > > > > > > >
> > > > >> > > > > > > > > > > > I dont know if this is the desire behavior
> or
> > if
> > > > >> this
> > > > >> > > > happend
> > > > >> > > > > > > > becase
> > > > >> > > > > > > > > > the
> > > > >> > > > > > > > > > > > httr request isnt finished?
> > > > >> > > > > > > > > > > > Then you answer me:
> > > > >> > > > > > > > > > > >
> > > > >> > > > > > > > > > > > in fact info from ejbcontext are taken in
> our
> > > > >> > > > securitymodule
> > > > >> > > > > > > > > > > >
> > > > >> > > > > > > > > > > > in tomee we set/unset it from a valve so at
> > the
> > > > >> > > > beginning/end
> > > > >> > > > > > of
> > > > >> > > > > > > > the
> > > > >> > > > > > > > > > > > request...all between is currently ignored
> so
> > > when
> > > > >> you
> > > > >> > > log
> > > > >> > > > > you
> > > > >> > > > > > > need
> > > > >> > > > > > > > > > > another
> > > > >> > > > > > > > > > > > request to get the updated information (from
> > the
> > > > >> tomcat
> > > > >> > > > > realm)
> > > > >> > > > > > > > > > > >
> > > > >> > > > > > > > > > > > "so when you log you need another request to
> > get
> > > > the
> > > > >> > > > updated
> > > > >> > > > > > > > > > information
> > > > >> > > > > > > > > > > > (from the tomcat realm)
> > > > >> > > > > > > > > > > >
> > > > >> > > > > > > > > > > > Then i get guest because is the desire
> > > behaviour,
> > > > >> after
> > > > >> > > the
> > > > >> > > > > > first
> > > > >> > > > > > > > > > > request i
> > > > >> > > > > > > > > > > > can get the user i expected.
> > > > >> > > > > > > > > > > >
> > > > >> > > > > > > > > > > > Then i resume, this is the default
> behaviour,
> > > and
> > > > >> works
> > > > >> > > but
> > > > >> > > > > you
> > > > >> > > > > > > > need
> > > > >> > > > > > > > > a
> > > > >> > > > > > > > > > > > second request.
> > > > >> > > > > > > > > > > >
> > > > >> > > > > > > > > > > >
> > > > >> > > > > > > > > > > >
> > > > >> > > > > > > > > > > > 2012/5/31 Romain Manni-Bucau <
> > > > rmannibucau@gmail.com
> > > > >> >
> > > > >> > > > > > > > > > > >
> > > > >> > > > > > > > > > > > > i think it should work
> > > > >> > > > > > > > > > > > >
> > > > >> > > > > > > > > > > > > - Romain
> > > > >> > > > > > > > > > > > >
> > > > >> > > > > > > > > > > > >
> > > > >> > > > > > > > > > > > > 2012/6/1 José Luis Cetina <
> > > maxtorzito@gmail.com
> > > > >
> > > > >> > > > > > > > > > > > >
> > > > >> > > > > > > > > > > > > > I mean this:
> > > > >> > > > > > > > > > > > > >
> > > > >> > > > > > > > > > > > > > I dont know if this is the desire
> > behaviour
> > > or
> > > > >> if
> > > > >> > > this
> > > > >> > > > > > > happend
> > > > >> > > > > > > > > > > because
> > > > >> > > > > > > > > > > > > the
> > > > >> > > > > > > > > > > > > > http request isnt finished?
> > > > >> > > > > > > > > > > > > >
> > > > >> > > > > > > > > > > > > >
> > > > >> > > > > > > > > > > > > >
> > > > >> > > > > > > > > > > > > > 2012/5/31 José Luis Cetina <
> > > > >> maxtorzito@gmail.com>
> > > > >> > > > > > > > > > > > > >
> > > > >> > > > > > > > > > > > > > > Ok, the what i asked is correct??
> > > > >> > > > > > > > > > > > > > >
> > > > >> > > > > > > > > > > > > > > "I dont know if this is the desire
> > > behaviour
> > > > >> or
> > > > >> > if
> > > > >> > > > this
> > > > >> > > > > > > > happend
> > > > >> > > > > > > > > > > > because
> > > > >> > > > > > > > > > > > > > > the http request isnt finished?"
> > > > >> > > > > > > > > > > > > > >
> > > > >> > > > > > > > > > > > > > > 2012/5/31 Romain Manni-Bucau <
> > > > >> > > rmannibucau@gmail.com>
> > > > >> > > > > > > > > > > > > > >
> > > > >> > > > > > > > > > > > > > >> ok,
> > > > >> > > > > > > > > > > > > > >>
> > > > >> > > > > > > > > > > > > > >> in fact info from ejbcontext are
> taken
> > in
> > > > our
> > > > >> > > > > > > securitymodule
> > > > >> > > > > > > > > > > > > > >>
> > > > >> > > > > > > > > > > > > > >> in tomee we set/unset it from a valve
> > so
> > > at
> > > > >> the
> > > > >> > > > > > > > beginning/end
> > > > >> > > > > > > > > of
> > > > >> > > > > > > > > > > the
> > > > >> > > > > > > > > > > > > > >> request...all between is currently
> > > ignored
> > > > so
> > > > >> > when
> > > > >> > > > you
> > > > >> > > > > > log
> > > > >> > > > > > > > you
> > > > >> > > > > > > > > > > need
> > > > >> > > > > > > > > > > > > > >> another
> > > > >> > > > > > > > > > > > > > >> request to get the updated
> information
> > > > (from
> > > > >> the
> > > > >> > > > > tomcat
> > > > >> > > > > > > > realm)
> > > > >> > > > > > > > > > > > > > >>
> > > > >> > > > > > > > > > > > > > >> - Romain
> > > > >> > > > > > > > > > > > > > >>
> > > > >> > > > > > > > > > > > > > >>
> > > > >> > > > > > > > > > > > > > >> 2012/6/1 José Luis Cetina <
> > > > >> maxtorzito@gmail.com
> > > > >> > >
> > > > >> > > > > > > > > > > > > > >>
> > > > >> > > > > > > > > > > > > > >> > Yes, it work
> > > > >> > > > > > > > > > > > > > >> >
> > > > >> > > > > > > > > > > > > > >> > 1) Login (form login) using
> > > > DataSourceRealm
> > > > >> > > > > > > > > > > > > > >> >
> > > > >> > > > > > > > > > > > > > >> >
> > > > >> > > > > > > > > > > > > > >> > 2) Redirect to page2 from my
> > > managedbean
> > > > >> > > > > > > > > > > > > > >> >
> > > > >> > > > > > > > > > > > > > >> > 2012/5/31 Romain Manni-Bucau <
> > > > >> > > > rmannibucau@gmail.com
> > > > >> > > > > >
> > > > >> > > > > > > > > > > > > > >> >
> > > > >> > > > > > > > > > > > > > >> > > so you mean using the flow i
> > > described
> > > > >> > before
> > > > >> > > it
> > > > >> > > > > > > works?
> > > > >> > > > > > > > > > > (sorry,
> > > > >> > > > > > > > > > > > > just
> > > > >> > > > > > > > > > > > > > >> to
> > > > >> > > > > > > > > > > > > > >> > be
> > > > >> > > > > > > > > > > > > > >> > > sure to understand)
> > > > >> > > > > > > > > > > > > > >> > >
> > > > >> > > > > > > > > > > > > > >> > > - Romain
> > > > >> > > > > > > > > > > > > > >> > >
> > > > >> > > > > > > > > > > > > > >> > >
> > > > >> > > > > > > > > > > > > > >> > > 2012/6/1 José Luis Cetina <
> > > > >> > > maxtorzito@gmail.com
> > > > >> > > > >
> > > > >> > > > > > > > > > > > > > >> > >
> > > > >> > > > > > > > > > > > > > >> > > > Hi i can login and i can
> navigate
> > > > >> > (redirect)
> > > > >> > > > to
> > > > >> > > > > my
> > > > >> > > > > > > > other
> > > > >> > > > > > > > > > > page,
> > > > >> > > > > > > > > > > > > > but i
> > > > >> > > > > > > > > > > > > > >> > dont
> > > > >> > > > > > > > > > > > > > >> > > > know why im getting guest user
> in
> > > the
> > > > >> > login
> > > > >> > > > > mbean,
> > > > >> > > > > > > > after
> > > > >> > > > > > > > > > > that
> > > > >> > > > > > > > > > > > in
> > > > >> > > > > > > > > > > > > > >> other
> > > > >> > > > > > > > > > > > > > >> > > > mbean  i get my "real" user.
> > > > >> > > > > > > > > > > > > > >> > > >
> > > > >> > > > > > > > > > > > > > >> > > >
> > > > >> > > > > > > > > > > > > > >> > > > 2012/5/31 Romain Manni-Bucau <
> > > > >> > > > > > rmannibucau@gmail.com
> > > > >> > > > > > > >
> > > > >> > > > > > > > > > > > > > >> > > >
> > > > >> > > > > > > > > > > > > > >> > > > > maybe
> > > > >> > > > > > > > > > > > > > >> > > > >
> > > > >> > > > > > > > > > > > > > >> > > >
> > > > >> > > > > > > > > > > > > > >> > >
> > > > >> > > > > > > > > > > > > > >> >
> > > > >> > > > > > > > > > > > > > >>
> > > > >> > > > > > > > > > > > > >
> > > > >> > > > > > > > > > > > >
> > > > >> > > > > > > > > > > >
> > > > >> > > > > > > > > > >
> > > > >> > > > > > > > > >
> > > > >> > > > > > > > >
> > > > >> > > > > > > >
> > > > >> > > > > > >
> > > > >> > > > > >
> > > > >> > > > >
> > > > >> > > >
> > > > >> > >
> > > > >> >
> > > > >>
> > > >
> > >
> >
> http://rmannibucau.wordpress.com/2012/05/09/tomee-and-its-ssh-connector/but
> > > > >> > > > > > > > > > > > > > >> > > > > it uses properties file, it
> > just
> > > > >> need a
> > > > >> > > > custom
> > > > >> > > > > > > login
> > > > >> > > > > > > > > > > module
> > > > >> > > > > > > > > > > > > > >> > > > implementation
> > > > >> > > > > > > > > > > > > > >> > > > > to use a db.
> > > > >> > > > > > > > > > > > > > >> > > > >
> > > > >> > > > > > > > > > > > > > >> > > > > well,
> > > > >> > > > > > > > > > > > > > >> > > > >
> > > > >> > > > > > > > > > > > > > >> > > > > before can you test it
> please?
> > > > >> > > > > > > > > > > > > > >> > > > > 1) login
> > > > >> > > > > > > > > > > > > > >> > > > > 2) redirect to your page
> using
> > > your
> > > > >> bean
> > > > >> > > > > > > > > > > > > > >> > > > >
> > > > >> > > > > > > > > > > > > > >> > > > > - Romain
> > > > >> > > > > > > > > > > > > > >> > > > >
> > > > >> > > > > > > > > > > > > > >> > > > >
> > > > >> > > > > > > > > > > > > > >> > > > > 2012/6/1 José Luis Cetina <
> > > > >> > > > > maxtorzito@gmail.com
> > > > >> > > > > > >
> > > > >> > > > > > > > > > > > > > >> > > > >
> > > > >> > > > > > > > > > > > > > >> > > > > > I have to read and know how
> > to
> > > > use
> > > > >> > > this, i
> > > > >> > > > > > > always
> > > > >> > > > > > > > > use
> > > > >> > > > > > > > > > > > > > >> DataSource or
> > > > >> > > > > > > > > > > > > > >> > > > > > JDBCRealm. (with
> glassfish).
> > > > >> > > > > > > > > > > > > > >> > > > > > im reading now, do you have
> > > > >> something
> > > > >> > > for
> > > > >> > > > a
> > > > >> > > > > > > > > > quickstart?
> > > > >> > > > > > > > > > > > for
> > > > >> > > > > > > > > > > > > > >> share
> > > > >> > > > > > > > > > > > > > >> > me
> > > > >> > > > > > > > > > > > > > >> > > > > >
> > > > >> > > > > > > > > > > > > > >> > > > > > 2012/5/31 Romain
> Manni-Bucau
> > <
> > > > >> > > > > > > > rmannibucau@gmail.com
> > > > >> > > > > > > > > >
> > > > >> > > > > > > > > > > > > > >> > > > > >
> > > > >> > > > > > > > > > > > > > >> > > > > > > having your password in a
> > db
> > > is
> > > > >> not
> > > > >> > an
> > > > >> > > > > issue
> > > > >> > > > > > > > but i
> > > > >> > > > > > > > > > > think
> > > > >> > > > > > > > > > > > > you
> > > > >> > > > > > > > > > > > > > >> > should
> > > > >> > > > > > > > > > > > > > >> > > > > > > use
> > > > >> > > org.apache.catalina.realm.JAASRealm
> > > > >> > > > > > > > > > > > > > >> > > > > > >
> > > > >> > > > > > > > > > > > > > >> > > > > > > for instance:
> > > > >> > > > > > > > > > > > > > >> > > > > > >
> > > > >> > > > > > > > > > > > > > >> > > > > > >     <Realm
> > > > >> > > > > > > > > > > >
> > className="org.apache.catalina.realm.JAASRealm"
> > > > >> > > > > > > > > > > > > > >> > > > > > > appName="MyDBLoginModule"
> > > > >> > > > > > > > > > > > > > >> > > > > > >
> > > > >> > > > > > > > > > > > > > >> > > > > > >
> > > > >> > > > > > > > > > > > > > >> > > > > > >
> > > > >> > > > > > > > > > > > > > >> > > > > >
> > > > >> > > > > > > > > > > > > > >> > > > >
> > > > >> > > > > > > > > > > > > > >> > > >
> > > > >> > > > > > > > > > > > > > >> > >
> > > > >> > > > > > > > > > > > > > >> >
> > > > >> > > > > > > > > > > > > > >>
> > > > >> > > > > > > > > > > > > >
> > > > >> > > > > > > > > > > > >
> > > > >> > > > > > > > > > > >
> > > > >> > > > > > > > > > >
> > > > >> > > > > > > > > >
> > > > >> > > > > > > > >
> > > > >> > > > > > > >
> > > > >> > > > > > >
> > > > >> > > > > >
> > > > >> > > > >
> > > > >> > > >
> > > > >> > >
> > > > >> >
> > > > >>
> > > >
> > >
> >
>  userClassNames="org.apache.openejb.core.security.AbstractSecurityService$User"
> > > > >> > > > > > > > > > > > > > >> > > > > > >
> > > > >> > > > > > > > > > > > > > >> > > > > > >
> > > > >> > > > > > > > > > > > > > >> > > > > > >
> > > > >> > > > > > > > > > > > > > >> > > > > >
> > > > >> > > > > > > > > > > > > > >> > > > >
> > > > >> > > > > > > > > > > > > > >> > > >
> > > > >> > > > > > > > > > > > > > >> > >
> > > > >> > > > > > > > > > > > > > >> >
> > > > >> > > > > > > > > > > > > > >>
> > > > >> > > > > > > > > > > > > >
> > > > >> > > > > > > > > > > > >
> > > > >> > > > > > > > > > > >
> > > > >> > > > > > > > > > >
> > > > >> > > > > > > > > >
> > > > >> > > > > > > > >
> > > > >> > > > > > > >
> > > > >> > > > > > >
> > > > >> > > > > >
> > > > >> > > > >
> > > > >> > > >
> > > > >> > >
> > > > >> >
> > > > >>
> > > >
> > >
> >
>  roleClassNames="org.apache.openejb.core.security.AbstractSecurityService$Group">
> > > > >> > > > > > > > > > > > > > >> > > > > > >      </Realm>
> > > > >> > > > > > > > > > > > > > >> > > > > > >
> > > > >> > > > > > > > > > > > > > >> > > > > > > so simply implement a
> > custom
> > > > >> > > LoginModule
> > > > >> > > > > > > instead
> > > > >> > > > > > > > > of
> > > > >> > > > > > > > > > a
> > > > >> > > > > > > > > > > > > realm
> > > > >> > > > > > > > > > > > > > >> > > > > > >
> > > > >> > > > > > > > > > > > > > >> > > > > > > wdyt?
> > > > >> > > > > > > > > > > > > > >> > > > > > >
> > > > >> > > > > > > > > > > > > > >> > > > > > > - Romain
> > > > >> > > > > > > > > > > > > > >> > > > > > >
> > > > >> > > > > > > > > > > > > > >> > > > > > >
> > > > >> > > > > > > > > > > > > > >> > > > > > > 2012/6/1 José Luis
> Cetina <
> > > > >> > > > > > > maxtorzito@gmail.com
> > > > >> > > > > > > > >
> > > > >> > > > > > > > > > > > > > >> > > > > > >
> > > > >> > > > > > > > > > > > > > >> > > > > > > > Sorry, i use
> > > > DataSourceRealm, i
> > > > >> > have
> > > > >> > > > my
> > > > >> > > > > > > > > > > > user/pass/roles
> > > > >> > > > > > > > > > > > > in
> > > > >> > > > > > > > > > > > > > >> the
> > > > >> > > > > > > > > > > > > > >> > > DB.
> > > > >> > > > > > > > > > > > > > >> > > > > > > >
> > > > >> > > > > > > > > > > > > > >> > > > > > > >
> > > > >> > > > > > > > > > > > > > >> > > > > > > >
> > > > >> > > > > > > > > > > > > > >> > > > > > > > 2012/5/31 Romain
> > > Manni-Bucau
> > > > <
> > > > >> > > > > > > > > > rmannibucau@gmail.com
> > > > >> > > > > > > > > > > >
> > > > >> > > > > > > > > > > > > > >> > > > > > > >
> > > > >> > > > > > > > > > > > > > >> > > > > > > > > can't you do it with
> an
> > > > >> embedded
> > > > >> > > > one?
> > > > >> > > > > > > > > > > > > > >> > > > > > > > >
> > > > >> > > > > > > > > > > > > > >> > > > > > > > > well DataSourceRealm
> > > > doesn't
> > > > >> use
> > > > >> > > > JAAS
> > > > >> > > > > by
> > > > >> > > > > > > > > > default i
> > > > >> > > > > > > > > > > > > > think,
> > > > >> > > > > > > > > > > > > > >> > maybe
> > > > >> > > > > > > > > > > > > > >> > > > > > that's
> > > > >> > > > > > > > > > > > > > >> > > > > > > > the
> > > > >> > > > > > > > > > > > > > >> > > > > > > > > issue
> > > > >> > > > > > > > > > > > > > >> > > > > > > > >
> > > > >> > > > > > > > > > > > > > >> > > > > > > > > - Romain
> > > > >> > > > > > > > > > > > > > >> > > > > > > > >
> > > > >> > > > > > > > > > > > > > >> > > > > > > > >
> > > > >> > > > > > > > > > > > > > >> > > > > > > > > 2012/6/1 José Luis
> > > Cetina <
> > > > >> > > > > > > > > maxtorzito@gmail.com
> > > > >> > > > > > > > > > >
> > > > >> > > > > > > > > > > > > > >> > > > > > > > >
> > > > >> > > > > > > > > > > > > > >> > > > > > > > > > OK, i can create a
> > > > sample,
> > > > >> > but i
> > > > >> > > > use
> > > > >> > > > > > > > > > > > > DataSourceRealm,
> > > > >> > > > > > > > > > > > > > >> are
> > > > >> > > > > > > > > > > > > > >> > you
> > > > >> > > > > > > > > > > > > > >> > > > > gonna
> > > > >> > > > > > > > > > > > > > >> > > > > > > > > > configure your
> > > database?
> > > > >> > > > > > > > > > > > > > >> > > > > > > > > >
> > > > >> > > > > > > > > > > > > > >> > > > > > > > > > 2012/5/31 Romain
> > > > >> Manni-Bucau <
> > > > >> > > > > > > > > > > > rmannibucau@gmail.com
> > > > >> > > > > > > > > > > > > >
> > > > >> > > > > > > > > > > > > > >> > > > > > > > > >
> > > > >> > > > > > > > > > > > > > >> > > > > > > > > > > can you have a
> try
> > in
> > > > an
> > > > >> EJB
> > > > >> > > > > please?
> > > > >> > > > > > > > (just
> > > > >> > > > > > > > > > try
> > > > >> > > > > > > > > > > > to
> > > > >> > > > > > > > > > > > > > add
> > > > >> > > > > > > > > > > > > > >> > > > > @Stateless
> > > > >> > > > > > > > > > > > > > >> > > > > > on
> > > > >> > > > > > > > > > > > > > >> > > > > > > > > your
> > > > >> > > > > > > > > > > > > > >> > > > > > > > > > > managed bean for
> > > > >> instance)
> > > > >> > > > > > > > > > > > > > >> > > > > > > > > > >
> > > > >> > > > > > > > > > > > > > >> > > > > > > > > > > can you share a
> > > sample
> > > > >> easy
> > > > >> > to
> > > > >> > > > > run?
> > > > >> > > > > > > > > > > > > > >> > > > > > > > > > >
> > > > >> > > > > > > > > > > > > > >> > > > > > > > > > > - Romain
> > > > >> > > > > > > > > > > > > > >> > > > > > > > > > >
> > > > >> > > > > > > > > > > > > > >> > > > > > > > > > >
> > > > >> > > > > > > > > > > > > > >> > > > > > > > > > > 2012/6/1 José
> Luis
> > > > >> Cetina <
> > > > >> > > > > > > > > > > maxtorzito@gmail.com
> > > > >> > > > > > > > > > > > >
> > > > >> > > > > > > > > > > > > > >> > > > > > > > > > >
> > > > >> > > > > > > > > > > > > > >> > > > > > > > > > > > Yes, im using
> > JAAS
> > > > >> > > > > > > > > > > > > > >> > > > > > > > > > > >
> > > > >> > > > > > > > > > > > > > >> > > > > > > > > > > > 2012/5/31
> Romain
> > > > >> > > Manni-Bucau <
> > > > >> > > > > > > > > > > > > > rmannibucau@gmail.com
> > > > >> > > > > > > > > > > > > > >> >
> > > > >> > > > > > > > > > > > > > >> > > > > > > > > > > >
> > > > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > Hi,
> > > > >> > > > > > > > > > > > > > >> > > > > > > > > > > > >
> > > > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > Do you use
> > jaas?
> > > > >> > > > > > > > > > > > > > >> > > > > > > > > > > > >
> > > > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > - Romain
> > > > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > Le 31 mai
> 2012
> > > > 20:14,
> > > > >> > > "José
> > > > >> > > > > Luis
> > > > >> > > > > > > > > > Cetina" <
> > > > >> > > > > > > > > > > > > > >> > > > > > maxtorzito@gmail.com
> > > > >> > > > > > > > > > > > > > >> > > > > > > >
> > > > >> > > > > > > > > > > > > > >> > > > > > > > a
> > > > >> > > > > > > > > > > > > > >> > > > > > > > > > > écrit
> > > > >> > > > > > > > > > > > > > >> > > > > > > > > > > > :
> > > > >> > > > > > > > > > > > > > >> > > > > > > > > > > > >
> > > > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > > Hi i have
> > this
> > > > >> > scenario:
> > > > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > >
> > > > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > > I have a
> page
> > > > >> > > login.xhtml,
> > > > >> > > > > > this
> > > > >> > > > > > > > page
> > > > >> > > > > > > > > > > has a
> > > > >> > > > > > > > > > > > > > >> > > ManagedBean
> > > > >> > > > > > > > > > > > > > >> > > > > > > (@Named)
> > > > >> > > > > > > > > > > > > > >> > > > > > > > > > this
> > > > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > > managedbean
> > use
> > > > the
> > > > >> > > > > > > > > > > > request.login(user,pass)
> > > > >> > > > > > > > > > > > > > >> > method.
> > > > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > >
> > > > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > > When i do
> > this:
> > > > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > >
> > > > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > > managedbean
> > > > class:
> > > > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > >
> > > > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > > @Resource
> > > > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > > private
> > > > EJBContext
> > > > >> > > > > ejbContext;
> > > > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > > .
> > > > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > > .
> > > > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > >
> > > > >> > > request.login(user,pass);
> > > > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > > String
> name =
> > > > >> > > > > > > > > > > > > > >> > > >
> > > > >> ejbContext.getCallerPrincipal().getName();
> > > > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > >
> > > > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > > I get
> "guest"
> > > as
> > > > my
> > > > >> > user
> > > > >> > > > > name.
> > > > >> > > > > > > > But i
> > > > >> > > > > > > > > > > > expect
> > > > >> > > > > > > > > > > > > > the
> > > > >> > > > > > > > > > > > > > >> > name
> > > > >> > > > > > > > > > > > > > >> > > of
> > > > >> > > > > > > > > > > > > > >> > > > > my
> > > > >> > > > > > > > > > > > > > >> > > > > > > user
> > > > >> > > > > > > > > > > > > > >> > > > > > > > > (of
> > > > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > course
> > > > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > > is not
> guest)
> > > > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > >
> > > > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > > If the
> login
> > > was
> > > > >> > > > successful
> > > > >> > > > > my
> > > > >> > > > > > > > login
> > > > >> > > > > > > > > > > page
> > > > >> > > > > > > > > > > > > > >> navigate
> > > > >> > > > > > > > > > > > > > >> > to
> > > > >> > > > > > > > > > > > > > >> > > > > other
> > > > >> > > > > > > > > > > > > > >> > > > > > > > page
> > > > >> > > > > > > > > > > > > > >> > > > > > > > > > lets
> > > > >> > > > > > > > > > > > > > >> > > > > > > > > > > > say
> > > > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > > pageb.xhtml
> > > > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > >
> > > > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > > If i
> create a
> > > > >> > > managedbean
> > > > >> > > > > > > (@Named)
> > > > >> > > > > > > > > for
> > > > >> > > > > > > > > > > > > > >> pageb.xhtml
> > > > >> > > > > > > > > > > > > > >> > > and
> > > > >> > > > > > > > > > > > > > >> > > > in
> > > > >> > > > > > > > > > > > > > >> > > > > > > that
> > > > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > managedbean
> > > > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > > i use
> again:
> > > > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > > String
> name =
> > > > >> > > > > > > > > > > > > > >> > > >
> > > > >> ejbContext.getCallerPrincipal().getName();
> > > > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > > then, here
> i
> > > get
> > > > my
> > > > >> > > > > "correct"
> > > > >> > > > > > > name
> > > > >> > > > > > > > > of
> > > > >> > > > > > > > > > > the
> > > > >> > > > > > > > > > > > > user
> > > > >> > > > > > > > > > > > > > >> (not
> > > > >> > > > > > > > > > > > > > >> > > > > guest).
> > > > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > >
> > > > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > > I dont know
> > if
> > > > >> this is
> > > > >> > > the
> > > > >> > > > > > > desire
> > > > >> > > > > > > > > > > > behaviour
> > > > >> > > > > > > > > > > > > or
> > > > >> > > > > > > > > > > > > > >> if
> > > > >> > > > > > > > > > > > > > >> > > this
> > > > >> > > > > > > > > > > > > > >> > > > > > > happend
> > > > >> > > > > > > > > > > > > > >> > > > > > > > > > > because
> > > > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > the
> > > > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > > http
> request
> > > isnt
> > > > >> > > > finished?
> > > > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > >
> > > > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > > other
> > question
> > > > why
> > > > >> if
> > > > >> > i
> > > > >> > > > call
> > > > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > > the
> > > > >> > > > > > > > > > > > > >
> >  ejbContext.getCallerPrincipal().getName();
> > > > >> > > > > > > > > > > > > > >> > > before
> > > > >> > > > > > > > > > > > > > >> > > > > the
> > > > >> > > > > > > > > > > > > > >> > > > > > > > > > > > >
> request.login()
> > > > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > > method i
> get
> > > > again
> > > > >> > > > "guest",
> > > > >> > > > > > why
> > > > >> > > > > > > > not
> > > > >> > > > > > > > > > > null?
> > > > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > >
> > > > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > > If this
> > > question
> > > > is
> > > > >> > for
> > > > >> > > > > > > > > tomee(openejb)
> > > > >> > > > > > > > > > > or
> > > > >> > > > > > > > > > > > > > >> tomcat?
> > > > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > >
> > > > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > > Thanks
> > > > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > >
> > > > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > >
> > > > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > >
> > > > >> > > > > > > > > > > > > > >> > > > > > > > >
> > > > >> > > > > > > > > > > > > > >> > > >
> > > > >> > > > > > > > > > > > > >
> > > > >> > > > > > > > >
> > > > >> > > >
> > > > -------------------------------------------------------------------
> > > > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > > *SCJA. José
> > > Luis
> > > > >> > Cetina*
> > > > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > >
> > > > >> > > > > > > > > > > > > > >> > > > > > > > >
> > > > >> > > > > > > > > > > > > > >> > > >
> > > > >> > > > > > > > > > > > > >
> > > > >> > > > > > > > >
> > > > >> > > >
> > > > -------------------------------------------------------------------
> > > > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > >
> > > > >> > > > > > > > > > > > > > >> > > > > > > > > > > > >
> > > > >> > > > > > > > > > > > > > >> > > > > > > > > > > >
> > > > >> > > > > > > > > > > > > > >> > > > > > > > > > > >
> > > > >> > > > > > > > > > > > > > >> > > > > > > > > > > >
> > > > >> > > > > > > > > > > > > > >> > > > > > > > > > > > --
> > > > >> > > > > > > > > > > > > > >> > > > > > > > > > > >
> > > > >> > > > > > > > > > > > > > >> > > > > > >
> > > > >> > > > > > > > > > > > > > >> >
> > > > >> > > > > > > > > > > >
> > > > >> > > > > > >
> > > > >> >
> > -------------------------------------------------------------------
> > > > >> > > > > > > > > > > > > > >> > > > > > > > > > > > *SCJA. José
> Luis
> > > > >> Cetina*
> > > > >> > > > > > > > > > > > > > >> > > > > > > > > > > >
> > > > >> > > > > > > > > > > > > > >> > > > > > >
> > > > >> > > > > > > > > > > > > > >> >
> > > > >> > > > > > > > > > > >
> > > > >> > > > > > >
> > > > >> >
> > -------------------------------------------------------------------
> > > > >> > > > > > > > > > > > > > >> > > > > > > > > > > >
> > > > >> > > > > > > > > > > > > > >> > > > > > > > > > >
> > > > >> > > > > > > > > > > > > > >> > > > > > > > > >
> > > > >> > > > > > > > > > > > > > >> > > > > > > > > >
> > > > >> > > > > > > > > > > > > > >> > > > > > > > > >
> > > > >> > > > > > > > > > > > > > >> > > > > > > > > > --
> > > > >> > > > > > > > > > > > > > >> > > > > > > > > >
> > > > >> > > > > > > > > > > > > > >> > > > >
> > > > >> > > > > > > > > > > > > > >>
> > > > >> > > > > > > > > > >
> > > > >> > > > > >
> > > > >>
> -------------------------------------------------------------------
> > > > >> > > > > > > > > > > > > > >> > > > > > > > > > *SCJA. José Luis
> > > Cetina*
> > > > >> > > > > > > > > > > > > > >> > > > > > > > > >
> > > > >> > > > > > > > > > > > > > >> > > > >
> > > > >> > > > > > > > > > > > > > >>
> > > > >> > > > > > > > > > >
> > > > >> > > > > >
> > > > >>
> -------------------------------------------------------------------
> > > > >> > > > > > > > > > > > > > >> > > > > > > > > >
> > > > >> > > > > > > > > > > > > > >> > > > > > > > >
> > > > >> > > > > > > > > > > > > > >> > > > > > > >
> > > > >> > > > > > > > > > > > > > >> > > > > > > >
> > > > >> > > > > > > > > > > > > > >> > > > > > > >
> > > > >> > > > > > > > > > > > > > >> > > > > > > > --
> > > > >> > > > > > > > > > > > > > >> > > > > > > >
> > > > >> > > > > > > > > > > > > > >> > >
> > > > >> > > > > > > > > > > > >
> > > > >> > > > > > > >
> > > > >> > >
> > > -------------------------------------------------------------------
> > > > >> > > > > > > > > > > > > > >> > > > > > > > *SCJA. José Luis
> Cetina*
> > > > >> > > > > > > > > > > > > > >> > > > > > > >
> > > > >> > > > > > > > > > > > > > >> > >
> > > > >> > > > > > > > > > > > >
> > > > >> > > > > > > >
> > > > >> > >
> > > -------------------------------------------------------------------
> > > > >> > > > > > > > > > > > > > >> > > > > > > >
> > > > >> > > > > > > > > > > > > > >> > > > > > >
> > > > >> > > > > > > > > > > > > > >> > > > > >
> > > > >> > > > > > > > > > > > > > >> > > > > >
> > > > >> > > > > > > > > > > > > > >> > > > > >
> > > > >> > > > > > > > > > > > > > >> > > > > > --
> > > > >> > > > > > > > > > > > > > >> > > > > >
> > > > >> > > > > > > > > > > > > > >>
> > > > >> > > > > > > > > > >
> > > > >> > > > > >
> > > > >>
> -------------------------------------------------------------------
> > > > >> > > > > > > > > > > > > > >> > > > > > *SCJA. José Luis Cetina*
> > > > >> > > > > > > > > > > > > > >> > > > > >
> > > > >> > > > > > > > > > > > > > >>
> > > > >> > > > > > > > > > >
> > > > >> > > > > >
> > > > >>
> -------------------------------------------------------------------
> > > > >> > > > > > > > > > > > > > >> > > > > >
> > > > >> > > > > > > > > > > > > > >> > > > >
> > > > >> > > > > > > > > > > > > > >> > > >
> > > > >> > > > > > > > > > > > > > >> > > >
> > > > >> > > > > > > > > > > > > > >> > > >
> > > > >> > > > > > > > > > > > > > >> > > > --
> > > > >> > > > > > > > > > > > > > >> > > >
> > > > >> > > > > > > > > > > > > >
> > > > >> > > > > > > > >
> > > > >> > > >
> > > > -------------------------------------------------------------------
> > > > >> > > > > > > > > > > > > > >> > > > *SCJA. José Luis Cetina*
> > > > >> > > > > > > > > > > > > > >> > > >
> > > > >> > > > > > > > > > > > > >
> > > > >> > > > > > > > >
> > > > >> > > >
> > > > -------------------------------------------------------------------
> > > > >> > > > > > > > > > > > > > >> > > >
> > > > >> > > > > > > > > > > > > > >> > >
> > > > >> > > > > > > > > > > > > > >> >
> > > > >> > > > > > > > > > > > > > >> >
> > > > >> > > > > > > > > > > > > > >> >
> > > > >> > > > > > > > > > > > > > >> > --
> > > > >> > > > > > > > > > > > > > >> >
> > > > >> > > > > > > > > > > >
> > > > >> > > > > > >
> > > > >> >
> > -------------------------------------------------------------------
> > > > >> > > > > > > > > > > > > > >> > *SCJA. José Luis Cetina*
> > > > >> > > > > > > > > > > > > > >> >
> > > > >> > > > > > > > > > > >
> > > > >> > > > > > >
> > > > >> >
> > -------------------------------------------------------------------
> > > > >> > > > > > > > > > > > > > >> >
> > > > >> > > > > > > > > > > > > > >>
> > > > >> > > > > > > > > > > > > > >
> > > > >> > > > > > > > > > > > > > >
> > > > >> > > > > > > > > > > > > > >
> > > > >> > > > > > > > > > > > > > > --
> > > > >> > > > > > > > > > > > > > >
> > > > >> > > > > > > > > >
> > > > >> > > > >
> > > > >>
> -------------------------------------------------------------------
> > > > >> > > > > > > > > > > > > > > *SCJA. José Luis Cetina*
> > > > >> > > > > > > > > > > > > > >
> > > > >> > > > > > > > > >
> > > > >> > > > >
> > > > >>
> -------------------------------------------------------------------
> > > > >> > > > > > > > > > > > > > >
> > > > >> > > > > > > > > > > > > > >
> > > > >> > > > > > > > > > > > > >
> > > > >> > > > > > > > > > > > > >
> > > > >> > > > > > > > > > > > > > --
> > > > >> > > > > > > > > > > > > >
> > > > >> > > > > > > > >
> > > > >> > > >
> > > > -------------------------------------------------------------------
> > > > >> > > > > > > > > > > > > > *SCJA. José Luis Cetina*
> > > > >> > > > > > > > > > > > > >
> > > > >> > > > > > > > >
> > > > >> > > >
> > > > -------------------------------------------------------------------
> > > > >> > > > > > > > > > > > > >
> > > > >> > > > > > > > > > > > >
> > > > >> > > > > > > > > > > >
> > > > >> > > > > > > > > > > >
> > > > >> > > > > > > > > > > >
> > > > >> > > > > > > > > > > > --
> > > > >> > > > > > > > > > > >
> > > > >> > > > > > >
> > > > >> >
> > -------------------------------------------------------------------
> > > > >> > > > > > > > > > > > *SCJA. José Luis Cetina*
> > > > >> > > > > > > > > > > >
> > > > >> > > > > > >
> > > > >> >
> > -------------------------------------------------------------------
> > > > >> > > > > > > > > > > >
> > > > >> > > > > > > > > > >
> > > > >> > > > > > > > > >
> > > > >> > > > > > > > > >
> > > > >> > > > > > > > > >
> > > > >> > > > > > > > > > --
> > > > >> > > > > > > > > >
> > > > >> > > > >
> > > > >>
> -------------------------------------------------------------------
> > > > >> > > > > > > > > > *SCJA. José Luis Cetina*
> > > > >> > > > > > > > > >
> > > > >> > > > >
> > > > >>
> -------------------------------------------------------------------
> > > > >> > > > > > > > > >
> > > > >> > > > > > > > >
> > > > >> > > > > > > >
> > > > >> > > > > > > >
> > > > >> > > > > > > >
> > > > >> > > > > > > > --
> > > > >> > > > > > > >
> > > > >> > >
> > > -------------------------------------------------------------------
> > > > >> > > > > > > > *SCJA. José Luis Cetina*
> > > > >> > > > > > > >
> > > > >> > >
> > > -------------------------------------------------------------------
> > > > >> > > > > > > >
> > > > >> > > > > > >
> > > > >> > > > > >
> > > > >> > > > > >
> > > > >> > > > > >
> > > > >> > > > > > --
> > > > >> > > > > >
> > > > >>
> -------------------------------------------------------------------
> > > > >> > > > > > *SCJA. José Luis Cetina*
> > > > >> > > > > >
> > > > >>
> -------------------------------------------------------------------
> > > > >> > > > > >
> > > > >> > > > >
> > > > >> > > >
> > > > >> > > >
> > > > >> > > >
> > > > >> > > > --
> > > > >> > > >
> > > > -------------------------------------------------------------------
> > > > >> > > > *SCJA. José Luis Cetina*
> > > > >> > > >
> > > > -------------------------------------------------------------------
> > > > >> > > >
> > > > >> > >
> > > > >> >
> > > > >> >
> > > > >> >
> > > > >> > --
> > > > >> >
> > -------------------------------------------------------------------
> > > > >> > *SCJA. José Luis Cetina*
> > > > >> >
> > -------------------------------------------------------------------
> > > > >> >
> > > > >>
> > > > >
> > > > >
> > > > >
> > > > > --
> > > > > -------------------------------------------------------------------
> > > > > *SCJA. José Luis Cetina*
> > > > > -------------------------------------------------------------------
> > > > >
> > > > >
> > > >
> > > >
> > > > --
> > > > -------------------------------------------------------------------
> > > > *SCJA. José Luis Cetina*
> > > > -------------------------------------------------------------------
> > > >
> > >
> >
>



-- 
-------------------------------------------------------------------
*SCJA. José Luis Cetina*
-------------------------------------------------------------------

Re: Guest user

Posted by Romain Manni-Bucau <rm...@gmail.com>.
that's because in your authenticator you have the attribute
"changeSessionIdOnAuthentication" set to true.

- Romain


2012/6/15 José Luis Cetina <ma...@gmail.com>

> Hi Romain, let me tell you, the problem only occurs when you use login
> method and try to set something in the session bean just after the next
> line of request.login, if I comment the login method, then it works ok,
> please give a try with a simple test with login method and you will see the
> problem, I tested many times
>  El 15/06/2012 04:40, "Romain Manni-Bucau" <rm...@gmail.com>
> escribió:
>
> > Hi,
> >
> > i didnt test with the login but it seems it works
> >
> > but please add @RequestScoped to MyNextPageMBean or don't use
> > postconstrutct otherwise you have a kind of cache effect depending on the
> > moment when the bean is created.
> >
> > here a sample:
> >
> >
> http://svn.apache.org/repos/asf/openejb/trunk/openejb/examples/cdi-session-scope/
> >
> > - Romain
> >
> >
> > 2012/6/15 José Luis Cetina <ma...@gmail.com>
> >
> > > Hi Romain, well i have an other problem and i think is related to this
> > same
> > > reported issue.
> > >
> > > We talked about if i login using request.login(user,pass) method and if
> > the
> > > credentials and login was successfull then when i get the user i get a
> > > guess user:
> > >
> > > request.login(user,pass);
> > > String name = ejbContext.getCallerPrincipal().getName();
> > >
> > > Ok, then this was fixed, and its ok now, now returns the valid user.
> > >
> > > But now if i do this
> > >
> > > @Inject
> > > private MySessionBean mySessionBean;
> > >
> > > public String login(){
> > >   request.login(user,pass);
> > >   mySessionBean.setName("My name is JOE");
> > >   //then i do a redirect here
> > >  return "next_page";
> > > }
> > >
> > > now in my managedbean of my next_page.xhtml i had:
> > >
> > > @Named
> > > public MyNextPageMBean implements Serializable{
> > >
> > > @Inject
> > > private MySessionBean mySessionBean;
> > >
> > >  @PostConstruc
> > >  public void test(){
> > >    mySessionBean.getName(); <---HERE I GET NULL ALWAYS
> > >   }
> > >
> > > }
> > >
> > >
> > > SessionBean:
> > >
> > > import java.io.Serializable;
> > > import javax.enterprise.context.SessionScoped;
> > > import javax.inject.Named;
> > >
> > > @Named
> > > @SessionScoped
> > > public class MySessionBean implements Serializable{
> > >
> > >    private String name;
> > >
> > >    public MySessionBean() {
> > >
> > >    }
> > >
> > >    public String getName() {
> > >        return name;
> > >    }
> > >
> > >    public void setName(String name) {
> > >        this.name = name;
> > >    }
> > > }
> > >
> > >
> > >
> > > As you can see i get null, mi login its ok, but when i saved something
> in
> > > my sessionbean when i try to retrive what i saved before, i always get
> > > null, like if i never set the value (and of course i did it) but this
> > ONLY
> > > HAPPEND when i try to set the any value just before request.login, if i
> > set
> > > the value in the second bean  like
> > >
> > > mySessionBean.setName("My name is JOE"); then in other's page i can get
> > the
> > > value without any problem, i do a lot of test and the problem is when i
> > > only set the values (in my session bean) just before request.login,
> then
> > i
> > > associated this with the "guest user problem" as you sayed this was
> > > happening because the user was "recognized" only after the first
> request.
> > >
> > > Again, is this the expected behaviour? it seem buggy
> > >
> > > Im using:  apache-tomee-1.1.0-20120612.040829-22-webprofile
> > >
> > >
> > > 2012/6/1 José Luis Cetina <ma...@gmail.com>
> > >
> > > > ok
> > > >
> > > >
> > > > 2012/6/1 Romain Manni-Bucau <rm...@gmail.com>
> > > >
> > > >> deployment in progress:
> > > >> http://ci.apache.org/builders/openejb-trunk-deploy/builds/378
> > > >>
> > > >> - Romain
> > > >>
> > > >>
> > > >> 2012/6/1 José Luis Cetina <ma...@gmail.com>
> > > >>
> > > >> > Ok, in what tomee build this will be available?
> > > >> >
> > > >> > 2012/5/31 Romain Manni-Bucau <rm...@gmail.com>
> > > >> >
> > > >> > > yep
> > > >> > >
> > > >> > > just commited, a new commit will come where this class will
> > > >> automatically
> > > >> > > be added normally
> > > >> > >
> > > >> > > - Romain
> > > >> > >
> > > >> > >
> > > >> > > 2012/6/1 José Luis Cetina <ma...@gmail.com>
> > > >> > >
> > > >> > > > im getting a ClassNotFound
> > > >> > > >
> > > >> > > > Caused by: java.lang.ClassNotFoundException:
> > > >> > > > org.apache.tomee.catalina.TomEERealm
> > > >> > > >
> > > >> > > > 2012/5/31 Romain Manni-Bucau <rm...@gmail.com>
> > > >> > > >
> > > >> > > > > my sample is working, too late to add test but manually it
> > works
> > > >> > > > >
> > > >> > > > > so i guess it should work for you
> > > >> > > > >
> > > >> > > > > the question now is should we add it automatically?
> > > >> > > > >
> > > >> > > > > - Romain
> > > >> > > > >
> > > >> > > > >
> > > >> > > > > 2012/6/1 José Luis Cetina <ma...@gmail.com>
> > > >> > > > >
> > > >> > > > > > Oooh great, with this i can get the principal user in the
> > > first
> > > >> > > > request?
> > > >> > > > > or
> > > >> > > > > > this is something that you gonna fix?
> > > >> > > > > >
> > > >> > > > > > 2012/5/31 Romain Manni-Bucau <rm...@gmail.com>
> > > >> > > > > >
> > > >> > > > > > > that's brand new ;)
> > > >> > > > > > >
> > > >> > > > > > > just added it, it mainly delegate to the real realm but
> > add
> > > >> the
> > > >> > > > > principal
> > > >> > > > > > > info to openejb/tomee security service which is used in
> > > >> > ejbcontext
> > > >> > > > impl
> > > >> > > > > > (to
> > > >> > > > > > > make it short)
> > > >> > > > > > >
> > > >> > > > > > > - Romain
> > > >> > > > > > >
> > > >> > > > > > >
> > > >> > > > > > > 2012/6/1 José Luis Cetina <ma...@gmail.com>
> > > >> > > > > > >
> > > >> > > > > > > > I have this in my context.xml
> > > >> > > > > > > >
> > > >> > > > > > > > <Realm className="MyExtendedDataSourceRealm"
> > > >> > > > > > > >  dataSourceName="MyDataSource"
> > > >> > > > > > > > digest="SHA-256"
> > > >> > > > > > > > encodePassword="Base64"
> > > >> > > > > > > > queryRealmRolesUser="SELECT rol FROM xxxx WHERE
> user=?"
> > > >> > > > > > > > queryRealmUsers="SELECT pass FROM xxx WHERE user=?"/>
> > > >> > > > > > > >
> > > >> > > > > > > > As you can see i extend the datasource realm, i have
> > this
> > > >> realm
> > > >> > > > > config
> > > >> > > > > > in
> > > >> > > > > > > > the context.xml in my webapp (not context.xml TomEE).
> > > >> > > > > > > >
> > > >> > > > > > > > But, as i can see in your example, you surround your
> > realm
> > > >> with
> > > >> > > > > > > TomEERealm,
> > > >> > > > > > > > if this necessary?. I didn't know this
> > > >> > > > > > > >
> > > >> > > > > > > >
> > > >> > > > > > > >
> > > >> > > > > > > > 2012/5/31 Romain Manni-Bucau <rm...@gmail.com>
> > > >> > > > > > > >
> > > >> > > > > > > > > in my test i used:
> > > >> > > > > > > > >
> > > >> > > > > > > > >    <Realm
> > > >> className="org.apache.tomee.catalina.TomEERealm">
> > > >> > > > > > > > >        <Realm
> > > >> className="org.apache.catalina.realm.JAASRealm"
> > > >> > > > > > > > > appName="PropertiesLoginModule"
> > > >> > > > > > > > >
> > > >> > > > > > > > >
> > > >> > > > > > > > >
> > > >> > > > > > > >
> > > >> > > > > > >
> > > >> > > > > >
> > > >> > > > >
> > > >> > > >
> > > >> > >
> > > >> >
> > > >>
> > >
> >
>  userClassNames="org.apache.openejb.core.security.AbstractSecurityService$User"
> > > >> > > > > > > > >
> > > >> > > > > > > > >
> > > >> > > > > > > > >
> > > >> > > > > > > >
> > > >> > > > > > >
> > > >> > > > > >
> > > >> > > > >
> > > >> > > >
> > > >> > >
> > > >> >
> > > >>
> > >
> >
>  roleClassNames="org.apache.openejb.core.security.AbstractSecurityService$Group">
> > > >> > > > > > > > >        </Realm>
> > > >> > > > > > > > >       </Realm>
> > > >> > > > > > > > >
> > > >> > > > > > > > > but i guess you can replace the jaasrealm by your
> > > dsrealm
> > > >> > > > > > > > >
> > > >> > > > > > > > > - Romain
> > > >> > > > > > > > >
> > > >> > > > > > > > >
> > > >> > > > > > > > > 2012/6/1 José Luis Cetina <ma...@gmail.com>
> > > >> > > > > > > > >
> > > >> > > > > > > > > > Yes, it seems buggy.
> > > >> > > > > > > > > >
> > > >> > > > > > > > > > Where i have to replace?
> > > >> > > > > > > > > >
> > > >> > > > > > > > > > Remember im using DataSourceRealm
> > > >> > > > > > > > > >
> > > >> > > > > > > > > > 2012/5/31 Romain Manni-Bucau <
> rmannibucau@gmail.com
> > >
> > > >> > > > > > > > > >
> > > >> > > > > > > > > > > this is the current status,
> > > >> > > > > > > > > > >
> > > >> > > > > > > > > > > but IMO it is buggy,
> > > >> > > > > > > > > > >
> > > >> > > > > > > > > > > i'll commit soon a TomEEJAASRealm to make it
> > working
> > > >> > > (replace
> > > >> > > > > > > > JAASRealm
> > > >> > > > > > > > > > in
> > > >> > > > > > > > > > > the conf)
> > > >> > > > > > > > > > >
> > > >> > > > > > > > > > > - Romain
> > > >> > > > > > > > > > >
> > > >> > > > > > > > > > >
> > > >> > > > > > > > > > > 2012/6/1 José Luis Cetina <maxtorzito@gmail.com
> >
> > > >> > > > > > > > > > >
> > > >> > > > > > > > > > > > i think we are getting confused.
> > > >> > > > > > > > > > > >
> > > >> > > > > > > > > > > > If i resume all, this what i asked (the final
> of
> > > the
> > > >> > > first
> > > >> > > > > > post)
> > > >> > > > > > > > > > > >
> > > >> > > > > > > > > > > > I dont know if this is the desire behavior or
> if
> > > >> this
> > > >> > > > happend
> > > >> > > > > > > > becase
> > > >> > > > > > > > > > the
> > > >> > > > > > > > > > > > httr request isnt finished?
> > > >> > > > > > > > > > > > Then you answer me:
> > > >> > > > > > > > > > > >
> > > >> > > > > > > > > > > > in fact info from ejbcontext are taken in our
> > > >> > > > securitymodule
> > > >> > > > > > > > > > > >
> > > >> > > > > > > > > > > > in tomee we set/unset it from a valve so at
> the
> > > >> > > > beginning/end
> > > >> > > > > > of
> > > >> > > > > > > > the
> > > >> > > > > > > > > > > > request...all between is currently ignored so
> > when
> > > >> you
> > > >> > > log
> > > >> > > > > you
> > > >> > > > > > > need
> > > >> > > > > > > > > > > another
> > > >> > > > > > > > > > > > request to get the updated information (from
> the
> > > >> tomcat
> > > >> > > > > realm)
> > > >> > > > > > > > > > > >
> > > >> > > > > > > > > > > > "so when you log you need another request to
> get
> > > the
> > > >> > > > updated
> > > >> > > > > > > > > > information
> > > >> > > > > > > > > > > > (from the tomcat realm)
> > > >> > > > > > > > > > > >
> > > >> > > > > > > > > > > > Then i get guest because is the desire
> > behaviour,
> > > >> after
> > > >> > > the
> > > >> > > > > > first
> > > >> > > > > > > > > > > request i
> > > >> > > > > > > > > > > > can get the user i expected.
> > > >> > > > > > > > > > > >
> > > >> > > > > > > > > > > > Then i resume, this is the default behaviour,
> > and
> > > >> works
> > > >> > > but
> > > >> > > > > you
> > > >> > > > > > > > need
> > > >> > > > > > > > > a
> > > >> > > > > > > > > > > > second request.
> > > >> > > > > > > > > > > >
> > > >> > > > > > > > > > > >
> > > >> > > > > > > > > > > >
> > > >> > > > > > > > > > > > 2012/5/31 Romain Manni-Bucau <
> > > rmannibucau@gmail.com
> > > >> >
> > > >> > > > > > > > > > > >
> > > >> > > > > > > > > > > > > i think it should work
> > > >> > > > > > > > > > > > >
> > > >> > > > > > > > > > > > > - Romain
> > > >> > > > > > > > > > > > >
> > > >> > > > > > > > > > > > >
> > > >> > > > > > > > > > > > > 2012/6/1 José Luis Cetina <
> > maxtorzito@gmail.com
> > > >
> > > >> > > > > > > > > > > > >
> > > >> > > > > > > > > > > > > > I mean this:
> > > >> > > > > > > > > > > > > >
> > > >> > > > > > > > > > > > > > I dont know if this is the desire
> behaviour
> > or
> > > >> if
> > > >> > > this
> > > >> > > > > > > happend
> > > >> > > > > > > > > > > because
> > > >> > > > > > > > > > > > > the
> > > >> > > > > > > > > > > > > > http request isnt finished?
> > > >> > > > > > > > > > > > > >
> > > >> > > > > > > > > > > > > >
> > > >> > > > > > > > > > > > > >
> > > >> > > > > > > > > > > > > > 2012/5/31 José Luis Cetina <
> > > >> maxtorzito@gmail.com>
> > > >> > > > > > > > > > > > > >
> > > >> > > > > > > > > > > > > > > Ok, the what i asked is correct??
> > > >> > > > > > > > > > > > > > >
> > > >> > > > > > > > > > > > > > > "I dont know if this is the desire
> > behaviour
> > > >> or
> > > >> > if
> > > >> > > > this
> > > >> > > > > > > > happend
> > > >> > > > > > > > > > > > because
> > > >> > > > > > > > > > > > > > > the http request isnt finished?"
> > > >> > > > > > > > > > > > > > >
> > > >> > > > > > > > > > > > > > > 2012/5/31 Romain Manni-Bucau <
> > > >> > > rmannibucau@gmail.com>
> > > >> > > > > > > > > > > > > > >
> > > >> > > > > > > > > > > > > > >> ok,
> > > >> > > > > > > > > > > > > > >>
> > > >> > > > > > > > > > > > > > >> in fact info from ejbcontext are taken
> in
> > > our
> > > >> > > > > > > securitymodule
> > > >> > > > > > > > > > > > > > >>
> > > >> > > > > > > > > > > > > > >> in tomee we set/unset it from a valve
> so
> > at
> > > >> the
> > > >> > > > > > > > beginning/end
> > > >> > > > > > > > > of
> > > >> > > > > > > > > > > the
> > > >> > > > > > > > > > > > > > >> request...all between is currently
> > ignored
> > > so
> > > >> > when
> > > >> > > > you
> > > >> > > > > > log
> > > >> > > > > > > > you
> > > >> > > > > > > > > > > need
> > > >> > > > > > > > > > > > > > >> another
> > > >> > > > > > > > > > > > > > >> request to get the updated information
> > > (from
> > > >> the
> > > >> > > > > tomcat
> > > >> > > > > > > > realm)
> > > >> > > > > > > > > > > > > > >>
> > > >> > > > > > > > > > > > > > >> - Romain
> > > >> > > > > > > > > > > > > > >>
> > > >> > > > > > > > > > > > > > >>
> > > >> > > > > > > > > > > > > > >> 2012/6/1 José Luis Cetina <
> > > >> maxtorzito@gmail.com
> > > >> > >
> > > >> > > > > > > > > > > > > > >>
> > > >> > > > > > > > > > > > > > >> > Yes, it work
> > > >> > > > > > > > > > > > > > >> >
> > > >> > > > > > > > > > > > > > >> > 1) Login (form login) using
> > > DataSourceRealm
> > > >> > > > > > > > > > > > > > >> >
> > > >> > > > > > > > > > > > > > >> >
> > > >> > > > > > > > > > > > > > >> > 2) Redirect to page2 from my
> > managedbean
> > > >> > > > > > > > > > > > > > >> >
> > > >> > > > > > > > > > > > > > >> > 2012/5/31 Romain Manni-Bucau <
> > > >> > > > rmannibucau@gmail.com
> > > >> > > > > >
> > > >> > > > > > > > > > > > > > >> >
> > > >> > > > > > > > > > > > > > >> > > so you mean using the flow i
> > described
> > > >> > before
> > > >> > > it
> > > >> > > > > > > works?
> > > >> > > > > > > > > > > (sorry,
> > > >> > > > > > > > > > > > > just
> > > >> > > > > > > > > > > > > > >> to
> > > >> > > > > > > > > > > > > > >> > be
> > > >> > > > > > > > > > > > > > >> > > sure to understand)
> > > >> > > > > > > > > > > > > > >> > >
> > > >> > > > > > > > > > > > > > >> > > - Romain
> > > >> > > > > > > > > > > > > > >> > >
> > > >> > > > > > > > > > > > > > >> > >
> > > >> > > > > > > > > > > > > > >> > > 2012/6/1 José Luis Cetina <
> > > >> > > maxtorzito@gmail.com
> > > >> > > > >
> > > >> > > > > > > > > > > > > > >> > >
> > > >> > > > > > > > > > > > > > >> > > > Hi i can login and i can navigate
> > > >> > (redirect)
> > > >> > > > to
> > > >> > > > > my
> > > >> > > > > > > > other
> > > >> > > > > > > > > > > page,
> > > >> > > > > > > > > > > > > > but i
> > > >> > > > > > > > > > > > > > >> > dont
> > > >> > > > > > > > > > > > > > >> > > > know why im getting guest user in
> > the
> > > >> > login
> > > >> > > > > mbean,
> > > >> > > > > > > > after
> > > >> > > > > > > > > > > that
> > > >> > > > > > > > > > > > in
> > > >> > > > > > > > > > > > > > >> other
> > > >> > > > > > > > > > > > > > >> > > > mbean  i get my "real" user.
> > > >> > > > > > > > > > > > > > >> > > >
> > > >> > > > > > > > > > > > > > >> > > >
> > > >> > > > > > > > > > > > > > >> > > > 2012/5/31 Romain Manni-Bucau <
> > > >> > > > > > rmannibucau@gmail.com
> > > >> > > > > > > >
> > > >> > > > > > > > > > > > > > >> > > >
> > > >> > > > > > > > > > > > > > >> > > > > maybe
> > > >> > > > > > > > > > > > > > >> > > > >
> > > >> > > > > > > > > > > > > > >> > > >
> > > >> > > > > > > > > > > > > > >> > >
> > > >> > > > > > > > > > > > > > >> >
> > > >> > > > > > > > > > > > > > >>
> > > >> > > > > > > > > > > > > >
> > > >> > > > > > > > > > > > >
> > > >> > > > > > > > > > > >
> > > >> > > > > > > > > > >
> > > >> > > > > > > > > >
> > > >> > > > > > > > >
> > > >> > > > > > > >
> > > >> > > > > > >
> > > >> > > > > >
> > > >> > > > >
> > > >> > > >
> > > >> > >
> > > >> >
> > > >>
> > >
> >
> http://rmannibucau.wordpress.com/2012/05/09/tomee-and-its-ssh-connector/but
> > > >> > > > > > > > > > > > > > >> > > > > it uses properties file, it
> just
> > > >> need a
> > > >> > > > custom
> > > >> > > > > > > login
> > > >> > > > > > > > > > > module
> > > >> > > > > > > > > > > > > > >> > > > implementation
> > > >> > > > > > > > > > > > > > >> > > > > to use a db.
> > > >> > > > > > > > > > > > > > >> > > > >
> > > >> > > > > > > > > > > > > > >> > > > > well,
> > > >> > > > > > > > > > > > > > >> > > > >
> > > >> > > > > > > > > > > > > > >> > > > > before can you test it please?
> > > >> > > > > > > > > > > > > > >> > > > > 1) login
> > > >> > > > > > > > > > > > > > >> > > > > 2) redirect to your page using
> > your
> > > >> bean
> > > >> > > > > > > > > > > > > > >> > > > >
> > > >> > > > > > > > > > > > > > >> > > > > - Romain
> > > >> > > > > > > > > > > > > > >> > > > >
> > > >> > > > > > > > > > > > > > >> > > > >
> > > >> > > > > > > > > > > > > > >> > > > > 2012/6/1 José Luis Cetina <
> > > >> > > > > maxtorzito@gmail.com
> > > >> > > > > > >
> > > >> > > > > > > > > > > > > > >> > > > >
> > > >> > > > > > > > > > > > > > >> > > > > > I have to read and know how
> to
> > > use
> > > >> > > this, i
> > > >> > > > > > > always
> > > >> > > > > > > > > use
> > > >> > > > > > > > > > > > > > >> DataSource or
> > > >> > > > > > > > > > > > > > >> > > > > > JDBCRealm. (with glassfish).
> > > >> > > > > > > > > > > > > > >> > > > > > im reading now, do you have
> > > >> something
> > > >> > > for
> > > >> > > > a
> > > >> > > > > > > > > > quickstart?
> > > >> > > > > > > > > > > > for
> > > >> > > > > > > > > > > > > > >> share
> > > >> > > > > > > > > > > > > > >> > me
> > > >> > > > > > > > > > > > > > >> > > > > >
> > > >> > > > > > > > > > > > > > >> > > > > > 2012/5/31 Romain Manni-Bucau
> <
> > > >> > > > > > > > rmannibucau@gmail.com
> > > >> > > > > > > > > >
> > > >> > > > > > > > > > > > > > >> > > > > >
> > > >> > > > > > > > > > > > > > >> > > > > > > having your password in a
> db
> > is
> > > >> not
> > > >> > an
> > > >> > > > > issue
> > > >> > > > > > > > but i
> > > >> > > > > > > > > > > think
> > > >> > > > > > > > > > > > > you
> > > >> > > > > > > > > > > > > > >> > should
> > > >> > > > > > > > > > > > > > >> > > > > > > use
> > > >> > > org.apache.catalina.realm.JAASRealm
> > > >> > > > > > > > > > > > > > >> > > > > > >
> > > >> > > > > > > > > > > > > > >> > > > > > > for instance:
> > > >> > > > > > > > > > > > > > >> > > > > > >
> > > >> > > > > > > > > > > > > > >> > > > > > >     <Realm
> > > >> > > > > > > > > > > >
> className="org.apache.catalina.realm.JAASRealm"
> > > >> > > > > > > > > > > > > > >> > > > > > > appName="MyDBLoginModule"
> > > >> > > > > > > > > > > > > > >> > > > > > >
> > > >> > > > > > > > > > > > > > >> > > > > > >
> > > >> > > > > > > > > > > > > > >> > > > > > >
> > > >> > > > > > > > > > > > > > >> > > > > >
> > > >> > > > > > > > > > > > > > >> > > > >
> > > >> > > > > > > > > > > > > > >> > > >
> > > >> > > > > > > > > > > > > > >> > >
> > > >> > > > > > > > > > > > > > >> >
> > > >> > > > > > > > > > > > > > >>
> > > >> > > > > > > > > > > > > >
> > > >> > > > > > > > > > > > >
> > > >> > > > > > > > > > > >
> > > >> > > > > > > > > > >
> > > >> > > > > > > > > >
> > > >> > > > > > > > >
> > > >> > > > > > > >
> > > >> > > > > > >
> > > >> > > > > >
> > > >> > > > >
> > > >> > > >
> > > >> > >
> > > >> >
> > > >>
> > >
> >
>  userClassNames="org.apache.openejb.core.security.AbstractSecurityService$User"
> > > >> > > > > > > > > > > > > > >> > > > > > >
> > > >> > > > > > > > > > > > > > >> > > > > > >
> > > >> > > > > > > > > > > > > > >> > > > > > >
> > > >> > > > > > > > > > > > > > >> > > > > >
> > > >> > > > > > > > > > > > > > >> > > > >
> > > >> > > > > > > > > > > > > > >> > > >
> > > >> > > > > > > > > > > > > > >> > >
> > > >> > > > > > > > > > > > > > >> >
> > > >> > > > > > > > > > > > > > >>
> > > >> > > > > > > > > > > > > >
> > > >> > > > > > > > > > > > >
> > > >> > > > > > > > > > > >
> > > >> > > > > > > > > > >
> > > >> > > > > > > > > >
> > > >> > > > > > > > >
> > > >> > > > > > > >
> > > >> > > > > > >
> > > >> > > > > >
> > > >> > > > >
> > > >> > > >
> > > >> > >
> > > >> >
> > > >>
> > >
> >
>  roleClassNames="org.apache.openejb.core.security.AbstractSecurityService$Group">
> > > >> > > > > > > > > > > > > > >> > > > > > >      </Realm>
> > > >> > > > > > > > > > > > > > >> > > > > > >
> > > >> > > > > > > > > > > > > > >> > > > > > > so simply implement a
> custom
> > > >> > > LoginModule
> > > >> > > > > > > instead
> > > >> > > > > > > > > of
> > > >> > > > > > > > > > a
> > > >> > > > > > > > > > > > > realm
> > > >> > > > > > > > > > > > > > >> > > > > > >
> > > >> > > > > > > > > > > > > > >> > > > > > > wdyt?
> > > >> > > > > > > > > > > > > > >> > > > > > >
> > > >> > > > > > > > > > > > > > >> > > > > > > - Romain
> > > >> > > > > > > > > > > > > > >> > > > > > >
> > > >> > > > > > > > > > > > > > >> > > > > > >
> > > >> > > > > > > > > > > > > > >> > > > > > > 2012/6/1 José Luis Cetina <
> > > >> > > > > > > maxtorzito@gmail.com
> > > >> > > > > > > > >
> > > >> > > > > > > > > > > > > > >> > > > > > >
> > > >> > > > > > > > > > > > > > >> > > > > > > > Sorry, i use
> > > DataSourceRealm, i
> > > >> > have
> > > >> > > > my
> > > >> > > > > > > > > > > > user/pass/roles
> > > >> > > > > > > > > > > > > in
> > > >> > > > > > > > > > > > > > >> the
> > > >> > > > > > > > > > > > > > >> > > DB.
> > > >> > > > > > > > > > > > > > >> > > > > > > >
> > > >> > > > > > > > > > > > > > >> > > > > > > >
> > > >> > > > > > > > > > > > > > >> > > > > > > >
> > > >> > > > > > > > > > > > > > >> > > > > > > > 2012/5/31 Romain
> > Manni-Bucau
> > > <
> > > >> > > > > > > > > > rmannibucau@gmail.com
> > > >> > > > > > > > > > > >
> > > >> > > > > > > > > > > > > > >> > > > > > > >
> > > >> > > > > > > > > > > > > > >> > > > > > > > > can't you do it with an
> > > >> embedded
> > > >> > > > one?
> > > >> > > > > > > > > > > > > > >> > > > > > > > >
> > > >> > > > > > > > > > > > > > >> > > > > > > > > well DataSourceRealm
> > > doesn't
> > > >> use
> > > >> > > > JAAS
> > > >> > > > > by
> > > >> > > > > > > > > > default i
> > > >> > > > > > > > > > > > > > think,
> > > >> > > > > > > > > > > > > > >> > maybe
> > > >> > > > > > > > > > > > > > >> > > > > > that's
> > > >> > > > > > > > > > > > > > >> > > > > > > > the
> > > >> > > > > > > > > > > > > > >> > > > > > > > > issue
> > > >> > > > > > > > > > > > > > >> > > > > > > > >
> > > >> > > > > > > > > > > > > > >> > > > > > > > > - Romain
> > > >> > > > > > > > > > > > > > >> > > > > > > > >
> > > >> > > > > > > > > > > > > > >> > > > > > > > >
> > > >> > > > > > > > > > > > > > >> > > > > > > > > 2012/6/1 José Luis
> > Cetina <
> > > >> > > > > > > > > maxtorzito@gmail.com
> > > >> > > > > > > > > > >
> > > >> > > > > > > > > > > > > > >> > > > > > > > >
> > > >> > > > > > > > > > > > > > >> > > > > > > > > > OK, i can create a
> > > sample,
> > > >> > but i
> > > >> > > > use
> > > >> > > > > > > > > > > > > DataSourceRealm,
> > > >> > > > > > > > > > > > > > >> are
> > > >> > > > > > > > > > > > > > >> > you
> > > >> > > > > > > > > > > > > > >> > > > > gonna
> > > >> > > > > > > > > > > > > > >> > > > > > > > > > configure your
> > database?
> > > >> > > > > > > > > > > > > > >> > > > > > > > > >
> > > >> > > > > > > > > > > > > > >> > > > > > > > > > 2012/5/31 Romain
> > > >> Manni-Bucau <
> > > >> > > > > > > > > > > > rmannibucau@gmail.com
> > > >> > > > > > > > > > > > > >
> > > >> > > > > > > > > > > > > > >> > > > > > > > > >
> > > >> > > > > > > > > > > > > > >> > > > > > > > > > > can you have a try
> in
> > > an
> > > >> EJB
> > > >> > > > > please?
> > > >> > > > > > > > (just
> > > >> > > > > > > > > > try
> > > >> > > > > > > > > > > > to
> > > >> > > > > > > > > > > > > > add
> > > >> > > > > > > > > > > > > > >> > > > > @Stateless
> > > >> > > > > > > > > > > > > > >> > > > > > on
> > > >> > > > > > > > > > > > > > >> > > > > > > > > your
> > > >> > > > > > > > > > > > > > >> > > > > > > > > > > managed bean for
> > > >> instance)
> > > >> > > > > > > > > > > > > > >> > > > > > > > > > >
> > > >> > > > > > > > > > > > > > >> > > > > > > > > > > can you share a
> > sample
> > > >> easy
> > > >> > to
> > > >> > > > > run?
> > > >> > > > > > > > > > > > > > >> > > > > > > > > > >
> > > >> > > > > > > > > > > > > > >> > > > > > > > > > > - Romain
> > > >> > > > > > > > > > > > > > >> > > > > > > > > > >
> > > >> > > > > > > > > > > > > > >> > > > > > > > > > >
> > > >> > > > > > > > > > > > > > >> > > > > > > > > > > 2012/6/1 José Luis
> > > >> Cetina <
> > > >> > > > > > > > > > > maxtorzito@gmail.com
> > > >> > > > > > > > > > > > >
> > > >> > > > > > > > > > > > > > >> > > > > > > > > > >
> > > >> > > > > > > > > > > > > > >> > > > > > > > > > > > Yes, im using
> JAAS
> > > >> > > > > > > > > > > > > > >> > > > > > > > > > > >
> > > >> > > > > > > > > > > > > > >> > > > > > > > > > > > 2012/5/31 Romain
> > > >> > > Manni-Bucau <
> > > >> > > > > > > > > > > > > > rmannibucau@gmail.com
> > > >> > > > > > > > > > > > > > >> >
> > > >> > > > > > > > > > > > > > >> > > > > > > > > > > >
> > > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > Hi,
> > > >> > > > > > > > > > > > > > >> > > > > > > > > > > > >
> > > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > Do you use
> jaas?
> > > >> > > > > > > > > > > > > > >> > > > > > > > > > > > >
> > > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > - Romain
> > > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > Le 31 mai 2012
> > > 20:14,
> > > >> > > "José
> > > >> > > > > Luis
> > > >> > > > > > > > > > Cetina" <
> > > >> > > > > > > > > > > > > > >> > > > > > maxtorzito@gmail.com
> > > >> > > > > > > > > > > > > > >> > > > > > > >
> > > >> > > > > > > > > > > > > > >> > > > > > > > a
> > > >> > > > > > > > > > > > > > >> > > > > > > > > > > écrit
> > > >> > > > > > > > > > > > > > >> > > > > > > > > > > > :
> > > >> > > > > > > > > > > > > > >> > > > > > > > > > > > >
> > > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > > Hi i have
> this
> > > >> > scenario:
> > > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > >
> > > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > > I have a page
> > > >> > > login.xhtml,
> > > >> > > > > > this
> > > >> > > > > > > > page
> > > >> > > > > > > > > > > has a
> > > >> > > > > > > > > > > > > > >> > > ManagedBean
> > > >> > > > > > > > > > > > > > >> > > > > > > (@Named)
> > > >> > > > > > > > > > > > > > >> > > > > > > > > > this
> > > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > > managedbean
> use
> > > the
> > > >> > > > > > > > > > > > request.login(user,pass)
> > > >> > > > > > > > > > > > > > >> > method.
> > > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > >
> > > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > > When i do
> this:
> > > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > >
> > > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > > managedbean
> > > class:
> > > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > >
> > > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > > @Resource
> > > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > > private
> > > EJBContext
> > > >> > > > > ejbContext;
> > > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > > .
> > > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > > .
> > > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > >
> > > >> > > request.login(user,pass);
> > > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > > String name =
> > > >> > > > > > > > > > > > > > >> > > >
> > > >> ejbContext.getCallerPrincipal().getName();
> > > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > >
> > > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > > I get "guest"
> > as
> > > my
> > > >> > user
> > > >> > > > > name.
> > > >> > > > > > > > But i
> > > >> > > > > > > > > > > > expect
> > > >> > > > > > > > > > > > > > the
> > > >> > > > > > > > > > > > > > >> > name
> > > >> > > > > > > > > > > > > > >> > > of
> > > >> > > > > > > > > > > > > > >> > > > > my
> > > >> > > > > > > > > > > > > > >> > > > > > > user
> > > >> > > > > > > > > > > > > > >> > > > > > > > > (of
> > > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > course
> > > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > > is not guest)
> > > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > >
> > > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > > If the login
> > was
> > > >> > > > successful
> > > >> > > > > my
> > > >> > > > > > > > login
> > > >> > > > > > > > > > > page
> > > >> > > > > > > > > > > > > > >> navigate
> > > >> > > > > > > > > > > > > > >> > to
> > > >> > > > > > > > > > > > > > >> > > > > other
> > > >> > > > > > > > > > > > > > >> > > > > > > > page
> > > >> > > > > > > > > > > > > > >> > > > > > > > > > lets
> > > >> > > > > > > > > > > > > > >> > > > > > > > > > > > say
> > > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > > pageb.xhtml
> > > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > >
> > > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > > If i create a
> > > >> > > managedbean
> > > >> > > > > > > (@Named)
> > > >> > > > > > > > > for
> > > >> > > > > > > > > > > > > > >> pageb.xhtml
> > > >> > > > > > > > > > > > > > >> > > and
> > > >> > > > > > > > > > > > > > >> > > > in
> > > >> > > > > > > > > > > > > > >> > > > > > > that
> > > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > managedbean
> > > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > > i use again:
> > > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > > String name =
> > > >> > > > > > > > > > > > > > >> > > >
> > > >> ejbContext.getCallerPrincipal().getName();
> > > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > > then, here i
> > get
> > > my
> > > >> > > > > "correct"
> > > >> > > > > > > name
> > > >> > > > > > > > > of
> > > >> > > > > > > > > > > the
> > > >> > > > > > > > > > > > > user
> > > >> > > > > > > > > > > > > > >> (not
> > > >> > > > > > > > > > > > > > >> > > > > guest).
> > > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > >
> > > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > > I dont know
> if
> > > >> this is
> > > >> > > the
> > > >> > > > > > > desire
> > > >> > > > > > > > > > > > behaviour
> > > >> > > > > > > > > > > > > or
> > > >> > > > > > > > > > > > > > >> if
> > > >> > > > > > > > > > > > > > >> > > this
> > > >> > > > > > > > > > > > > > >> > > > > > > happend
> > > >> > > > > > > > > > > > > > >> > > > > > > > > > > because
> > > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > the
> > > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > > http request
> > isnt
> > > >> > > > finished?
> > > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > >
> > > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > > other
> question
> > > why
> > > >> if
> > > >> > i
> > > >> > > > call
> > > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > > the
> > > >> > > > > > > > > > > > > >
>  ejbContext.getCallerPrincipal().getName();
> > > >> > > > > > > > > > > > > > >> > > before
> > > >> > > > > > > > > > > > > > >> > > > > the
> > > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > request.login()
> > > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > > method i get
> > > again
> > > >> > > > "guest",
> > > >> > > > > > why
> > > >> > > > > > > > not
> > > >> > > > > > > > > > > null?
> > > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > >
> > > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > > If this
> > question
> > > is
> > > >> > for
> > > >> > > > > > > > > tomee(openejb)
> > > >> > > > > > > > > > > or
> > > >> > > > > > > > > > > > > > >> tomcat?
> > > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > >
> > > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > > Thanks
> > > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > >
> > > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > >
> > > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > >
> > > >> > > > > > > > > > > > > > >> > > > > > > > >
> > > >> > > > > > > > > > > > > > >> > > >
> > > >> > > > > > > > > > > > > >
> > > >> > > > > > > > >
> > > >> > > >
> > > -------------------------------------------------------------------
> > > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > > *SCJA. José
> > Luis
> > > >> > Cetina*
> > > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > >
> > > >> > > > > > > > > > > > > > >> > > > > > > > >
> > > >> > > > > > > > > > > > > > >> > > >
> > > >> > > > > > > > > > > > > >
> > > >> > > > > > > > >
> > > >> > > >
> > > -------------------------------------------------------------------
> > > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > >
> > > >> > > > > > > > > > > > > > >> > > > > > > > > > > > >
> > > >> > > > > > > > > > > > > > >> > > > > > > > > > > >
> > > >> > > > > > > > > > > > > > >> > > > > > > > > > > >
> > > >> > > > > > > > > > > > > > >> > > > > > > > > > > >
> > > >> > > > > > > > > > > > > > >> > > > > > > > > > > > --
> > > >> > > > > > > > > > > > > > >> > > > > > > > > > > >
> > > >> > > > > > > > > > > > > > >> > > > > > >
> > > >> > > > > > > > > > > > > > >> >
> > > >> > > > > > > > > > > >
> > > >> > > > > > >
> > > >> >
> -------------------------------------------------------------------
> > > >> > > > > > > > > > > > > > >> > > > > > > > > > > > *SCJA. José Luis
> > > >> Cetina*
> > > >> > > > > > > > > > > > > > >> > > > > > > > > > > >
> > > >> > > > > > > > > > > > > > >> > > > > > >
> > > >> > > > > > > > > > > > > > >> >
> > > >> > > > > > > > > > > >
> > > >> > > > > > >
> > > >> >
> -------------------------------------------------------------------
> > > >> > > > > > > > > > > > > > >> > > > > > > > > > > >
> > > >> > > > > > > > > > > > > > >> > > > > > > > > > >
> > > >> > > > > > > > > > > > > > >> > > > > > > > > >
> > > >> > > > > > > > > > > > > > >> > > > > > > > > >
> > > >> > > > > > > > > > > > > > >> > > > > > > > > >
> > > >> > > > > > > > > > > > > > >> > > > > > > > > > --
> > > >> > > > > > > > > > > > > > >> > > > > > > > > >
> > > >> > > > > > > > > > > > > > >> > > > >
> > > >> > > > > > > > > > > > > > >>
> > > >> > > > > > > > > > >
> > > >> > > > > >
> > > >> -------------------------------------------------------------------
> > > >> > > > > > > > > > > > > > >> > > > > > > > > > *SCJA. José Luis
> > Cetina*
> > > >> > > > > > > > > > > > > > >> > > > > > > > > >
> > > >> > > > > > > > > > > > > > >> > > > >
> > > >> > > > > > > > > > > > > > >>
> > > >> > > > > > > > > > >
> > > >> > > > > >
> > > >> -------------------------------------------------------------------
> > > >> > > > > > > > > > > > > > >> > > > > > > > > >
> > > >> > > > > > > > > > > > > > >> > > > > > > > >
> > > >> > > > > > > > > > > > > > >> > > > > > > >
> > > >> > > > > > > > > > > > > > >> > > > > > > >
> > > >> > > > > > > > > > > > > > >> > > > > > > >
> > > >> > > > > > > > > > > > > > >> > > > > > > > --
> > > >> > > > > > > > > > > > > > >> > > > > > > >
> > > >> > > > > > > > > > > > > > >> > >
> > > >> > > > > > > > > > > > >
> > > >> > > > > > > >
> > > >> > >
> > -------------------------------------------------------------------
> > > >> > > > > > > > > > > > > > >> > > > > > > > *SCJA. José Luis Cetina*
> > > >> > > > > > > > > > > > > > >> > > > > > > >
> > > >> > > > > > > > > > > > > > >> > >
> > > >> > > > > > > > > > > > >
> > > >> > > > > > > >
> > > >> > >
> > -------------------------------------------------------------------
> > > >> > > > > > > > > > > > > > >> > > > > > > >
> > > >> > > > > > > > > > > > > > >> > > > > > >
> > > >> > > > > > > > > > > > > > >> > > > > >
> > > >> > > > > > > > > > > > > > >> > > > > >
> > > >> > > > > > > > > > > > > > >> > > > > >
> > > >> > > > > > > > > > > > > > >> > > > > > --
> > > >> > > > > > > > > > > > > > >> > > > > >
> > > >> > > > > > > > > > > > > > >>
> > > >> > > > > > > > > > >
> > > >> > > > > >
> > > >> -------------------------------------------------------------------
> > > >> > > > > > > > > > > > > > >> > > > > > *SCJA. José Luis Cetina*
> > > >> > > > > > > > > > > > > > >> > > > > >
> > > >> > > > > > > > > > > > > > >>
> > > >> > > > > > > > > > >
> > > >> > > > > >
> > > >> -------------------------------------------------------------------
> > > >> > > > > > > > > > > > > > >> > > > > >
> > > >> > > > > > > > > > > > > > >> > > > >
> > > >> > > > > > > > > > > > > > >> > > >
> > > >> > > > > > > > > > > > > > >> > > >
> > > >> > > > > > > > > > > > > > >> > > >
> > > >> > > > > > > > > > > > > > >> > > > --
> > > >> > > > > > > > > > > > > > >> > > >
> > > >> > > > > > > > > > > > > >
> > > >> > > > > > > > >
> > > >> > > >
> > > -------------------------------------------------------------------
> > > >> > > > > > > > > > > > > > >> > > > *SCJA. José Luis Cetina*
> > > >> > > > > > > > > > > > > > >> > > >
> > > >> > > > > > > > > > > > > >
> > > >> > > > > > > > >
> > > >> > > >
> > > -------------------------------------------------------------------
> > > >> > > > > > > > > > > > > > >> > > >
> > > >> > > > > > > > > > > > > > >> > >
> > > >> > > > > > > > > > > > > > >> >
> > > >> > > > > > > > > > > > > > >> >
> > > >> > > > > > > > > > > > > > >> >
> > > >> > > > > > > > > > > > > > >> > --
> > > >> > > > > > > > > > > > > > >> >
> > > >> > > > > > > > > > > >
> > > >> > > > > > >
> > > >> >
> -------------------------------------------------------------------
> > > >> > > > > > > > > > > > > > >> > *SCJA. José Luis Cetina*
> > > >> > > > > > > > > > > > > > >> >
> > > >> > > > > > > > > > > >
> > > >> > > > > > >
> > > >> >
> -------------------------------------------------------------------
> > > >> > > > > > > > > > > > > > >> >
> > > >> > > > > > > > > > > > > > >>
> > > >> > > > > > > > > > > > > > >
> > > >> > > > > > > > > > > > > > >
> > > >> > > > > > > > > > > > > > >
> > > >> > > > > > > > > > > > > > > --
> > > >> > > > > > > > > > > > > > >
> > > >> > > > > > > > > >
> > > >> > > > >
> > > >> -------------------------------------------------------------------
> > > >> > > > > > > > > > > > > > > *SCJA. José Luis Cetina*
> > > >> > > > > > > > > > > > > > >
> > > >> > > > > > > > > >
> > > >> > > > >
> > > >> -------------------------------------------------------------------
> > > >> > > > > > > > > > > > > > >
> > > >> > > > > > > > > > > > > > >
> > > >> > > > > > > > > > > > > >
> > > >> > > > > > > > > > > > > >
> > > >> > > > > > > > > > > > > > --
> > > >> > > > > > > > > > > > > >
> > > >> > > > > > > > >
> > > >> > > >
> > > -------------------------------------------------------------------
> > > >> > > > > > > > > > > > > > *SCJA. José Luis Cetina*
> > > >> > > > > > > > > > > > > >
> > > >> > > > > > > > >
> > > >> > > >
> > > -------------------------------------------------------------------
> > > >> > > > > > > > > > > > > >
> > > >> > > > > > > > > > > > >
> > > >> > > > > > > > > > > >
> > > >> > > > > > > > > > > >
> > > >> > > > > > > > > > > >
> > > >> > > > > > > > > > > > --
> > > >> > > > > > > > > > > >
> > > >> > > > > > >
> > > >> >
> -------------------------------------------------------------------
> > > >> > > > > > > > > > > > *SCJA. José Luis Cetina*
> > > >> > > > > > > > > > > >
> > > >> > > > > > >
> > > >> >
> -------------------------------------------------------------------
> > > >> > > > > > > > > > > >
> > > >> > > > > > > > > > >
> > > >> > > > > > > > > >
> > > >> > > > > > > > > >
> > > >> > > > > > > > > >
> > > >> > > > > > > > > > --
> > > >> > > > > > > > > >
> > > >> > > > >
> > > >> -------------------------------------------------------------------
> > > >> > > > > > > > > > *SCJA. José Luis Cetina*
> > > >> > > > > > > > > >
> > > >> > > > >
> > > >> -------------------------------------------------------------------
> > > >> > > > > > > > > >
> > > >> > > > > > > > >
> > > >> > > > > > > >
> > > >> > > > > > > >
> > > >> > > > > > > >
> > > >> > > > > > > > --
> > > >> > > > > > > >
> > > >> > >
> > -------------------------------------------------------------------
> > > >> > > > > > > > *SCJA. José Luis Cetina*
> > > >> > > > > > > >
> > > >> > >
> > -------------------------------------------------------------------
> > > >> > > > > > > >
> > > >> > > > > > >
> > > >> > > > > >
> > > >> > > > > >
> > > >> > > > > >
> > > >> > > > > > --
> > > >> > > > > >
> > > >> -------------------------------------------------------------------
> > > >> > > > > > *SCJA. José Luis Cetina*
> > > >> > > > > >
> > > >> -------------------------------------------------------------------
> > > >> > > > > >
> > > >> > > > >
> > > >> > > >
> > > >> > > >
> > > >> > > >
> > > >> > > > --
> > > >> > > >
> > > -------------------------------------------------------------------
> > > >> > > > *SCJA. José Luis Cetina*
> > > >> > > >
> > > -------------------------------------------------------------------
> > > >> > > >
> > > >> > >
> > > >> >
> > > >> >
> > > >> >
> > > >> > --
> > > >> >
> -------------------------------------------------------------------
> > > >> > *SCJA. José Luis Cetina*
> > > >> >
> -------------------------------------------------------------------
> > > >> >
> > > >>
> > > >
> > > >
> > > >
> > > > --
> > > > -------------------------------------------------------------------
> > > > *SCJA. José Luis Cetina*
> > > > -------------------------------------------------------------------
> > > >
> > > >
> > >
> > >
> > > --
> > > -------------------------------------------------------------------
> > > *SCJA. José Luis Cetina*
> > > -------------------------------------------------------------------
> > >
> >
>

RE: Guest user

Posted by Robin <ro...@gmail.com>.
Please Remove me from the e-mail list.
Thank You
Robin

-----Original Message-----
From: José Luis Cetina [mailto:maxtorzito@gmail.com] 
Sent: Friday, June 15, 2012 8:07 AM
To: users@openejb.apache.org
Subject: Re: Guest user

Hi Romain, let me tell you, the problem only occurs when you use login
method and try to set something in the session bean just after the next line
of request.login, if I comment the login method, then it works ok, please
give a try with a simple test with login method and you will see the
problem, I tested many times  El 15/06/2012 04:40, "Romain Manni-Bucau"
<rm...@gmail.com> escribió:

> Hi,
>
> i didnt test with the login but it seems it works
>
> but please add @RequestScoped to MyNextPageMBean or don't use 
> postconstrutct otherwise you have a kind of cache effect depending on 
> the moment when the bean is created.
>
> here a sample:
>
> http://svn.apache.org/repos/asf/openejb/trunk/openejb/examples/cdi-ses
> sion-scope/
>
> - Romain
>
>
> 2012/6/15 José Luis Cetina <ma...@gmail.com>
>
> > Hi Romain, well i have an other problem and i think is related to 
> > this
> same
> > reported issue.
> >
> > We talked about if i login using request.login(user,pass) method and 
> > if
> the
> > credentials and login was successfull then when i get the user i get 
> > a guess user:
> >
> > request.login(user,pass);
> > String name = ejbContext.getCallerPrincipal().getName();
> >
> > Ok, then this was fixed, and its ok now, now returns the valid user.
> >
> > But now if i do this
> >
> > @Inject
> > private MySessionBean mySessionBean;
> >
> > public String login(){
> >   request.login(user,pass);
> >   mySessionBean.setName("My name is JOE");
> >   //then i do a redirect here
> >  return "next_page";
> > }
> >
> > now in my managedbean of my next_page.xhtml i had:
> >
> > @Named
> > public MyNextPageMBean implements Serializable{
> >
> > @Inject
> > private MySessionBean mySessionBean;
> >
> >  @PostConstruc
> >  public void test(){
> >    mySessionBean.getName(); <---HERE I GET NULL ALWAYS
> >   }
> >
> > }
> >
> >
> > SessionBean:
> >
> > import java.io.Serializable;
> > import javax.enterprise.context.SessionScoped;
> > import javax.inject.Named;
> >
> > @Named
> > @SessionScoped
> > public class MySessionBean implements Serializable{
> >
> >    private String name;
> >
> >    public MySessionBean() {
> >
> >    }
> >
> >    public String getName() {
> >        return name;
> >    }
> >
> >    public void setName(String name) {
> >        this.name = name;
> >    }
> > }
> >
> >
> >
> > As you can see i get null, mi login its ok, but when i saved 
> > something in my sessionbean when i try to retrive what i saved 
> > before, i always get null, like if i never set the value (and of 
> > course i did it) but this
> ONLY
> > HAPPEND when i try to set the any value just before request.login, 
> > if i
> set
> > the value in the second bean  like
> >
> > mySessionBean.setName("My name is JOE"); then in other's page i can 
> > get
> the
> > value without any problem, i do a lot of test and the problem is 
> > when i only set the values (in my session bean) just before 
> > request.login, then
> i
> > associated this with the "guest user problem" as you sayed this was 
> > happening because the user was "recognized" only after the first
request.
> >
> > Again, is this the expected behaviour? it seem buggy
> >
> > Im using:  apache-tomee-1.1.0-20120612.040829-22-webprofile
> >
> >
> > 2012/6/1 José Luis Cetina <ma...@gmail.com>
> >
> > > ok
> > >
> > >
> > > 2012/6/1 Romain Manni-Bucau <rm...@gmail.com>
> > >
> > >> deployment in progress:
> > >> http://ci.apache.org/builders/openejb-trunk-deploy/builds/378
> > >>
> > >> - Romain
> > >>
> > >>
> > >> 2012/6/1 José Luis Cetina <ma...@gmail.com>
> > >>
> > >> > Ok, in what tomee build this will be available?
> > >> >
> > >> > 2012/5/31 Romain Manni-Bucau <rm...@gmail.com>
> > >> >
> > >> > > yep
> > >> > >
> > >> > > just commited, a new commit will come where this class will
> > >> automatically
> > >> > > be added normally
> > >> > >
> > >> > > - Romain
> > >> > >
> > >> > >
> > >> > > 2012/6/1 José Luis Cetina <ma...@gmail.com>
> > >> > >
> > >> > > > im getting a ClassNotFound
> > >> > > >
> > >> > > > Caused by: java.lang.ClassNotFoundException:
> > >> > > > org.apache.tomee.catalina.TomEERealm
> > >> > > >
> > >> > > > 2012/5/31 Romain Manni-Bucau <rm...@gmail.com>
> > >> > > >
> > >> > > > > my sample is working, too late to add test but manually 
> > >> > > > > it
> works
> > >> > > > >
> > >> > > > > so i guess it should work for you
> > >> > > > >
> > >> > > > > the question now is should we add it automatically?
> > >> > > > >
> > >> > > > > - Romain
> > >> > > > >
> > >> > > > >
> > >> > > > > 2012/6/1 José Luis Cetina <ma...@gmail.com>
> > >> > > > >
> > >> > > > > > Oooh great, with this i can get the principal user in 
> > >> > > > > > the
> > first
> > >> > > > request?
> > >> > > > > or
> > >> > > > > > this is something that you gonna fix?
> > >> > > > > >
> > >> > > > > > 2012/5/31 Romain Manni-Bucau <rm...@gmail.com>
> > >> > > > > >
> > >> > > > > > > that's brand new ;)
> > >> > > > > > >
> > >> > > > > > > just added it, it mainly delegate to the real realm 
> > >> > > > > > > but
> add
> > >> the
> > >> > > > > principal
> > >> > > > > > > info to openejb/tomee security service which is used 
> > >> > > > > > > in
> > >> > ejbcontext
> > >> > > > impl
> > >> > > > > > (to
> > >> > > > > > > make it short)
> > >> > > > > > >
> > >> > > > > > > - Romain
> > >> > > > > > >
> > >> > > > > > >
> > >> > > > > > > 2012/6/1 José Luis Cetina <ma...@gmail.com>
> > >> > > > > > >
> > >> > > > > > > > I have this in my context.xml
> > >> > > > > > > >
> > >> > > > > > > > <Realm className="MyExtendedDataSourceRealm"
> > >> > > > > > > >  dataSourceName="MyDataSource"
> > >> > > > > > > > digest="SHA-256"
> > >> > > > > > > > encodePassword="Base64"
> > >> > > > > > > > queryRealmRolesUser="SELECT rol FROM xxxx WHERE user=?"
> > >> > > > > > > > queryRealmUsers="SELECT pass FROM xxx WHERE 
> > >> > > > > > > > user=?"/>
> > >> > > > > > > >
> > >> > > > > > > > As you can see i extend the datasource realm, i 
> > >> > > > > > > > have
> this
> > >> realm
> > >> > > > > config
> > >> > > > > > in
> > >> > > > > > > > the context.xml in my webapp (not context.xml TomEE).
> > >> > > > > > > >
> > >> > > > > > > > But, as i can see in your example, you surround 
> > >> > > > > > > > your
> realm
> > >> with
> > >> > > > > > > TomEERealm,
> > >> > > > > > > > if this necessary?. I didn't know this
> > >> > > > > > > >
> > >> > > > > > > >
> > >> > > > > > > >
> > >> > > > > > > > 2012/5/31 Romain Manni-Bucau 
> > >> > > > > > > > <rm...@gmail.com>
> > >> > > > > > > >
> > >> > > > > > > > > in my test i used:
> > >> > > > > > > > >
> > >> > > > > > > > >    <Realm
> > >> className="org.apache.tomee.catalina.TomEERealm">
> > >> > > > > > > > >        <Realm
> > >> className="org.apache.catalina.realm.JAASRealm"
> > >> > > > > > > > > appName="PropertiesLoginModule"
> > >> > > > > > > > >
> > >> > > > > > > > >
> > >> > > > > > > > >
> > >> > > > > > > >
> > >> > > > > > >
> > >> > > > > >
> > >> > > > >
> > >> > > >
> > >> > >
> > >> >
> > >>
> >
>
userClassNames="org.apache.openejb.core.security.AbstractSecurityService$Use
r"
> > >> > > > > > > > >
> > >> > > > > > > > >
> > >> > > > > > > > >
> > >> > > > > > > >
> > >> > > > > > >
> > >> > > > > >
> > >> > > > >
> > >> > > >
> > >> > >
> > >> >
> > >>
> >
>  
> roleClassNames="org.apache.openejb.core.security.AbstractSecurityServi
> ce$Group">
> > >> > > > > > > > >        </Realm>
> > >> > > > > > > > >       </Realm>
> > >> > > > > > > > >
> > >> > > > > > > > > but i guess you can replace the jaasrealm by your
> > dsrealm
> > >> > > > > > > > >
> > >> > > > > > > > > - Romain
> > >> > > > > > > > >
> > >> > > > > > > > >
> > >> > > > > > > > > 2012/6/1 José Luis Cetina <ma...@gmail.com>
> > >> > > > > > > > >
> > >> > > > > > > > > > Yes, it seems buggy.
> > >> > > > > > > > > >
> > >> > > > > > > > > > Where i have to replace?
> > >> > > > > > > > > >
> > >> > > > > > > > > > Remember im using DataSourceRealm
> > >> > > > > > > > > >
> > >> > > > > > > > > > 2012/5/31 Romain Manni-Bucau 
> > >> > > > > > > > > > <rmannibucau@gmail.com
> >
> > >> > > > > > > > > >
> > >> > > > > > > > > > > this is the current status,
> > >> > > > > > > > > > >
> > >> > > > > > > > > > > but IMO it is buggy,
> > >> > > > > > > > > > >
> > >> > > > > > > > > > > i'll commit soon a TomEEJAASRealm to make it
> working
> > >> > > (replace
> > >> > > > > > > > JAASRealm
> > >> > > > > > > > > > in
> > >> > > > > > > > > > > the conf)
> > >> > > > > > > > > > >
> > >> > > > > > > > > > > - Romain
> > >> > > > > > > > > > >
> > >> > > > > > > > > > >
> > >> > > > > > > > > > > 2012/6/1 José Luis Cetina 
> > >> > > > > > > > > > > <ma...@gmail.com>
> > >> > > > > > > > > > >
> > >> > > > > > > > > > > > i think we are getting confused.
> > >> > > > > > > > > > > >
> > >> > > > > > > > > > > > If i resume all, this what i asked (the 
> > >> > > > > > > > > > > > final of
> > the
> > >> > > first
> > >> > > > > > post)
> > >> > > > > > > > > > > >
> > >> > > > > > > > > > > > I dont know if this is the desire behavior 
> > >> > > > > > > > > > > > or if
> > >> this
> > >> > > > happend
> > >> > > > > > > > becase
> > >> > > > > > > > > > the
> > >> > > > > > > > > > > > httr request isnt finished?
> > >> > > > > > > > > > > > Then you answer me:
> > >> > > > > > > > > > > >
> > >> > > > > > > > > > > > in fact info from ejbcontext are taken in 
> > >> > > > > > > > > > > > our
> > >> > > > securitymodule
> > >> > > > > > > > > > > >
> > >> > > > > > > > > > > > in tomee we set/unset it from a valve so at 
> > >> > > > > > > > > > > > the
> > >> > > > beginning/end
> > >> > > > > > of
> > >> > > > > > > > the
> > >> > > > > > > > > > > > request...all between is currently ignored 
> > >> > > > > > > > > > > > so
> when
> > >> you
> > >> > > log
> > >> > > > > you
> > >> > > > > > > need
> > >> > > > > > > > > > > another
> > >> > > > > > > > > > > > request to get the updated information 
> > >> > > > > > > > > > > > (from the
> > >> tomcat
> > >> > > > > realm)
> > >> > > > > > > > > > > >
> > >> > > > > > > > > > > > "so when you log you need another request 
> > >> > > > > > > > > > > > to get
> > the
> > >> > > > updated
> > >> > > > > > > > > > information
> > >> > > > > > > > > > > > (from the tomcat realm)
> > >> > > > > > > > > > > >
> > >> > > > > > > > > > > > Then i get guest because is the desire
> behaviour,
> > >> after
> > >> > > the
> > >> > > > > > first
> > >> > > > > > > > > > > request i
> > >> > > > > > > > > > > > can get the user i expected.
> > >> > > > > > > > > > > >
> > >> > > > > > > > > > > > Then i resume, this is the default 
> > >> > > > > > > > > > > > behaviour,
> and
> > >> works
> > >> > > but
> > >> > > > > you
> > >> > > > > > > > need
> > >> > > > > > > > > a
> > >> > > > > > > > > > > > second request.
> > >> > > > > > > > > > > >
> > >> > > > > > > > > > > >
> > >> > > > > > > > > > > >
> > >> > > > > > > > > > > > 2012/5/31 Romain Manni-Bucau <
> > rmannibucau@gmail.com
> > >> >
> > >> > > > > > > > > > > >
> > >> > > > > > > > > > > > > i think it should work
> > >> > > > > > > > > > > > >
> > >> > > > > > > > > > > > > - Romain
> > >> > > > > > > > > > > > >
> > >> > > > > > > > > > > > >
> > >> > > > > > > > > > > > > 2012/6/1 José Luis Cetina <
> maxtorzito@gmail.com
> > >
> > >> > > > > > > > > > > > >
> > >> > > > > > > > > > > > > > I mean this:
> > >> > > > > > > > > > > > > >
> > >> > > > > > > > > > > > > > I dont know if this is the desire 
> > >> > > > > > > > > > > > > > behaviour
> or
> > >> if
> > >> > > this
> > >> > > > > > > happend
> > >> > > > > > > > > > > because
> > >> > > > > > > > > > > > > the
> > >> > > > > > > > > > > > > > http request isnt finished?
> > >> > > > > > > > > > > > > >
> > >> > > > > > > > > > > > > >
> > >> > > > > > > > > > > > > >
> > >> > > > > > > > > > > > > > 2012/5/31 José Luis Cetina <
> > >> maxtorzito@gmail.com>
> > >> > > > > > > > > > > > > >
> > >> > > > > > > > > > > > > > > Ok, the what i asked is correct??
> > >> > > > > > > > > > > > > > >
> > >> > > > > > > > > > > > > > > "I dont know if this is the desire
> behaviour
> > >> or
> > >> > if
> > >> > > > this
> > >> > > > > > > > happend
> > >> > > > > > > > > > > > because
> > >> > > > > > > > > > > > > > > the http request isnt finished?"
> > >> > > > > > > > > > > > > > >
> > >> > > > > > > > > > > > > > > 2012/5/31 Romain Manni-Bucau <
> > >> > > rmannibucau@gmail.com>
> > >> > > > > > > > > > > > > > >
> > >> > > > > > > > > > > > > > >> ok,
> > >> > > > > > > > > > > > > > >>
> > >> > > > > > > > > > > > > > >> in fact info from ejbcontext are 
> > >> > > > > > > > > > > > > > >> taken in
> > our
> > >> > > > > > > securitymodule
> > >> > > > > > > > > > > > > > >>
> > >> > > > > > > > > > > > > > >> in tomee we set/unset it from a 
> > >> > > > > > > > > > > > > > >> valve so
> at
> > >> the
> > >> > > > > > > > beginning/end
> > >> > > > > > > > > of
> > >> > > > > > > > > > > the
> > >> > > > > > > > > > > > > > >> request...all between is currently
> ignored
> > so
> > >> > when
> > >> > > > you
> > >> > > > > > log
> > >> > > > > > > > you
> > >> > > > > > > > > > > need
> > >> > > > > > > > > > > > > > >> another request to get the updated 
> > >> > > > > > > > > > > > > > >> information
> > (from
> > >> the
> > >> > > > > tomcat
> > >> > > > > > > > realm)
> > >> > > > > > > > > > > > > > >>
> > >> > > > > > > > > > > > > > >> - Romain
> > >> > > > > > > > > > > > > > >>
> > >> > > > > > > > > > > > > > >>
> > >> > > > > > > > > > > > > > >> 2012/6/1 José Luis Cetina <
> > >> maxtorzito@gmail.com
> > >> > >
> > >> > > > > > > > > > > > > > >>
> > >> > > > > > > > > > > > > > >> > Yes, it work
> > >> > > > > > > > > > > > > > >> >
> > >> > > > > > > > > > > > > > >> > 1) Login (form login) using
> > DataSourceRealm
> > >> > > > > > > > > > > > > > >> >
> > >> > > > > > > > > > > > > > >> >
> > >> > > > > > > > > > > > > > >> > 2) Redirect to page2 from my
> managedbean
> > >> > > > > > > > > > > > > > >> >
> > >> > > > > > > > > > > > > > >> > 2012/5/31 Romain Manni-Bucau <
> > >> > > > rmannibucau@gmail.com
> > >> > > > > >
> > >> > > > > > > > > > > > > > >> >
> > >> > > > > > > > > > > > > > >> > > so you mean using the flow i
> described
> > >> > before
> > >> > > it
> > >> > > > > > > works?
> > >> > > > > > > > > > > (sorry,
> > >> > > > > > > > > > > > > just
> > >> > > > > > > > > > > > > > >> to
> > >> > > > > > > > > > > > > > >> > be
> > >> > > > > > > > > > > > > > >> > > sure to understand)
> > >> > > > > > > > > > > > > > >> > >
> > >> > > > > > > > > > > > > > >> > > - Romain
> > >> > > > > > > > > > > > > > >> > >
> > >> > > > > > > > > > > > > > >> > >
> > >> > > > > > > > > > > > > > >> > > 2012/6/1 José Luis Cetina <
> > >> > > maxtorzito@gmail.com
> > >> > > > >
> > >> > > > > > > > > > > > > > >> > >
> > >> > > > > > > > > > > > > > >> > > > Hi i can login and i can 
> > >> > > > > > > > > > > > > > >> > > > navigate
> > >> > (redirect)
> > >> > > > to
> > >> > > > > my
> > >> > > > > > > > other
> > >> > > > > > > > > > > page,
> > >> > > > > > > > > > > > > > but i
> > >> > > > > > > > > > > > > > >> > dont
> > >> > > > > > > > > > > > > > >> > > > know why im getting guest user 
> > >> > > > > > > > > > > > > > >> > > > in
> the
> > >> > login
> > >> > > > > mbean,
> > >> > > > > > > > after
> > >> > > > > > > > > > > that
> > >> > > > > > > > > > > > in
> > >> > > > > > > > > > > > > > >> other
> > >> > > > > > > > > > > > > > >> > > > mbean  i get my "real" user.
> > >> > > > > > > > > > > > > > >> > > >
> > >> > > > > > > > > > > > > > >> > > >
> > >> > > > > > > > > > > > > > >> > > > 2012/5/31 Romain Manni-Bucau <
> > >> > > > > > rmannibucau@gmail.com
> > >> > > > > > > >
> > >> > > > > > > > > > > > > > >> > > >
> > >> > > > > > > > > > > > > > >> > > > > maybe
> > >> > > > > > > > > > > > > > >> > > > >
> > >> > > > > > > > > > > > > > >> > > >
> > >> > > > > > > > > > > > > > >> > >
> > >> > > > > > > > > > > > > > >> >
> > >> > > > > > > > > > > > > > >>
> > >> > > > > > > > > > > > > >
> > >> > > > > > > > > > > > >
> > >> > > > > > > > > > > >
> > >> > > > > > > > > > >
> > >> > > > > > > > > >
> > >> > > > > > > > >
> > >> > > > > > > >
> > >> > > > > > >
> > >> > > > > >
> > >> > > > >
> > >> > > >
> > >> > >
> > >> >
> > >>
> >
> http://rmannibucau.wordpress.com/2012/05/09/tomee-and-its-ssh-connecto
> r/but
> > >> > > > > > > > > > > > > > >> > > > > it uses properties file, it 
> > >> > > > > > > > > > > > > > >> > > > > just
> > >> need a
> > >> > > > custom
> > >> > > > > > > login
> > >> > > > > > > > > > > module
> > >> > > > > > > > > > > > > > >> > > > implementation
> > >> > > > > > > > > > > > > > >> > > > > to use a db.
> > >> > > > > > > > > > > > > > >> > > > >
> > >> > > > > > > > > > > > > > >> > > > > well,
> > >> > > > > > > > > > > > > > >> > > > >
> > >> > > > > > > > > > > > > > >> > > > > before can you test it please?
> > >> > > > > > > > > > > > > > >> > > > > 1) login
> > >> > > > > > > > > > > > > > >> > > > > 2) redirect to your page 
> > >> > > > > > > > > > > > > > >> > > > > using
> your
> > >> bean
> > >> > > > > > > > > > > > > > >> > > > >
> > >> > > > > > > > > > > > > > >> > > > > - Romain
> > >> > > > > > > > > > > > > > >> > > > >
> > >> > > > > > > > > > > > > > >> > > > >
> > >> > > > > > > > > > > > > > >> > > > > 2012/6/1 José Luis Cetina <
> > >> > > > > maxtorzito@gmail.com
> > >> > > > > > >
> > >> > > > > > > > > > > > > > >> > > > >
> > >> > > > > > > > > > > > > > >> > > > > > I have to read and know 
> > >> > > > > > > > > > > > > > >> > > > > > how to
> > use
> > >> > > this, i
> > >> > > > > > > always
> > >> > > > > > > > > use
> > >> > > > > > > > > > > > > > >> DataSource or
> > >> > > > > > > > > > > > > > >> > > > > > JDBCRealm. (with glassfish).
> > >> > > > > > > > > > > > > > >> > > > > > im reading now, do you 
> > >> > > > > > > > > > > > > > >> > > > > > have
> > >> something
> > >> > > for
> > >> > > > a
> > >> > > > > > > > > > quickstart?
> > >> > > > > > > > > > > > for
> > >> > > > > > > > > > > > > > >> share
> > >> > > > > > > > > > > > > > >> > me
> > >> > > > > > > > > > > > > > >> > > > > >
> > >> > > > > > > > > > > > > > >> > > > > > 2012/5/31 Romain 
> > >> > > > > > > > > > > > > > >> > > > > > Manni-Bucau <
> > >> > > > > > > > rmannibucau@gmail.com
> > >> > > > > > > > > >
> > >> > > > > > > > > > > > > > >> > > > > >
> > >> > > > > > > > > > > > > > >> > > > > > > having your password in 
> > >> > > > > > > > > > > > > > >> > > > > > > a db
> is
> > >> not
> > >> > an
> > >> > > > > issue
> > >> > > > > > > > but i
> > >> > > > > > > > > > > think
> > >> > > > > > > > > > > > > you
> > >> > > > > > > > > > > > > > >> > should
> > >> > > > > > > > > > > > > > >> > > > > > > use
> > >> > > org.apache.catalina.realm.JAASRealm
> > >> > > > > > > > > > > > > > >> > > > > > >
> > >> > > > > > > > > > > > > > >> > > > > > > for instance:
> > >> > > > > > > > > > > > > > >> > > > > > >
> > >> > > > > > > > > > > > > > >> > > > > > >     <Realm
> > >> > > > > > > > > > > > className="org.apache.catalina.realm.JAASRealm"
> > >> > > > > > > > > > > > > > >> > > > > > > appName="MyDBLoginModule"
> > >> > > > > > > > > > > > > > >> > > > > > >
> > >> > > > > > > > > > > > > > >> > > > > > >
> > >> > > > > > > > > > > > > > >> > > > > > >
> > >> > > > > > > > > > > > > > >> > > > > >
> > >> > > > > > > > > > > > > > >> > > > >
> > >> > > > > > > > > > > > > > >> > > >
> > >> > > > > > > > > > > > > > >> > >
> > >> > > > > > > > > > > > > > >> >
> > >> > > > > > > > > > > > > > >>
> > >> > > > > > > > > > > > > >
> > >> > > > > > > > > > > > >
> > >> > > > > > > > > > > >
> > >> > > > > > > > > > >
> > >> > > > > > > > > >
> > >> > > > > > > > >
> > >> > > > > > > >
> > >> > > > > > >
> > >> > > > > >
> > >> > > > >
> > >> > > >
> > >> > >
> > >> >
> > >>
> >
>
userClassNames="org.apache.openejb.core.security.AbstractSecurityService$Use
r"
> > >> > > > > > > > > > > > > > >> > > > > > >
> > >> > > > > > > > > > > > > > >> > > > > > >
> > >> > > > > > > > > > > > > > >> > > > > > >
> > >> > > > > > > > > > > > > > >> > > > > >
> > >> > > > > > > > > > > > > > >> > > > >
> > >> > > > > > > > > > > > > > >> > > >
> > >> > > > > > > > > > > > > > >> > >
> > >> > > > > > > > > > > > > > >> >
> > >> > > > > > > > > > > > > > >>
> > >> > > > > > > > > > > > > >
> > >> > > > > > > > > > > > >
> > >> > > > > > > > > > > >
> > >> > > > > > > > > > >
> > >> > > > > > > > > >
> > >> > > > > > > > >
> > >> > > > > > > >
> > >> > > > > > >
> > >> > > > > >
> > >> > > > >
> > >> > > >
> > >> > >
> > >> >
> > >>
> >
>  
> roleClassNames="org.apache.openejb.core.security.AbstractSecurityServi
> ce$Group">
> > >> > > > > > > > > > > > > > >> > > > > > >      </Realm>
> > >> > > > > > > > > > > > > > >> > > > > > >
> > >> > > > > > > > > > > > > > >> > > > > > > so simply implement a 
> > >> > > > > > > > > > > > > > >> > > > > > > custom
> > >> > > LoginModule
> > >> > > > > > > instead
> > >> > > > > > > > > of
> > >> > > > > > > > > > a
> > >> > > > > > > > > > > > > realm
> > >> > > > > > > > > > > > > > >> > > > > > >
> > >> > > > > > > > > > > > > > >> > > > > > > wdyt?
> > >> > > > > > > > > > > > > > >> > > > > > >
> > >> > > > > > > > > > > > > > >> > > > > > > - Romain
> > >> > > > > > > > > > > > > > >> > > > > > >
> > >> > > > > > > > > > > > > > >> > > > > > >
> > >> > > > > > > > > > > > > > >> > > > > > > 2012/6/1 José Luis 
> > >> > > > > > > > > > > > > > >> > > > > > > Cetina <
> > >> > > > > > > maxtorzito@gmail.com
> > >> > > > > > > > >
> > >> > > > > > > > > > > > > > >> > > > > > >
> > >> > > > > > > > > > > > > > >> > > > > > > > Sorry, i use
> > DataSourceRealm, i
> > >> > have
> > >> > > > my
> > >> > > > > > > > > > > > user/pass/roles
> > >> > > > > > > > > > > > > in
> > >> > > > > > > > > > > > > > >> the
> > >> > > > > > > > > > > > > > >> > > DB.
> > >> > > > > > > > > > > > > > >> > > > > > > >
> > >> > > > > > > > > > > > > > >> > > > > > > >
> > >> > > > > > > > > > > > > > >> > > > > > > >
> > >> > > > > > > > > > > > > > >> > > > > > > > 2012/5/31 Romain
> Manni-Bucau
> > <
> > >> > > > > > > > > > rmannibucau@gmail.com
> > >> > > > > > > > > > > >
> > >> > > > > > > > > > > > > > >> > > > > > > >
> > >> > > > > > > > > > > > > > >> > > > > > > > > can't you do it with 
> > >> > > > > > > > > > > > > > >> > > > > > > > > an
> > >> embedded
> > >> > > > one?
> > >> > > > > > > > > > > > > > >> > > > > > > > >
> > >> > > > > > > > > > > > > > >> > > > > > > > > well DataSourceRealm
> > doesn't
> > >> use
> > >> > > > JAAS
> > >> > > > > by
> > >> > > > > > > > > > default i
> > >> > > > > > > > > > > > > > think,
> > >> > > > > > > > > > > > > > >> > maybe
> > >> > > > > > > > > > > > > > >> > > > > > that's
> > >> > > > > > > > > > > > > > >> > > > > > > > the
> > >> > > > > > > > > > > > > > >> > > > > > > > > issue
> > >> > > > > > > > > > > > > > >> > > > > > > > >
> > >> > > > > > > > > > > > > > >> > > > > > > > > - Romain
> > >> > > > > > > > > > > > > > >> > > > > > > > >
> > >> > > > > > > > > > > > > > >> > > > > > > > >
> > >> > > > > > > > > > > > > > >> > > > > > > > > 2012/6/1 José Luis
> Cetina <
> > >> > > > > > > > > maxtorzito@gmail.com
> > >> > > > > > > > > > >
> > >> > > > > > > > > > > > > > >> > > > > > > > >
> > >> > > > > > > > > > > > > > >> > > > > > > > > > OK, i can create a
> > sample,
> > >> > but i
> > >> > > > use
> > >> > > > > > > > > > > > > DataSourceRealm,
> > >> > > > > > > > > > > > > > >> are
> > >> > > > > > > > > > > > > > >> > you
> > >> > > > > > > > > > > > > > >> > > > > gonna
> > >> > > > > > > > > > > > > > >> > > > > > > > > > configure your
> database?
> > >> > > > > > > > > > > > > > >> > > > > > > > > >
> > >> > > > > > > > > > > > > > >> > > > > > > > > > 2012/5/31 Romain
> > >> Manni-Bucau <
> > >> > > > > > > > > > > > rmannibucau@gmail.com
> > >> > > > > > > > > > > > > >
> > >> > > > > > > > > > > > > > >> > > > > > > > > >
> > >> > > > > > > > > > > > > > >> > > > > > > > > > > can you have a 
> > >> > > > > > > > > > > > > > >> > > > > > > > > > > try in
> > an
> > >> EJB
> > >> > > > > please?
> > >> > > > > > > > (just
> > >> > > > > > > > > > try
> > >> > > > > > > > > > > > to
> > >> > > > > > > > > > > > > > add
> > >> > > > > > > > > > > > > > >> > > > > @Stateless
> > >> > > > > > > > > > > > > > >> > > > > > on
> > >> > > > > > > > > > > > > > >> > > > > > > > > your
> > >> > > > > > > > > > > > > > >> > > > > > > > > > > managed bean for
> > >> instance)
> > >> > > > > > > > > > > > > > >> > > > > > > > > > >
> > >> > > > > > > > > > > > > > >> > > > > > > > > > > can you share a
> sample
> > >> easy
> > >> > to
> > >> > > > > run?
> > >> > > > > > > > > > > > > > >> > > > > > > > > > >
> > >> > > > > > > > > > > > > > >> > > > > > > > > > > - Romain
> > >> > > > > > > > > > > > > > >> > > > > > > > > > >
> > >> > > > > > > > > > > > > > >> > > > > > > > > > >
> > >> > > > > > > > > > > > > > >> > > > > > > > > > > 2012/6/1 José 
> > >> > > > > > > > > > > > > > >> > > > > > > > > > > Luis
> > >> Cetina <
> > >> > > > > > > > > > > maxtorzito@gmail.com
> > >> > > > > > > > > > > > >
> > >> > > > > > > > > > > > > > >> > > > > > > > > > >
> > >> > > > > > > > > > > > > > >> > > > > > > > > > > > Yes, im using 
> > >> > > > > > > > > > > > > > >> > > > > > > > > > > > JAAS
> > >> > > > > > > > > > > > > > >> > > > > > > > > > > >
> > >> > > > > > > > > > > > > > >> > > > > > > > > > > > 2012/5/31 
> > >> > > > > > > > > > > > > > >> > > > > > > > > > > > Romain
> > >> > > Manni-Bucau <
> > >> > > > > > > > > > > > > > rmannibucau@gmail.com
> > >> > > > > > > > > > > > > > >> >
> > >> > > > > > > > > > > > > > >> > > > > > > > > > > >
> > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > Hi,
> > >> > > > > > > > > > > > > > >> > > > > > > > > > > > >
> > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > Do you use jaas?
> > >> > > > > > > > > > > > > > >> > > > > > > > > > > > >
> > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > - Romain Le 
> > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > 31 mai 2012
> > 20:14,
> > >> > > "José
> > >> > > > > Luis
> > >> > > > > > > > > > Cetina" <
> > >> > > > > > > > > > > > > > >> > > > > > maxtorzito@gmail.com
> > >> > > > > > > > > > > > > > >> > > > > > > >
> > >> > > > > > > > > > > > > > >> > > > > > > > a
> > >> > > > > > > > > > > > > > >> > > > > > > > > > > écrit
> > >> > > > > > > > > > > > > > >> > > > > > > > > > > > :
> > >> > > > > > > > > > > > > > >> > > > > > > > > > > > >
> > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > > Hi i have 
> > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > > this
> > >> > scenario:
> > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > >
> > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > > I have a 
> > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > > page
> > >> > > login.xhtml,
> > >> > > > > > this
> > >> > > > > > > > page
> > >> > > > > > > > > > > has a
> > >> > > > > > > > > > > > > > >> > > ManagedBean
> > >> > > > > > > > > > > > > > >> > > > > > > (@Named)
> > >> > > > > > > > > > > > > > >> > > > > > > > > > this
> > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > > managedbea
> > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > > n use
> > the
> > >> > > > > > > > > > > > request.login(user,pass)
> > >> > > > > > > > > > > > > > >> > method.
> > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > >
> > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > > When i do
this:
> > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > >
> > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > > managedbea
> > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > > n
> > class:
> > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > >
> > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > > @Resource 
> > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > > private
> > EJBContext
> > >> > > > > ejbContext;
> > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > > .
> > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > > .
> > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > >
> > >> > > request.login(user,pass);
> > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > > String 
> > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > > name =
> > >> > > > > > > > > > > > > > >> > > >
> > >> ejbContext.getCallerPrincipal().getName();
> > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > >
> > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > > I get "guest"
> as
> > my
> > >> > user
> > >> > > > > name.
> > >> > > > > > > > But i
> > >> > > > > > > > > > > > expect
> > >> > > > > > > > > > > > > > the
> > >> > > > > > > > > > > > > > >> > name
> > >> > > > > > > > > > > > > > >> > > of
> > >> > > > > > > > > > > > > > >> > > > > my
> > >> > > > > > > > > > > > > > >> > > > > > > user
> > >> > > > > > > > > > > > > > >> > > > > > > > > (of
> > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > course
> > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > > is not 
> > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > > guest)
> > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > >
> > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > > If the 
> > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > > login
> was
> > >> > > > successful
> > >> > > > > my
> > >> > > > > > > > login
> > >> > > > > > > > > > > page
> > >> > > > > > > > > > > > > > >> navigate
> > >> > > > > > > > > > > > > > >> > to
> > >> > > > > > > > > > > > > > >> > > > > other
> > >> > > > > > > > > > > > > > >> > > > > > > > page
> > >> > > > > > > > > > > > > > >> > > > > > > > > > lets
> > >> > > > > > > > > > > > > > >> > > > > > > > > > > > say
> > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > > pageb.xhtm
> > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > > l
> > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > >
> > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > > If i 
> > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > > create a
> > >> > > managedbean
> > >> > > > > > > (@Named)
> > >> > > > > > > > > for
> > >> > > > > > > > > > > > > > >> pageb.xhtml
> > >> > > > > > > > > > > > > > >> > > and
> > >> > > > > > > > > > > > > > >> > > > in
> > >> > > > > > > > > > > > > > >> > > > > > > that
> > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > managedbean
> > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > > i use again:
> > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > > String 
> > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > > name =
> > >> > > > > > > > > > > > > > >> > > >
> > >> ejbContext.getCallerPrincipal().getName();
> > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > > then, here 
> > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > > i
> get
> > my
> > >> > > > > "correct"
> > >> > > > > > > name
> > >> > > > > > > > > of
> > >> > > > > > > > > > > the
> > >> > > > > > > > > > > > > user
> > >> > > > > > > > > > > > > > >> (not
> > >> > > > > > > > > > > > > > >> > > > > guest).
> > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > >
> > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > > I dont 
> > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > > know if
> > >> this is
> > >> > > the
> > >> > > > > > > desire
> > >> > > > > > > > > > > > behaviour
> > >> > > > > > > > > > > > > or
> > >> > > > > > > > > > > > > > >> if
> > >> > > > > > > > > > > > > > >> > > this
> > >> > > > > > > > > > > > > > >> > > > > > > happend
> > >> > > > > > > > > > > > > > >> > > > > > > > > > > because
> > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > the
> > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > > http 
> > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > > request
> isnt
> > >> > > > finished?
> > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > >
> > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > > other 
> > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > > question
> > why
> > >> if
> > >> > i
> > >> > > > call
> > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > > the
> > >> > > > > > > > > > > > > >  
> > >> > > > > > > > > > > > > > ejbContext.getCallerPrincipal().getName
> > >> > > > > > > > > > > > > > ();
> > >> > > > > > > > > > > > > > >> > > before
> > >> > > > > > > > > > > > > > >> > > > > the
> > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > request.logi
> > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > n()
> > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > > method i 
> > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > > get
> > again
> > >> > > > "guest",
> > >> > > > > > why
> > >> > > > > > > > not
> > >> > > > > > > > > > > null?
> > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > >
> > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > > If this
> question
> > is
> > >> > for
> > >> > > > > > > > > tomee(openejb)
> > >> > > > > > > > > > > or
> > >> > > > > > > > > > > > > > >> tomcat?
> > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > >
> > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > > Thanks
> > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > >
> > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > >
> > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > >
> > >> > > > > > > > > > > > > > >> > > > > > > > >
> > >> > > > > > > > > > > > > > >> > > >
> > >> > > > > > > > > > > > > >
> > >> > > > > > > > >
> > >> > > >
> > -------------------------------------------------------------------
> > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > > *SCJA. 
> > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > > José
> Luis
> > >> > Cetina*
> > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > >
> > >> > > > > > > > > > > > > > >> > > > > > > > >
> > >> > > > > > > > > > > > > > >> > > >
> > >> > > > > > > > > > > > > >
> > >> > > > > > > > >
> > >> > > >
> > -------------------------------------------------------------------
> > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > >
> > >> > > > > > > > > > > > > > >> > > > > > > > > > > > >
> > >> > > > > > > > > > > > > > >> > > > > > > > > > > >
> > >> > > > > > > > > > > > > > >> > > > > > > > > > > >
> > >> > > > > > > > > > > > > > >> > > > > > > > > > > >
> > >> > > > > > > > > > > > > > >> > > > > > > > > > > > --
> > >> > > > > > > > > > > > > > >> > > > > > > > > > > >
> > >> > > > > > > > > > > > > > >> > > > > > >
> > >> > > > > > > > > > > > > > >> >
> > >> > > > > > > > > > > >
> > >> > > > > > >
> > >> > ---------------------------------------------------------------
> > >> > ----
> > >> > > > > > > > > > > > > > >> > > > > > > > > > > > *SCJA. José 
> > >> > > > > > > > > > > > > > >> > > > > > > > > > > > Luis
> > >> Cetina*
> > >> > > > > > > > > > > > > > >> > > > > > > > > > > >
> > >> > > > > > > > > > > > > > >> > > > > > >
> > >> > > > > > > > > > > > > > >> >
> > >> > > > > > > > > > > >
> > >> > > > > > >
> > >> > ---------------------------------------------------------------
> > >> > ----
> > >> > > > > > > > > > > > > > >> > > > > > > > > > > >
> > >> > > > > > > > > > > > > > >> > > > > > > > > > >
> > >> > > > > > > > > > > > > > >> > > > > > > > > >
> > >> > > > > > > > > > > > > > >> > > > > > > > > >
> > >> > > > > > > > > > > > > > >> > > > > > > > > >
> > >> > > > > > > > > > > > > > >> > > > > > > > > > --
> > >> > > > > > > > > > > > > > >> > > > > > > > > >
> > >> > > > > > > > > > > > > > >> > > > >
> > >> > > > > > > > > > > > > > >>
> > >> > > > > > > > > > >
> > >> > > > > >
> > >> -----------------------------------------------------------------
> > >> --
> > >> > > > > > > > > > > > > > >> > > > > > > > > > *SCJA. José Luis
> Cetina*
> > >> > > > > > > > > > > > > > >> > > > > > > > > >
> > >> > > > > > > > > > > > > > >> > > > >
> > >> > > > > > > > > > > > > > >>
> > >> > > > > > > > > > >
> > >> > > > > >
> > >> -----------------------------------------------------------------
> > >> --
> > >> > > > > > > > > > > > > > >> > > > > > > > > >
> > >> > > > > > > > > > > > > > >> > > > > > > > >
> > >> > > > > > > > > > > > > > >> > > > > > > >
> > >> > > > > > > > > > > > > > >> > > > > > > >
> > >> > > > > > > > > > > > > > >> > > > > > > >
> > >> > > > > > > > > > > > > > >> > > > > > > > --
> > >> > > > > > > > > > > > > > >> > > > > > > >
> > >> > > > > > > > > > > > > > >> > >
> > >> > > > > > > > > > > > >
> > >> > > > > > > >
> > >> > >
> -------------------------------------------------------------------
> > >> > > > > > > > > > > > > > >> > > > > > > > *SCJA. José Luis 
> > >> > > > > > > > > > > > > > >> > > > > > > > Cetina*
> > >> > > > > > > > > > > > > > >> > > > > > > >
> > >> > > > > > > > > > > > > > >> > >
> > >> > > > > > > > > > > > >
> > >> > > > > > > >
> > >> > >
> -------------------------------------------------------------------
> > >> > > > > > > > > > > > > > >> > > > > > > >
> > >> > > > > > > > > > > > > > >> > > > > > >
> > >> > > > > > > > > > > > > > >> > > > > >
> > >> > > > > > > > > > > > > > >> > > > > >
> > >> > > > > > > > > > > > > > >> > > > > >
> > >> > > > > > > > > > > > > > >> > > > > > --
> > >> > > > > > > > > > > > > > >> > > > > >
> > >> > > > > > > > > > > > > > >>
> > >> > > > > > > > > > >
> > >> > > > > >
> > >> -----------------------------------------------------------------
> > >> --
> > >> > > > > > > > > > > > > > >> > > > > > *SCJA. José Luis Cetina*
> > >> > > > > > > > > > > > > > >> > > > > >
> > >> > > > > > > > > > > > > > >>
> > >> > > > > > > > > > >
> > >> > > > > >
> > >> -----------------------------------------------------------------
> > >> --
> > >> > > > > > > > > > > > > > >> > > > > >
> > >> > > > > > > > > > > > > > >> > > > >
> > >> > > > > > > > > > > > > > >> > > >
> > >> > > > > > > > > > > > > > >> > > >
> > >> > > > > > > > > > > > > > >> > > >
> > >> > > > > > > > > > > > > > >> > > > --
> > >> > > > > > > > > > > > > > >> > > >
> > >> > > > > > > > > > > > > >
> > >> > > > > > > > >
> > >> > > >
> > -------------------------------------------------------------------
> > >> > > > > > > > > > > > > > >> > > > *SCJA. José Luis Cetina*
> > >> > > > > > > > > > > > > > >> > > >
> > >> > > > > > > > > > > > > >
> > >> > > > > > > > >
> > >> > > >
> > -------------------------------------------------------------------
> > >> > > > > > > > > > > > > > >> > > >
> > >> > > > > > > > > > > > > > >> > >
> > >> > > > > > > > > > > > > > >> >
> > >> > > > > > > > > > > > > > >> >
> > >> > > > > > > > > > > > > > >> >
> > >> > > > > > > > > > > > > > >> > --
> > >> > > > > > > > > > > > > > >> >
> > >> > > > > > > > > > > >
> > >> > > > > > >
> > >> > ---------------------------------------------------------------
> > >> > ----
> > >> > > > > > > > > > > > > > >> > *SCJA. José Luis Cetina*
> > >> > > > > > > > > > > > > > >> >
> > >> > > > > > > > > > > >
> > >> > > > > > >
> > >> > ---------------------------------------------------------------
> > >> > ----
> > >> > > > > > > > > > > > > > >> >
> > >> > > > > > > > > > > > > > >>
> > >> > > > > > > > > > > > > > >
> > >> > > > > > > > > > > > > > >
> > >> > > > > > > > > > > > > > >
> > >> > > > > > > > > > > > > > > --
> > >> > > > > > > > > > > > > > >
> > >> > > > > > > > > >
> > >> > > > >
> > >> -----------------------------------------------------------------
> > >> --
> > >> > > > > > > > > > > > > > > *SCJA. José Luis Cetina*
> > >> > > > > > > > > > > > > > >
> > >> > > > > > > > > >
> > >> > > > >
> > >> -----------------------------------------------------------------
> > >> --
> > >> > > > > > > > > > > > > > >
> > >> > > > > > > > > > > > > > >
> > >> > > > > > > > > > > > > >
> > >> > > > > > > > > > > > > >
> > >> > > > > > > > > > > > > > --
> > >> > > > > > > > > > > > > >
> > >> > > > > > > > >
> > >> > > >
> > -------------------------------------------------------------------
> > >> > > > > > > > > > > > > > *SCJA. José Luis Cetina*
> > >> > > > > > > > > > > > > >
> > >> > > > > > > > >
> > >> > > >
> > -------------------------------------------------------------------
> > >> > > > > > > > > > > > > >
> > >> > > > > > > > > > > > >
> > >> > > > > > > > > > > >
> > >> > > > > > > > > > > >
> > >> > > > > > > > > > > >
> > >> > > > > > > > > > > > --
> > >> > > > > > > > > > > >
> > >> > > > > > >
> > >> > ---------------------------------------------------------------
> > >> > ----
> > >> > > > > > > > > > > > *SCJA. José Luis Cetina*
> > >> > > > > > > > > > > >
> > >> > > > > > >
> > >> > ---------------------------------------------------------------
> > >> > ----
> > >> > > > > > > > > > > >
> > >> > > > > > > > > > >
> > >> > > > > > > > > >
> > >> > > > > > > > > >
> > >> > > > > > > > > >
> > >> > > > > > > > > > --
> > >> > > > > > > > > >
> > >> > > > >
> > >> -----------------------------------------------------------------
> > >> --
> > >> > > > > > > > > > *SCJA. José Luis Cetina*
> > >> > > > > > > > > >
> > >> > > > >
> > >> -----------------------------------------------------------------
> > >> --
> > >> > > > > > > > > >
> > >> > > > > > > > >
> > >> > > > > > > >
> > >> > > > > > > >
> > >> > > > > > > >
> > >> > > > > > > > --
> > >> > > > > > > >
> > >> > >
> -------------------------------------------------------------------
> > >> > > > > > > > *SCJA. José Luis Cetina*
> > >> > > > > > > >
> > >> > >
> -------------------------------------------------------------------
> > >> > > > > > > >
> > >> > > > > > >
> > >> > > > > >
> > >> > > > > >
> > >> > > > > >
> > >> > > > > > --
> > >> > > > > >
> > >> -----------------------------------------------------------------
> > >> --
> > >> > > > > > *SCJA. José Luis Cetina*
> > >> > > > > >
> > >> -----------------------------------------------------------------
> > >> --
> > >> > > > > >
> > >> > > > >
> > >> > > >
> > >> > > >
> > >> > > >
> > >> > > > --
> > >> > > >
> > -------------------------------------------------------------------
> > >> > > > *SCJA. José Luis Cetina*
> > >> > > >
> > -------------------------------------------------------------------
> > >> > > >
> > >> > >
> > >> >
> > >> >
> > >> >
> > >> > --
> > >> > ---------------------------------------------------------------
> > >> > ----
> > >> > *SCJA. José Luis Cetina*
> > >> > ---------------------------------------------------------------
> > >> > ----
> > >> >
> > >>
> > >
> > >
> > >
> > > --
> > > ------------------------------------------------------------------
> > > -
> > > *SCJA. José Luis Cetina*
> > > ------------------------------------------------------------------
> > > -
> > >
> > >
> >
> >
> > --
> > -------------------------------------------------------------------
> > *SCJA. José Luis Cetina*
> > -------------------------------------------------------------------
> >
>


Re: Guest user

Posted by José Luis Cetina <ma...@gmail.com>.
Hi Romain, let me tell you, the problem only occurs when you use login
method and try to set something in the session bean just after the next
line of request.login, if I comment the login method, then it works ok,
please give a try with a simple test with login method and you will see the
problem, I tested many times
 El 15/06/2012 04:40, "Romain Manni-Bucau" <rm...@gmail.com> escribió:

> Hi,
>
> i didnt test with the login but it seems it works
>
> but please add @RequestScoped to MyNextPageMBean or don't use
> postconstrutct otherwise you have a kind of cache effect depending on the
> moment when the bean is created.
>
> here a sample:
>
> http://svn.apache.org/repos/asf/openejb/trunk/openejb/examples/cdi-session-scope/
>
> - Romain
>
>
> 2012/6/15 José Luis Cetina <ma...@gmail.com>
>
> > Hi Romain, well i have an other problem and i think is related to this
> same
> > reported issue.
> >
> > We talked about if i login using request.login(user,pass) method and if
> the
> > credentials and login was successfull then when i get the user i get a
> > guess user:
> >
> > request.login(user,pass);
> > String name = ejbContext.getCallerPrincipal().getName();
> >
> > Ok, then this was fixed, and its ok now, now returns the valid user.
> >
> > But now if i do this
> >
> > @Inject
> > private MySessionBean mySessionBean;
> >
> > public String login(){
> >   request.login(user,pass);
> >   mySessionBean.setName("My name is JOE");
> >   //then i do a redirect here
> >  return "next_page";
> > }
> >
> > now in my managedbean of my next_page.xhtml i had:
> >
> > @Named
> > public MyNextPageMBean implements Serializable{
> >
> > @Inject
> > private MySessionBean mySessionBean;
> >
> >  @PostConstruc
> >  public void test(){
> >    mySessionBean.getName(); <---HERE I GET NULL ALWAYS
> >   }
> >
> > }
> >
> >
> > SessionBean:
> >
> > import java.io.Serializable;
> > import javax.enterprise.context.SessionScoped;
> > import javax.inject.Named;
> >
> > @Named
> > @SessionScoped
> > public class MySessionBean implements Serializable{
> >
> >    private String name;
> >
> >    public MySessionBean() {
> >
> >    }
> >
> >    public String getName() {
> >        return name;
> >    }
> >
> >    public void setName(String name) {
> >        this.name = name;
> >    }
> > }
> >
> >
> >
> > As you can see i get null, mi login its ok, but when i saved something in
> > my sessionbean when i try to retrive what i saved before, i always get
> > null, like if i never set the value (and of course i did it) but this
> ONLY
> > HAPPEND when i try to set the any value just before request.login, if i
> set
> > the value in the second bean  like
> >
> > mySessionBean.setName("My name is JOE"); then in other's page i can get
> the
> > value without any problem, i do a lot of test and the problem is when i
> > only set the values (in my session bean) just before request.login, then
> i
> > associated this with the "guest user problem" as you sayed this was
> > happening because the user was "recognized" only after the first request.
> >
> > Again, is this the expected behaviour? it seem buggy
> >
> > Im using:  apache-tomee-1.1.0-20120612.040829-22-webprofile
> >
> >
> > 2012/6/1 José Luis Cetina <ma...@gmail.com>
> >
> > > ok
> > >
> > >
> > > 2012/6/1 Romain Manni-Bucau <rm...@gmail.com>
> > >
> > >> deployment in progress:
> > >> http://ci.apache.org/builders/openejb-trunk-deploy/builds/378
> > >>
> > >> - Romain
> > >>
> > >>
> > >> 2012/6/1 José Luis Cetina <ma...@gmail.com>
> > >>
> > >> > Ok, in what tomee build this will be available?
> > >> >
> > >> > 2012/5/31 Romain Manni-Bucau <rm...@gmail.com>
> > >> >
> > >> > > yep
> > >> > >
> > >> > > just commited, a new commit will come where this class will
> > >> automatically
> > >> > > be added normally
> > >> > >
> > >> > > - Romain
> > >> > >
> > >> > >
> > >> > > 2012/6/1 José Luis Cetina <ma...@gmail.com>
> > >> > >
> > >> > > > im getting a ClassNotFound
> > >> > > >
> > >> > > > Caused by: java.lang.ClassNotFoundException:
> > >> > > > org.apache.tomee.catalina.TomEERealm
> > >> > > >
> > >> > > > 2012/5/31 Romain Manni-Bucau <rm...@gmail.com>
> > >> > > >
> > >> > > > > my sample is working, too late to add test but manually it
> works
> > >> > > > >
> > >> > > > > so i guess it should work for you
> > >> > > > >
> > >> > > > > the question now is should we add it automatically?
> > >> > > > >
> > >> > > > > - Romain
> > >> > > > >
> > >> > > > >
> > >> > > > > 2012/6/1 José Luis Cetina <ma...@gmail.com>
> > >> > > > >
> > >> > > > > > Oooh great, with this i can get the principal user in the
> > first
> > >> > > > request?
> > >> > > > > or
> > >> > > > > > this is something that you gonna fix?
> > >> > > > > >
> > >> > > > > > 2012/5/31 Romain Manni-Bucau <rm...@gmail.com>
> > >> > > > > >
> > >> > > > > > > that's brand new ;)
> > >> > > > > > >
> > >> > > > > > > just added it, it mainly delegate to the real realm but
> add
> > >> the
> > >> > > > > principal
> > >> > > > > > > info to openejb/tomee security service which is used in
> > >> > ejbcontext
> > >> > > > impl
> > >> > > > > > (to
> > >> > > > > > > make it short)
> > >> > > > > > >
> > >> > > > > > > - Romain
> > >> > > > > > >
> > >> > > > > > >
> > >> > > > > > > 2012/6/1 José Luis Cetina <ma...@gmail.com>
> > >> > > > > > >
> > >> > > > > > > > I have this in my context.xml
> > >> > > > > > > >
> > >> > > > > > > > <Realm className="MyExtendedDataSourceRealm"
> > >> > > > > > > >  dataSourceName="MyDataSource"
> > >> > > > > > > > digest="SHA-256"
> > >> > > > > > > > encodePassword="Base64"
> > >> > > > > > > > queryRealmRolesUser="SELECT rol FROM xxxx WHERE user=?"
> > >> > > > > > > > queryRealmUsers="SELECT pass FROM xxx WHERE user=?"/>
> > >> > > > > > > >
> > >> > > > > > > > As you can see i extend the datasource realm, i have
> this
> > >> realm
> > >> > > > > config
> > >> > > > > > in
> > >> > > > > > > > the context.xml in my webapp (not context.xml TomEE).
> > >> > > > > > > >
> > >> > > > > > > > But, as i can see in your example, you surround your
> realm
> > >> with
> > >> > > > > > > TomEERealm,
> > >> > > > > > > > if this necessary?. I didn't know this
> > >> > > > > > > >
> > >> > > > > > > >
> > >> > > > > > > >
> > >> > > > > > > > 2012/5/31 Romain Manni-Bucau <rm...@gmail.com>
> > >> > > > > > > >
> > >> > > > > > > > > in my test i used:
> > >> > > > > > > > >
> > >> > > > > > > > >    <Realm
> > >> className="org.apache.tomee.catalina.TomEERealm">
> > >> > > > > > > > >        <Realm
> > >> className="org.apache.catalina.realm.JAASRealm"
> > >> > > > > > > > > appName="PropertiesLoginModule"
> > >> > > > > > > > >
> > >> > > > > > > > >
> > >> > > > > > > > >
> > >> > > > > > > >
> > >> > > > > > >
> > >> > > > > >
> > >> > > > >
> > >> > > >
> > >> > >
> > >> >
> > >>
> >
>  userClassNames="org.apache.openejb.core.security.AbstractSecurityService$User"
> > >> > > > > > > > >
> > >> > > > > > > > >
> > >> > > > > > > > >
> > >> > > > > > > >
> > >> > > > > > >
> > >> > > > > >
> > >> > > > >
> > >> > > >
> > >> > >
> > >> >
> > >>
> >
>  roleClassNames="org.apache.openejb.core.security.AbstractSecurityService$Group">
> > >> > > > > > > > >        </Realm>
> > >> > > > > > > > >       </Realm>
> > >> > > > > > > > >
> > >> > > > > > > > > but i guess you can replace the jaasrealm by your
> > dsrealm
> > >> > > > > > > > >
> > >> > > > > > > > > - Romain
> > >> > > > > > > > >
> > >> > > > > > > > >
> > >> > > > > > > > > 2012/6/1 José Luis Cetina <ma...@gmail.com>
> > >> > > > > > > > >
> > >> > > > > > > > > > Yes, it seems buggy.
> > >> > > > > > > > > >
> > >> > > > > > > > > > Where i have to replace?
> > >> > > > > > > > > >
> > >> > > > > > > > > > Remember im using DataSourceRealm
> > >> > > > > > > > > >
> > >> > > > > > > > > > 2012/5/31 Romain Manni-Bucau <rmannibucau@gmail.com
> >
> > >> > > > > > > > > >
> > >> > > > > > > > > > > this is the current status,
> > >> > > > > > > > > > >
> > >> > > > > > > > > > > but IMO it is buggy,
> > >> > > > > > > > > > >
> > >> > > > > > > > > > > i'll commit soon a TomEEJAASRealm to make it
> working
> > >> > > (replace
> > >> > > > > > > > JAASRealm
> > >> > > > > > > > > > in
> > >> > > > > > > > > > > the conf)
> > >> > > > > > > > > > >
> > >> > > > > > > > > > > - Romain
> > >> > > > > > > > > > >
> > >> > > > > > > > > > >
> > >> > > > > > > > > > > 2012/6/1 José Luis Cetina <ma...@gmail.com>
> > >> > > > > > > > > > >
> > >> > > > > > > > > > > > i think we are getting confused.
> > >> > > > > > > > > > > >
> > >> > > > > > > > > > > > If i resume all, this what i asked (the final of
> > the
> > >> > > first
> > >> > > > > > post)
> > >> > > > > > > > > > > >
> > >> > > > > > > > > > > > I dont know if this is the desire behavior or if
> > >> this
> > >> > > > happend
> > >> > > > > > > > becase
> > >> > > > > > > > > > the
> > >> > > > > > > > > > > > httr request isnt finished?
> > >> > > > > > > > > > > > Then you answer me:
> > >> > > > > > > > > > > >
> > >> > > > > > > > > > > > in fact info from ejbcontext are taken in our
> > >> > > > securitymodule
> > >> > > > > > > > > > > >
> > >> > > > > > > > > > > > in tomee we set/unset it from a valve so at the
> > >> > > > beginning/end
> > >> > > > > > of
> > >> > > > > > > > the
> > >> > > > > > > > > > > > request...all between is currently ignored so
> when
> > >> you
> > >> > > log
> > >> > > > > you
> > >> > > > > > > need
> > >> > > > > > > > > > > another
> > >> > > > > > > > > > > > request to get the updated information (from the
> > >> tomcat
> > >> > > > > realm)
> > >> > > > > > > > > > > >
> > >> > > > > > > > > > > > "so when you log you need another request to get
> > the
> > >> > > > updated
> > >> > > > > > > > > > information
> > >> > > > > > > > > > > > (from the tomcat realm)
> > >> > > > > > > > > > > >
> > >> > > > > > > > > > > > Then i get guest because is the desire
> behaviour,
> > >> after
> > >> > > the
> > >> > > > > > first
> > >> > > > > > > > > > > request i
> > >> > > > > > > > > > > > can get the user i expected.
> > >> > > > > > > > > > > >
> > >> > > > > > > > > > > > Then i resume, this is the default behaviour,
> and
> > >> works
> > >> > > but
> > >> > > > > you
> > >> > > > > > > > need
> > >> > > > > > > > > a
> > >> > > > > > > > > > > > second request.
> > >> > > > > > > > > > > >
> > >> > > > > > > > > > > >
> > >> > > > > > > > > > > >
> > >> > > > > > > > > > > > 2012/5/31 Romain Manni-Bucau <
> > rmannibucau@gmail.com
> > >> >
> > >> > > > > > > > > > > >
> > >> > > > > > > > > > > > > i think it should work
> > >> > > > > > > > > > > > >
> > >> > > > > > > > > > > > > - Romain
> > >> > > > > > > > > > > > >
> > >> > > > > > > > > > > > >
> > >> > > > > > > > > > > > > 2012/6/1 José Luis Cetina <
> maxtorzito@gmail.com
> > >
> > >> > > > > > > > > > > > >
> > >> > > > > > > > > > > > > > I mean this:
> > >> > > > > > > > > > > > > >
> > >> > > > > > > > > > > > > > I dont know if this is the desire behaviour
> or
> > >> if
> > >> > > this
> > >> > > > > > > happend
> > >> > > > > > > > > > > because
> > >> > > > > > > > > > > > > the
> > >> > > > > > > > > > > > > > http request isnt finished?
> > >> > > > > > > > > > > > > >
> > >> > > > > > > > > > > > > >
> > >> > > > > > > > > > > > > >
> > >> > > > > > > > > > > > > > 2012/5/31 José Luis Cetina <
> > >> maxtorzito@gmail.com>
> > >> > > > > > > > > > > > > >
> > >> > > > > > > > > > > > > > > Ok, the what i asked is correct??
> > >> > > > > > > > > > > > > > >
> > >> > > > > > > > > > > > > > > "I dont know if this is the desire
> behaviour
> > >> or
> > >> > if
> > >> > > > this
> > >> > > > > > > > happend
> > >> > > > > > > > > > > > because
> > >> > > > > > > > > > > > > > > the http request isnt finished?"
> > >> > > > > > > > > > > > > > >
> > >> > > > > > > > > > > > > > > 2012/5/31 Romain Manni-Bucau <
> > >> > > rmannibucau@gmail.com>
> > >> > > > > > > > > > > > > > >
> > >> > > > > > > > > > > > > > >> ok,
> > >> > > > > > > > > > > > > > >>
> > >> > > > > > > > > > > > > > >> in fact info from ejbcontext are taken in
> > our
> > >> > > > > > > securitymodule
> > >> > > > > > > > > > > > > > >>
> > >> > > > > > > > > > > > > > >> in tomee we set/unset it from a valve so
> at
> > >> the
> > >> > > > > > > > beginning/end
> > >> > > > > > > > > of
> > >> > > > > > > > > > > the
> > >> > > > > > > > > > > > > > >> request...all between is currently
> ignored
> > so
> > >> > when
> > >> > > > you
> > >> > > > > > log
> > >> > > > > > > > you
> > >> > > > > > > > > > > need
> > >> > > > > > > > > > > > > > >> another
> > >> > > > > > > > > > > > > > >> request to get the updated information
> > (from
> > >> the
> > >> > > > > tomcat
> > >> > > > > > > > realm)
> > >> > > > > > > > > > > > > > >>
> > >> > > > > > > > > > > > > > >> - Romain
> > >> > > > > > > > > > > > > > >>
> > >> > > > > > > > > > > > > > >>
> > >> > > > > > > > > > > > > > >> 2012/6/1 José Luis Cetina <
> > >> maxtorzito@gmail.com
> > >> > >
> > >> > > > > > > > > > > > > > >>
> > >> > > > > > > > > > > > > > >> > Yes, it work
> > >> > > > > > > > > > > > > > >> >
> > >> > > > > > > > > > > > > > >> > 1) Login (form login) using
> > DataSourceRealm
> > >> > > > > > > > > > > > > > >> >
> > >> > > > > > > > > > > > > > >> >
> > >> > > > > > > > > > > > > > >> > 2) Redirect to page2 from my
> managedbean
> > >> > > > > > > > > > > > > > >> >
> > >> > > > > > > > > > > > > > >> > 2012/5/31 Romain Manni-Bucau <
> > >> > > > rmannibucau@gmail.com
> > >> > > > > >
> > >> > > > > > > > > > > > > > >> >
> > >> > > > > > > > > > > > > > >> > > so you mean using the flow i
> described
> > >> > before
> > >> > > it
> > >> > > > > > > works?
> > >> > > > > > > > > > > (sorry,
> > >> > > > > > > > > > > > > just
> > >> > > > > > > > > > > > > > >> to
> > >> > > > > > > > > > > > > > >> > be
> > >> > > > > > > > > > > > > > >> > > sure to understand)
> > >> > > > > > > > > > > > > > >> > >
> > >> > > > > > > > > > > > > > >> > > - Romain
> > >> > > > > > > > > > > > > > >> > >
> > >> > > > > > > > > > > > > > >> > >
> > >> > > > > > > > > > > > > > >> > > 2012/6/1 José Luis Cetina <
> > >> > > maxtorzito@gmail.com
> > >> > > > >
> > >> > > > > > > > > > > > > > >> > >
> > >> > > > > > > > > > > > > > >> > > > Hi i can login and i can navigate
> > >> > (redirect)
> > >> > > > to
> > >> > > > > my
> > >> > > > > > > > other
> > >> > > > > > > > > > > page,
> > >> > > > > > > > > > > > > > but i
> > >> > > > > > > > > > > > > > >> > dont
> > >> > > > > > > > > > > > > > >> > > > know why im getting guest user in
> the
> > >> > login
> > >> > > > > mbean,
> > >> > > > > > > > after
> > >> > > > > > > > > > > that
> > >> > > > > > > > > > > > in
> > >> > > > > > > > > > > > > > >> other
> > >> > > > > > > > > > > > > > >> > > > mbean  i get my "real" user.
> > >> > > > > > > > > > > > > > >> > > >
> > >> > > > > > > > > > > > > > >> > > >
> > >> > > > > > > > > > > > > > >> > > > 2012/5/31 Romain Manni-Bucau <
> > >> > > > > > rmannibucau@gmail.com
> > >> > > > > > > >
> > >> > > > > > > > > > > > > > >> > > >
> > >> > > > > > > > > > > > > > >> > > > > maybe
> > >> > > > > > > > > > > > > > >> > > > >
> > >> > > > > > > > > > > > > > >> > > >
> > >> > > > > > > > > > > > > > >> > >
> > >> > > > > > > > > > > > > > >> >
> > >> > > > > > > > > > > > > > >>
> > >> > > > > > > > > > > > > >
> > >> > > > > > > > > > > > >
> > >> > > > > > > > > > > >
> > >> > > > > > > > > > >
> > >> > > > > > > > > >
> > >> > > > > > > > >
> > >> > > > > > > >
> > >> > > > > > >
> > >> > > > > >
> > >> > > > >
> > >> > > >
> > >> > >
> > >> >
> > >>
> >
> http://rmannibucau.wordpress.com/2012/05/09/tomee-and-its-ssh-connector/but
> > >> > > > > > > > > > > > > > >> > > > > it uses properties file, it just
> > >> need a
> > >> > > > custom
> > >> > > > > > > login
> > >> > > > > > > > > > > module
> > >> > > > > > > > > > > > > > >> > > > implementation
> > >> > > > > > > > > > > > > > >> > > > > to use a db.
> > >> > > > > > > > > > > > > > >> > > > >
> > >> > > > > > > > > > > > > > >> > > > > well,
> > >> > > > > > > > > > > > > > >> > > > >
> > >> > > > > > > > > > > > > > >> > > > > before can you test it please?
> > >> > > > > > > > > > > > > > >> > > > > 1) login
> > >> > > > > > > > > > > > > > >> > > > > 2) redirect to your page using
> your
> > >> bean
> > >> > > > > > > > > > > > > > >> > > > >
> > >> > > > > > > > > > > > > > >> > > > > - Romain
> > >> > > > > > > > > > > > > > >> > > > >
> > >> > > > > > > > > > > > > > >> > > > >
> > >> > > > > > > > > > > > > > >> > > > > 2012/6/1 José Luis Cetina <
> > >> > > > > maxtorzito@gmail.com
> > >> > > > > > >
> > >> > > > > > > > > > > > > > >> > > > >
> > >> > > > > > > > > > > > > > >> > > > > > I have to read and know how to
> > use
> > >> > > this, i
> > >> > > > > > > always
> > >> > > > > > > > > use
> > >> > > > > > > > > > > > > > >> DataSource or
> > >> > > > > > > > > > > > > > >> > > > > > JDBCRealm. (with glassfish).
> > >> > > > > > > > > > > > > > >> > > > > > im reading now, do you have
> > >> something
> > >> > > for
> > >> > > > a
> > >> > > > > > > > > > quickstart?
> > >> > > > > > > > > > > > for
> > >> > > > > > > > > > > > > > >> share
> > >> > > > > > > > > > > > > > >> > me
> > >> > > > > > > > > > > > > > >> > > > > >
> > >> > > > > > > > > > > > > > >> > > > > > 2012/5/31 Romain Manni-Bucau <
> > >> > > > > > > > rmannibucau@gmail.com
> > >> > > > > > > > > >
> > >> > > > > > > > > > > > > > >> > > > > >
> > >> > > > > > > > > > > > > > >> > > > > > > having your password in a db
> is
> > >> not
> > >> > an
> > >> > > > > issue
> > >> > > > > > > > but i
> > >> > > > > > > > > > > think
> > >> > > > > > > > > > > > > you
> > >> > > > > > > > > > > > > > >> > should
> > >> > > > > > > > > > > > > > >> > > > > > > use
> > >> > > org.apache.catalina.realm.JAASRealm
> > >> > > > > > > > > > > > > > >> > > > > > >
> > >> > > > > > > > > > > > > > >> > > > > > > for instance:
> > >> > > > > > > > > > > > > > >> > > > > > >
> > >> > > > > > > > > > > > > > >> > > > > > >     <Realm
> > >> > > > > > > > > > > > className="org.apache.catalina.realm.JAASRealm"
> > >> > > > > > > > > > > > > > >> > > > > > > appName="MyDBLoginModule"
> > >> > > > > > > > > > > > > > >> > > > > > >
> > >> > > > > > > > > > > > > > >> > > > > > >
> > >> > > > > > > > > > > > > > >> > > > > > >
> > >> > > > > > > > > > > > > > >> > > > > >
> > >> > > > > > > > > > > > > > >> > > > >
> > >> > > > > > > > > > > > > > >> > > >
> > >> > > > > > > > > > > > > > >> > >
> > >> > > > > > > > > > > > > > >> >
> > >> > > > > > > > > > > > > > >>
> > >> > > > > > > > > > > > > >
> > >> > > > > > > > > > > > >
> > >> > > > > > > > > > > >
> > >> > > > > > > > > > >
> > >> > > > > > > > > >
> > >> > > > > > > > >
> > >> > > > > > > >
> > >> > > > > > >
> > >> > > > > >
> > >> > > > >
> > >> > > >
> > >> > >
> > >> >
> > >>
> >
>  userClassNames="org.apache.openejb.core.security.AbstractSecurityService$User"
> > >> > > > > > > > > > > > > > >> > > > > > >
> > >> > > > > > > > > > > > > > >> > > > > > >
> > >> > > > > > > > > > > > > > >> > > > > > >
> > >> > > > > > > > > > > > > > >> > > > > >
> > >> > > > > > > > > > > > > > >> > > > >
> > >> > > > > > > > > > > > > > >> > > >
> > >> > > > > > > > > > > > > > >> > >
> > >> > > > > > > > > > > > > > >> >
> > >> > > > > > > > > > > > > > >>
> > >> > > > > > > > > > > > > >
> > >> > > > > > > > > > > > >
> > >> > > > > > > > > > > >
> > >> > > > > > > > > > >
> > >> > > > > > > > > >
> > >> > > > > > > > >
> > >> > > > > > > >
> > >> > > > > > >
> > >> > > > > >
> > >> > > > >
> > >> > > >
> > >> > >
> > >> >
> > >>
> >
>  roleClassNames="org.apache.openejb.core.security.AbstractSecurityService$Group">
> > >> > > > > > > > > > > > > > >> > > > > > >      </Realm>
> > >> > > > > > > > > > > > > > >> > > > > > >
> > >> > > > > > > > > > > > > > >> > > > > > > so simply implement a custom
> > >> > > LoginModule
> > >> > > > > > > instead
> > >> > > > > > > > > of
> > >> > > > > > > > > > a
> > >> > > > > > > > > > > > > realm
> > >> > > > > > > > > > > > > > >> > > > > > >
> > >> > > > > > > > > > > > > > >> > > > > > > wdyt?
> > >> > > > > > > > > > > > > > >> > > > > > >
> > >> > > > > > > > > > > > > > >> > > > > > > - Romain
> > >> > > > > > > > > > > > > > >> > > > > > >
> > >> > > > > > > > > > > > > > >> > > > > > >
> > >> > > > > > > > > > > > > > >> > > > > > > 2012/6/1 José Luis Cetina <
> > >> > > > > > > maxtorzito@gmail.com
> > >> > > > > > > > >
> > >> > > > > > > > > > > > > > >> > > > > > >
> > >> > > > > > > > > > > > > > >> > > > > > > > Sorry, i use
> > DataSourceRealm, i
> > >> > have
> > >> > > > my
> > >> > > > > > > > > > > > user/pass/roles
> > >> > > > > > > > > > > > > in
> > >> > > > > > > > > > > > > > >> the
> > >> > > > > > > > > > > > > > >> > > DB.
> > >> > > > > > > > > > > > > > >> > > > > > > >
> > >> > > > > > > > > > > > > > >> > > > > > > >
> > >> > > > > > > > > > > > > > >> > > > > > > >
> > >> > > > > > > > > > > > > > >> > > > > > > > 2012/5/31 Romain
> Manni-Bucau
> > <
> > >> > > > > > > > > > rmannibucau@gmail.com
> > >> > > > > > > > > > > >
> > >> > > > > > > > > > > > > > >> > > > > > > >
> > >> > > > > > > > > > > > > > >> > > > > > > > > can't you do it with an
> > >> embedded
> > >> > > > one?
> > >> > > > > > > > > > > > > > >> > > > > > > > >
> > >> > > > > > > > > > > > > > >> > > > > > > > > well DataSourceRealm
> > doesn't
> > >> use
> > >> > > > JAAS
> > >> > > > > by
> > >> > > > > > > > > > default i
> > >> > > > > > > > > > > > > > think,
> > >> > > > > > > > > > > > > > >> > maybe
> > >> > > > > > > > > > > > > > >> > > > > > that's
> > >> > > > > > > > > > > > > > >> > > > > > > > the
> > >> > > > > > > > > > > > > > >> > > > > > > > > issue
> > >> > > > > > > > > > > > > > >> > > > > > > > >
> > >> > > > > > > > > > > > > > >> > > > > > > > > - Romain
> > >> > > > > > > > > > > > > > >> > > > > > > > >
> > >> > > > > > > > > > > > > > >> > > > > > > > >
> > >> > > > > > > > > > > > > > >> > > > > > > > > 2012/6/1 José Luis
> Cetina <
> > >> > > > > > > > > maxtorzito@gmail.com
> > >> > > > > > > > > > >
> > >> > > > > > > > > > > > > > >> > > > > > > > >
> > >> > > > > > > > > > > > > > >> > > > > > > > > > OK, i can create a
> > sample,
> > >> > but i
> > >> > > > use
> > >> > > > > > > > > > > > > DataSourceRealm,
> > >> > > > > > > > > > > > > > >> are
> > >> > > > > > > > > > > > > > >> > you
> > >> > > > > > > > > > > > > > >> > > > > gonna
> > >> > > > > > > > > > > > > > >> > > > > > > > > > configure your
> database?
> > >> > > > > > > > > > > > > > >> > > > > > > > > >
> > >> > > > > > > > > > > > > > >> > > > > > > > > > 2012/5/31 Romain
> > >> Manni-Bucau <
> > >> > > > > > > > > > > > rmannibucau@gmail.com
> > >> > > > > > > > > > > > > >
> > >> > > > > > > > > > > > > > >> > > > > > > > > >
> > >> > > > > > > > > > > > > > >> > > > > > > > > > > can you have a try in
> > an
> > >> EJB
> > >> > > > > please?
> > >> > > > > > > > (just
> > >> > > > > > > > > > try
> > >> > > > > > > > > > > > to
> > >> > > > > > > > > > > > > > add
> > >> > > > > > > > > > > > > > >> > > > > @Stateless
> > >> > > > > > > > > > > > > > >> > > > > > on
> > >> > > > > > > > > > > > > > >> > > > > > > > > your
> > >> > > > > > > > > > > > > > >> > > > > > > > > > > managed bean for
> > >> instance)
> > >> > > > > > > > > > > > > > >> > > > > > > > > > >
> > >> > > > > > > > > > > > > > >> > > > > > > > > > > can you share a
> sample
> > >> easy
> > >> > to
> > >> > > > > run?
> > >> > > > > > > > > > > > > > >> > > > > > > > > > >
> > >> > > > > > > > > > > > > > >> > > > > > > > > > > - Romain
> > >> > > > > > > > > > > > > > >> > > > > > > > > > >
> > >> > > > > > > > > > > > > > >> > > > > > > > > > >
> > >> > > > > > > > > > > > > > >> > > > > > > > > > > 2012/6/1 José Luis
> > >> Cetina <
> > >> > > > > > > > > > > maxtorzito@gmail.com
> > >> > > > > > > > > > > > >
> > >> > > > > > > > > > > > > > >> > > > > > > > > > >
> > >> > > > > > > > > > > > > > >> > > > > > > > > > > > Yes, im using JAAS
> > >> > > > > > > > > > > > > > >> > > > > > > > > > > >
> > >> > > > > > > > > > > > > > >> > > > > > > > > > > > 2012/5/31 Romain
> > >> > > Manni-Bucau <
> > >> > > > > > > > > > > > > > rmannibucau@gmail.com
> > >> > > > > > > > > > > > > > >> >
> > >> > > > > > > > > > > > > > >> > > > > > > > > > > >
> > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > Hi,
> > >> > > > > > > > > > > > > > >> > > > > > > > > > > > >
> > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > Do you use jaas?
> > >> > > > > > > > > > > > > > >> > > > > > > > > > > > >
> > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > - Romain
> > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > Le 31 mai 2012
> > 20:14,
> > >> > > "José
> > >> > > > > Luis
> > >> > > > > > > > > > Cetina" <
> > >> > > > > > > > > > > > > > >> > > > > > maxtorzito@gmail.com
> > >> > > > > > > > > > > > > > >> > > > > > > >
> > >> > > > > > > > > > > > > > >> > > > > > > > a
> > >> > > > > > > > > > > > > > >> > > > > > > > > > > écrit
> > >> > > > > > > > > > > > > > >> > > > > > > > > > > > :
> > >> > > > > > > > > > > > > > >> > > > > > > > > > > > >
> > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > > Hi i have this
> > >> > scenario:
> > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > >
> > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > > I have a page
> > >> > > login.xhtml,
> > >> > > > > > this
> > >> > > > > > > > page
> > >> > > > > > > > > > > has a
> > >> > > > > > > > > > > > > > >> > > ManagedBean
> > >> > > > > > > > > > > > > > >> > > > > > > (@Named)
> > >> > > > > > > > > > > > > > >> > > > > > > > > > this
> > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > > managedbean use
> > the
> > >> > > > > > > > > > > > request.login(user,pass)
> > >> > > > > > > > > > > > > > >> > method.
> > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > >
> > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > > When i do this:
> > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > >
> > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > > managedbean
> > class:
> > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > >
> > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > > @Resource
> > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > > private
> > EJBContext
> > >> > > > > ejbContext;
> > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > > .
> > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > > .
> > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > >
> > >> > > request.login(user,pass);
> > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > > String name =
> > >> > > > > > > > > > > > > > >> > > >
> > >> ejbContext.getCallerPrincipal().getName();
> > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > >
> > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > > I get "guest"
> as
> > my
> > >> > user
> > >> > > > > name.
> > >> > > > > > > > But i
> > >> > > > > > > > > > > > expect
> > >> > > > > > > > > > > > > > the
> > >> > > > > > > > > > > > > > >> > name
> > >> > > > > > > > > > > > > > >> > > of
> > >> > > > > > > > > > > > > > >> > > > > my
> > >> > > > > > > > > > > > > > >> > > > > > > user
> > >> > > > > > > > > > > > > > >> > > > > > > > > (of
> > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > course
> > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > > is not guest)
> > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > >
> > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > > If the login
> was
> > >> > > > successful
> > >> > > > > my
> > >> > > > > > > > login
> > >> > > > > > > > > > > page
> > >> > > > > > > > > > > > > > >> navigate
> > >> > > > > > > > > > > > > > >> > to
> > >> > > > > > > > > > > > > > >> > > > > other
> > >> > > > > > > > > > > > > > >> > > > > > > > page
> > >> > > > > > > > > > > > > > >> > > > > > > > > > lets
> > >> > > > > > > > > > > > > > >> > > > > > > > > > > > say
> > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > > pageb.xhtml
> > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > >
> > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > > If i create a
> > >> > > managedbean
> > >> > > > > > > (@Named)
> > >> > > > > > > > > for
> > >> > > > > > > > > > > > > > >> pageb.xhtml
> > >> > > > > > > > > > > > > > >> > > and
> > >> > > > > > > > > > > > > > >> > > > in
> > >> > > > > > > > > > > > > > >> > > > > > > that
> > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > managedbean
> > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > > i use again:
> > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > > String name =
> > >> > > > > > > > > > > > > > >> > > >
> > >> ejbContext.getCallerPrincipal().getName();
> > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > > then, here i
> get
> > my
> > >> > > > > "correct"
> > >> > > > > > > name
> > >> > > > > > > > > of
> > >> > > > > > > > > > > the
> > >> > > > > > > > > > > > > user
> > >> > > > > > > > > > > > > > >> (not
> > >> > > > > > > > > > > > > > >> > > > > guest).
> > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > >
> > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > > I dont know if
> > >> this is
> > >> > > the
> > >> > > > > > > desire
> > >> > > > > > > > > > > > behaviour
> > >> > > > > > > > > > > > > or
> > >> > > > > > > > > > > > > > >> if
> > >> > > > > > > > > > > > > > >> > > this
> > >> > > > > > > > > > > > > > >> > > > > > > happend
> > >> > > > > > > > > > > > > > >> > > > > > > > > > > because
> > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > the
> > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > > http request
> isnt
> > >> > > > finished?
> > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > >
> > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > > other question
> > why
> > >> if
> > >> > i
> > >> > > > call
> > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > > the
> > >> > > > > > > > > > > > > >  ejbContext.getCallerPrincipal().getName();
> > >> > > > > > > > > > > > > > >> > > before
> > >> > > > > > > > > > > > > > >> > > > > the
> > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > request.login()
> > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > > method i get
> > again
> > >> > > > "guest",
> > >> > > > > > why
> > >> > > > > > > > not
> > >> > > > > > > > > > > null?
> > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > >
> > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > > If this
> question
> > is
> > >> > for
> > >> > > > > > > > > tomee(openejb)
> > >> > > > > > > > > > > or
> > >> > > > > > > > > > > > > > >> tomcat?
> > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > >
> > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > > Thanks
> > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > >
> > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > >
> > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > >
> > >> > > > > > > > > > > > > > >> > > > > > > > >
> > >> > > > > > > > > > > > > > >> > > >
> > >> > > > > > > > > > > > > >
> > >> > > > > > > > >
> > >> > > >
> > -------------------------------------------------------------------
> > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > > *SCJA. José
> Luis
> > >> > Cetina*
> > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > >
> > >> > > > > > > > > > > > > > >> > > > > > > > >
> > >> > > > > > > > > > > > > > >> > > >
> > >> > > > > > > > > > > > > >
> > >> > > > > > > > >
> > >> > > >
> > -------------------------------------------------------------------
> > >> > > > > > > > > > > > > > >> > > > > > > > > > > > > >
> > >> > > > > > > > > > > > > > >> > > > > > > > > > > > >
> > >> > > > > > > > > > > > > > >> > > > > > > > > > > >
> > >> > > > > > > > > > > > > > >> > > > > > > > > > > >
> > >> > > > > > > > > > > > > > >> > > > > > > > > > > >
> > >> > > > > > > > > > > > > > >> > > > > > > > > > > > --
> > >> > > > > > > > > > > > > > >> > > > > > > > > > > >
> > >> > > > > > > > > > > > > > >> > > > > > >
> > >> > > > > > > > > > > > > > >> >
> > >> > > > > > > > > > > >
> > >> > > > > > >
> > >> > -------------------------------------------------------------------
> > >> > > > > > > > > > > > > > >> > > > > > > > > > > > *SCJA. José Luis
> > >> Cetina*
> > >> > > > > > > > > > > > > > >> > > > > > > > > > > >
> > >> > > > > > > > > > > > > > >> > > > > > >
> > >> > > > > > > > > > > > > > >> >
> > >> > > > > > > > > > > >
> > >> > > > > > >
> > >> > -------------------------------------------------------------------
> > >> > > > > > > > > > > > > > >> > > > > > > > > > > >
> > >> > > > > > > > > > > > > > >> > > > > > > > > > >
> > >> > > > > > > > > > > > > > >> > > > > > > > > >
> > >> > > > > > > > > > > > > > >> > > > > > > > > >
> > >> > > > > > > > > > > > > > >> > > > > > > > > >
> > >> > > > > > > > > > > > > > >> > > > > > > > > > --
> > >> > > > > > > > > > > > > > >> > > > > > > > > >
> > >> > > > > > > > > > > > > > >> > > > >
> > >> > > > > > > > > > > > > > >>
> > >> > > > > > > > > > >
> > >> > > > > >
> > >> -------------------------------------------------------------------
> > >> > > > > > > > > > > > > > >> > > > > > > > > > *SCJA. José Luis
> Cetina*
> > >> > > > > > > > > > > > > > >> > > > > > > > > >
> > >> > > > > > > > > > > > > > >> > > > >
> > >> > > > > > > > > > > > > > >>
> > >> > > > > > > > > > >
> > >> > > > > >
> > >> -------------------------------------------------------------------
> > >> > > > > > > > > > > > > > >> > > > > > > > > >
> > >> > > > > > > > > > > > > > >> > > > > > > > >
> > >> > > > > > > > > > > > > > >> > > > > > > >
> > >> > > > > > > > > > > > > > >> > > > > > > >
> > >> > > > > > > > > > > > > > >> > > > > > > >
> > >> > > > > > > > > > > > > > >> > > > > > > > --
> > >> > > > > > > > > > > > > > >> > > > > > > >
> > >> > > > > > > > > > > > > > >> > >
> > >> > > > > > > > > > > > >
> > >> > > > > > > >
> > >> > >
> -------------------------------------------------------------------
> > >> > > > > > > > > > > > > > >> > > > > > > > *SCJA. José Luis Cetina*
> > >> > > > > > > > > > > > > > >> > > > > > > >
> > >> > > > > > > > > > > > > > >> > >
> > >> > > > > > > > > > > > >
> > >> > > > > > > >
> > >> > >
> -------------------------------------------------------------------
> > >> > > > > > > > > > > > > > >> > > > > > > >
> > >> > > > > > > > > > > > > > >> > > > > > >
> > >> > > > > > > > > > > > > > >> > > > > >
> > >> > > > > > > > > > > > > > >> > > > > >
> > >> > > > > > > > > > > > > > >> > > > > >
> > >> > > > > > > > > > > > > > >> > > > > > --
> > >> > > > > > > > > > > > > > >> > > > > >
> > >> > > > > > > > > > > > > > >>
> > >> > > > > > > > > > >
> > >> > > > > >
> > >> -------------------------------------------------------------------
> > >> > > > > > > > > > > > > > >> > > > > > *SCJA. José Luis Cetina*
> > >> > > > > > > > > > > > > > >> > > > > >
> > >> > > > > > > > > > > > > > >>
> > >> > > > > > > > > > >
> > >> > > > > >
> > >> -------------------------------------------------------------------
> > >> > > > > > > > > > > > > > >> > > > > >
> > >> > > > > > > > > > > > > > >> > > > >
> > >> > > > > > > > > > > > > > >> > > >
> > >> > > > > > > > > > > > > > >> > > >
> > >> > > > > > > > > > > > > > >> > > >
> > >> > > > > > > > > > > > > > >> > > > --
> > >> > > > > > > > > > > > > > >> > > >
> > >> > > > > > > > > > > > > >
> > >> > > > > > > > >
> > >> > > >
> > -------------------------------------------------------------------
> > >> > > > > > > > > > > > > > >> > > > *SCJA. José Luis Cetina*
> > >> > > > > > > > > > > > > > >> > > >
> > >> > > > > > > > > > > > > >
> > >> > > > > > > > >
> > >> > > >
> > -------------------------------------------------------------------
> > >> > > > > > > > > > > > > > >> > > >
> > >> > > > > > > > > > > > > > >> > >
> > >> > > > > > > > > > > > > > >> >
> > >> > > > > > > > > > > > > > >> >
> > >> > > > > > > > > > > > > > >> >
> > >> > > > > > > > > > > > > > >> > --
> > >> > > > > > > > > > > > > > >> >
> > >> > > > > > > > > > > >
> > >> > > > > > >
> > >> > -------------------------------------------------------------------
> > >> > > > > > > > > > > > > > >> > *SCJA. José Luis Cetina*
> > >> > > > > > > > > > > > > > >> >
> > >> > > > > > > > > > > >
> > >> > > > > > >
> > >> > -------------------------------------------------------------------
> > >> > > > > > > > > > > > > > >> >
> > >> > > > > > > > > > > > > > >>
> > >> > > > > > > > > > > > > > >
> > >> > > > > > > > > > > > > > >
> > >> > > > > > > > > > > > > > >
> > >> > > > > > > > > > > > > > > --
> > >> > > > > > > > > > > > > > >
> > >> > > > > > > > > >
> > >> > > > >
> > >> -------------------------------------------------------------------
> > >> > > > > > > > > > > > > > > *SCJA. José Luis Cetina*
> > >> > > > > > > > > > > > > > >
> > >> > > > > > > > > >
> > >> > > > >
> > >> -------------------------------------------------------------------
> > >> > > > > > > > > > > > > > >
> > >> > > > > > > > > > > > > > >
> > >> > > > > > > > > > > > > >
> > >> > > > > > > > > > > > > >
> > >> > > > > > > > > > > > > > --
> > >> > > > > > > > > > > > > >
> > >> > > > > > > > >
> > >> > > >
> > -------------------------------------------------------------------
> > >> > > > > > > > > > > > > > *SCJA. José Luis Cetina*
> > >> > > > > > > > > > > > > >
> > >> > > > > > > > >
> > >> > > >
> > -------------------------------------------------------------------
> > >> > > > > > > > > > > > > >
> > >> > > > > > > > > > > > >
> > >> > > > > > > > > > > >
> > >> > > > > > > > > > > >
> > >> > > > > > > > > > > >
> > >> > > > > > > > > > > > --
> > >> > > > > > > > > > > >
> > >> > > > > > >
> > >> > -------------------------------------------------------------------
> > >> > > > > > > > > > > > *SCJA. José Luis Cetina*
> > >> > > > > > > > > > > >
> > >> > > > > > >
> > >> > -------------------------------------------------------------------
> > >> > > > > > > > > > > >
> > >> > > > > > > > > > >
> > >> > > > > > > > > >
> > >> > > > > > > > > >
> > >> > > > > > > > > >
> > >> > > > > > > > > > --
> > >> > > > > > > > > >
> > >> > > > >
> > >> -------------------------------------------------------------------
> > >> > > > > > > > > > *SCJA. José Luis Cetina*
> > >> > > > > > > > > >
> > >> > > > >
> > >> -------------------------------------------------------------------
> > >> > > > > > > > > >
> > >> > > > > > > > >
> > >> > > > > > > >
> > >> > > > > > > >
> > >> > > > > > > >
> > >> > > > > > > > --
> > >> > > > > > > >
> > >> > >
> -------------------------------------------------------------------
> > >> > > > > > > > *SCJA. José Luis Cetina*
> > >> > > > > > > >
> > >> > >
> -------------------------------------------------------------------
> > >> > > > > > > >
> > >> > > > > > >
> > >> > > > > >
> > >> > > > > >
> > >> > > > > >
> > >> > > > > > --
> > >> > > > > >
> > >> -------------------------------------------------------------------
> > >> > > > > > *SCJA. José Luis Cetina*
> > >> > > > > >
> > >> -------------------------------------------------------------------
> > >> > > > > >
> > >> > > > >
> > >> > > >
> > >> > > >
> > >> > > >
> > >> > > > --
> > >> > > >
> > -------------------------------------------------------------------
> > >> > > > *SCJA. José Luis Cetina*
> > >> > > >
> > -------------------------------------------------------------------
> > >> > > >
> > >> > >
> > >> >
> > >> >
> > >> >
> > >> > --
> > >> > -------------------------------------------------------------------
> > >> > *SCJA. José Luis Cetina*
> > >> > -------------------------------------------------------------------
> > >> >
> > >>
> > >
> > >
> > >
> > > --
> > > -------------------------------------------------------------------
> > > *SCJA. José Luis Cetina*
> > > -------------------------------------------------------------------
> > >
> > >
> >
> >
> > --
> > -------------------------------------------------------------------
> > *SCJA. José Luis Cetina*
> > -------------------------------------------------------------------
> >
>

Re: Guest user

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

i didnt test with the login but it seems it works

but please add @RequestScoped to MyNextPageMBean or don't use
postconstrutct otherwise you have a kind of cache effect depending on the
moment when the bean is created.

here a sample:
http://svn.apache.org/repos/asf/openejb/trunk/openejb/examples/cdi-session-scope/

- Romain


2012/6/15 José Luis Cetina <ma...@gmail.com>

> Hi Romain, well i have an other problem and i think is related to this same
> reported issue.
>
> We talked about if i login using request.login(user,pass) method and if the
> credentials and login was successfull then when i get the user i get a
> guess user:
>
> request.login(user,pass);
> String name = ejbContext.getCallerPrincipal().getName();
>
> Ok, then this was fixed, and its ok now, now returns the valid user.
>
> But now if i do this
>
> @Inject
> private MySessionBean mySessionBean;
>
> public String login(){
>   request.login(user,pass);
>   mySessionBean.setName("My name is JOE");
>   //then i do a redirect here
>  return "next_page";
> }
>
> now in my managedbean of my next_page.xhtml i had:
>
> @Named
> public MyNextPageMBean implements Serializable{
>
> @Inject
> private MySessionBean mySessionBean;
>
>  @PostConstruc
>  public void test(){
>    mySessionBean.getName(); <---HERE I GET NULL ALWAYS
>   }
>
> }
>
>
> SessionBean:
>
> import java.io.Serializable;
> import javax.enterprise.context.SessionScoped;
> import javax.inject.Named;
>
> @Named
> @SessionScoped
> public class MySessionBean implements Serializable{
>
>    private String name;
>
>    public MySessionBean() {
>
>    }
>
>    public String getName() {
>        return name;
>    }
>
>    public void setName(String name) {
>        this.name = name;
>    }
> }
>
>
>
> As you can see i get null, mi login its ok, but when i saved something in
> my sessionbean when i try to retrive what i saved before, i always get
> null, like if i never set the value (and of course i did it) but this ONLY
> HAPPEND when i try to set the any value just before request.login, if i set
> the value in the second bean  like
>
> mySessionBean.setName("My name is JOE"); then in other's page i can get the
> value without any problem, i do a lot of test and the problem is when i
> only set the values (in my session bean) just before request.login, then i
> associated this with the "guest user problem" as you sayed this was
> happening because the user was "recognized" only after the first request.
>
> Again, is this the expected behaviour? it seem buggy
>
> Im using:  apache-tomee-1.1.0-20120612.040829-22-webprofile
>
>
> 2012/6/1 José Luis Cetina <ma...@gmail.com>
>
> > ok
> >
> >
> > 2012/6/1 Romain Manni-Bucau <rm...@gmail.com>
> >
> >> deployment in progress:
> >> http://ci.apache.org/builders/openejb-trunk-deploy/builds/378
> >>
> >> - Romain
> >>
> >>
> >> 2012/6/1 José Luis Cetina <ma...@gmail.com>
> >>
> >> > Ok, in what tomee build this will be available?
> >> >
> >> > 2012/5/31 Romain Manni-Bucau <rm...@gmail.com>
> >> >
> >> > > yep
> >> > >
> >> > > just commited, a new commit will come where this class will
> >> automatically
> >> > > be added normally
> >> > >
> >> > > - Romain
> >> > >
> >> > >
> >> > > 2012/6/1 José Luis Cetina <ma...@gmail.com>
> >> > >
> >> > > > im getting a ClassNotFound
> >> > > >
> >> > > > Caused by: java.lang.ClassNotFoundException:
> >> > > > org.apache.tomee.catalina.TomEERealm
> >> > > >
> >> > > > 2012/5/31 Romain Manni-Bucau <rm...@gmail.com>
> >> > > >
> >> > > > > my sample is working, too late to add test but manually it works
> >> > > > >
> >> > > > > so i guess it should work for you
> >> > > > >
> >> > > > > the question now is should we add it automatically?
> >> > > > >
> >> > > > > - Romain
> >> > > > >
> >> > > > >
> >> > > > > 2012/6/1 José Luis Cetina <ma...@gmail.com>
> >> > > > >
> >> > > > > > Oooh great, with this i can get the principal user in the
> first
> >> > > > request?
> >> > > > > or
> >> > > > > > this is something that you gonna fix?
> >> > > > > >
> >> > > > > > 2012/5/31 Romain Manni-Bucau <rm...@gmail.com>
> >> > > > > >
> >> > > > > > > that's brand new ;)
> >> > > > > > >
> >> > > > > > > just added it, it mainly delegate to the real realm but add
> >> the
> >> > > > > principal
> >> > > > > > > info to openejb/tomee security service which is used in
> >> > ejbcontext
> >> > > > impl
> >> > > > > > (to
> >> > > > > > > make it short)
> >> > > > > > >
> >> > > > > > > - Romain
> >> > > > > > >
> >> > > > > > >
> >> > > > > > > 2012/6/1 José Luis Cetina <ma...@gmail.com>
> >> > > > > > >
> >> > > > > > > > I have this in my context.xml
> >> > > > > > > >
> >> > > > > > > > <Realm className="MyExtendedDataSourceRealm"
> >> > > > > > > >  dataSourceName="MyDataSource"
> >> > > > > > > > digest="SHA-256"
> >> > > > > > > > encodePassword="Base64"
> >> > > > > > > > queryRealmRolesUser="SELECT rol FROM xxxx WHERE user=?"
> >> > > > > > > > queryRealmUsers="SELECT pass FROM xxx WHERE user=?"/>
> >> > > > > > > >
> >> > > > > > > > As you can see i extend the datasource realm, i have this
> >> realm
> >> > > > > config
> >> > > > > > in
> >> > > > > > > > the context.xml in my webapp (not context.xml TomEE).
> >> > > > > > > >
> >> > > > > > > > But, as i can see in your example, you surround your realm
> >> with
> >> > > > > > > TomEERealm,
> >> > > > > > > > if this necessary?. I didn't know this
> >> > > > > > > >
> >> > > > > > > >
> >> > > > > > > >
> >> > > > > > > > 2012/5/31 Romain Manni-Bucau <rm...@gmail.com>
> >> > > > > > > >
> >> > > > > > > > > in my test i used:
> >> > > > > > > > >
> >> > > > > > > > >    <Realm
> >> className="org.apache.tomee.catalina.TomEERealm">
> >> > > > > > > > >        <Realm
> >> className="org.apache.catalina.realm.JAASRealm"
> >> > > > > > > > > appName="PropertiesLoginModule"
> >> > > > > > > > >
> >> > > > > > > > >
> >> > > > > > > > >
> >> > > > > > > >
> >> > > > > > >
> >> > > > > >
> >> > > > >
> >> > > >
> >> > >
> >> >
> >>
>  userClassNames="org.apache.openejb.core.security.AbstractSecurityService$User"
> >> > > > > > > > >
> >> > > > > > > > >
> >> > > > > > > > >
> >> > > > > > > >
> >> > > > > > >
> >> > > > > >
> >> > > > >
> >> > > >
> >> > >
> >> >
> >>
>  roleClassNames="org.apache.openejb.core.security.AbstractSecurityService$Group">
> >> > > > > > > > >        </Realm>
> >> > > > > > > > >       </Realm>
> >> > > > > > > > >
> >> > > > > > > > > but i guess you can replace the jaasrealm by your
> dsrealm
> >> > > > > > > > >
> >> > > > > > > > > - Romain
> >> > > > > > > > >
> >> > > > > > > > >
> >> > > > > > > > > 2012/6/1 José Luis Cetina <ma...@gmail.com>
> >> > > > > > > > >
> >> > > > > > > > > > Yes, it seems buggy.
> >> > > > > > > > > >
> >> > > > > > > > > > Where i have to replace?
> >> > > > > > > > > >
> >> > > > > > > > > > Remember im using DataSourceRealm
> >> > > > > > > > > >
> >> > > > > > > > > > 2012/5/31 Romain Manni-Bucau <rm...@gmail.com>
> >> > > > > > > > > >
> >> > > > > > > > > > > this is the current status,
> >> > > > > > > > > > >
> >> > > > > > > > > > > but IMO it is buggy,
> >> > > > > > > > > > >
> >> > > > > > > > > > > i'll commit soon a TomEEJAASRealm to make it working
> >> > > (replace
> >> > > > > > > > JAASRealm
> >> > > > > > > > > > in
> >> > > > > > > > > > > the conf)
> >> > > > > > > > > > >
> >> > > > > > > > > > > - Romain
> >> > > > > > > > > > >
> >> > > > > > > > > > >
> >> > > > > > > > > > > 2012/6/1 José Luis Cetina <ma...@gmail.com>
> >> > > > > > > > > > >
> >> > > > > > > > > > > > i think we are getting confused.
> >> > > > > > > > > > > >
> >> > > > > > > > > > > > If i resume all, this what i asked (the final of
> the
> >> > > first
> >> > > > > > post)
> >> > > > > > > > > > > >
> >> > > > > > > > > > > > I dont know if this is the desire behavior or if
> >> this
> >> > > > happend
> >> > > > > > > > becase
> >> > > > > > > > > > the
> >> > > > > > > > > > > > httr request isnt finished?
> >> > > > > > > > > > > > Then you answer me:
> >> > > > > > > > > > > >
> >> > > > > > > > > > > > in fact info from ejbcontext are taken in our
> >> > > > securitymodule
> >> > > > > > > > > > > >
> >> > > > > > > > > > > > in tomee we set/unset it from a valve so at the
> >> > > > beginning/end
> >> > > > > > of
> >> > > > > > > > the
> >> > > > > > > > > > > > request...all between is currently ignored so when
> >> you
> >> > > log
> >> > > > > you
> >> > > > > > > need
> >> > > > > > > > > > > another
> >> > > > > > > > > > > > request to get the updated information (from the
> >> tomcat
> >> > > > > realm)
> >> > > > > > > > > > > >
> >> > > > > > > > > > > > "so when you log you need another request to get
> the
> >> > > > updated
> >> > > > > > > > > > information
> >> > > > > > > > > > > > (from the tomcat realm)
> >> > > > > > > > > > > >
> >> > > > > > > > > > > > Then i get guest because is the desire behaviour,
> >> after
> >> > > the
> >> > > > > > first
> >> > > > > > > > > > > request i
> >> > > > > > > > > > > > can get the user i expected.
> >> > > > > > > > > > > >
> >> > > > > > > > > > > > Then i resume, this is the default behaviour, and
> >> works
> >> > > but
> >> > > > > you
> >> > > > > > > > need
> >> > > > > > > > > a
> >> > > > > > > > > > > > second request.
> >> > > > > > > > > > > >
> >> > > > > > > > > > > >
> >> > > > > > > > > > > >
> >> > > > > > > > > > > > 2012/5/31 Romain Manni-Bucau <
> rmannibucau@gmail.com
> >> >
> >> > > > > > > > > > > >
> >> > > > > > > > > > > > > i think it should work
> >> > > > > > > > > > > > >
> >> > > > > > > > > > > > > - Romain
> >> > > > > > > > > > > > >
> >> > > > > > > > > > > > >
> >> > > > > > > > > > > > > 2012/6/1 José Luis Cetina <maxtorzito@gmail.com
> >
> >> > > > > > > > > > > > >
> >> > > > > > > > > > > > > > I mean this:
> >> > > > > > > > > > > > > >
> >> > > > > > > > > > > > > > I dont know if this is the desire behaviour or
> >> if
> >> > > this
> >> > > > > > > happend
> >> > > > > > > > > > > because
> >> > > > > > > > > > > > > the
> >> > > > > > > > > > > > > > http request isnt finished?
> >> > > > > > > > > > > > > >
> >> > > > > > > > > > > > > >
> >> > > > > > > > > > > > > >
> >> > > > > > > > > > > > > > 2012/5/31 José Luis Cetina <
> >> maxtorzito@gmail.com>
> >> > > > > > > > > > > > > >
> >> > > > > > > > > > > > > > > Ok, the what i asked is correct??
> >> > > > > > > > > > > > > > >
> >> > > > > > > > > > > > > > > "I dont know if this is the desire behaviour
> >> or
> >> > if
> >> > > > this
> >> > > > > > > > happend
> >> > > > > > > > > > > > because
> >> > > > > > > > > > > > > > > the http request isnt finished?"
> >> > > > > > > > > > > > > > >
> >> > > > > > > > > > > > > > > 2012/5/31 Romain Manni-Bucau <
> >> > > rmannibucau@gmail.com>
> >> > > > > > > > > > > > > > >
> >> > > > > > > > > > > > > > >> ok,
> >> > > > > > > > > > > > > > >>
> >> > > > > > > > > > > > > > >> in fact info from ejbcontext are taken in
> our
> >> > > > > > > securitymodule
> >> > > > > > > > > > > > > > >>
> >> > > > > > > > > > > > > > >> in tomee we set/unset it from a valve so at
> >> the
> >> > > > > > > > beginning/end
> >> > > > > > > > > of
> >> > > > > > > > > > > the
> >> > > > > > > > > > > > > > >> request...all between is currently ignored
> so
> >> > when
> >> > > > you
> >> > > > > > log
> >> > > > > > > > you
> >> > > > > > > > > > > need
> >> > > > > > > > > > > > > > >> another
> >> > > > > > > > > > > > > > >> request to get the updated information
> (from
> >> the
> >> > > > > tomcat
> >> > > > > > > > realm)
> >> > > > > > > > > > > > > > >>
> >> > > > > > > > > > > > > > >> - Romain
> >> > > > > > > > > > > > > > >>
> >> > > > > > > > > > > > > > >>
> >> > > > > > > > > > > > > > >> 2012/6/1 José Luis Cetina <
> >> maxtorzito@gmail.com
> >> > >
> >> > > > > > > > > > > > > > >>
> >> > > > > > > > > > > > > > >> > Yes, it work
> >> > > > > > > > > > > > > > >> >
> >> > > > > > > > > > > > > > >> > 1) Login (form login) using
> DataSourceRealm
> >> > > > > > > > > > > > > > >> >
> >> > > > > > > > > > > > > > >> >
> >> > > > > > > > > > > > > > >> > 2) Redirect to page2 from my managedbean
> >> > > > > > > > > > > > > > >> >
> >> > > > > > > > > > > > > > >> > 2012/5/31 Romain Manni-Bucau <
> >> > > > rmannibucau@gmail.com
> >> > > > > >
> >> > > > > > > > > > > > > > >> >
> >> > > > > > > > > > > > > > >> > > so you mean using the flow i described
> >> > before
> >> > > it
> >> > > > > > > works?
> >> > > > > > > > > > > (sorry,
> >> > > > > > > > > > > > > just
> >> > > > > > > > > > > > > > >> to
> >> > > > > > > > > > > > > > >> > be
> >> > > > > > > > > > > > > > >> > > sure to understand)
> >> > > > > > > > > > > > > > >> > >
> >> > > > > > > > > > > > > > >> > > - Romain
> >> > > > > > > > > > > > > > >> > >
> >> > > > > > > > > > > > > > >> > >
> >> > > > > > > > > > > > > > >> > > 2012/6/1 José Luis Cetina <
> >> > > maxtorzito@gmail.com
> >> > > > >
> >> > > > > > > > > > > > > > >> > >
> >> > > > > > > > > > > > > > >> > > > Hi i can login and i can navigate
> >> > (redirect)
> >> > > > to
> >> > > > > my
> >> > > > > > > > other
> >> > > > > > > > > > > page,
> >> > > > > > > > > > > > > > but i
> >> > > > > > > > > > > > > > >> > dont
> >> > > > > > > > > > > > > > >> > > > know why im getting guest user in the
> >> > login
> >> > > > > mbean,
> >> > > > > > > > after
> >> > > > > > > > > > > that
> >> > > > > > > > > > > > in
> >> > > > > > > > > > > > > > >> other
> >> > > > > > > > > > > > > > >> > > > mbean  i get my "real" user.
> >> > > > > > > > > > > > > > >> > > >
> >> > > > > > > > > > > > > > >> > > >
> >> > > > > > > > > > > > > > >> > > > 2012/5/31 Romain Manni-Bucau <
> >> > > > > > rmannibucau@gmail.com
> >> > > > > > > >
> >> > > > > > > > > > > > > > >> > > >
> >> > > > > > > > > > > > > > >> > > > > maybe
> >> > > > > > > > > > > > > > >> > > > >
> >> > > > > > > > > > > > > > >> > > >
> >> > > > > > > > > > > > > > >> > >
> >> > > > > > > > > > > > > > >> >
> >> > > > > > > > > > > > > > >>
> >> > > > > > > > > > > > > >
> >> > > > > > > > > > > > >
> >> > > > > > > > > > > >
> >> > > > > > > > > > >
> >> > > > > > > > > >
> >> > > > > > > > >
> >> > > > > > > >
> >> > > > > > >
> >> > > > > >
> >> > > > >
> >> > > >
> >> > >
> >> >
> >>
> http://rmannibucau.wordpress.com/2012/05/09/tomee-and-its-ssh-connector/but
> >> > > > > > > > > > > > > > >> > > > > it uses properties file, it just
> >> need a
> >> > > > custom
> >> > > > > > > login
> >> > > > > > > > > > > module
> >> > > > > > > > > > > > > > >> > > > implementation
> >> > > > > > > > > > > > > > >> > > > > to use a db.
> >> > > > > > > > > > > > > > >> > > > >
> >> > > > > > > > > > > > > > >> > > > > well,
> >> > > > > > > > > > > > > > >> > > > >
> >> > > > > > > > > > > > > > >> > > > > before can you test it please?
> >> > > > > > > > > > > > > > >> > > > > 1) login
> >> > > > > > > > > > > > > > >> > > > > 2) redirect to your page using your
> >> bean
> >> > > > > > > > > > > > > > >> > > > >
> >> > > > > > > > > > > > > > >> > > > > - Romain
> >> > > > > > > > > > > > > > >> > > > >
> >> > > > > > > > > > > > > > >> > > > >
> >> > > > > > > > > > > > > > >> > > > > 2012/6/1 José Luis Cetina <
> >> > > > > maxtorzito@gmail.com
> >> > > > > > >
> >> > > > > > > > > > > > > > >> > > > >
> >> > > > > > > > > > > > > > >> > > > > > I have to read and know how to
> use
> >> > > this, i
> >> > > > > > > always
> >> > > > > > > > > use
> >> > > > > > > > > > > > > > >> DataSource or
> >> > > > > > > > > > > > > > >> > > > > > JDBCRealm. (with glassfish).
> >> > > > > > > > > > > > > > >> > > > > > im reading now, do you have
> >> something
> >> > > for
> >> > > > a
> >> > > > > > > > > > quickstart?
> >> > > > > > > > > > > > for
> >> > > > > > > > > > > > > > >> share
> >> > > > > > > > > > > > > > >> > me
> >> > > > > > > > > > > > > > >> > > > > >
> >> > > > > > > > > > > > > > >> > > > > > 2012/5/31 Romain Manni-Bucau <
> >> > > > > > > > rmannibucau@gmail.com
> >> > > > > > > > > >
> >> > > > > > > > > > > > > > >> > > > > >
> >> > > > > > > > > > > > > > >> > > > > > > having your password in a db is
> >> not
> >> > an
> >> > > > > issue
> >> > > > > > > > but i
> >> > > > > > > > > > > think
> >> > > > > > > > > > > > > you
> >> > > > > > > > > > > > > > >> > should
> >> > > > > > > > > > > > > > >> > > > > > > use
> >> > > org.apache.catalina.realm.JAASRealm
> >> > > > > > > > > > > > > > >> > > > > > >
> >> > > > > > > > > > > > > > >> > > > > > > for instance:
> >> > > > > > > > > > > > > > >> > > > > > >
> >> > > > > > > > > > > > > > >> > > > > > >     <Realm
> >> > > > > > > > > > > > className="org.apache.catalina.realm.JAASRealm"
> >> > > > > > > > > > > > > > >> > > > > > > appName="MyDBLoginModule"
> >> > > > > > > > > > > > > > >> > > > > > >
> >> > > > > > > > > > > > > > >> > > > > > >
> >> > > > > > > > > > > > > > >> > > > > > >
> >> > > > > > > > > > > > > > >> > > > > >
> >> > > > > > > > > > > > > > >> > > > >
> >> > > > > > > > > > > > > > >> > > >
> >> > > > > > > > > > > > > > >> > >
> >> > > > > > > > > > > > > > >> >
> >> > > > > > > > > > > > > > >>
> >> > > > > > > > > > > > > >
> >> > > > > > > > > > > > >
> >> > > > > > > > > > > >
> >> > > > > > > > > > >
> >> > > > > > > > > >
> >> > > > > > > > >
> >> > > > > > > >
> >> > > > > > >
> >> > > > > >
> >> > > > >
> >> > > >
> >> > >
> >> >
> >>
>  userClassNames="org.apache.openejb.core.security.AbstractSecurityService$User"
> >> > > > > > > > > > > > > > >> > > > > > >
> >> > > > > > > > > > > > > > >> > > > > > >
> >> > > > > > > > > > > > > > >> > > > > > >
> >> > > > > > > > > > > > > > >> > > > > >
> >> > > > > > > > > > > > > > >> > > > >
> >> > > > > > > > > > > > > > >> > > >
> >> > > > > > > > > > > > > > >> > >
> >> > > > > > > > > > > > > > >> >
> >> > > > > > > > > > > > > > >>
> >> > > > > > > > > > > > > >
> >> > > > > > > > > > > > >
> >> > > > > > > > > > > >
> >> > > > > > > > > > >
> >> > > > > > > > > >
> >> > > > > > > > >
> >> > > > > > > >
> >> > > > > > >
> >> > > > > >
> >> > > > >
> >> > > >
> >> > >
> >> >
> >>
>  roleClassNames="org.apache.openejb.core.security.AbstractSecurityService$Group">
> >> > > > > > > > > > > > > > >> > > > > > >      </Realm>
> >> > > > > > > > > > > > > > >> > > > > > >
> >> > > > > > > > > > > > > > >> > > > > > > so simply implement a custom
> >> > > LoginModule
> >> > > > > > > instead
> >> > > > > > > > > of
> >> > > > > > > > > > a
> >> > > > > > > > > > > > > realm
> >> > > > > > > > > > > > > > >> > > > > > >
> >> > > > > > > > > > > > > > >> > > > > > > wdyt?
> >> > > > > > > > > > > > > > >> > > > > > >
> >> > > > > > > > > > > > > > >> > > > > > > - Romain
> >> > > > > > > > > > > > > > >> > > > > > >
> >> > > > > > > > > > > > > > >> > > > > > >
> >> > > > > > > > > > > > > > >> > > > > > > 2012/6/1 José Luis Cetina <
> >> > > > > > > maxtorzito@gmail.com
> >> > > > > > > > >
> >> > > > > > > > > > > > > > >> > > > > > >
> >> > > > > > > > > > > > > > >> > > > > > > > Sorry, i use
> DataSourceRealm, i
> >> > have
> >> > > > my
> >> > > > > > > > > > > > user/pass/roles
> >> > > > > > > > > > > > > in
> >> > > > > > > > > > > > > > >> the
> >> > > > > > > > > > > > > > >> > > DB.
> >> > > > > > > > > > > > > > >> > > > > > > >
> >> > > > > > > > > > > > > > >> > > > > > > >
> >> > > > > > > > > > > > > > >> > > > > > > >
> >> > > > > > > > > > > > > > >> > > > > > > > 2012/5/31 Romain Manni-Bucau
> <
> >> > > > > > > > > > rmannibucau@gmail.com
> >> > > > > > > > > > > >
> >> > > > > > > > > > > > > > >> > > > > > > >
> >> > > > > > > > > > > > > > >> > > > > > > > > can't you do it with an
> >> embedded
> >> > > > one?
> >> > > > > > > > > > > > > > >> > > > > > > > >
> >> > > > > > > > > > > > > > >> > > > > > > > > well DataSourceRealm
> doesn't
> >> use
> >> > > > JAAS
> >> > > > > by
> >> > > > > > > > > > default i
> >> > > > > > > > > > > > > > think,
> >> > > > > > > > > > > > > > >> > maybe
> >> > > > > > > > > > > > > > >> > > > > > that's
> >> > > > > > > > > > > > > > >> > > > > > > > the
> >> > > > > > > > > > > > > > >> > > > > > > > > issue
> >> > > > > > > > > > > > > > >> > > > > > > > >
> >> > > > > > > > > > > > > > >> > > > > > > > > - Romain
> >> > > > > > > > > > > > > > >> > > > > > > > >
> >> > > > > > > > > > > > > > >> > > > > > > > >
> >> > > > > > > > > > > > > > >> > > > > > > > > 2012/6/1 José Luis Cetina <
> >> > > > > > > > > maxtorzito@gmail.com
> >> > > > > > > > > > >
> >> > > > > > > > > > > > > > >> > > > > > > > >
> >> > > > > > > > > > > > > > >> > > > > > > > > > OK, i can create a
> sample,
> >> > but i
> >> > > > use
> >> > > > > > > > > > > > > DataSourceRealm,
> >> > > > > > > > > > > > > > >> are
> >> > > > > > > > > > > > > > >> > you
> >> > > > > > > > > > > > > > >> > > > > gonna
> >> > > > > > > > > > > > > > >> > > > > > > > > > configure your database?
> >> > > > > > > > > > > > > > >> > > > > > > > > >
> >> > > > > > > > > > > > > > >> > > > > > > > > > 2012/5/31 Romain
> >> Manni-Bucau <
> >> > > > > > > > > > > > rmannibucau@gmail.com
> >> > > > > > > > > > > > > >
> >> > > > > > > > > > > > > > >> > > > > > > > > >
> >> > > > > > > > > > > > > > >> > > > > > > > > > > can you have a try in
> an
> >> EJB
> >> > > > > please?
> >> > > > > > > > (just
> >> > > > > > > > > > try
> >> > > > > > > > > > > > to
> >> > > > > > > > > > > > > > add
> >> > > > > > > > > > > > > > >> > > > > @Stateless
> >> > > > > > > > > > > > > > >> > > > > > on
> >> > > > > > > > > > > > > > >> > > > > > > > > your
> >> > > > > > > > > > > > > > >> > > > > > > > > > > managed bean for
> >> instance)
> >> > > > > > > > > > > > > > >> > > > > > > > > > >
> >> > > > > > > > > > > > > > >> > > > > > > > > > > can you share a sample
> >> easy
> >> > to
> >> > > > > run?
> >> > > > > > > > > > > > > > >> > > > > > > > > > >
> >> > > > > > > > > > > > > > >> > > > > > > > > > > - Romain
> >> > > > > > > > > > > > > > >> > > > > > > > > > >
> >> > > > > > > > > > > > > > >> > > > > > > > > > >
> >> > > > > > > > > > > > > > >> > > > > > > > > > > 2012/6/1 José Luis
> >> Cetina <
> >> > > > > > > > > > > maxtorzito@gmail.com
> >> > > > > > > > > > > > >
> >> > > > > > > > > > > > > > >> > > > > > > > > > >
> >> > > > > > > > > > > > > > >> > > > > > > > > > > > Yes, im using JAAS
> >> > > > > > > > > > > > > > >> > > > > > > > > > > >
> >> > > > > > > > > > > > > > >> > > > > > > > > > > > 2012/5/31 Romain
> >> > > Manni-Bucau <
> >> > > > > > > > > > > > > > rmannibucau@gmail.com
> >> > > > > > > > > > > > > > >> >
> >> > > > > > > > > > > > > > >> > > > > > > > > > > >
> >> > > > > > > > > > > > > > >> > > > > > > > > > > > > Hi,
> >> > > > > > > > > > > > > > >> > > > > > > > > > > > >
> >> > > > > > > > > > > > > > >> > > > > > > > > > > > > Do you use jaas?
> >> > > > > > > > > > > > > > >> > > > > > > > > > > > >
> >> > > > > > > > > > > > > > >> > > > > > > > > > > > > - Romain
> >> > > > > > > > > > > > > > >> > > > > > > > > > > > > Le 31 mai 2012
> 20:14,
> >> > > "José
> >> > > > > Luis
> >> > > > > > > > > > Cetina" <
> >> > > > > > > > > > > > > > >> > > > > > maxtorzito@gmail.com
> >> > > > > > > > > > > > > > >> > > > > > > >
> >> > > > > > > > > > > > > > >> > > > > > > > a
> >> > > > > > > > > > > > > > >> > > > > > > > > > > écrit
> >> > > > > > > > > > > > > > >> > > > > > > > > > > > :
> >> > > > > > > > > > > > > > >> > > > > > > > > > > > >
> >> > > > > > > > > > > > > > >> > > > > > > > > > > > > > Hi i have this
> >> > scenario:
> >> > > > > > > > > > > > > > >> > > > > > > > > > > > > >
> >> > > > > > > > > > > > > > >> > > > > > > > > > > > > > I have a page
> >> > > login.xhtml,
> >> > > > > > this
> >> > > > > > > > page
> >> > > > > > > > > > > has a
> >> > > > > > > > > > > > > > >> > > ManagedBean
> >> > > > > > > > > > > > > > >> > > > > > > (@Named)
> >> > > > > > > > > > > > > > >> > > > > > > > > > this
> >> > > > > > > > > > > > > > >> > > > > > > > > > > > > > managedbean use
> the
> >> > > > > > > > > > > > request.login(user,pass)
> >> > > > > > > > > > > > > > >> > method.
> >> > > > > > > > > > > > > > >> > > > > > > > > > > > > >
> >> > > > > > > > > > > > > > >> > > > > > > > > > > > > > When i do this:
> >> > > > > > > > > > > > > > >> > > > > > > > > > > > > >
> >> > > > > > > > > > > > > > >> > > > > > > > > > > > > > managedbean
> class:
> >> > > > > > > > > > > > > > >> > > > > > > > > > > > > >
> >> > > > > > > > > > > > > > >> > > > > > > > > > > > > > @Resource
> >> > > > > > > > > > > > > > >> > > > > > > > > > > > > > private
> EJBContext
> >> > > > > ejbContext;
> >> > > > > > > > > > > > > > >> > > > > > > > > > > > > > .
> >> > > > > > > > > > > > > > >> > > > > > > > > > > > > > .
> >> > > > > > > > > > > > > > >> > > > > > > > > > > > > >
> >> > > request.login(user,pass);
> >> > > > > > > > > > > > > > >> > > > > > > > > > > > > > String name =
> >> > > > > > > > > > > > > > >> > > >
> >> ejbContext.getCallerPrincipal().getName();
> >> > > > > > > > > > > > > > >> > > > > > > > > > > > > >
> >> > > > > > > > > > > > > > >> > > > > > > > > > > > > > I get "guest" as
> my
> >> > user
> >> > > > > name.
> >> > > > > > > > But i
> >> > > > > > > > > > > > expect
> >> > > > > > > > > > > > > > the
> >> > > > > > > > > > > > > > >> > name
> >> > > > > > > > > > > > > > >> > > of
> >> > > > > > > > > > > > > > >> > > > > my
> >> > > > > > > > > > > > > > >> > > > > > > user
> >> > > > > > > > > > > > > > >> > > > > > > > > (of
> >> > > > > > > > > > > > > > >> > > > > > > > > > > > > course
> >> > > > > > > > > > > > > > >> > > > > > > > > > > > > > is not guest)
> >> > > > > > > > > > > > > > >> > > > > > > > > > > > > >
> >> > > > > > > > > > > > > > >> > > > > > > > > > > > > > If the login was
> >> > > > successful
> >> > > > > my
> >> > > > > > > > login
> >> > > > > > > > > > > page
> >> > > > > > > > > > > > > > >> navigate
> >> > > > > > > > > > > > > > >> > to
> >> > > > > > > > > > > > > > >> > > > > other
> >> > > > > > > > > > > > > > >> > > > > > > > page
> >> > > > > > > > > > > > > > >> > > > > > > > > > lets
> >> > > > > > > > > > > > > > >> > > > > > > > > > > > say
> >> > > > > > > > > > > > > > >> > > > > > > > > > > > > > pageb.xhtml
> >> > > > > > > > > > > > > > >> > > > > > > > > > > > > >
> >> > > > > > > > > > > > > > >> > > > > > > > > > > > > > If i create a
> >> > > managedbean
> >> > > > > > > (@Named)
> >> > > > > > > > > for
> >> > > > > > > > > > > > > > >> pageb.xhtml
> >> > > > > > > > > > > > > > >> > > and
> >> > > > > > > > > > > > > > >> > > > in
> >> > > > > > > > > > > > > > >> > > > > > > that
> >> > > > > > > > > > > > > > >> > > > > > > > > > > > > managedbean
> >> > > > > > > > > > > > > > >> > > > > > > > > > > > > > i use again:
> >> > > > > > > > > > > > > > >> > > > > > > > > > > > > > String name =
> >> > > > > > > > > > > > > > >> > > >
> >> ejbContext.getCallerPrincipal().getName();
> >> > > > > > > > > > > > > > >> > > > > > > > > > > > > > then, here i get
> my
> >> > > > > "correct"
> >> > > > > > > name
> >> > > > > > > > > of
> >> > > > > > > > > > > the
> >> > > > > > > > > > > > > user
> >> > > > > > > > > > > > > > >> (not
> >> > > > > > > > > > > > > > >> > > > > guest).
> >> > > > > > > > > > > > > > >> > > > > > > > > > > > > >
> >> > > > > > > > > > > > > > >> > > > > > > > > > > > > > I dont know if
> >> this is
> >> > > the
> >> > > > > > > desire
> >> > > > > > > > > > > > behaviour
> >> > > > > > > > > > > > > or
> >> > > > > > > > > > > > > > >> if
> >> > > > > > > > > > > > > > >> > > this
> >> > > > > > > > > > > > > > >> > > > > > > happend
> >> > > > > > > > > > > > > > >> > > > > > > > > > > because
> >> > > > > > > > > > > > > > >> > > > > > > > > > > > > the
> >> > > > > > > > > > > > > > >> > > > > > > > > > > > > > http request isnt
> >> > > > finished?
> >> > > > > > > > > > > > > > >> > > > > > > > > > > > > >
> >> > > > > > > > > > > > > > >> > > > > > > > > > > > > > other question
> why
> >> if
> >> > i
> >> > > > call
> >> > > > > > > > > > > > > > >> > > > > > > > > > > > > > the
> >> > > > > > > > > > > > > >  ejbContext.getCallerPrincipal().getName();
> >> > > > > > > > > > > > > > >> > > before
> >> > > > > > > > > > > > > > >> > > > > the
> >> > > > > > > > > > > > > > >> > > > > > > > > > > > > request.login()
> >> > > > > > > > > > > > > > >> > > > > > > > > > > > > > method i get
> again
> >> > > > "guest",
> >> > > > > > why
> >> > > > > > > > not
> >> > > > > > > > > > > null?
> >> > > > > > > > > > > > > > >> > > > > > > > > > > > > >
> >> > > > > > > > > > > > > > >> > > > > > > > > > > > > > If this question
> is
> >> > for
> >> > > > > > > > > tomee(openejb)
> >> > > > > > > > > > > or
> >> > > > > > > > > > > > > > >> tomcat?
> >> > > > > > > > > > > > > > >> > > > > > > > > > > > > >
> >> > > > > > > > > > > > > > >> > > > > > > > > > > > > > Thanks
> >> > > > > > > > > > > > > > >> > > > > > > > > > > > > >
> >> > > > > > > > > > > > > > >> > > > > > > > > > > > > >
> >> > > > > > > > > > > > > > >> > > > > > > > > > > > > >
> >> > > > > > > > > > > > > > >> > > > > > > > >
> >> > > > > > > > > > > > > > >> > > >
> >> > > > > > > > > > > > > >
> >> > > > > > > > >
> >> > > >
> -------------------------------------------------------------------
> >> > > > > > > > > > > > > > >> > > > > > > > > > > > > > *SCJA. José Luis
> >> > Cetina*
> >> > > > > > > > > > > > > > >> > > > > > > > > > > > > >
> >> > > > > > > > > > > > > > >> > > > > > > > >
> >> > > > > > > > > > > > > > >> > > >
> >> > > > > > > > > > > > > >
> >> > > > > > > > >
> >> > > >
> -------------------------------------------------------------------
> >> > > > > > > > > > > > > > >> > > > > > > > > > > > > >
> >> > > > > > > > > > > > > > >> > > > > > > > > > > > >
> >> > > > > > > > > > > > > > >> > > > > > > > > > > >
> >> > > > > > > > > > > > > > >> > > > > > > > > > > >
> >> > > > > > > > > > > > > > >> > > > > > > > > > > >
> >> > > > > > > > > > > > > > >> > > > > > > > > > > > --
> >> > > > > > > > > > > > > > >> > > > > > > > > > > >
> >> > > > > > > > > > > > > > >> > > > > > >
> >> > > > > > > > > > > > > > >> >
> >> > > > > > > > > > > >
> >> > > > > > >
> >> > -------------------------------------------------------------------
> >> > > > > > > > > > > > > > >> > > > > > > > > > > > *SCJA. José Luis
> >> Cetina*
> >> > > > > > > > > > > > > > >> > > > > > > > > > > >
> >> > > > > > > > > > > > > > >> > > > > > >
> >> > > > > > > > > > > > > > >> >
> >> > > > > > > > > > > >
> >> > > > > > >
> >> > -------------------------------------------------------------------
> >> > > > > > > > > > > > > > >> > > > > > > > > > > >
> >> > > > > > > > > > > > > > >> > > > > > > > > > >
> >> > > > > > > > > > > > > > >> > > > > > > > > >
> >> > > > > > > > > > > > > > >> > > > > > > > > >
> >> > > > > > > > > > > > > > >> > > > > > > > > >
> >> > > > > > > > > > > > > > >> > > > > > > > > > --
> >> > > > > > > > > > > > > > >> > > > > > > > > >
> >> > > > > > > > > > > > > > >> > > > >
> >> > > > > > > > > > > > > > >>
> >> > > > > > > > > > >
> >> > > > > >
> >> -------------------------------------------------------------------
> >> > > > > > > > > > > > > > >> > > > > > > > > > *SCJA. José Luis Cetina*
> >> > > > > > > > > > > > > > >> > > > > > > > > >
> >> > > > > > > > > > > > > > >> > > > >
> >> > > > > > > > > > > > > > >>
> >> > > > > > > > > > >
> >> > > > > >
> >> -------------------------------------------------------------------
> >> > > > > > > > > > > > > > >> > > > > > > > > >
> >> > > > > > > > > > > > > > >> > > > > > > > >
> >> > > > > > > > > > > > > > >> > > > > > > >
> >> > > > > > > > > > > > > > >> > > > > > > >
> >> > > > > > > > > > > > > > >> > > > > > > >
> >> > > > > > > > > > > > > > >> > > > > > > > --
> >> > > > > > > > > > > > > > >> > > > > > > >
> >> > > > > > > > > > > > > > >> > >
> >> > > > > > > > > > > > >
> >> > > > > > > >
> >> > > -------------------------------------------------------------------
> >> > > > > > > > > > > > > > >> > > > > > > > *SCJA. José Luis Cetina*
> >> > > > > > > > > > > > > > >> > > > > > > >
> >> > > > > > > > > > > > > > >> > >
> >> > > > > > > > > > > > >
> >> > > > > > > >
> >> > > -------------------------------------------------------------------
> >> > > > > > > > > > > > > > >> > > > > > > >
> >> > > > > > > > > > > > > > >> > > > > > >
> >> > > > > > > > > > > > > > >> > > > > >
> >> > > > > > > > > > > > > > >> > > > > >
> >> > > > > > > > > > > > > > >> > > > > >
> >> > > > > > > > > > > > > > >> > > > > > --
> >> > > > > > > > > > > > > > >> > > > > >
> >> > > > > > > > > > > > > > >>
> >> > > > > > > > > > >
> >> > > > > >
> >> -------------------------------------------------------------------
> >> > > > > > > > > > > > > > >> > > > > > *SCJA. José Luis Cetina*
> >> > > > > > > > > > > > > > >> > > > > >
> >> > > > > > > > > > > > > > >>
> >> > > > > > > > > > >
> >> > > > > >
> >> -------------------------------------------------------------------
> >> > > > > > > > > > > > > > >> > > > > >
> >> > > > > > > > > > > > > > >> > > > >
> >> > > > > > > > > > > > > > >> > > >
> >> > > > > > > > > > > > > > >> > > >
> >> > > > > > > > > > > > > > >> > > >
> >> > > > > > > > > > > > > > >> > > > --
> >> > > > > > > > > > > > > > >> > > >
> >> > > > > > > > > > > > > >
> >> > > > > > > > >
> >> > > >
> -------------------------------------------------------------------
> >> > > > > > > > > > > > > > >> > > > *SCJA. José Luis Cetina*
> >> > > > > > > > > > > > > > >> > > >
> >> > > > > > > > > > > > > >
> >> > > > > > > > >
> >> > > >
> -------------------------------------------------------------------
> >> > > > > > > > > > > > > > >> > > >
> >> > > > > > > > > > > > > > >> > >
> >> > > > > > > > > > > > > > >> >
> >> > > > > > > > > > > > > > >> >
> >> > > > > > > > > > > > > > >> >
> >> > > > > > > > > > > > > > >> > --
> >> > > > > > > > > > > > > > >> >
> >> > > > > > > > > > > >
> >> > > > > > >
> >> > -------------------------------------------------------------------
> >> > > > > > > > > > > > > > >> > *SCJA. José Luis Cetina*
> >> > > > > > > > > > > > > > >> >
> >> > > > > > > > > > > >
> >> > > > > > >
> >> > -------------------------------------------------------------------
> >> > > > > > > > > > > > > > >> >
> >> > > > > > > > > > > > > > >>
> >> > > > > > > > > > > > > > >
> >> > > > > > > > > > > > > > >
> >> > > > > > > > > > > > > > >
> >> > > > > > > > > > > > > > > --
> >> > > > > > > > > > > > > > >
> >> > > > > > > > > >
> >> > > > >
> >> -------------------------------------------------------------------
> >> > > > > > > > > > > > > > > *SCJA. José Luis Cetina*
> >> > > > > > > > > > > > > > >
> >> > > > > > > > > >
> >> > > > >
> >> -------------------------------------------------------------------
> >> > > > > > > > > > > > > > >
> >> > > > > > > > > > > > > > >
> >> > > > > > > > > > > > > >
> >> > > > > > > > > > > > > >
> >> > > > > > > > > > > > > > --
> >> > > > > > > > > > > > > >
> >> > > > > > > > >
> >> > > >
> -------------------------------------------------------------------
> >> > > > > > > > > > > > > > *SCJA. José Luis Cetina*
> >> > > > > > > > > > > > > >
> >> > > > > > > > >
> >> > > >
> -------------------------------------------------------------------
> >> > > > > > > > > > > > > >
> >> > > > > > > > > > > > >
> >> > > > > > > > > > > >
> >> > > > > > > > > > > >
> >> > > > > > > > > > > >
> >> > > > > > > > > > > > --
> >> > > > > > > > > > > >
> >> > > > > > >
> >> > -------------------------------------------------------------------
> >> > > > > > > > > > > > *SCJA. José Luis Cetina*
> >> > > > > > > > > > > >
> >> > > > > > >
> >> > -------------------------------------------------------------------
> >> > > > > > > > > > > >
> >> > > > > > > > > > >
> >> > > > > > > > > >
> >> > > > > > > > > >
> >> > > > > > > > > >
> >> > > > > > > > > > --
> >> > > > > > > > > >
> >> > > > >
> >> -------------------------------------------------------------------
> >> > > > > > > > > > *SCJA. José Luis Cetina*
> >> > > > > > > > > >
> >> > > > >
> >> -------------------------------------------------------------------
> >> > > > > > > > > >
> >> > > > > > > > >
> >> > > > > > > >
> >> > > > > > > >
> >> > > > > > > >
> >> > > > > > > > --
> >> > > > > > > >
> >> > > -------------------------------------------------------------------
> >> > > > > > > > *SCJA. José Luis Cetina*
> >> > > > > > > >
> >> > > -------------------------------------------------------------------
> >> > > > > > > >
> >> > > > > > >
> >> > > > > >
> >> > > > > >
> >> > > > > >
> >> > > > > > --
> >> > > > > >
> >> -------------------------------------------------------------------
> >> > > > > > *SCJA. José Luis Cetina*
> >> > > > > >
> >> -------------------------------------------------------------------
> >> > > > > >
> >> > > > >
> >> > > >
> >> > > >
> >> > > >
> >> > > > --
> >> > > >
> -------------------------------------------------------------------
> >> > > > *SCJA. José Luis Cetina*
> >> > > >
> -------------------------------------------------------------------
> >> > > >
> >> > >
> >> >
> >> >
> >> >
> >> > --
> >> > -------------------------------------------------------------------
> >> > *SCJA. José Luis Cetina*
> >> > -------------------------------------------------------------------
> >> >
> >>
> >
> >
> >
> > --
> > -------------------------------------------------------------------
> > *SCJA. José Luis Cetina*
> > -------------------------------------------------------------------
> >
> >
>
>
> --
> -------------------------------------------------------------------
> *SCJA. José Luis Cetina*
> -------------------------------------------------------------------
>

Re: Guest user

Posted by José Luis Cetina <ma...@gmail.com>.
Hi Romain, well i have an other problem and i think is related to this same
reported issue.

We talked about if i login using request.login(user,pass) method and if the
credentials and login was successfull then when i get the user i get a
guess user:

request.login(user,pass);
String name = ejbContext.getCallerPrincipal().getName();

Ok, then this was fixed, and its ok now, now returns the valid user.

But now if i do this

@Inject
private MySessionBean mySessionBean;

public String login(){
   request.login(user,pass);
   mySessionBean.setName("My name is JOE");
   //then i do a redirect here
 return "next_page";
}

now in my managedbean of my next_page.xhtml i had:

@Named
public MyNextPageMBean implements Serializable{

@Inject
private MySessionBean mySessionBean;

 @PostConstruc
  public void test(){
    mySessionBean.getName(); <---HERE I GET NULL ALWAYS
   }

}


SessionBean:

import java.io.Serializable;
import javax.enterprise.context.SessionScoped;
import javax.inject.Named;

@Named
@SessionScoped
public class MySessionBean implements Serializable{

    private String name;

    public MySessionBean() {

    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }
}



As you can see i get null, mi login its ok, but when i saved something in
my sessionbean when i try to retrive what i saved before, i always get
null, like if i never set the value (and of course i did it) but this ONLY
HAPPEND when i try to set the any value just before request.login, if i set
the value in the second bean  like

mySessionBean.setName("My name is JOE"); then in other's page i can get the
value without any problem, i do a lot of test and the problem is when i
only set the values (in my session bean) just before request.login, then i
associated this with the "guest user problem" as you sayed this was
happening because the user was "recognized" only after the first request.

Again, is this the expected behaviour? it seem buggy

Im using:  apache-tomee-1.1.0-20120612.040829-22-webprofile


2012/6/1 José Luis Cetina <ma...@gmail.com>

> ok
>
>
> 2012/6/1 Romain Manni-Bucau <rm...@gmail.com>
>
>> deployment in progress:
>> http://ci.apache.org/builders/openejb-trunk-deploy/builds/378
>>
>> - Romain
>>
>>
>> 2012/6/1 José Luis Cetina <ma...@gmail.com>
>>
>> > Ok, in what tomee build this will be available?
>> >
>> > 2012/5/31 Romain Manni-Bucau <rm...@gmail.com>
>> >
>> > > yep
>> > >
>> > > just commited, a new commit will come where this class will
>> automatically
>> > > be added normally
>> > >
>> > > - Romain
>> > >
>> > >
>> > > 2012/6/1 José Luis Cetina <ma...@gmail.com>
>> > >
>> > > > im getting a ClassNotFound
>> > > >
>> > > > Caused by: java.lang.ClassNotFoundException:
>> > > > org.apache.tomee.catalina.TomEERealm
>> > > >
>> > > > 2012/5/31 Romain Manni-Bucau <rm...@gmail.com>
>> > > >
>> > > > > my sample is working, too late to add test but manually it works
>> > > > >
>> > > > > so i guess it should work for you
>> > > > >
>> > > > > the question now is should we add it automatically?
>> > > > >
>> > > > > - Romain
>> > > > >
>> > > > >
>> > > > > 2012/6/1 José Luis Cetina <ma...@gmail.com>
>> > > > >
>> > > > > > Oooh great, with this i can get the principal user in the first
>> > > > request?
>> > > > > or
>> > > > > > this is something that you gonna fix?
>> > > > > >
>> > > > > > 2012/5/31 Romain Manni-Bucau <rm...@gmail.com>
>> > > > > >
>> > > > > > > that's brand new ;)
>> > > > > > >
>> > > > > > > just added it, it mainly delegate to the real realm but add
>> the
>> > > > > principal
>> > > > > > > info to openejb/tomee security service which is used in
>> > ejbcontext
>> > > > impl
>> > > > > > (to
>> > > > > > > make it short)
>> > > > > > >
>> > > > > > > - Romain
>> > > > > > >
>> > > > > > >
>> > > > > > > 2012/6/1 José Luis Cetina <ma...@gmail.com>
>> > > > > > >
>> > > > > > > > I have this in my context.xml
>> > > > > > > >
>> > > > > > > > <Realm className="MyExtendedDataSourceRealm"
>> > > > > > > >  dataSourceName="MyDataSource"
>> > > > > > > > digest="SHA-256"
>> > > > > > > > encodePassword="Base64"
>> > > > > > > > queryRealmRolesUser="SELECT rol FROM xxxx WHERE user=?"
>> > > > > > > > queryRealmUsers="SELECT pass FROM xxx WHERE user=?"/>
>> > > > > > > >
>> > > > > > > > As you can see i extend the datasource realm, i have this
>> realm
>> > > > > config
>> > > > > > in
>> > > > > > > > the context.xml in my webapp (not context.xml TomEE).
>> > > > > > > >
>> > > > > > > > But, as i can see in your example, you surround your realm
>> with
>> > > > > > > TomEERealm,
>> > > > > > > > if this necessary?. I didn't know this
>> > > > > > > >
>> > > > > > > >
>> > > > > > > >
>> > > > > > > > 2012/5/31 Romain Manni-Bucau <rm...@gmail.com>
>> > > > > > > >
>> > > > > > > > > in my test i used:
>> > > > > > > > >
>> > > > > > > > >    <Realm
>> className="org.apache.tomee.catalina.TomEERealm">
>> > > > > > > > >        <Realm
>> className="org.apache.catalina.realm.JAASRealm"
>> > > > > > > > > appName="PropertiesLoginModule"
>> > > > > > > > >
>> > > > > > > > >
>> > > > > > > > >
>> > > > > > > >
>> > > > > > >
>> > > > > >
>> > > > >
>> > > >
>> > >
>> >
>>  userClassNames="org.apache.openejb.core.security.AbstractSecurityService$User"
>> > > > > > > > >
>> > > > > > > > >
>> > > > > > > > >
>> > > > > > > >
>> > > > > > >
>> > > > > >
>> > > > >
>> > > >
>> > >
>> >
>>  roleClassNames="org.apache.openejb.core.security.AbstractSecurityService$Group">
>> > > > > > > > >        </Realm>
>> > > > > > > > >       </Realm>
>> > > > > > > > >
>> > > > > > > > > but i guess you can replace the jaasrealm by your dsrealm
>> > > > > > > > >
>> > > > > > > > > - Romain
>> > > > > > > > >
>> > > > > > > > >
>> > > > > > > > > 2012/6/1 José Luis Cetina <ma...@gmail.com>
>> > > > > > > > >
>> > > > > > > > > > Yes, it seems buggy.
>> > > > > > > > > >
>> > > > > > > > > > Where i have to replace?
>> > > > > > > > > >
>> > > > > > > > > > Remember im using DataSourceRealm
>> > > > > > > > > >
>> > > > > > > > > > 2012/5/31 Romain Manni-Bucau <rm...@gmail.com>
>> > > > > > > > > >
>> > > > > > > > > > > this is the current status,
>> > > > > > > > > > >
>> > > > > > > > > > > but IMO it is buggy,
>> > > > > > > > > > >
>> > > > > > > > > > > i'll commit soon a TomEEJAASRealm to make it working
>> > > (replace
>> > > > > > > > JAASRealm
>> > > > > > > > > > in
>> > > > > > > > > > > the conf)
>> > > > > > > > > > >
>> > > > > > > > > > > - Romain
>> > > > > > > > > > >
>> > > > > > > > > > >
>> > > > > > > > > > > 2012/6/1 José Luis Cetina <ma...@gmail.com>
>> > > > > > > > > > >
>> > > > > > > > > > > > i think we are getting confused.
>> > > > > > > > > > > >
>> > > > > > > > > > > > If i resume all, this what i asked (the final of the
>> > > first
>> > > > > > post)
>> > > > > > > > > > > >
>> > > > > > > > > > > > I dont know if this is the desire behavior or if
>> this
>> > > > happend
>> > > > > > > > becase
>> > > > > > > > > > the
>> > > > > > > > > > > > httr request isnt finished?
>> > > > > > > > > > > > Then you answer me:
>> > > > > > > > > > > >
>> > > > > > > > > > > > in fact info from ejbcontext are taken in our
>> > > > securitymodule
>> > > > > > > > > > > >
>> > > > > > > > > > > > in tomee we set/unset it from a valve so at the
>> > > > beginning/end
>> > > > > > of
>> > > > > > > > the
>> > > > > > > > > > > > request...all between is currently ignored so when
>> you
>> > > log
>> > > > > you
>> > > > > > > need
>> > > > > > > > > > > another
>> > > > > > > > > > > > request to get the updated information (from the
>> tomcat
>> > > > > realm)
>> > > > > > > > > > > >
>> > > > > > > > > > > > "so when you log you need another request to get the
>> > > > updated
>> > > > > > > > > > information
>> > > > > > > > > > > > (from the tomcat realm)
>> > > > > > > > > > > >
>> > > > > > > > > > > > Then i get guest because is the desire behaviour,
>> after
>> > > the
>> > > > > > first
>> > > > > > > > > > > request i
>> > > > > > > > > > > > can get the user i expected.
>> > > > > > > > > > > >
>> > > > > > > > > > > > Then i resume, this is the default behaviour, and
>> works
>> > > but
>> > > > > you
>> > > > > > > > need
>> > > > > > > > > a
>> > > > > > > > > > > > second request.
>> > > > > > > > > > > >
>> > > > > > > > > > > >
>> > > > > > > > > > > >
>> > > > > > > > > > > > 2012/5/31 Romain Manni-Bucau <rmannibucau@gmail.com
>> >
>> > > > > > > > > > > >
>> > > > > > > > > > > > > i think it should work
>> > > > > > > > > > > > >
>> > > > > > > > > > > > > - Romain
>> > > > > > > > > > > > >
>> > > > > > > > > > > > >
>> > > > > > > > > > > > > 2012/6/1 José Luis Cetina <ma...@gmail.com>
>> > > > > > > > > > > > >
>> > > > > > > > > > > > > > I mean this:
>> > > > > > > > > > > > > >
>> > > > > > > > > > > > > > I dont know if this is the desire behaviour or
>> if
>> > > this
>> > > > > > > happend
>> > > > > > > > > > > because
>> > > > > > > > > > > > > the
>> > > > > > > > > > > > > > http request isnt finished?
>> > > > > > > > > > > > > >
>> > > > > > > > > > > > > >
>> > > > > > > > > > > > > >
>> > > > > > > > > > > > > > 2012/5/31 José Luis Cetina <
>> maxtorzito@gmail.com>
>> > > > > > > > > > > > > >
>> > > > > > > > > > > > > > > Ok, the what i asked is correct??
>> > > > > > > > > > > > > > >
>> > > > > > > > > > > > > > > "I dont know if this is the desire behaviour
>> or
>> > if
>> > > > this
>> > > > > > > > happend
>> > > > > > > > > > > > because
>> > > > > > > > > > > > > > > the http request isnt finished?"
>> > > > > > > > > > > > > > >
>> > > > > > > > > > > > > > > 2012/5/31 Romain Manni-Bucau <
>> > > rmannibucau@gmail.com>
>> > > > > > > > > > > > > > >
>> > > > > > > > > > > > > > >> ok,
>> > > > > > > > > > > > > > >>
>> > > > > > > > > > > > > > >> in fact info from ejbcontext are taken in our
>> > > > > > > securitymodule
>> > > > > > > > > > > > > > >>
>> > > > > > > > > > > > > > >> in tomee we set/unset it from a valve so at
>> the
>> > > > > > > > beginning/end
>> > > > > > > > > of
>> > > > > > > > > > > the
>> > > > > > > > > > > > > > >> request...all between is currently ignored so
>> > when
>> > > > you
>> > > > > > log
>> > > > > > > > you
>> > > > > > > > > > > need
>> > > > > > > > > > > > > > >> another
>> > > > > > > > > > > > > > >> request to get the updated information (from
>> the
>> > > > > tomcat
>> > > > > > > > realm)
>> > > > > > > > > > > > > > >>
>> > > > > > > > > > > > > > >> - Romain
>> > > > > > > > > > > > > > >>
>> > > > > > > > > > > > > > >>
>> > > > > > > > > > > > > > >> 2012/6/1 José Luis Cetina <
>> maxtorzito@gmail.com
>> > >
>> > > > > > > > > > > > > > >>
>> > > > > > > > > > > > > > >> > Yes, it work
>> > > > > > > > > > > > > > >> >
>> > > > > > > > > > > > > > >> > 1) Login (form login) using DataSourceRealm
>> > > > > > > > > > > > > > >> >
>> > > > > > > > > > > > > > >> >
>> > > > > > > > > > > > > > >> > 2) Redirect to page2 from my managedbean
>> > > > > > > > > > > > > > >> >
>> > > > > > > > > > > > > > >> > 2012/5/31 Romain Manni-Bucau <
>> > > > rmannibucau@gmail.com
>> > > > > >
>> > > > > > > > > > > > > > >> >
>> > > > > > > > > > > > > > >> > > so you mean using the flow i described
>> > before
>> > > it
>> > > > > > > works?
>> > > > > > > > > > > (sorry,
>> > > > > > > > > > > > > just
>> > > > > > > > > > > > > > >> to
>> > > > > > > > > > > > > > >> > be
>> > > > > > > > > > > > > > >> > > sure to understand)
>> > > > > > > > > > > > > > >> > >
>> > > > > > > > > > > > > > >> > > - Romain
>> > > > > > > > > > > > > > >> > >
>> > > > > > > > > > > > > > >> > >
>> > > > > > > > > > > > > > >> > > 2012/6/1 José Luis Cetina <
>> > > maxtorzito@gmail.com
>> > > > >
>> > > > > > > > > > > > > > >> > >
>> > > > > > > > > > > > > > >> > > > Hi i can login and i can navigate
>> > (redirect)
>> > > > to
>> > > > > my
>> > > > > > > > other
>> > > > > > > > > > > page,
>> > > > > > > > > > > > > > but i
>> > > > > > > > > > > > > > >> > dont
>> > > > > > > > > > > > > > >> > > > know why im getting guest user in the
>> > login
>> > > > > mbean,
>> > > > > > > > after
>> > > > > > > > > > > that
>> > > > > > > > > > > > in
>> > > > > > > > > > > > > > >> other
>> > > > > > > > > > > > > > >> > > > mbean  i get my "real" user.
>> > > > > > > > > > > > > > >> > > >
>> > > > > > > > > > > > > > >> > > >
>> > > > > > > > > > > > > > >> > > > 2012/5/31 Romain Manni-Bucau <
>> > > > > > rmannibucau@gmail.com
>> > > > > > > >
>> > > > > > > > > > > > > > >> > > >
>> > > > > > > > > > > > > > >> > > > > maybe
>> > > > > > > > > > > > > > >> > > > >
>> > > > > > > > > > > > > > >> > > >
>> > > > > > > > > > > > > > >> > >
>> > > > > > > > > > > > > > >> >
>> > > > > > > > > > > > > > >>
>> > > > > > > > > > > > > >
>> > > > > > > > > > > > >
>> > > > > > > > > > > >
>> > > > > > > > > > >
>> > > > > > > > > >
>> > > > > > > > >
>> > > > > > > >
>> > > > > > >
>> > > > > >
>> > > > >
>> > > >
>> > >
>> >
>> http://rmannibucau.wordpress.com/2012/05/09/tomee-and-its-ssh-connector/but
>> > > > > > > > > > > > > > >> > > > > it uses properties file, it just
>> need a
>> > > > custom
>> > > > > > > login
>> > > > > > > > > > > module
>> > > > > > > > > > > > > > >> > > > implementation
>> > > > > > > > > > > > > > >> > > > > to use a db.
>> > > > > > > > > > > > > > >> > > > >
>> > > > > > > > > > > > > > >> > > > > well,
>> > > > > > > > > > > > > > >> > > > >
>> > > > > > > > > > > > > > >> > > > > before can you test it please?
>> > > > > > > > > > > > > > >> > > > > 1) login
>> > > > > > > > > > > > > > >> > > > > 2) redirect to your page using your
>> bean
>> > > > > > > > > > > > > > >> > > > >
>> > > > > > > > > > > > > > >> > > > > - Romain
>> > > > > > > > > > > > > > >> > > > >
>> > > > > > > > > > > > > > >> > > > >
>> > > > > > > > > > > > > > >> > > > > 2012/6/1 José Luis Cetina <
>> > > > > maxtorzito@gmail.com
>> > > > > > >
>> > > > > > > > > > > > > > >> > > > >
>> > > > > > > > > > > > > > >> > > > > > I have to read and know how to use
>> > > this, i
>> > > > > > > always
>> > > > > > > > > use
>> > > > > > > > > > > > > > >> DataSource or
>> > > > > > > > > > > > > > >> > > > > > JDBCRealm. (with glassfish).
>> > > > > > > > > > > > > > >> > > > > > im reading now, do you have
>> something
>> > > for
>> > > > a
>> > > > > > > > > > quickstart?
>> > > > > > > > > > > > for
>> > > > > > > > > > > > > > >> share
>> > > > > > > > > > > > > > >> > me
>> > > > > > > > > > > > > > >> > > > > >
>> > > > > > > > > > > > > > >> > > > > > 2012/5/31 Romain Manni-Bucau <
>> > > > > > > > rmannibucau@gmail.com
>> > > > > > > > > >
>> > > > > > > > > > > > > > >> > > > > >
>> > > > > > > > > > > > > > >> > > > > > > having your password in a db is
>> not
>> > an
>> > > > > issue
>> > > > > > > > but i
>> > > > > > > > > > > think
>> > > > > > > > > > > > > you
>> > > > > > > > > > > > > > >> > should
>> > > > > > > > > > > > > > >> > > > > > > use
>> > > org.apache.catalina.realm.JAASRealm
>> > > > > > > > > > > > > > >> > > > > > >
>> > > > > > > > > > > > > > >> > > > > > > for instance:
>> > > > > > > > > > > > > > >> > > > > > >
>> > > > > > > > > > > > > > >> > > > > > >     <Realm
>> > > > > > > > > > > > className="org.apache.catalina.realm.JAASRealm"
>> > > > > > > > > > > > > > >> > > > > > > appName="MyDBLoginModule"
>> > > > > > > > > > > > > > >> > > > > > >
>> > > > > > > > > > > > > > >> > > > > > >
>> > > > > > > > > > > > > > >> > > > > > >
>> > > > > > > > > > > > > > >> > > > > >
>> > > > > > > > > > > > > > >> > > > >
>> > > > > > > > > > > > > > >> > > >
>> > > > > > > > > > > > > > >> > >
>> > > > > > > > > > > > > > >> >
>> > > > > > > > > > > > > > >>
>> > > > > > > > > > > > > >
>> > > > > > > > > > > > >
>> > > > > > > > > > > >
>> > > > > > > > > > >
>> > > > > > > > > >
>> > > > > > > > >
>> > > > > > > >
>> > > > > > >
>> > > > > >
>> > > > >
>> > > >
>> > >
>> >
>>  userClassNames="org.apache.openejb.core.security.AbstractSecurityService$User"
>> > > > > > > > > > > > > > >> > > > > > >
>> > > > > > > > > > > > > > >> > > > > > >
>> > > > > > > > > > > > > > >> > > > > > >
>> > > > > > > > > > > > > > >> > > > > >
>> > > > > > > > > > > > > > >> > > > >
>> > > > > > > > > > > > > > >> > > >
>> > > > > > > > > > > > > > >> > >
>> > > > > > > > > > > > > > >> >
>> > > > > > > > > > > > > > >>
>> > > > > > > > > > > > > >
>> > > > > > > > > > > > >
>> > > > > > > > > > > >
>> > > > > > > > > > >
>> > > > > > > > > >
>> > > > > > > > >
>> > > > > > > >
>> > > > > > >
>> > > > > >
>> > > > >
>> > > >
>> > >
>> >
>>  roleClassNames="org.apache.openejb.core.security.AbstractSecurityService$Group">
>> > > > > > > > > > > > > > >> > > > > > >      </Realm>
>> > > > > > > > > > > > > > >> > > > > > >
>> > > > > > > > > > > > > > >> > > > > > > so simply implement a custom
>> > > LoginModule
>> > > > > > > instead
>> > > > > > > > > of
>> > > > > > > > > > a
>> > > > > > > > > > > > > realm
>> > > > > > > > > > > > > > >> > > > > > >
>> > > > > > > > > > > > > > >> > > > > > > wdyt?
>> > > > > > > > > > > > > > >> > > > > > >
>> > > > > > > > > > > > > > >> > > > > > > - Romain
>> > > > > > > > > > > > > > >> > > > > > >
>> > > > > > > > > > > > > > >> > > > > > >
>> > > > > > > > > > > > > > >> > > > > > > 2012/6/1 José Luis Cetina <
>> > > > > > > maxtorzito@gmail.com
>> > > > > > > > >
>> > > > > > > > > > > > > > >> > > > > > >
>> > > > > > > > > > > > > > >> > > > > > > > Sorry, i use DataSourceRealm, i
>> > have
>> > > > my
>> > > > > > > > > > > > user/pass/roles
>> > > > > > > > > > > > > in
>> > > > > > > > > > > > > > >> the
>> > > > > > > > > > > > > > >> > > DB.
>> > > > > > > > > > > > > > >> > > > > > > >
>> > > > > > > > > > > > > > >> > > > > > > >
>> > > > > > > > > > > > > > >> > > > > > > >
>> > > > > > > > > > > > > > >> > > > > > > > 2012/5/31 Romain Manni-Bucau <
>> > > > > > > > > > rmannibucau@gmail.com
>> > > > > > > > > > > >
>> > > > > > > > > > > > > > >> > > > > > > >
>> > > > > > > > > > > > > > >> > > > > > > > > can't you do it with an
>> embedded
>> > > > one?
>> > > > > > > > > > > > > > >> > > > > > > > >
>> > > > > > > > > > > > > > >> > > > > > > > > well DataSourceRealm doesn't
>> use
>> > > > JAAS
>> > > > > by
>> > > > > > > > > > default i
>> > > > > > > > > > > > > > think,
>> > > > > > > > > > > > > > >> > maybe
>> > > > > > > > > > > > > > >> > > > > > that's
>> > > > > > > > > > > > > > >> > > > > > > > the
>> > > > > > > > > > > > > > >> > > > > > > > > issue
>> > > > > > > > > > > > > > >> > > > > > > > >
>> > > > > > > > > > > > > > >> > > > > > > > > - Romain
>> > > > > > > > > > > > > > >> > > > > > > > >
>> > > > > > > > > > > > > > >> > > > > > > > >
>> > > > > > > > > > > > > > >> > > > > > > > > 2012/6/1 José Luis Cetina <
>> > > > > > > > > maxtorzito@gmail.com
>> > > > > > > > > > >
>> > > > > > > > > > > > > > >> > > > > > > > >
>> > > > > > > > > > > > > > >> > > > > > > > > > OK, i can create a sample,
>> > but i
>> > > > use
>> > > > > > > > > > > > > DataSourceRealm,
>> > > > > > > > > > > > > > >> are
>> > > > > > > > > > > > > > >> > you
>> > > > > > > > > > > > > > >> > > > > gonna
>> > > > > > > > > > > > > > >> > > > > > > > > > configure your database?
>> > > > > > > > > > > > > > >> > > > > > > > > >
>> > > > > > > > > > > > > > >> > > > > > > > > > 2012/5/31 Romain
>> Manni-Bucau <
>> > > > > > > > > > > > rmannibucau@gmail.com
>> > > > > > > > > > > > > >
>> > > > > > > > > > > > > > >> > > > > > > > > >
>> > > > > > > > > > > > > > >> > > > > > > > > > > can you have a try in an
>> EJB
>> > > > > please?
>> > > > > > > > (just
>> > > > > > > > > > try
>> > > > > > > > > > > > to
>> > > > > > > > > > > > > > add
>> > > > > > > > > > > > > > >> > > > > @Stateless
>> > > > > > > > > > > > > > >> > > > > > on
>> > > > > > > > > > > > > > >> > > > > > > > > your
>> > > > > > > > > > > > > > >> > > > > > > > > > > managed bean for
>> instance)
>> > > > > > > > > > > > > > >> > > > > > > > > > >
>> > > > > > > > > > > > > > >> > > > > > > > > > > can you share a sample
>> easy
>> > to
>> > > > > run?
>> > > > > > > > > > > > > > >> > > > > > > > > > >
>> > > > > > > > > > > > > > >> > > > > > > > > > > - Romain
>> > > > > > > > > > > > > > >> > > > > > > > > > >
>> > > > > > > > > > > > > > >> > > > > > > > > > >
>> > > > > > > > > > > > > > >> > > > > > > > > > > 2012/6/1 José Luis
>> Cetina <
>> > > > > > > > > > > maxtorzito@gmail.com
>> > > > > > > > > > > > >
>> > > > > > > > > > > > > > >> > > > > > > > > > >
>> > > > > > > > > > > > > > >> > > > > > > > > > > > Yes, im using JAAS
>> > > > > > > > > > > > > > >> > > > > > > > > > > >
>> > > > > > > > > > > > > > >> > > > > > > > > > > > 2012/5/31 Romain
>> > > Manni-Bucau <
>> > > > > > > > > > > > > > rmannibucau@gmail.com
>> > > > > > > > > > > > > > >> >
>> > > > > > > > > > > > > > >> > > > > > > > > > > >
>> > > > > > > > > > > > > > >> > > > > > > > > > > > > Hi,
>> > > > > > > > > > > > > > >> > > > > > > > > > > > >
>> > > > > > > > > > > > > > >> > > > > > > > > > > > > Do you use jaas?
>> > > > > > > > > > > > > > >> > > > > > > > > > > > >
>> > > > > > > > > > > > > > >> > > > > > > > > > > > > - Romain
>> > > > > > > > > > > > > > >> > > > > > > > > > > > > Le 31 mai 2012 20:14,
>> > > "José
>> > > > > Luis
>> > > > > > > > > > Cetina" <
>> > > > > > > > > > > > > > >> > > > > > maxtorzito@gmail.com
>> > > > > > > > > > > > > > >> > > > > > > >
>> > > > > > > > > > > > > > >> > > > > > > > a
>> > > > > > > > > > > > > > >> > > > > > > > > > > écrit
>> > > > > > > > > > > > > > >> > > > > > > > > > > > :
>> > > > > > > > > > > > > > >> > > > > > > > > > > > >
>> > > > > > > > > > > > > > >> > > > > > > > > > > > > > Hi i have this
>> > scenario:
>> > > > > > > > > > > > > > >> > > > > > > > > > > > > >
>> > > > > > > > > > > > > > >> > > > > > > > > > > > > > I have a page
>> > > login.xhtml,
>> > > > > > this
>> > > > > > > > page
>> > > > > > > > > > > has a
>> > > > > > > > > > > > > > >> > > ManagedBean
>> > > > > > > > > > > > > > >> > > > > > > (@Named)
>> > > > > > > > > > > > > > >> > > > > > > > > > this
>> > > > > > > > > > > > > > >> > > > > > > > > > > > > > managedbean use the
>> > > > > > > > > > > > request.login(user,pass)
>> > > > > > > > > > > > > > >> > method.
>> > > > > > > > > > > > > > >> > > > > > > > > > > > > >
>> > > > > > > > > > > > > > >> > > > > > > > > > > > > > When i do this:
>> > > > > > > > > > > > > > >> > > > > > > > > > > > > >
>> > > > > > > > > > > > > > >> > > > > > > > > > > > > > managedbean class:
>> > > > > > > > > > > > > > >> > > > > > > > > > > > > >
>> > > > > > > > > > > > > > >> > > > > > > > > > > > > > @Resource
>> > > > > > > > > > > > > > >> > > > > > > > > > > > > > private EJBContext
>> > > > > ejbContext;
>> > > > > > > > > > > > > > >> > > > > > > > > > > > > > .
>> > > > > > > > > > > > > > >> > > > > > > > > > > > > > .
>> > > > > > > > > > > > > > >> > > > > > > > > > > > > >
>> > > request.login(user,pass);
>> > > > > > > > > > > > > > >> > > > > > > > > > > > > > String name =
>> > > > > > > > > > > > > > >> > > >
>> ejbContext.getCallerPrincipal().getName();
>> > > > > > > > > > > > > > >> > > > > > > > > > > > > >
>> > > > > > > > > > > > > > >> > > > > > > > > > > > > > I get "guest" as my
>> > user
>> > > > > name.
>> > > > > > > > But i
>> > > > > > > > > > > > expect
>> > > > > > > > > > > > > > the
>> > > > > > > > > > > > > > >> > name
>> > > > > > > > > > > > > > >> > > of
>> > > > > > > > > > > > > > >> > > > > my
>> > > > > > > > > > > > > > >> > > > > > > user
>> > > > > > > > > > > > > > >> > > > > > > > > (of
>> > > > > > > > > > > > > > >> > > > > > > > > > > > > course
>> > > > > > > > > > > > > > >> > > > > > > > > > > > > > is not guest)
>> > > > > > > > > > > > > > >> > > > > > > > > > > > > >
>> > > > > > > > > > > > > > >> > > > > > > > > > > > > > If the login was
>> > > > successful
>> > > > > my
>> > > > > > > > login
>> > > > > > > > > > > page
>> > > > > > > > > > > > > > >> navigate
>> > > > > > > > > > > > > > >> > to
>> > > > > > > > > > > > > > >> > > > > other
>> > > > > > > > > > > > > > >> > > > > > > > page
>> > > > > > > > > > > > > > >> > > > > > > > > > lets
>> > > > > > > > > > > > > > >> > > > > > > > > > > > say
>> > > > > > > > > > > > > > >> > > > > > > > > > > > > > pageb.xhtml
>> > > > > > > > > > > > > > >> > > > > > > > > > > > > >
>> > > > > > > > > > > > > > >> > > > > > > > > > > > > > If i create a
>> > > managedbean
>> > > > > > > (@Named)
>> > > > > > > > > for
>> > > > > > > > > > > > > > >> pageb.xhtml
>> > > > > > > > > > > > > > >> > > and
>> > > > > > > > > > > > > > >> > > > in
>> > > > > > > > > > > > > > >> > > > > > > that
>> > > > > > > > > > > > > > >> > > > > > > > > > > > > managedbean
>> > > > > > > > > > > > > > >> > > > > > > > > > > > > > i use again:
>> > > > > > > > > > > > > > >> > > > > > > > > > > > > > String name =
>> > > > > > > > > > > > > > >> > > >
>> ejbContext.getCallerPrincipal().getName();
>> > > > > > > > > > > > > > >> > > > > > > > > > > > > > then, here i get my
>> > > > > "correct"
>> > > > > > > name
>> > > > > > > > > of
>> > > > > > > > > > > the
>> > > > > > > > > > > > > user
>> > > > > > > > > > > > > > >> (not
>> > > > > > > > > > > > > > >> > > > > guest).
>> > > > > > > > > > > > > > >> > > > > > > > > > > > > >
>> > > > > > > > > > > > > > >> > > > > > > > > > > > > > I dont know if
>> this is
>> > > the
>> > > > > > > desire
>> > > > > > > > > > > > behaviour
>> > > > > > > > > > > > > or
>> > > > > > > > > > > > > > >> if
>> > > > > > > > > > > > > > >> > > this
>> > > > > > > > > > > > > > >> > > > > > > happend
>> > > > > > > > > > > > > > >> > > > > > > > > > > because
>> > > > > > > > > > > > > > >> > > > > > > > > > > > > the
>> > > > > > > > > > > > > > >> > > > > > > > > > > > > > http request isnt
>> > > > finished?
>> > > > > > > > > > > > > > >> > > > > > > > > > > > > >
>> > > > > > > > > > > > > > >> > > > > > > > > > > > > > other question why
>> if
>> > i
>> > > > call
>> > > > > > > > > > > > > > >> > > > > > > > > > > > > > the
>> > > > > > > > > > > > > >  ejbContext.getCallerPrincipal().getName();
>> > > > > > > > > > > > > > >> > > before
>> > > > > > > > > > > > > > >> > > > > the
>> > > > > > > > > > > > > > >> > > > > > > > > > > > > request.login()
>> > > > > > > > > > > > > > >> > > > > > > > > > > > > > method i get again
>> > > > "guest",
>> > > > > > why
>> > > > > > > > not
>> > > > > > > > > > > null?
>> > > > > > > > > > > > > > >> > > > > > > > > > > > > >
>> > > > > > > > > > > > > > >> > > > > > > > > > > > > > If this question is
>> > for
>> > > > > > > > > tomee(openejb)
>> > > > > > > > > > > or
>> > > > > > > > > > > > > > >> tomcat?
>> > > > > > > > > > > > > > >> > > > > > > > > > > > > >
>> > > > > > > > > > > > > > >> > > > > > > > > > > > > > Thanks
>> > > > > > > > > > > > > > >> > > > > > > > > > > > > >
>> > > > > > > > > > > > > > >> > > > > > > > > > > > > >
>> > > > > > > > > > > > > > >> > > > > > > > > > > > > >
>> > > > > > > > > > > > > > >> > > > > > > > >
>> > > > > > > > > > > > > > >> > > >
>> > > > > > > > > > > > > >
>> > > > > > > > >
>> > > > -------------------------------------------------------------------
>> > > > > > > > > > > > > > >> > > > > > > > > > > > > > *SCJA. José Luis
>> > Cetina*
>> > > > > > > > > > > > > > >> > > > > > > > > > > > > >
>> > > > > > > > > > > > > > >> > > > > > > > >
>> > > > > > > > > > > > > > >> > > >
>> > > > > > > > > > > > > >
>> > > > > > > > >
>> > > > -------------------------------------------------------------------
>> > > > > > > > > > > > > > >> > > > > > > > > > > > > >
>> > > > > > > > > > > > > > >> > > > > > > > > > > > >
>> > > > > > > > > > > > > > >> > > > > > > > > > > >
>> > > > > > > > > > > > > > >> > > > > > > > > > > >
>> > > > > > > > > > > > > > >> > > > > > > > > > > >
>> > > > > > > > > > > > > > >> > > > > > > > > > > > --
>> > > > > > > > > > > > > > >> > > > > > > > > > > >
>> > > > > > > > > > > > > > >> > > > > > >
>> > > > > > > > > > > > > > >> >
>> > > > > > > > > > > >
>> > > > > > >
>> > -------------------------------------------------------------------
>> > > > > > > > > > > > > > >> > > > > > > > > > > > *SCJA. José Luis
>> Cetina*
>> > > > > > > > > > > > > > >> > > > > > > > > > > >
>> > > > > > > > > > > > > > >> > > > > > >
>> > > > > > > > > > > > > > >> >
>> > > > > > > > > > > >
>> > > > > > >
>> > -------------------------------------------------------------------
>> > > > > > > > > > > > > > >> > > > > > > > > > > >
>> > > > > > > > > > > > > > >> > > > > > > > > > >
>> > > > > > > > > > > > > > >> > > > > > > > > >
>> > > > > > > > > > > > > > >> > > > > > > > > >
>> > > > > > > > > > > > > > >> > > > > > > > > >
>> > > > > > > > > > > > > > >> > > > > > > > > > --
>> > > > > > > > > > > > > > >> > > > > > > > > >
>> > > > > > > > > > > > > > >> > > > >
>> > > > > > > > > > > > > > >>
>> > > > > > > > > > >
>> > > > > >
>> -------------------------------------------------------------------
>> > > > > > > > > > > > > > >> > > > > > > > > > *SCJA. José Luis Cetina*
>> > > > > > > > > > > > > > >> > > > > > > > > >
>> > > > > > > > > > > > > > >> > > > >
>> > > > > > > > > > > > > > >>
>> > > > > > > > > > >
>> > > > > >
>> -------------------------------------------------------------------
>> > > > > > > > > > > > > > >> > > > > > > > > >
>> > > > > > > > > > > > > > >> > > > > > > > >
>> > > > > > > > > > > > > > >> > > > > > > >
>> > > > > > > > > > > > > > >> > > > > > > >
>> > > > > > > > > > > > > > >> > > > > > > >
>> > > > > > > > > > > > > > >> > > > > > > > --
>> > > > > > > > > > > > > > >> > > > > > > >
>> > > > > > > > > > > > > > >> > >
>> > > > > > > > > > > > >
>> > > > > > > >
>> > > -------------------------------------------------------------------
>> > > > > > > > > > > > > > >> > > > > > > > *SCJA. José Luis Cetina*
>> > > > > > > > > > > > > > >> > > > > > > >
>> > > > > > > > > > > > > > >> > >
>> > > > > > > > > > > > >
>> > > > > > > >
>> > > -------------------------------------------------------------------
>> > > > > > > > > > > > > > >> > > > > > > >
>> > > > > > > > > > > > > > >> > > > > > >
>> > > > > > > > > > > > > > >> > > > > >
>> > > > > > > > > > > > > > >> > > > > >
>> > > > > > > > > > > > > > >> > > > > >
>> > > > > > > > > > > > > > >> > > > > > --
>> > > > > > > > > > > > > > >> > > > > >
>> > > > > > > > > > > > > > >>
>> > > > > > > > > > >
>> > > > > >
>> -------------------------------------------------------------------
>> > > > > > > > > > > > > > >> > > > > > *SCJA. José Luis Cetina*
>> > > > > > > > > > > > > > >> > > > > >
>> > > > > > > > > > > > > > >>
>> > > > > > > > > > >
>> > > > > >
>> -------------------------------------------------------------------
>> > > > > > > > > > > > > > >> > > > > >
>> > > > > > > > > > > > > > >> > > > >
>> > > > > > > > > > > > > > >> > > >
>> > > > > > > > > > > > > > >> > > >
>> > > > > > > > > > > > > > >> > > >
>> > > > > > > > > > > > > > >> > > > --
>> > > > > > > > > > > > > > >> > > >
>> > > > > > > > > > > > > >
>> > > > > > > > >
>> > > > -------------------------------------------------------------------
>> > > > > > > > > > > > > > >> > > > *SCJA. José Luis Cetina*
>> > > > > > > > > > > > > > >> > > >
>> > > > > > > > > > > > > >
>> > > > > > > > >
>> > > > -------------------------------------------------------------------
>> > > > > > > > > > > > > > >> > > >
>> > > > > > > > > > > > > > >> > >
>> > > > > > > > > > > > > > >> >
>> > > > > > > > > > > > > > >> >
>> > > > > > > > > > > > > > >> >
>> > > > > > > > > > > > > > >> > --
>> > > > > > > > > > > > > > >> >
>> > > > > > > > > > > >
>> > > > > > >
>> > -------------------------------------------------------------------
>> > > > > > > > > > > > > > >> > *SCJA. José Luis Cetina*
>> > > > > > > > > > > > > > >> >
>> > > > > > > > > > > >
>> > > > > > >
>> > -------------------------------------------------------------------
>> > > > > > > > > > > > > > >> >
>> > > > > > > > > > > > > > >>
>> > > > > > > > > > > > > > >
>> > > > > > > > > > > > > > >
>> > > > > > > > > > > > > > >
>> > > > > > > > > > > > > > > --
>> > > > > > > > > > > > > > >
>> > > > > > > > > >
>> > > > >
>> -------------------------------------------------------------------
>> > > > > > > > > > > > > > > *SCJA. José Luis Cetina*
>> > > > > > > > > > > > > > >
>> > > > > > > > > >
>> > > > >
>> -------------------------------------------------------------------
>> > > > > > > > > > > > > > >
>> > > > > > > > > > > > > > >
>> > > > > > > > > > > > > >
>> > > > > > > > > > > > > >
>> > > > > > > > > > > > > > --
>> > > > > > > > > > > > > >
>> > > > > > > > >
>> > > > -------------------------------------------------------------------
>> > > > > > > > > > > > > > *SCJA. José Luis Cetina*
>> > > > > > > > > > > > > >
>> > > > > > > > >
>> > > > -------------------------------------------------------------------
>> > > > > > > > > > > > > >
>> > > > > > > > > > > > >
>> > > > > > > > > > > >
>> > > > > > > > > > > >
>> > > > > > > > > > > >
>> > > > > > > > > > > > --
>> > > > > > > > > > > >
>> > > > > > >
>> > -------------------------------------------------------------------
>> > > > > > > > > > > > *SCJA. José Luis Cetina*
>> > > > > > > > > > > >
>> > > > > > >
>> > -------------------------------------------------------------------
>> > > > > > > > > > > >
>> > > > > > > > > > >
>> > > > > > > > > >
>> > > > > > > > > >
>> > > > > > > > > >
>> > > > > > > > > > --
>> > > > > > > > > >
>> > > > >
>> -------------------------------------------------------------------
>> > > > > > > > > > *SCJA. José Luis Cetina*
>> > > > > > > > > >
>> > > > >
>> -------------------------------------------------------------------
>> > > > > > > > > >
>> > > > > > > > >
>> > > > > > > >
>> > > > > > > >
>> > > > > > > >
>> > > > > > > > --
>> > > > > > > >
>> > > -------------------------------------------------------------------
>> > > > > > > > *SCJA. José Luis Cetina*
>> > > > > > > >
>> > > -------------------------------------------------------------------
>> > > > > > > >
>> > > > > > >
>> > > > > >
>> > > > > >
>> > > > > >
>> > > > > > --
>> > > > > >
>> -------------------------------------------------------------------
>> > > > > > *SCJA. José Luis Cetina*
>> > > > > >
>> -------------------------------------------------------------------
>> > > > > >
>> > > > >
>> > > >
>> > > >
>> > > >
>> > > > --
>> > > > -------------------------------------------------------------------
>> > > > *SCJA. José Luis Cetina*
>> > > > -------------------------------------------------------------------
>> > > >
>> > >
>> >
>> >
>> >
>> > --
>> > -------------------------------------------------------------------
>> > *SCJA. José Luis Cetina*
>> > -------------------------------------------------------------------
>> >
>>
>
>
>
> --
> -------------------------------------------------------------------
> *SCJA. José Luis Cetina*
> -------------------------------------------------------------------
>
>


-- 
-------------------------------------------------------------------
*SCJA. José Luis Cetina*
-------------------------------------------------------------------

Re: Guest user

Posted by José Luis Cetina <ma...@gmail.com>.
ok

2012/6/1 Romain Manni-Bucau <rm...@gmail.com>

> deployment in progress:
> http://ci.apache.org/builders/openejb-trunk-deploy/builds/378
>
> - Romain
>
>
> 2012/6/1 José Luis Cetina <ma...@gmail.com>
>
> > Ok, in what tomee build this will be available?
> >
> > 2012/5/31 Romain Manni-Bucau <rm...@gmail.com>
> >
> > > yep
> > >
> > > just commited, a new commit will come where this class will
> automatically
> > > be added normally
> > >
> > > - Romain
> > >
> > >
> > > 2012/6/1 José Luis Cetina <ma...@gmail.com>
> > >
> > > > im getting a ClassNotFound
> > > >
> > > > Caused by: java.lang.ClassNotFoundException:
> > > > org.apache.tomee.catalina.TomEERealm
> > > >
> > > > 2012/5/31 Romain Manni-Bucau <rm...@gmail.com>
> > > >
> > > > > my sample is working, too late to add test but manually it works
> > > > >
> > > > > so i guess it should work for you
> > > > >
> > > > > the question now is should we add it automatically?
> > > > >
> > > > > - Romain
> > > > >
> > > > >
> > > > > 2012/6/1 José Luis Cetina <ma...@gmail.com>
> > > > >
> > > > > > Oooh great, with this i can get the principal user in the first
> > > > request?
> > > > > or
> > > > > > this is something that you gonna fix?
> > > > > >
> > > > > > 2012/5/31 Romain Manni-Bucau <rm...@gmail.com>
> > > > > >
> > > > > > > that's brand new ;)
> > > > > > >
> > > > > > > just added it, it mainly delegate to the real realm but add the
> > > > > principal
> > > > > > > info to openejb/tomee security service which is used in
> > ejbcontext
> > > > impl
> > > > > > (to
> > > > > > > make it short)
> > > > > > >
> > > > > > > - Romain
> > > > > > >
> > > > > > >
> > > > > > > 2012/6/1 José Luis Cetina <ma...@gmail.com>
> > > > > > >
> > > > > > > > I have this in my context.xml
> > > > > > > >
> > > > > > > > <Realm className="MyExtendedDataSourceRealm"
> > > > > > > >  dataSourceName="MyDataSource"
> > > > > > > > digest="SHA-256"
> > > > > > > > encodePassword="Base64"
> > > > > > > > queryRealmRolesUser="SELECT rol FROM xxxx WHERE user=?"
> > > > > > > > queryRealmUsers="SELECT pass FROM xxx WHERE user=?"/>
> > > > > > > >
> > > > > > > > As you can see i extend the datasource realm, i have this
> realm
> > > > > config
> > > > > > in
> > > > > > > > the context.xml in my webapp (not context.xml TomEE).
> > > > > > > >
> > > > > > > > But, as i can see in your example, you surround your realm
> with
> > > > > > > TomEERealm,
> > > > > > > > if this necessary?. I didn't know this
> > > > > > > >
> > > > > > > >
> > > > > > > >
> > > > > > > > 2012/5/31 Romain Manni-Bucau <rm...@gmail.com>
> > > > > > > >
> > > > > > > > > in my test i used:
> > > > > > > > >
> > > > > > > > >    <Realm className="org.apache.tomee.catalina.TomEERealm">
> > > > > > > > >        <Realm
> className="org.apache.catalina.realm.JAASRealm"
> > > > > > > > > appName="PropertiesLoginModule"
> > > > > > > > >
> > > > > > > > >
> > > > > > > > >
> > > > > > > >
> > > > > > >
> > > > > >
> > > > >
> > > >
> > >
> >
>  userClassNames="org.apache.openejb.core.security.AbstractSecurityService$User"
> > > > > > > > >
> > > > > > > > >
> > > > > > > > >
> > > > > > > >
> > > > > > >
> > > > > >
> > > > >
> > > >
> > >
> >
>  roleClassNames="org.apache.openejb.core.security.AbstractSecurityService$Group">
> > > > > > > > >        </Realm>
> > > > > > > > >       </Realm>
> > > > > > > > >
> > > > > > > > > but i guess you can replace the jaasrealm by your dsrealm
> > > > > > > > >
> > > > > > > > > - Romain
> > > > > > > > >
> > > > > > > > >
> > > > > > > > > 2012/6/1 José Luis Cetina <ma...@gmail.com>
> > > > > > > > >
> > > > > > > > > > Yes, it seems buggy.
> > > > > > > > > >
> > > > > > > > > > Where i have to replace?
> > > > > > > > > >
> > > > > > > > > > Remember im using DataSourceRealm
> > > > > > > > > >
> > > > > > > > > > 2012/5/31 Romain Manni-Bucau <rm...@gmail.com>
> > > > > > > > > >
> > > > > > > > > > > this is the current status,
> > > > > > > > > > >
> > > > > > > > > > > but IMO it is buggy,
> > > > > > > > > > >
> > > > > > > > > > > i'll commit soon a TomEEJAASRealm to make it working
> > > (replace
> > > > > > > > JAASRealm
> > > > > > > > > > in
> > > > > > > > > > > the conf)
> > > > > > > > > > >
> > > > > > > > > > > - Romain
> > > > > > > > > > >
> > > > > > > > > > >
> > > > > > > > > > > 2012/6/1 José Luis Cetina <ma...@gmail.com>
> > > > > > > > > > >
> > > > > > > > > > > > i think we are getting confused.
> > > > > > > > > > > >
> > > > > > > > > > > > If i resume all, this what i asked (the final of the
> > > first
> > > > > > post)
> > > > > > > > > > > >
> > > > > > > > > > > > I dont know if this is the desire behavior or if this
> > > > happend
> > > > > > > > becase
> > > > > > > > > > the
> > > > > > > > > > > > httr request isnt finished?
> > > > > > > > > > > > Then you answer me:
> > > > > > > > > > > >
> > > > > > > > > > > > in fact info from ejbcontext are taken in our
> > > > securitymodule
> > > > > > > > > > > >
> > > > > > > > > > > > in tomee we set/unset it from a valve so at the
> > > > beginning/end
> > > > > > of
> > > > > > > > the
> > > > > > > > > > > > request...all between is currently ignored so when
> you
> > > log
> > > > > you
> > > > > > > need
> > > > > > > > > > > another
> > > > > > > > > > > > request to get the updated information (from the
> tomcat
> > > > > realm)
> > > > > > > > > > > >
> > > > > > > > > > > > "so when you log you need another request to get the
> > > > updated
> > > > > > > > > > information
> > > > > > > > > > > > (from the tomcat realm)
> > > > > > > > > > > >
> > > > > > > > > > > > Then i get guest because is the desire behaviour,
> after
> > > the
> > > > > > first
> > > > > > > > > > > request i
> > > > > > > > > > > > can get the user i expected.
> > > > > > > > > > > >
> > > > > > > > > > > > Then i resume, this is the default behaviour, and
> works
> > > but
> > > > > you
> > > > > > > > need
> > > > > > > > > a
> > > > > > > > > > > > second request.
> > > > > > > > > > > >
> > > > > > > > > > > >
> > > > > > > > > > > >
> > > > > > > > > > > > 2012/5/31 Romain Manni-Bucau <rm...@gmail.com>
> > > > > > > > > > > >
> > > > > > > > > > > > > i think it should work
> > > > > > > > > > > > >
> > > > > > > > > > > > > - Romain
> > > > > > > > > > > > >
> > > > > > > > > > > > >
> > > > > > > > > > > > > 2012/6/1 José Luis Cetina <ma...@gmail.com>
> > > > > > > > > > > > >
> > > > > > > > > > > > > > I mean this:
> > > > > > > > > > > > > >
> > > > > > > > > > > > > > I dont know if this is the desire behaviour or if
> > > this
> > > > > > > happend
> > > > > > > > > > > because
> > > > > > > > > > > > > the
> > > > > > > > > > > > > > http request isnt finished?
> > > > > > > > > > > > > >
> > > > > > > > > > > > > >
> > > > > > > > > > > > > >
> > > > > > > > > > > > > > 2012/5/31 José Luis Cetina <maxtorzito@gmail.com
> >
> > > > > > > > > > > > > >
> > > > > > > > > > > > > > > Ok, the what i asked is correct??
> > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > "I dont know if this is the desire behaviour or
> > if
> > > > this
> > > > > > > > happend
> > > > > > > > > > > > because
> > > > > > > > > > > > > > > the http request isnt finished?"
> > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > 2012/5/31 Romain Manni-Bucau <
> > > rmannibucau@gmail.com>
> > > > > > > > > > > > > > >
> > > > > > > > > > > > > > >> ok,
> > > > > > > > > > > > > > >>
> > > > > > > > > > > > > > >> in fact info from ejbcontext are taken in our
> > > > > > > securitymodule
> > > > > > > > > > > > > > >>
> > > > > > > > > > > > > > >> in tomee we set/unset it from a valve so at
> the
> > > > > > > > beginning/end
> > > > > > > > > of
> > > > > > > > > > > the
> > > > > > > > > > > > > > >> request...all between is currently ignored so
> > when
> > > > you
> > > > > > log
> > > > > > > > you
> > > > > > > > > > > need
> > > > > > > > > > > > > > >> another
> > > > > > > > > > > > > > >> request to get the updated information (from
> the
> > > > > tomcat
> > > > > > > > realm)
> > > > > > > > > > > > > > >>
> > > > > > > > > > > > > > >> - Romain
> > > > > > > > > > > > > > >>
> > > > > > > > > > > > > > >>
> > > > > > > > > > > > > > >> 2012/6/1 José Luis Cetina <
> maxtorzito@gmail.com
> > >
> > > > > > > > > > > > > > >>
> > > > > > > > > > > > > > >> > Yes, it work
> > > > > > > > > > > > > > >> >
> > > > > > > > > > > > > > >> > 1) Login (form login) using DataSourceRealm
> > > > > > > > > > > > > > >> >
> > > > > > > > > > > > > > >> >
> > > > > > > > > > > > > > >> > 2) Redirect to page2 from my managedbean
> > > > > > > > > > > > > > >> >
> > > > > > > > > > > > > > >> > 2012/5/31 Romain Manni-Bucau <
> > > > rmannibucau@gmail.com
> > > > > >
> > > > > > > > > > > > > > >> >
> > > > > > > > > > > > > > >> > > so you mean using the flow i described
> > before
> > > it
> > > > > > > works?
> > > > > > > > > > > (sorry,
> > > > > > > > > > > > > just
> > > > > > > > > > > > > > >> to
> > > > > > > > > > > > > > >> > be
> > > > > > > > > > > > > > >> > > sure to understand)
> > > > > > > > > > > > > > >> > >
> > > > > > > > > > > > > > >> > > - Romain
> > > > > > > > > > > > > > >> > >
> > > > > > > > > > > > > > >> > >
> > > > > > > > > > > > > > >> > > 2012/6/1 José Luis Cetina <
> > > maxtorzito@gmail.com
> > > > >
> > > > > > > > > > > > > > >> > >
> > > > > > > > > > > > > > >> > > > Hi i can login and i can navigate
> > (redirect)
> > > > to
> > > > > my
> > > > > > > > other
> > > > > > > > > > > page,
> > > > > > > > > > > > > > but i
> > > > > > > > > > > > > > >> > dont
> > > > > > > > > > > > > > >> > > > know why im getting guest user in the
> > login
> > > > > mbean,
> > > > > > > > after
> > > > > > > > > > > that
> > > > > > > > > > > > in
> > > > > > > > > > > > > > >> other
> > > > > > > > > > > > > > >> > > > mbean  i get my "real" user.
> > > > > > > > > > > > > > >> > > >
> > > > > > > > > > > > > > >> > > >
> > > > > > > > > > > > > > >> > > > 2012/5/31 Romain Manni-Bucau <
> > > > > > rmannibucau@gmail.com
> > > > > > > >
> > > > > > > > > > > > > > >> > > >
> > > > > > > > > > > > > > >> > > > > maybe
> > > > > > > > > > > > > > >> > > > >
> > > > > > > > > > > > > > >> > > >
> > > > > > > > > > > > > > >> > >
> > > > > > > > > > > > > > >> >
> > > > > > > > > > > > > > >>
> > > > > > > > > > > > > >
> > > > > > > > > > > > >
> > > > > > > > > > > >
> > > > > > > > > > >
> > > > > > > > > >
> > > > > > > > >
> > > > > > > >
> > > > > > >
> > > > > >
> > > > >
> > > >
> > >
> >
> http://rmannibucau.wordpress.com/2012/05/09/tomee-and-its-ssh-connector/but
> > > > > > > > > > > > > > >> > > > > it uses properties file, it just need
> a
> > > > custom
> > > > > > > login
> > > > > > > > > > > module
> > > > > > > > > > > > > > >> > > > implementation
> > > > > > > > > > > > > > >> > > > > to use a db.
> > > > > > > > > > > > > > >> > > > >
> > > > > > > > > > > > > > >> > > > > well,
> > > > > > > > > > > > > > >> > > > >
> > > > > > > > > > > > > > >> > > > > before can you test it please?
> > > > > > > > > > > > > > >> > > > > 1) login
> > > > > > > > > > > > > > >> > > > > 2) redirect to your page using your
> bean
> > > > > > > > > > > > > > >> > > > >
> > > > > > > > > > > > > > >> > > > > - Romain
> > > > > > > > > > > > > > >> > > > >
> > > > > > > > > > > > > > >> > > > >
> > > > > > > > > > > > > > >> > > > > 2012/6/1 José Luis Cetina <
> > > > > maxtorzito@gmail.com
> > > > > > >
> > > > > > > > > > > > > > >> > > > >
> > > > > > > > > > > > > > >> > > > > > I have to read and know how to use
> > > this, i
> > > > > > > always
> > > > > > > > > use
> > > > > > > > > > > > > > >> DataSource or
> > > > > > > > > > > > > > >> > > > > > JDBCRealm. (with glassfish).
> > > > > > > > > > > > > > >> > > > > > im reading now, do you have
> something
> > > for
> > > > a
> > > > > > > > > > quickstart?
> > > > > > > > > > > > for
> > > > > > > > > > > > > > >> share
> > > > > > > > > > > > > > >> > me
> > > > > > > > > > > > > > >> > > > > >
> > > > > > > > > > > > > > >> > > > > > 2012/5/31 Romain Manni-Bucau <
> > > > > > > > rmannibucau@gmail.com
> > > > > > > > > >
> > > > > > > > > > > > > > >> > > > > >
> > > > > > > > > > > > > > >> > > > > > > having your password in a db is
> not
> > an
> > > > > issue
> > > > > > > > but i
> > > > > > > > > > > think
> > > > > > > > > > > > > you
> > > > > > > > > > > > > > >> > should
> > > > > > > > > > > > > > >> > > > > > > use
> > > org.apache.catalina.realm.JAASRealm
> > > > > > > > > > > > > > >> > > > > > >
> > > > > > > > > > > > > > >> > > > > > > for instance:
> > > > > > > > > > > > > > >> > > > > > >
> > > > > > > > > > > > > > >> > > > > > >     <Realm
> > > > > > > > > > > > className="org.apache.catalina.realm.JAASRealm"
> > > > > > > > > > > > > > >> > > > > > > appName="MyDBLoginModule"
> > > > > > > > > > > > > > >> > > > > > >
> > > > > > > > > > > > > > >> > > > > > >
> > > > > > > > > > > > > > >> > > > > > >
> > > > > > > > > > > > > > >> > > > > >
> > > > > > > > > > > > > > >> > > > >
> > > > > > > > > > > > > > >> > > >
> > > > > > > > > > > > > > >> > >
> > > > > > > > > > > > > > >> >
> > > > > > > > > > > > > > >>
> > > > > > > > > > > > > >
> > > > > > > > > > > > >
> > > > > > > > > > > >
> > > > > > > > > > >
> > > > > > > > > >
> > > > > > > > >
> > > > > > > >
> > > > > > >
> > > > > >
> > > > >
> > > >
> > >
> >
>  userClassNames="org.apache.openejb.core.security.AbstractSecurityService$User"
> > > > > > > > > > > > > > >> > > > > > >
> > > > > > > > > > > > > > >> > > > > > >
> > > > > > > > > > > > > > >> > > > > > >
> > > > > > > > > > > > > > >> > > > > >
> > > > > > > > > > > > > > >> > > > >
> > > > > > > > > > > > > > >> > > >
> > > > > > > > > > > > > > >> > >
> > > > > > > > > > > > > > >> >
> > > > > > > > > > > > > > >>
> > > > > > > > > > > > > >
> > > > > > > > > > > > >
> > > > > > > > > > > >
> > > > > > > > > > >
> > > > > > > > > >
> > > > > > > > >
> > > > > > > >
> > > > > > >
> > > > > >
> > > > >
> > > >
> > >
> >
>  roleClassNames="org.apache.openejb.core.security.AbstractSecurityService$Group">
> > > > > > > > > > > > > > >> > > > > > >      </Realm>
> > > > > > > > > > > > > > >> > > > > > >
> > > > > > > > > > > > > > >> > > > > > > so simply implement a custom
> > > LoginModule
> > > > > > > instead
> > > > > > > > > of
> > > > > > > > > > a
> > > > > > > > > > > > > realm
> > > > > > > > > > > > > > >> > > > > > >
> > > > > > > > > > > > > > >> > > > > > > wdyt?
> > > > > > > > > > > > > > >> > > > > > >
> > > > > > > > > > > > > > >> > > > > > > - Romain
> > > > > > > > > > > > > > >> > > > > > >
> > > > > > > > > > > > > > >> > > > > > >
> > > > > > > > > > > > > > >> > > > > > > 2012/6/1 José Luis Cetina <
> > > > > > > maxtorzito@gmail.com
> > > > > > > > >
> > > > > > > > > > > > > > >> > > > > > >
> > > > > > > > > > > > > > >> > > > > > > > Sorry, i use DataSourceRealm, i
> > have
> > > > my
> > > > > > > > > > > > user/pass/roles
> > > > > > > > > > > > > in
> > > > > > > > > > > > > > >> the
> > > > > > > > > > > > > > >> > > DB.
> > > > > > > > > > > > > > >> > > > > > > >
> > > > > > > > > > > > > > >> > > > > > > >
> > > > > > > > > > > > > > >> > > > > > > >
> > > > > > > > > > > > > > >> > > > > > > > 2012/5/31 Romain Manni-Bucau <
> > > > > > > > > > rmannibucau@gmail.com
> > > > > > > > > > > >
> > > > > > > > > > > > > > >> > > > > > > >
> > > > > > > > > > > > > > >> > > > > > > > > can't you do it with an
> embedded
> > > > one?
> > > > > > > > > > > > > > >> > > > > > > > >
> > > > > > > > > > > > > > >> > > > > > > > > well DataSourceRealm doesn't
> use
> > > > JAAS
> > > > > by
> > > > > > > > > > default i
> > > > > > > > > > > > > > think,
> > > > > > > > > > > > > > >> > maybe
> > > > > > > > > > > > > > >> > > > > > that's
> > > > > > > > > > > > > > >> > > > > > > > the
> > > > > > > > > > > > > > >> > > > > > > > > issue
> > > > > > > > > > > > > > >> > > > > > > > >
> > > > > > > > > > > > > > >> > > > > > > > > - Romain
> > > > > > > > > > > > > > >> > > > > > > > >
> > > > > > > > > > > > > > >> > > > > > > > >
> > > > > > > > > > > > > > >> > > > > > > > > 2012/6/1 José Luis Cetina <
> > > > > > > > > maxtorzito@gmail.com
> > > > > > > > > > >
> > > > > > > > > > > > > > >> > > > > > > > >
> > > > > > > > > > > > > > >> > > > > > > > > > OK, i can create a sample,
> > but i
> > > > use
> > > > > > > > > > > > > DataSourceRealm,
> > > > > > > > > > > > > > >> are
> > > > > > > > > > > > > > >> > you
> > > > > > > > > > > > > > >> > > > > gonna
> > > > > > > > > > > > > > >> > > > > > > > > > configure your database?
> > > > > > > > > > > > > > >> > > > > > > > > >
> > > > > > > > > > > > > > >> > > > > > > > > > 2012/5/31 Romain
> Manni-Bucau <
> > > > > > > > > > > > rmannibucau@gmail.com
> > > > > > > > > > > > > >
> > > > > > > > > > > > > > >> > > > > > > > > >
> > > > > > > > > > > > > > >> > > > > > > > > > > can you have a try in an
> EJB
> > > > > please?
> > > > > > > > (just
> > > > > > > > > > try
> > > > > > > > > > > > to
> > > > > > > > > > > > > > add
> > > > > > > > > > > > > > >> > > > > @Stateless
> > > > > > > > > > > > > > >> > > > > > on
> > > > > > > > > > > > > > >> > > > > > > > > your
> > > > > > > > > > > > > > >> > > > > > > > > > > managed bean for instance)
> > > > > > > > > > > > > > >> > > > > > > > > > >
> > > > > > > > > > > > > > >> > > > > > > > > > > can you share a sample
> easy
> > to
> > > > > run?
> > > > > > > > > > > > > > >> > > > > > > > > > >
> > > > > > > > > > > > > > >> > > > > > > > > > > - Romain
> > > > > > > > > > > > > > >> > > > > > > > > > >
> > > > > > > > > > > > > > >> > > > > > > > > > >
> > > > > > > > > > > > > > >> > > > > > > > > > > 2012/6/1 José Luis Cetina
> <
> > > > > > > > > > > maxtorzito@gmail.com
> > > > > > > > > > > > >
> > > > > > > > > > > > > > >> > > > > > > > > > >
> > > > > > > > > > > > > > >> > > > > > > > > > > > Yes, im using JAAS
> > > > > > > > > > > > > > >> > > > > > > > > > > >
> > > > > > > > > > > > > > >> > > > > > > > > > > > 2012/5/31 Romain
> > > Manni-Bucau <
> > > > > > > > > > > > > > rmannibucau@gmail.com
> > > > > > > > > > > > > > >> >
> > > > > > > > > > > > > > >> > > > > > > > > > > >
> > > > > > > > > > > > > > >> > > > > > > > > > > > > Hi,
> > > > > > > > > > > > > > >> > > > > > > > > > > > >
> > > > > > > > > > > > > > >> > > > > > > > > > > > > Do you use jaas?
> > > > > > > > > > > > > > >> > > > > > > > > > > > >
> > > > > > > > > > > > > > >> > > > > > > > > > > > > - Romain
> > > > > > > > > > > > > > >> > > > > > > > > > > > > Le 31 mai 2012 20:14,
> > > "José
> > > > > Luis
> > > > > > > > > > Cetina" <
> > > > > > > > > > > > > > >> > > > > > maxtorzito@gmail.com
> > > > > > > > > > > > > > >> > > > > > > >
> > > > > > > > > > > > > > >> > > > > > > > a
> > > > > > > > > > > > > > >> > > > > > > > > > > écrit
> > > > > > > > > > > > > > >> > > > > > > > > > > > :
> > > > > > > > > > > > > > >> > > > > > > > > > > > >
> > > > > > > > > > > > > > >> > > > > > > > > > > > > > Hi i have this
> > scenario:
> > > > > > > > > > > > > > >> > > > > > > > > > > > > >
> > > > > > > > > > > > > > >> > > > > > > > > > > > > > I have a page
> > > login.xhtml,
> > > > > > this
> > > > > > > > page
> > > > > > > > > > > has a
> > > > > > > > > > > > > > >> > > ManagedBean
> > > > > > > > > > > > > > >> > > > > > > (@Named)
> > > > > > > > > > > > > > >> > > > > > > > > > this
> > > > > > > > > > > > > > >> > > > > > > > > > > > > > managedbean use the
> > > > > > > > > > > > request.login(user,pass)
> > > > > > > > > > > > > > >> > method.
> > > > > > > > > > > > > > >> > > > > > > > > > > > > >
> > > > > > > > > > > > > > >> > > > > > > > > > > > > > When i do this:
> > > > > > > > > > > > > > >> > > > > > > > > > > > > >
> > > > > > > > > > > > > > >> > > > > > > > > > > > > > managedbean class:
> > > > > > > > > > > > > > >> > > > > > > > > > > > > >
> > > > > > > > > > > > > > >> > > > > > > > > > > > > > @Resource
> > > > > > > > > > > > > > >> > > > > > > > > > > > > > private EJBContext
> > > > > ejbContext;
> > > > > > > > > > > > > > >> > > > > > > > > > > > > > .
> > > > > > > > > > > > > > >> > > > > > > > > > > > > > .
> > > > > > > > > > > > > > >> > > > > > > > > > > > > >
> > > request.login(user,pass);
> > > > > > > > > > > > > > >> > > > > > > > > > > > > > String name =
> > > > > > > > > > > > > > >> > > >
> ejbContext.getCallerPrincipal().getName();
> > > > > > > > > > > > > > >> > > > > > > > > > > > > >
> > > > > > > > > > > > > > >> > > > > > > > > > > > > > I get "guest" as my
> > user
> > > > > name.
> > > > > > > > But i
> > > > > > > > > > > > expect
> > > > > > > > > > > > > > the
> > > > > > > > > > > > > > >> > name
> > > > > > > > > > > > > > >> > > of
> > > > > > > > > > > > > > >> > > > > my
> > > > > > > > > > > > > > >> > > > > > > user
> > > > > > > > > > > > > > >> > > > > > > > > (of
> > > > > > > > > > > > > > >> > > > > > > > > > > > > course
> > > > > > > > > > > > > > >> > > > > > > > > > > > > > is not guest)
> > > > > > > > > > > > > > >> > > > > > > > > > > > > >
> > > > > > > > > > > > > > >> > > > > > > > > > > > > > If the login was
> > > > successful
> > > > > my
> > > > > > > > login
> > > > > > > > > > > page
> > > > > > > > > > > > > > >> navigate
> > > > > > > > > > > > > > >> > to
> > > > > > > > > > > > > > >> > > > > other
> > > > > > > > > > > > > > >> > > > > > > > page
> > > > > > > > > > > > > > >> > > > > > > > > > lets
> > > > > > > > > > > > > > >> > > > > > > > > > > > say
> > > > > > > > > > > > > > >> > > > > > > > > > > > > > pageb.xhtml
> > > > > > > > > > > > > > >> > > > > > > > > > > > > >
> > > > > > > > > > > > > > >> > > > > > > > > > > > > > If i create a
> > > managedbean
> > > > > > > (@Named)
> > > > > > > > > for
> > > > > > > > > > > > > > >> pageb.xhtml
> > > > > > > > > > > > > > >> > > and
> > > > > > > > > > > > > > >> > > > in
> > > > > > > > > > > > > > >> > > > > > > that
> > > > > > > > > > > > > > >> > > > > > > > > > > > > managedbean
> > > > > > > > > > > > > > >> > > > > > > > > > > > > > i use again:
> > > > > > > > > > > > > > >> > > > > > > > > > > > > > String name =
> > > > > > > > > > > > > > >> > > >
> ejbContext.getCallerPrincipal().getName();
> > > > > > > > > > > > > > >> > > > > > > > > > > > > > then, here i get my
> > > > > "correct"
> > > > > > > name
> > > > > > > > > of
> > > > > > > > > > > the
> > > > > > > > > > > > > user
> > > > > > > > > > > > > > >> (not
> > > > > > > > > > > > > > >> > > > > guest).
> > > > > > > > > > > > > > >> > > > > > > > > > > > > >
> > > > > > > > > > > > > > >> > > > > > > > > > > > > > I dont know if this
> is
> > > the
> > > > > > > desire
> > > > > > > > > > > > behaviour
> > > > > > > > > > > > > or
> > > > > > > > > > > > > > >> if
> > > > > > > > > > > > > > >> > > this
> > > > > > > > > > > > > > >> > > > > > > happend
> > > > > > > > > > > > > > >> > > > > > > > > > > because
> > > > > > > > > > > > > > >> > > > > > > > > > > > > the
> > > > > > > > > > > > > > >> > > > > > > > > > > > > > http request isnt
> > > > finished?
> > > > > > > > > > > > > > >> > > > > > > > > > > > > >
> > > > > > > > > > > > > > >> > > > > > > > > > > > > > other question why
> if
> > i
> > > > call
> > > > > > > > > > > > > > >> > > > > > > > > > > > > > the
> > > > > > > > > > > > > >  ejbContext.getCallerPrincipal().getName();
> > > > > > > > > > > > > > >> > > before
> > > > > > > > > > > > > > >> > > > > the
> > > > > > > > > > > > > > >> > > > > > > > > > > > > request.login()
> > > > > > > > > > > > > > >> > > > > > > > > > > > > > method i get again
> > > > "guest",
> > > > > > why
> > > > > > > > not
> > > > > > > > > > > null?
> > > > > > > > > > > > > > >> > > > > > > > > > > > > >
> > > > > > > > > > > > > > >> > > > > > > > > > > > > > If this question is
> > for
> > > > > > > > > tomee(openejb)
> > > > > > > > > > > or
> > > > > > > > > > > > > > >> tomcat?
> > > > > > > > > > > > > > >> > > > > > > > > > > > > >
> > > > > > > > > > > > > > >> > > > > > > > > > > > > > Thanks
> > > > > > > > > > > > > > >> > > > > > > > > > > > > >
> > > > > > > > > > > > > > >> > > > > > > > > > > > > >
> > > > > > > > > > > > > > >> > > > > > > > > > > > > >
> > > > > > > > > > > > > > >> > > > > > > > >
> > > > > > > > > > > > > > >> > > >
> > > > > > > > > > > > > >
> > > > > > > > >
> > > > -------------------------------------------------------------------
> > > > > > > > > > > > > > >> > > > > > > > > > > > > > *SCJA. José Luis
> > Cetina*
> > > > > > > > > > > > > > >> > > > > > > > > > > > > >
> > > > > > > > > > > > > > >> > > > > > > > >
> > > > > > > > > > > > > > >> > > >
> > > > > > > > > > > > > >
> > > > > > > > >
> > > > -------------------------------------------------------------------
> > > > > > > > > > > > > > >> > > > > > > > > > > > > >
> > > > > > > > > > > > > > >> > > > > > > > > > > > >
> > > > > > > > > > > > > > >> > > > > > > > > > > >
> > > > > > > > > > > > > > >> > > > > > > > > > > >
> > > > > > > > > > > > > > >> > > > > > > > > > > >
> > > > > > > > > > > > > > >> > > > > > > > > > > > --
> > > > > > > > > > > > > > >> > > > > > > > > > > >
> > > > > > > > > > > > > > >> > > > > > >
> > > > > > > > > > > > > > >> >
> > > > > > > > > > > >
> > > > > > >
> > -------------------------------------------------------------------
> > > > > > > > > > > > > > >> > > > > > > > > > > > *SCJA. José Luis Cetina*
> > > > > > > > > > > > > > >> > > > > > > > > > > >
> > > > > > > > > > > > > > >> > > > > > >
> > > > > > > > > > > > > > >> >
> > > > > > > > > > > >
> > > > > > >
> > -------------------------------------------------------------------
> > > > > > > > > > > > > > >> > > > > > > > > > > >
> > > > > > > > > > > > > > >> > > > > > > > > > >
> > > > > > > > > > > > > > >> > > > > > > > > >
> > > > > > > > > > > > > > >> > > > > > > > > >
> > > > > > > > > > > > > > >> > > > > > > > > >
> > > > > > > > > > > > > > >> > > > > > > > > > --
> > > > > > > > > > > > > > >> > > > > > > > > >
> > > > > > > > > > > > > > >> > > > >
> > > > > > > > > > > > > > >>
> > > > > > > > > > >
> > > > > >
> -------------------------------------------------------------------
> > > > > > > > > > > > > > >> > > > > > > > > > *SCJA. José Luis Cetina*
> > > > > > > > > > > > > > >> > > > > > > > > >
> > > > > > > > > > > > > > >> > > > >
> > > > > > > > > > > > > > >>
> > > > > > > > > > >
> > > > > >
> -------------------------------------------------------------------
> > > > > > > > > > > > > > >> > > > > > > > > >
> > > > > > > > > > > > > > >> > > > > > > > >
> > > > > > > > > > > > > > >> > > > > > > >
> > > > > > > > > > > > > > >> > > > > > > >
> > > > > > > > > > > > > > >> > > > > > > >
> > > > > > > > > > > > > > >> > > > > > > > --
> > > > > > > > > > > > > > >> > > > > > > >
> > > > > > > > > > > > > > >> > >
> > > > > > > > > > > > >
> > > > > > > >
> > > -------------------------------------------------------------------
> > > > > > > > > > > > > > >> > > > > > > > *SCJA. José Luis Cetina*
> > > > > > > > > > > > > > >> > > > > > > >
> > > > > > > > > > > > > > >> > >
> > > > > > > > > > > > >
> > > > > > > >
> > > -------------------------------------------------------------------
> > > > > > > > > > > > > > >> > > > > > > >
> > > > > > > > > > > > > > >> > > > > > >
> > > > > > > > > > > > > > >> > > > > >
> > > > > > > > > > > > > > >> > > > > >
> > > > > > > > > > > > > > >> > > > > >
> > > > > > > > > > > > > > >> > > > > > --
> > > > > > > > > > > > > > >> > > > > >
> > > > > > > > > > > > > > >>
> > > > > > > > > > >
> > > > > >
> -------------------------------------------------------------------
> > > > > > > > > > > > > > >> > > > > > *SCJA. José Luis Cetina*
> > > > > > > > > > > > > > >> > > > > >
> > > > > > > > > > > > > > >>
> > > > > > > > > > >
> > > > > >
> -------------------------------------------------------------------
> > > > > > > > > > > > > > >> > > > > >
> > > > > > > > > > > > > > >> > > > >
> > > > > > > > > > > > > > >> > > >
> > > > > > > > > > > > > > >> > > >
> > > > > > > > > > > > > > >> > > >
> > > > > > > > > > > > > > >> > > > --
> > > > > > > > > > > > > > >> > > >
> > > > > > > > > > > > > >
> > > > > > > > >
> > > > -------------------------------------------------------------------
> > > > > > > > > > > > > > >> > > > *SCJA. José Luis Cetina*
> > > > > > > > > > > > > > >> > > >
> > > > > > > > > > > > > >
> > > > > > > > >
> > > > -------------------------------------------------------------------
> > > > > > > > > > > > > > >> > > >
> > > > > > > > > > > > > > >> > >
> > > > > > > > > > > > > > >> >
> > > > > > > > > > > > > > >> >
> > > > > > > > > > > > > > >> >
> > > > > > > > > > > > > > >> > --
> > > > > > > > > > > > > > >> >
> > > > > > > > > > > >
> > > > > > >
> > -------------------------------------------------------------------
> > > > > > > > > > > > > > >> > *SCJA. José Luis Cetina*
> > > > > > > > > > > > > > >> >
> > > > > > > > > > > >
> > > > > > >
> > -------------------------------------------------------------------
> > > > > > > > > > > > > > >> >
> > > > > > > > > > > > > > >>
> > > > > > > > > > > > > > >
> > > > > > > > > > > > > > >
> > > > > > > > > > > > > > >
> > > > > > > > > > > > > > > --
> > > > > > > > > > > > > > >
> > > > > > > > > >
> > > > > -------------------------------------------------------------------
> > > > > > > > > > > > > > > *SCJA. José Luis Cetina*
> > > > > > > > > > > > > > >
> > > > > > > > > >
> > > > > -------------------------------------------------------------------
> > > > > > > > > > > > > > >
> > > > > > > > > > > > > > >
> > > > > > > > > > > > > >
> > > > > > > > > > > > > >
> > > > > > > > > > > > > > --
> > > > > > > > > > > > > >
> > > > > > > > >
> > > > -------------------------------------------------------------------
> > > > > > > > > > > > > > *SCJA. José Luis Cetina*
> > > > > > > > > > > > > >
> > > > > > > > >
> > > > -------------------------------------------------------------------
> > > > > > > > > > > > > >
> > > > > > > > > > > > >
> > > > > > > > > > > >
> > > > > > > > > > > >
> > > > > > > > > > > >
> > > > > > > > > > > > --
> > > > > > > > > > > >
> > > > > > >
> > -------------------------------------------------------------------
> > > > > > > > > > > > *SCJA. José Luis Cetina*
> > > > > > > > > > > >
> > > > > > >
> > -------------------------------------------------------------------
> > > > > > > > > > > >
> > > > > > > > > > >
> > > > > > > > > >
> > > > > > > > > >
> > > > > > > > > >
> > > > > > > > > > --
> > > > > > > > > >
> > > > > -------------------------------------------------------------------
> > > > > > > > > > *SCJA. José Luis Cetina*
> > > > > > > > > >
> > > > > -------------------------------------------------------------------
> > > > > > > > > >
> > > > > > > > >
> > > > > > > >
> > > > > > > >
> > > > > > > >
> > > > > > > > --
> > > > > > > >
> > > -------------------------------------------------------------------
> > > > > > > > *SCJA. José Luis Cetina*
> > > > > > > >
> > > -------------------------------------------------------------------
> > > > > > > >
> > > > > > >
> > > > > >
> > > > > >
> > > > > >
> > > > > > --
> > > > > >
> -------------------------------------------------------------------
> > > > > > *SCJA. José Luis Cetina*
> > > > > >
> -------------------------------------------------------------------
> > > > > >
> > > > >
> > > >
> > > >
> > > >
> > > > --
> > > > -------------------------------------------------------------------
> > > > *SCJA. José Luis Cetina*
> > > > -------------------------------------------------------------------
> > > >
> > >
> >
> >
> >
> > --
> > -------------------------------------------------------------------
> > *SCJA. José Luis Cetina*
> > -------------------------------------------------------------------
> >
>



-- 
-------------------------------------------------------------------
*SCJA. José Luis Cetina*
-------------------------------------------------------------------

Re: Guest user

Posted by Romain Manni-Bucau <rm...@gmail.com>.
deployment in progress:
http://ci.apache.org/builders/openejb-trunk-deploy/builds/378

- Romain


2012/6/1 José Luis Cetina <ma...@gmail.com>

> Ok, in what tomee build this will be available?
>
> 2012/5/31 Romain Manni-Bucau <rm...@gmail.com>
>
> > yep
> >
> > just commited, a new commit will come where this class will automatically
> > be added normally
> >
> > - Romain
> >
> >
> > 2012/6/1 José Luis Cetina <ma...@gmail.com>
> >
> > > im getting a ClassNotFound
> > >
> > > Caused by: java.lang.ClassNotFoundException:
> > > org.apache.tomee.catalina.TomEERealm
> > >
> > > 2012/5/31 Romain Manni-Bucau <rm...@gmail.com>
> > >
> > > > my sample is working, too late to add test but manually it works
> > > >
> > > > so i guess it should work for you
> > > >
> > > > the question now is should we add it automatically?
> > > >
> > > > - Romain
> > > >
> > > >
> > > > 2012/6/1 José Luis Cetina <ma...@gmail.com>
> > > >
> > > > > Oooh great, with this i can get the principal user in the first
> > > request?
> > > > or
> > > > > this is something that you gonna fix?
> > > > >
> > > > > 2012/5/31 Romain Manni-Bucau <rm...@gmail.com>
> > > > >
> > > > > > that's brand new ;)
> > > > > >
> > > > > > just added it, it mainly delegate to the real realm but add the
> > > > principal
> > > > > > info to openejb/tomee security service which is used in
> ejbcontext
> > > impl
> > > > > (to
> > > > > > make it short)
> > > > > >
> > > > > > - Romain
> > > > > >
> > > > > >
> > > > > > 2012/6/1 José Luis Cetina <ma...@gmail.com>
> > > > > >
> > > > > > > I have this in my context.xml
> > > > > > >
> > > > > > > <Realm className="MyExtendedDataSourceRealm"
> > > > > > >  dataSourceName="MyDataSource"
> > > > > > > digest="SHA-256"
> > > > > > > encodePassword="Base64"
> > > > > > > queryRealmRolesUser="SELECT rol FROM xxxx WHERE user=?"
> > > > > > > queryRealmUsers="SELECT pass FROM xxx WHERE user=?"/>
> > > > > > >
> > > > > > > As you can see i extend the datasource realm, i have this realm
> > > > config
> > > > > in
> > > > > > > the context.xml in my webapp (not context.xml TomEE).
> > > > > > >
> > > > > > > But, as i can see in your example, you surround your realm with
> > > > > > TomEERealm,
> > > > > > > if this necessary?. I didn't know this
> > > > > > >
> > > > > > >
> > > > > > >
> > > > > > > 2012/5/31 Romain Manni-Bucau <rm...@gmail.com>
> > > > > > >
> > > > > > > > in my test i used:
> > > > > > > >
> > > > > > > >    <Realm className="org.apache.tomee.catalina.TomEERealm">
> > > > > > > >        <Realm className="org.apache.catalina.realm.JAASRealm"
> > > > > > > > appName="PropertiesLoginModule"
> > > > > > > >
> > > > > > > >
> > > > > > > >
> > > > > > >
> > > > > >
> > > > >
> > > >
> > >
> >
>  userClassNames="org.apache.openejb.core.security.AbstractSecurityService$User"
> > > > > > > >
> > > > > > > >
> > > > > > > >
> > > > > > >
> > > > > >
> > > > >
> > > >
> > >
> >
>  roleClassNames="org.apache.openejb.core.security.AbstractSecurityService$Group">
> > > > > > > >        </Realm>
> > > > > > > >       </Realm>
> > > > > > > >
> > > > > > > > but i guess you can replace the jaasrealm by your dsrealm
> > > > > > > >
> > > > > > > > - Romain
> > > > > > > >
> > > > > > > >
> > > > > > > > 2012/6/1 José Luis Cetina <ma...@gmail.com>
> > > > > > > >
> > > > > > > > > Yes, it seems buggy.
> > > > > > > > >
> > > > > > > > > Where i have to replace?
> > > > > > > > >
> > > > > > > > > Remember im using DataSourceRealm
> > > > > > > > >
> > > > > > > > > 2012/5/31 Romain Manni-Bucau <rm...@gmail.com>
> > > > > > > > >
> > > > > > > > > > this is the current status,
> > > > > > > > > >
> > > > > > > > > > but IMO it is buggy,
> > > > > > > > > >
> > > > > > > > > > i'll commit soon a TomEEJAASRealm to make it working
> > (replace
> > > > > > > JAASRealm
> > > > > > > > > in
> > > > > > > > > > the conf)
> > > > > > > > > >
> > > > > > > > > > - Romain
> > > > > > > > > >
> > > > > > > > > >
> > > > > > > > > > 2012/6/1 José Luis Cetina <ma...@gmail.com>
> > > > > > > > > >
> > > > > > > > > > > i think we are getting confused.
> > > > > > > > > > >
> > > > > > > > > > > If i resume all, this what i asked (the final of the
> > first
> > > > > post)
> > > > > > > > > > >
> > > > > > > > > > > I dont know if this is the desire behavior or if this
> > > happend
> > > > > > > becase
> > > > > > > > > the
> > > > > > > > > > > httr request isnt finished?
> > > > > > > > > > > Then you answer me:
> > > > > > > > > > >
> > > > > > > > > > > in fact info from ejbcontext are taken in our
> > > securitymodule
> > > > > > > > > > >
> > > > > > > > > > > in tomee we set/unset it from a valve so at the
> > > beginning/end
> > > > > of
> > > > > > > the
> > > > > > > > > > > request...all between is currently ignored so when you
> > log
> > > > you
> > > > > > need
> > > > > > > > > > another
> > > > > > > > > > > request to get the updated information (from the tomcat
> > > > realm)
> > > > > > > > > > >
> > > > > > > > > > > "so when you log you need another request to get the
> > > updated
> > > > > > > > > information
> > > > > > > > > > > (from the tomcat realm)
> > > > > > > > > > >
> > > > > > > > > > > Then i get guest because is the desire behaviour, after
> > the
> > > > > first
> > > > > > > > > > request i
> > > > > > > > > > > can get the user i expected.
> > > > > > > > > > >
> > > > > > > > > > > Then i resume, this is the default behaviour, and works
> > but
> > > > you
> > > > > > > need
> > > > > > > > a
> > > > > > > > > > > second request.
> > > > > > > > > > >
> > > > > > > > > > >
> > > > > > > > > > >
> > > > > > > > > > > 2012/5/31 Romain Manni-Bucau <rm...@gmail.com>
> > > > > > > > > > >
> > > > > > > > > > > > i think it should work
> > > > > > > > > > > >
> > > > > > > > > > > > - Romain
> > > > > > > > > > > >
> > > > > > > > > > > >
> > > > > > > > > > > > 2012/6/1 José Luis Cetina <ma...@gmail.com>
> > > > > > > > > > > >
> > > > > > > > > > > > > I mean this:
> > > > > > > > > > > > >
> > > > > > > > > > > > > I dont know if this is the desire behaviour or if
> > this
> > > > > > happend
> > > > > > > > > > because
> > > > > > > > > > > > the
> > > > > > > > > > > > > http request isnt finished?
> > > > > > > > > > > > >
> > > > > > > > > > > > >
> > > > > > > > > > > > >
> > > > > > > > > > > > > 2012/5/31 José Luis Cetina <ma...@gmail.com>
> > > > > > > > > > > > >
> > > > > > > > > > > > > > Ok, the what i asked is correct??
> > > > > > > > > > > > > >
> > > > > > > > > > > > > > "I dont know if this is the desire behaviour or
> if
> > > this
> > > > > > > happend
> > > > > > > > > > > because
> > > > > > > > > > > > > > the http request isnt finished?"
> > > > > > > > > > > > > >
> > > > > > > > > > > > > > 2012/5/31 Romain Manni-Bucau <
> > rmannibucau@gmail.com>
> > > > > > > > > > > > > >
> > > > > > > > > > > > > >> ok,
> > > > > > > > > > > > > >>
> > > > > > > > > > > > > >> in fact info from ejbcontext are taken in our
> > > > > > securitymodule
> > > > > > > > > > > > > >>
> > > > > > > > > > > > > >> in tomee we set/unset it from a valve so at the
> > > > > > > beginning/end
> > > > > > > > of
> > > > > > > > > > the
> > > > > > > > > > > > > >> request...all between is currently ignored so
> when
> > > you
> > > > > log
> > > > > > > you
> > > > > > > > > > need
> > > > > > > > > > > > > >> another
> > > > > > > > > > > > > >> request to get the updated information (from the
> > > > tomcat
> > > > > > > realm)
> > > > > > > > > > > > > >>
> > > > > > > > > > > > > >> - Romain
> > > > > > > > > > > > > >>
> > > > > > > > > > > > > >>
> > > > > > > > > > > > > >> 2012/6/1 José Luis Cetina <maxtorzito@gmail.com
> >
> > > > > > > > > > > > > >>
> > > > > > > > > > > > > >> > Yes, it work
> > > > > > > > > > > > > >> >
> > > > > > > > > > > > > >> > 1) Login (form login) using DataSourceRealm
> > > > > > > > > > > > > >> >
> > > > > > > > > > > > > >> >
> > > > > > > > > > > > > >> > 2) Redirect to page2 from my managedbean
> > > > > > > > > > > > > >> >
> > > > > > > > > > > > > >> > 2012/5/31 Romain Manni-Bucau <
> > > rmannibucau@gmail.com
> > > > >
> > > > > > > > > > > > > >> >
> > > > > > > > > > > > > >> > > so you mean using the flow i described
> before
> > it
> > > > > > works?
> > > > > > > > > > (sorry,
> > > > > > > > > > > > just
> > > > > > > > > > > > > >> to
> > > > > > > > > > > > > >> > be
> > > > > > > > > > > > > >> > > sure to understand)
> > > > > > > > > > > > > >> > >
> > > > > > > > > > > > > >> > > - Romain
> > > > > > > > > > > > > >> > >
> > > > > > > > > > > > > >> > >
> > > > > > > > > > > > > >> > > 2012/6/1 José Luis Cetina <
> > maxtorzito@gmail.com
> > > >
> > > > > > > > > > > > > >> > >
> > > > > > > > > > > > > >> > > > Hi i can login and i can navigate
> (redirect)
> > > to
> > > > my
> > > > > > > other
> > > > > > > > > > page,
> > > > > > > > > > > > > but i
> > > > > > > > > > > > > >> > dont
> > > > > > > > > > > > > >> > > > know why im getting guest user in the
> login
> > > > mbean,
> > > > > > > after
> > > > > > > > > > that
> > > > > > > > > > > in
> > > > > > > > > > > > > >> other
> > > > > > > > > > > > > >> > > > mbean  i get my "real" user.
> > > > > > > > > > > > > >> > > >
> > > > > > > > > > > > > >> > > >
> > > > > > > > > > > > > >> > > > 2012/5/31 Romain Manni-Bucau <
> > > > > rmannibucau@gmail.com
> > > > > > >
> > > > > > > > > > > > > >> > > >
> > > > > > > > > > > > > >> > > > > maybe
> > > > > > > > > > > > > >> > > > >
> > > > > > > > > > > > > >> > > >
> > > > > > > > > > > > > >> > >
> > > > > > > > > > > > > >> >
> > > > > > > > > > > > > >>
> > > > > > > > > > > > >
> > > > > > > > > > > >
> > > > > > > > > > >
> > > > > > > > > >
> > > > > > > > >
> > > > > > > >
> > > > > > >
> > > > > >
> > > > >
> > > >
> > >
> >
> http://rmannibucau.wordpress.com/2012/05/09/tomee-and-its-ssh-connector/but
> > > > > > > > > > > > > >> > > > > it uses properties file, it just need a
> > > custom
> > > > > > login
> > > > > > > > > > module
> > > > > > > > > > > > > >> > > > implementation
> > > > > > > > > > > > > >> > > > > to use a db.
> > > > > > > > > > > > > >> > > > >
> > > > > > > > > > > > > >> > > > > well,
> > > > > > > > > > > > > >> > > > >
> > > > > > > > > > > > > >> > > > > before can you test it please?
> > > > > > > > > > > > > >> > > > > 1) login
> > > > > > > > > > > > > >> > > > > 2) redirect to your page using your bean
> > > > > > > > > > > > > >> > > > >
> > > > > > > > > > > > > >> > > > > - Romain
> > > > > > > > > > > > > >> > > > >
> > > > > > > > > > > > > >> > > > >
> > > > > > > > > > > > > >> > > > > 2012/6/1 José Luis Cetina <
> > > > maxtorzito@gmail.com
> > > > > >
> > > > > > > > > > > > > >> > > > >
> > > > > > > > > > > > > >> > > > > > I have to read and know how to use
> > this, i
> > > > > > always
> > > > > > > > use
> > > > > > > > > > > > > >> DataSource or
> > > > > > > > > > > > > >> > > > > > JDBCRealm. (with glassfish).
> > > > > > > > > > > > > >> > > > > > im reading now, do you have something
> > for
> > > a
> > > > > > > > > quickstart?
> > > > > > > > > > > for
> > > > > > > > > > > > > >> share
> > > > > > > > > > > > > >> > me
> > > > > > > > > > > > > >> > > > > >
> > > > > > > > > > > > > >> > > > > > 2012/5/31 Romain Manni-Bucau <
> > > > > > > rmannibucau@gmail.com
> > > > > > > > >
> > > > > > > > > > > > > >> > > > > >
> > > > > > > > > > > > > >> > > > > > > having your password in a db is not
> an
> > > > issue
> > > > > > > but i
> > > > > > > > > > think
> > > > > > > > > > > > you
> > > > > > > > > > > > > >> > should
> > > > > > > > > > > > > >> > > > > > > use
> > org.apache.catalina.realm.JAASRealm
> > > > > > > > > > > > > >> > > > > > >
> > > > > > > > > > > > > >> > > > > > > for instance:
> > > > > > > > > > > > > >> > > > > > >
> > > > > > > > > > > > > >> > > > > > >     <Realm
> > > > > > > > > > > className="org.apache.catalina.realm.JAASRealm"
> > > > > > > > > > > > > >> > > > > > > appName="MyDBLoginModule"
> > > > > > > > > > > > > >> > > > > > >
> > > > > > > > > > > > > >> > > > > > >
> > > > > > > > > > > > > >> > > > > > >
> > > > > > > > > > > > > >> > > > > >
> > > > > > > > > > > > > >> > > > >
> > > > > > > > > > > > > >> > > >
> > > > > > > > > > > > > >> > >
> > > > > > > > > > > > > >> >
> > > > > > > > > > > > > >>
> > > > > > > > > > > > >
> > > > > > > > > > > >
> > > > > > > > > > >
> > > > > > > > > >
> > > > > > > > >
> > > > > > > >
> > > > > > >
> > > > > >
> > > > >
> > > >
> > >
> >
>  userClassNames="org.apache.openejb.core.security.AbstractSecurityService$User"
> > > > > > > > > > > > > >> > > > > > >
> > > > > > > > > > > > > >> > > > > > >
> > > > > > > > > > > > > >> > > > > > >
> > > > > > > > > > > > > >> > > > > >
> > > > > > > > > > > > > >> > > > >
> > > > > > > > > > > > > >> > > >
> > > > > > > > > > > > > >> > >
> > > > > > > > > > > > > >> >
> > > > > > > > > > > > > >>
> > > > > > > > > > > > >
> > > > > > > > > > > >
> > > > > > > > > > >
> > > > > > > > > >
> > > > > > > > >
> > > > > > > >
> > > > > > >
> > > > > >
> > > > >
> > > >
> > >
> >
>  roleClassNames="org.apache.openejb.core.security.AbstractSecurityService$Group">
> > > > > > > > > > > > > >> > > > > > >      </Realm>
> > > > > > > > > > > > > >> > > > > > >
> > > > > > > > > > > > > >> > > > > > > so simply implement a custom
> > LoginModule
> > > > > > instead
> > > > > > > > of
> > > > > > > > > a
> > > > > > > > > > > > realm
> > > > > > > > > > > > > >> > > > > > >
> > > > > > > > > > > > > >> > > > > > > wdyt?
> > > > > > > > > > > > > >> > > > > > >
> > > > > > > > > > > > > >> > > > > > > - Romain
> > > > > > > > > > > > > >> > > > > > >
> > > > > > > > > > > > > >> > > > > > >
> > > > > > > > > > > > > >> > > > > > > 2012/6/1 José Luis Cetina <
> > > > > > maxtorzito@gmail.com
> > > > > > > >
> > > > > > > > > > > > > >> > > > > > >
> > > > > > > > > > > > > >> > > > > > > > Sorry, i use DataSourceRealm, i
> have
> > > my
> > > > > > > > > > > user/pass/roles
> > > > > > > > > > > > in
> > > > > > > > > > > > > >> the
> > > > > > > > > > > > > >> > > DB.
> > > > > > > > > > > > > >> > > > > > > >
> > > > > > > > > > > > > >> > > > > > > >
> > > > > > > > > > > > > >> > > > > > > >
> > > > > > > > > > > > > >> > > > > > > > 2012/5/31 Romain Manni-Bucau <
> > > > > > > > > rmannibucau@gmail.com
> > > > > > > > > > >
> > > > > > > > > > > > > >> > > > > > > >
> > > > > > > > > > > > > >> > > > > > > > > can't you do it with an embedded
> > > one?
> > > > > > > > > > > > > >> > > > > > > > >
> > > > > > > > > > > > > >> > > > > > > > > well DataSourceRealm doesn't use
> > > JAAS
> > > > by
> > > > > > > > > default i
> > > > > > > > > > > > > think,
> > > > > > > > > > > > > >> > maybe
> > > > > > > > > > > > > >> > > > > > that's
> > > > > > > > > > > > > >> > > > > > > > the
> > > > > > > > > > > > > >> > > > > > > > > issue
> > > > > > > > > > > > > >> > > > > > > > >
> > > > > > > > > > > > > >> > > > > > > > > - Romain
> > > > > > > > > > > > > >> > > > > > > > >
> > > > > > > > > > > > > >> > > > > > > > >
> > > > > > > > > > > > > >> > > > > > > > > 2012/6/1 José Luis Cetina <
> > > > > > > > maxtorzito@gmail.com
> > > > > > > > > >
> > > > > > > > > > > > > >> > > > > > > > >
> > > > > > > > > > > > > >> > > > > > > > > > OK, i can create a sample,
> but i
> > > use
> > > > > > > > > > > > DataSourceRealm,
> > > > > > > > > > > > > >> are
> > > > > > > > > > > > > >> > you
> > > > > > > > > > > > > >> > > > > gonna
> > > > > > > > > > > > > >> > > > > > > > > > configure your database?
> > > > > > > > > > > > > >> > > > > > > > > >
> > > > > > > > > > > > > >> > > > > > > > > > 2012/5/31 Romain Manni-Bucau <
> > > > > > > > > > > rmannibucau@gmail.com
> > > > > > > > > > > > >
> > > > > > > > > > > > > >> > > > > > > > > >
> > > > > > > > > > > > > >> > > > > > > > > > > can you have a try in an EJB
> > > > please?
> > > > > > > (just
> > > > > > > > > try
> > > > > > > > > > > to
> > > > > > > > > > > > > add
> > > > > > > > > > > > > >> > > > > @Stateless
> > > > > > > > > > > > > >> > > > > > on
> > > > > > > > > > > > > >> > > > > > > > > your
> > > > > > > > > > > > > >> > > > > > > > > > > managed bean for instance)
> > > > > > > > > > > > > >> > > > > > > > > > >
> > > > > > > > > > > > > >> > > > > > > > > > > can you share a sample easy
> to
> > > > run?
> > > > > > > > > > > > > >> > > > > > > > > > >
> > > > > > > > > > > > > >> > > > > > > > > > > - Romain
> > > > > > > > > > > > > >> > > > > > > > > > >
> > > > > > > > > > > > > >> > > > > > > > > > >
> > > > > > > > > > > > > >> > > > > > > > > > > 2012/6/1 José Luis Cetina <
> > > > > > > > > > maxtorzito@gmail.com
> > > > > > > > > > > >
> > > > > > > > > > > > > >> > > > > > > > > > >
> > > > > > > > > > > > > >> > > > > > > > > > > > Yes, im using JAAS
> > > > > > > > > > > > > >> > > > > > > > > > > >
> > > > > > > > > > > > > >> > > > > > > > > > > > 2012/5/31 Romain
> > Manni-Bucau <
> > > > > > > > > > > > > rmannibucau@gmail.com
> > > > > > > > > > > > > >> >
> > > > > > > > > > > > > >> > > > > > > > > > > >
> > > > > > > > > > > > > >> > > > > > > > > > > > > Hi,
> > > > > > > > > > > > > >> > > > > > > > > > > > >
> > > > > > > > > > > > > >> > > > > > > > > > > > > Do you use jaas?
> > > > > > > > > > > > > >> > > > > > > > > > > > >
> > > > > > > > > > > > > >> > > > > > > > > > > > > - Romain
> > > > > > > > > > > > > >> > > > > > > > > > > > > Le 31 mai 2012 20:14,
> > "José
> > > > Luis
> > > > > > > > > Cetina" <
> > > > > > > > > > > > > >> > > > > > maxtorzito@gmail.com
> > > > > > > > > > > > > >> > > > > > > >
> > > > > > > > > > > > > >> > > > > > > > a
> > > > > > > > > > > > > >> > > > > > > > > > > écrit
> > > > > > > > > > > > > >> > > > > > > > > > > > :
> > > > > > > > > > > > > >> > > > > > > > > > > > >
> > > > > > > > > > > > > >> > > > > > > > > > > > > > Hi i have this
> scenario:
> > > > > > > > > > > > > >> > > > > > > > > > > > > >
> > > > > > > > > > > > > >> > > > > > > > > > > > > > I have a page
> > login.xhtml,
> > > > > this
> > > > > > > page
> > > > > > > > > > has a
> > > > > > > > > > > > > >> > > ManagedBean
> > > > > > > > > > > > > >> > > > > > > (@Named)
> > > > > > > > > > > > > >> > > > > > > > > > this
> > > > > > > > > > > > > >> > > > > > > > > > > > > > managedbean use the
> > > > > > > > > > > request.login(user,pass)
> > > > > > > > > > > > > >> > method.
> > > > > > > > > > > > > >> > > > > > > > > > > > > >
> > > > > > > > > > > > > >> > > > > > > > > > > > > > When i do this:
> > > > > > > > > > > > > >> > > > > > > > > > > > > >
> > > > > > > > > > > > > >> > > > > > > > > > > > > > managedbean class:
> > > > > > > > > > > > > >> > > > > > > > > > > > > >
> > > > > > > > > > > > > >> > > > > > > > > > > > > > @Resource
> > > > > > > > > > > > > >> > > > > > > > > > > > > > private EJBContext
> > > > ejbContext;
> > > > > > > > > > > > > >> > > > > > > > > > > > > > .
> > > > > > > > > > > > > >> > > > > > > > > > > > > > .
> > > > > > > > > > > > > >> > > > > > > > > > > > > >
> > request.login(user,pass);
> > > > > > > > > > > > > >> > > > > > > > > > > > > > String name =
> > > > > > > > > > > > > >> > > > ejbContext.getCallerPrincipal().getName();
> > > > > > > > > > > > > >> > > > > > > > > > > > > >
> > > > > > > > > > > > > >> > > > > > > > > > > > > > I get "guest" as my
> user
> > > > name.
> > > > > > > But i
> > > > > > > > > > > expect
> > > > > > > > > > > > > the
> > > > > > > > > > > > > >> > name
> > > > > > > > > > > > > >> > > of
> > > > > > > > > > > > > >> > > > > my
> > > > > > > > > > > > > >> > > > > > > user
> > > > > > > > > > > > > >> > > > > > > > > (of
> > > > > > > > > > > > > >> > > > > > > > > > > > > course
> > > > > > > > > > > > > >> > > > > > > > > > > > > > is not guest)
> > > > > > > > > > > > > >> > > > > > > > > > > > > >
> > > > > > > > > > > > > >> > > > > > > > > > > > > > If the login was
> > > successful
> > > > my
> > > > > > > login
> > > > > > > > > > page
> > > > > > > > > > > > > >> navigate
> > > > > > > > > > > > > >> > to
> > > > > > > > > > > > > >> > > > > other
> > > > > > > > > > > > > >> > > > > > > > page
> > > > > > > > > > > > > >> > > > > > > > > > lets
> > > > > > > > > > > > > >> > > > > > > > > > > > say
> > > > > > > > > > > > > >> > > > > > > > > > > > > > pageb.xhtml
> > > > > > > > > > > > > >> > > > > > > > > > > > > >
> > > > > > > > > > > > > >> > > > > > > > > > > > > > If i create a
> > managedbean
> > > > > > (@Named)
> > > > > > > > for
> > > > > > > > > > > > > >> pageb.xhtml
> > > > > > > > > > > > > >> > > and
> > > > > > > > > > > > > >> > > > in
> > > > > > > > > > > > > >> > > > > > > that
> > > > > > > > > > > > > >> > > > > > > > > > > > > managedbean
> > > > > > > > > > > > > >> > > > > > > > > > > > > > i use again:
> > > > > > > > > > > > > >> > > > > > > > > > > > > > String name =
> > > > > > > > > > > > > >> > > > ejbContext.getCallerPrincipal().getName();
> > > > > > > > > > > > > >> > > > > > > > > > > > > > then, here i get my
> > > > "correct"
> > > > > > name
> > > > > > > > of
> > > > > > > > > > the
> > > > > > > > > > > > user
> > > > > > > > > > > > > >> (not
> > > > > > > > > > > > > >> > > > > guest).
> > > > > > > > > > > > > >> > > > > > > > > > > > > >
> > > > > > > > > > > > > >> > > > > > > > > > > > > > I dont know if this is
> > the
> > > > > > desire
> > > > > > > > > > > behaviour
> > > > > > > > > > > > or
> > > > > > > > > > > > > >> if
> > > > > > > > > > > > > >> > > this
> > > > > > > > > > > > > >> > > > > > > happend
> > > > > > > > > > > > > >> > > > > > > > > > > because
> > > > > > > > > > > > > >> > > > > > > > > > > > > the
> > > > > > > > > > > > > >> > > > > > > > > > > > > > http request isnt
> > > finished?
> > > > > > > > > > > > > >> > > > > > > > > > > > > >
> > > > > > > > > > > > > >> > > > > > > > > > > > > > other question why if
> i
> > > call
> > > > > > > > > > > > > >> > > > > > > > > > > > > > the
> > > > > > > > > > > > >  ejbContext.getCallerPrincipal().getName();
> > > > > > > > > > > > > >> > > before
> > > > > > > > > > > > > >> > > > > the
> > > > > > > > > > > > > >> > > > > > > > > > > > > request.login()
> > > > > > > > > > > > > >> > > > > > > > > > > > > > method i get again
> > > "guest",
> > > > > why
> > > > > > > not
> > > > > > > > > > null?
> > > > > > > > > > > > > >> > > > > > > > > > > > > >
> > > > > > > > > > > > > >> > > > > > > > > > > > > > If this question is
> for
> > > > > > > > tomee(openejb)
> > > > > > > > > > or
> > > > > > > > > > > > > >> tomcat?
> > > > > > > > > > > > > >> > > > > > > > > > > > > >
> > > > > > > > > > > > > >> > > > > > > > > > > > > > Thanks
> > > > > > > > > > > > > >> > > > > > > > > > > > > >
> > > > > > > > > > > > > >> > > > > > > > > > > > > >
> > > > > > > > > > > > > >> > > > > > > > > > > > > >
> > > > > > > > > > > > > >> > > > > > > > >
> > > > > > > > > > > > > >> > > >
> > > > > > > > > > > > >
> > > > > > > >
> > > -------------------------------------------------------------------
> > > > > > > > > > > > > >> > > > > > > > > > > > > > *SCJA. José Luis
> Cetina*
> > > > > > > > > > > > > >> > > > > > > > > > > > > >
> > > > > > > > > > > > > >> > > > > > > > >
> > > > > > > > > > > > > >> > > >
> > > > > > > > > > > > >
> > > > > > > >
> > > -------------------------------------------------------------------
> > > > > > > > > > > > > >> > > > > > > > > > > > > >
> > > > > > > > > > > > > >> > > > > > > > > > > > >
> > > > > > > > > > > > > >> > > > > > > > > > > >
> > > > > > > > > > > > > >> > > > > > > > > > > >
> > > > > > > > > > > > > >> > > > > > > > > > > >
> > > > > > > > > > > > > >> > > > > > > > > > > > --
> > > > > > > > > > > > > >> > > > > > > > > > > >
> > > > > > > > > > > > > >> > > > > > >
> > > > > > > > > > > > > >> >
> > > > > > > > > > >
> > > > > >
> -------------------------------------------------------------------
> > > > > > > > > > > > > >> > > > > > > > > > > > *SCJA. José Luis Cetina*
> > > > > > > > > > > > > >> > > > > > > > > > > >
> > > > > > > > > > > > > >> > > > > > >
> > > > > > > > > > > > > >> >
> > > > > > > > > > >
> > > > > >
> -------------------------------------------------------------------
> > > > > > > > > > > > > >> > > > > > > > > > > >
> > > > > > > > > > > > > >> > > > > > > > > > >
> > > > > > > > > > > > > >> > > > > > > > > >
> > > > > > > > > > > > > >> > > > > > > > > >
> > > > > > > > > > > > > >> > > > > > > > > >
> > > > > > > > > > > > > >> > > > > > > > > > --
> > > > > > > > > > > > > >> > > > > > > > > >
> > > > > > > > > > > > > >> > > > >
> > > > > > > > > > > > > >>
> > > > > > > > > >
> > > > > -------------------------------------------------------------------
> > > > > > > > > > > > > >> > > > > > > > > > *SCJA. José Luis Cetina*
> > > > > > > > > > > > > >> > > > > > > > > >
> > > > > > > > > > > > > >> > > > >
> > > > > > > > > > > > > >>
> > > > > > > > > >
> > > > > -------------------------------------------------------------------
> > > > > > > > > > > > > >> > > > > > > > > >
> > > > > > > > > > > > > >> > > > > > > > >
> > > > > > > > > > > > > >> > > > > > > >
> > > > > > > > > > > > > >> > > > > > > >
> > > > > > > > > > > > > >> > > > > > > >
> > > > > > > > > > > > > >> > > > > > > > --
> > > > > > > > > > > > > >> > > > > > > >
> > > > > > > > > > > > > >> > >
> > > > > > > > > > > >
> > > > > > >
> > -------------------------------------------------------------------
> > > > > > > > > > > > > >> > > > > > > > *SCJA. José Luis Cetina*
> > > > > > > > > > > > > >> > > > > > > >
> > > > > > > > > > > > > >> > >
> > > > > > > > > > > >
> > > > > > >
> > -------------------------------------------------------------------
> > > > > > > > > > > > > >> > > > > > > >
> > > > > > > > > > > > > >> > > > > > >
> > > > > > > > > > > > > >> > > > > >
> > > > > > > > > > > > > >> > > > > >
> > > > > > > > > > > > > >> > > > > >
> > > > > > > > > > > > > >> > > > > > --
> > > > > > > > > > > > > >> > > > > >
> > > > > > > > > > > > > >>
> > > > > > > > > >
> > > > > -------------------------------------------------------------------
> > > > > > > > > > > > > >> > > > > > *SCJA. José Luis Cetina*
> > > > > > > > > > > > > >> > > > > >
> > > > > > > > > > > > > >>
> > > > > > > > > >
> > > > > -------------------------------------------------------------------
> > > > > > > > > > > > > >> > > > > >
> > > > > > > > > > > > > >> > > > >
> > > > > > > > > > > > > >> > > >
> > > > > > > > > > > > > >> > > >
> > > > > > > > > > > > > >> > > >
> > > > > > > > > > > > > >> > > > --
> > > > > > > > > > > > > >> > > >
> > > > > > > > > > > > >
> > > > > > > >
> > > -------------------------------------------------------------------
> > > > > > > > > > > > > >> > > > *SCJA. José Luis Cetina*
> > > > > > > > > > > > > >> > > >
> > > > > > > > > > > > >
> > > > > > > >
> > > -------------------------------------------------------------------
> > > > > > > > > > > > > >> > > >
> > > > > > > > > > > > > >> > >
> > > > > > > > > > > > > >> >
> > > > > > > > > > > > > >> >
> > > > > > > > > > > > > >> >
> > > > > > > > > > > > > >> > --
> > > > > > > > > > > > > >> >
> > > > > > > > > > >
> > > > > >
> -------------------------------------------------------------------
> > > > > > > > > > > > > >> > *SCJA. José Luis Cetina*
> > > > > > > > > > > > > >> >
> > > > > > > > > > >
> > > > > >
> -------------------------------------------------------------------
> > > > > > > > > > > > > >> >
> > > > > > > > > > > > > >>
> > > > > > > > > > > > > >
> > > > > > > > > > > > > >
> > > > > > > > > > > > > >
> > > > > > > > > > > > > > --
> > > > > > > > > > > > > >
> > > > > > > > >
> > > > -------------------------------------------------------------------
> > > > > > > > > > > > > > *SCJA. José Luis Cetina*
> > > > > > > > > > > > > >
> > > > > > > > >
> > > > -------------------------------------------------------------------
> > > > > > > > > > > > > >
> > > > > > > > > > > > > >
> > > > > > > > > > > > >
> > > > > > > > > > > > >
> > > > > > > > > > > > > --
> > > > > > > > > > > > >
> > > > > > > >
> > > -------------------------------------------------------------------
> > > > > > > > > > > > > *SCJA. José Luis Cetina*
> > > > > > > > > > > > >
> > > > > > > >
> > > -------------------------------------------------------------------
> > > > > > > > > > > > >
> > > > > > > > > > > >
> > > > > > > > > > >
> > > > > > > > > > >
> > > > > > > > > > >
> > > > > > > > > > > --
> > > > > > > > > > >
> > > > > >
> -------------------------------------------------------------------
> > > > > > > > > > > *SCJA. José Luis Cetina*
> > > > > > > > > > >
> > > > > >
> -------------------------------------------------------------------
> > > > > > > > > > >
> > > > > > > > > >
> > > > > > > > >
> > > > > > > > >
> > > > > > > > >
> > > > > > > > > --
> > > > > > > > >
> > > > -------------------------------------------------------------------
> > > > > > > > > *SCJA. José Luis Cetina*
> > > > > > > > >
> > > > -------------------------------------------------------------------
> > > > > > > > >
> > > > > > > >
> > > > > > >
> > > > > > >
> > > > > > >
> > > > > > > --
> > > > > > >
> > -------------------------------------------------------------------
> > > > > > > *SCJA. José Luis Cetina*
> > > > > > >
> > -------------------------------------------------------------------
> > > > > > >
> > > > > >
> > > > >
> > > > >
> > > > >
> > > > > --
> > > > > -------------------------------------------------------------------
> > > > > *SCJA. José Luis Cetina*
> > > > > -------------------------------------------------------------------
> > > > >
> > > >
> > >
> > >
> > >
> > > --
> > > -------------------------------------------------------------------
> > > *SCJA. José Luis Cetina*
> > > -------------------------------------------------------------------
> > >
> >
>
>
>
> --
> -------------------------------------------------------------------
> *SCJA. José Luis Cetina*
> -------------------------------------------------------------------
>

Re: Guest user

Posted by José Luis Cetina <ma...@gmail.com>.
Ok, in what tomee build this will be available?

2012/5/31 Romain Manni-Bucau <rm...@gmail.com>

> yep
>
> just commited, a new commit will come where this class will automatically
> be added normally
>
> - Romain
>
>
> 2012/6/1 José Luis Cetina <ma...@gmail.com>
>
> > im getting a ClassNotFound
> >
> > Caused by: java.lang.ClassNotFoundException:
> > org.apache.tomee.catalina.TomEERealm
> >
> > 2012/5/31 Romain Manni-Bucau <rm...@gmail.com>
> >
> > > my sample is working, too late to add test but manually it works
> > >
> > > so i guess it should work for you
> > >
> > > the question now is should we add it automatically?
> > >
> > > - Romain
> > >
> > >
> > > 2012/6/1 José Luis Cetina <ma...@gmail.com>
> > >
> > > > Oooh great, with this i can get the principal user in the first
> > request?
> > > or
> > > > this is something that you gonna fix?
> > > >
> > > > 2012/5/31 Romain Manni-Bucau <rm...@gmail.com>
> > > >
> > > > > that's brand new ;)
> > > > >
> > > > > just added it, it mainly delegate to the real realm but add the
> > > principal
> > > > > info to openejb/tomee security service which is used in ejbcontext
> > impl
> > > > (to
> > > > > make it short)
> > > > >
> > > > > - Romain
> > > > >
> > > > >
> > > > > 2012/6/1 José Luis Cetina <ma...@gmail.com>
> > > > >
> > > > > > I have this in my context.xml
> > > > > >
> > > > > > <Realm className="MyExtendedDataSourceRealm"
> > > > > >  dataSourceName="MyDataSource"
> > > > > > digest="SHA-256"
> > > > > > encodePassword="Base64"
> > > > > > queryRealmRolesUser="SELECT rol FROM xxxx WHERE user=?"
> > > > > > queryRealmUsers="SELECT pass FROM xxx WHERE user=?"/>
> > > > > >
> > > > > > As you can see i extend the datasource realm, i have this realm
> > > config
> > > > in
> > > > > > the context.xml in my webapp (not context.xml TomEE).
> > > > > >
> > > > > > But, as i can see in your example, you surround your realm with
> > > > > TomEERealm,
> > > > > > if this necessary?. I didn't know this
> > > > > >
> > > > > >
> > > > > >
> > > > > > 2012/5/31 Romain Manni-Bucau <rm...@gmail.com>
> > > > > >
> > > > > > > in my test i used:
> > > > > > >
> > > > > > >    <Realm className="org.apache.tomee.catalina.TomEERealm">
> > > > > > >        <Realm className="org.apache.catalina.realm.JAASRealm"
> > > > > > > appName="PropertiesLoginModule"
> > > > > > >
> > > > > > >
> > > > > > >
> > > > > >
> > > > >
> > > >
> > >
> >
>  userClassNames="org.apache.openejb.core.security.AbstractSecurityService$User"
> > > > > > >
> > > > > > >
> > > > > > >
> > > > > >
> > > > >
> > > >
> > >
> >
>  roleClassNames="org.apache.openejb.core.security.AbstractSecurityService$Group">
> > > > > > >        </Realm>
> > > > > > >       </Realm>
> > > > > > >
> > > > > > > but i guess you can replace the jaasrealm by your dsrealm
> > > > > > >
> > > > > > > - Romain
> > > > > > >
> > > > > > >
> > > > > > > 2012/6/1 José Luis Cetina <ma...@gmail.com>
> > > > > > >
> > > > > > > > Yes, it seems buggy.
> > > > > > > >
> > > > > > > > Where i have to replace?
> > > > > > > >
> > > > > > > > Remember im using DataSourceRealm
> > > > > > > >
> > > > > > > > 2012/5/31 Romain Manni-Bucau <rm...@gmail.com>
> > > > > > > >
> > > > > > > > > this is the current status,
> > > > > > > > >
> > > > > > > > > but IMO it is buggy,
> > > > > > > > >
> > > > > > > > > i'll commit soon a TomEEJAASRealm to make it working
> (replace
> > > > > > JAASRealm
> > > > > > > > in
> > > > > > > > > the conf)
> > > > > > > > >
> > > > > > > > > - Romain
> > > > > > > > >
> > > > > > > > >
> > > > > > > > > 2012/6/1 José Luis Cetina <ma...@gmail.com>
> > > > > > > > >
> > > > > > > > > > i think we are getting confused.
> > > > > > > > > >
> > > > > > > > > > If i resume all, this what i asked (the final of the
> first
> > > > post)
> > > > > > > > > >
> > > > > > > > > > I dont know if this is the desire behavior or if this
> > happend
> > > > > > becase
> > > > > > > > the
> > > > > > > > > > httr request isnt finished?
> > > > > > > > > > Then you answer me:
> > > > > > > > > >
> > > > > > > > > > in fact info from ejbcontext are taken in our
> > securitymodule
> > > > > > > > > >
> > > > > > > > > > in tomee we set/unset it from a valve so at the
> > beginning/end
> > > > of
> > > > > > the
> > > > > > > > > > request...all between is currently ignored so when you
> log
> > > you
> > > > > need
> > > > > > > > > another
> > > > > > > > > > request to get the updated information (from the tomcat
> > > realm)
> > > > > > > > > >
> > > > > > > > > > "so when you log you need another request to get the
> > updated
> > > > > > > > information
> > > > > > > > > > (from the tomcat realm)
> > > > > > > > > >
> > > > > > > > > > Then i get guest because is the desire behaviour, after
> the
> > > > first
> > > > > > > > > request i
> > > > > > > > > > can get the user i expected.
> > > > > > > > > >
> > > > > > > > > > Then i resume, this is the default behaviour, and works
> but
> > > you
> > > > > > need
> > > > > > > a
> > > > > > > > > > second request.
> > > > > > > > > >
> > > > > > > > > >
> > > > > > > > > >
> > > > > > > > > > 2012/5/31 Romain Manni-Bucau <rm...@gmail.com>
> > > > > > > > > >
> > > > > > > > > > > i think it should work
> > > > > > > > > > >
> > > > > > > > > > > - Romain
> > > > > > > > > > >
> > > > > > > > > > >
> > > > > > > > > > > 2012/6/1 José Luis Cetina <ma...@gmail.com>
> > > > > > > > > > >
> > > > > > > > > > > > I mean this:
> > > > > > > > > > > >
> > > > > > > > > > > > I dont know if this is the desire behaviour or if
> this
> > > > > happend
> > > > > > > > > because
> > > > > > > > > > > the
> > > > > > > > > > > > http request isnt finished?
> > > > > > > > > > > >
> > > > > > > > > > > >
> > > > > > > > > > > >
> > > > > > > > > > > > 2012/5/31 José Luis Cetina <ma...@gmail.com>
> > > > > > > > > > > >
> > > > > > > > > > > > > Ok, the what i asked is correct??
> > > > > > > > > > > > >
> > > > > > > > > > > > > "I dont know if this is the desire behaviour or if
> > this
> > > > > > happend
> > > > > > > > > > because
> > > > > > > > > > > > > the http request isnt finished?"
> > > > > > > > > > > > >
> > > > > > > > > > > > > 2012/5/31 Romain Manni-Bucau <
> rmannibucau@gmail.com>
> > > > > > > > > > > > >
> > > > > > > > > > > > >> ok,
> > > > > > > > > > > > >>
> > > > > > > > > > > > >> in fact info from ejbcontext are taken in our
> > > > > securitymodule
> > > > > > > > > > > > >>
> > > > > > > > > > > > >> in tomee we set/unset it from a valve so at the
> > > > > > beginning/end
> > > > > > > of
> > > > > > > > > the
> > > > > > > > > > > > >> request...all between is currently ignored so when
> > you
> > > > log
> > > > > > you
> > > > > > > > > need
> > > > > > > > > > > > >> another
> > > > > > > > > > > > >> request to get the updated information (from the
> > > tomcat
> > > > > > realm)
> > > > > > > > > > > > >>
> > > > > > > > > > > > >> - Romain
> > > > > > > > > > > > >>
> > > > > > > > > > > > >>
> > > > > > > > > > > > >> 2012/6/1 José Luis Cetina <ma...@gmail.com>
> > > > > > > > > > > > >>
> > > > > > > > > > > > >> > Yes, it work
> > > > > > > > > > > > >> >
> > > > > > > > > > > > >> > 1) Login (form login) using DataSourceRealm
> > > > > > > > > > > > >> >
> > > > > > > > > > > > >> >
> > > > > > > > > > > > >> > 2) Redirect to page2 from my managedbean
> > > > > > > > > > > > >> >
> > > > > > > > > > > > >> > 2012/5/31 Romain Manni-Bucau <
> > rmannibucau@gmail.com
> > > >
> > > > > > > > > > > > >> >
> > > > > > > > > > > > >> > > so you mean using the flow i described before
> it
> > > > > works?
> > > > > > > > > (sorry,
> > > > > > > > > > > just
> > > > > > > > > > > > >> to
> > > > > > > > > > > > >> > be
> > > > > > > > > > > > >> > > sure to understand)
> > > > > > > > > > > > >> > >
> > > > > > > > > > > > >> > > - Romain
> > > > > > > > > > > > >> > >
> > > > > > > > > > > > >> > >
> > > > > > > > > > > > >> > > 2012/6/1 José Luis Cetina <
> maxtorzito@gmail.com
> > >
> > > > > > > > > > > > >> > >
> > > > > > > > > > > > >> > > > Hi i can login and i can navigate (redirect)
> > to
> > > my
> > > > > > other
> > > > > > > > > page,
> > > > > > > > > > > > but i
> > > > > > > > > > > > >> > dont
> > > > > > > > > > > > >> > > > know why im getting guest user in the login
> > > mbean,
> > > > > > after
> > > > > > > > > that
> > > > > > > > > > in
> > > > > > > > > > > > >> other
> > > > > > > > > > > > >> > > > mbean  i get my "real" user.
> > > > > > > > > > > > >> > > >
> > > > > > > > > > > > >> > > >
> > > > > > > > > > > > >> > > > 2012/5/31 Romain Manni-Bucau <
> > > > rmannibucau@gmail.com
> > > > > >
> > > > > > > > > > > > >> > > >
> > > > > > > > > > > > >> > > > > maybe
> > > > > > > > > > > > >> > > > >
> > > > > > > > > > > > >> > > >
> > > > > > > > > > > > >> > >
> > > > > > > > > > > > >> >
> > > > > > > > > > > > >>
> > > > > > > > > > > >
> > > > > > > > > > >
> > > > > > > > > >
> > > > > > > > >
> > > > > > > >
> > > > > > >
> > > > > >
> > > > >
> > > >
> > >
> >
> http://rmannibucau.wordpress.com/2012/05/09/tomee-and-its-ssh-connector/but
> > > > > > > > > > > > >> > > > > it uses properties file, it just need a
> > custom
> > > > > login
> > > > > > > > > module
> > > > > > > > > > > > >> > > > implementation
> > > > > > > > > > > > >> > > > > to use a db.
> > > > > > > > > > > > >> > > > >
> > > > > > > > > > > > >> > > > > well,
> > > > > > > > > > > > >> > > > >
> > > > > > > > > > > > >> > > > > before can you test it please?
> > > > > > > > > > > > >> > > > > 1) login
> > > > > > > > > > > > >> > > > > 2) redirect to your page using your bean
> > > > > > > > > > > > >> > > > >
> > > > > > > > > > > > >> > > > > - Romain
> > > > > > > > > > > > >> > > > >
> > > > > > > > > > > > >> > > > >
> > > > > > > > > > > > >> > > > > 2012/6/1 José Luis Cetina <
> > > maxtorzito@gmail.com
> > > > >
> > > > > > > > > > > > >> > > > >
> > > > > > > > > > > > >> > > > > > I have to read and know how to use
> this, i
> > > > > always
> > > > > > > use
> > > > > > > > > > > > >> DataSource or
> > > > > > > > > > > > >> > > > > > JDBCRealm. (with glassfish).
> > > > > > > > > > > > >> > > > > > im reading now, do you have something
> for
> > a
> > > > > > > > quickstart?
> > > > > > > > > > for
> > > > > > > > > > > > >> share
> > > > > > > > > > > > >> > me
> > > > > > > > > > > > >> > > > > >
> > > > > > > > > > > > >> > > > > > 2012/5/31 Romain Manni-Bucau <
> > > > > > rmannibucau@gmail.com
> > > > > > > >
> > > > > > > > > > > > >> > > > > >
> > > > > > > > > > > > >> > > > > > > having your password in a db is not an
> > > issue
> > > > > > but i
> > > > > > > > > think
> > > > > > > > > > > you
> > > > > > > > > > > > >> > should
> > > > > > > > > > > > >> > > > > > > use
> org.apache.catalina.realm.JAASRealm
> > > > > > > > > > > > >> > > > > > >
> > > > > > > > > > > > >> > > > > > > for instance:
> > > > > > > > > > > > >> > > > > > >
> > > > > > > > > > > > >> > > > > > >     <Realm
> > > > > > > > > > className="org.apache.catalina.realm.JAASRealm"
> > > > > > > > > > > > >> > > > > > > appName="MyDBLoginModule"
> > > > > > > > > > > > >> > > > > > >
> > > > > > > > > > > > >> > > > > > >
> > > > > > > > > > > > >> > > > > > >
> > > > > > > > > > > > >> > > > > >
> > > > > > > > > > > > >> > > > >
> > > > > > > > > > > > >> > > >
> > > > > > > > > > > > >> > >
> > > > > > > > > > > > >> >
> > > > > > > > > > > > >>
> > > > > > > > > > > >
> > > > > > > > > > >
> > > > > > > > > >
> > > > > > > > >
> > > > > > > >
> > > > > > >
> > > > > >
> > > > >
> > > >
> > >
> >
>  userClassNames="org.apache.openejb.core.security.AbstractSecurityService$User"
> > > > > > > > > > > > >> > > > > > >
> > > > > > > > > > > > >> > > > > > >
> > > > > > > > > > > > >> > > > > > >
> > > > > > > > > > > > >> > > > > >
> > > > > > > > > > > > >> > > > >
> > > > > > > > > > > > >> > > >
> > > > > > > > > > > > >> > >
> > > > > > > > > > > > >> >
> > > > > > > > > > > > >>
> > > > > > > > > > > >
> > > > > > > > > > >
> > > > > > > > > >
> > > > > > > > >
> > > > > > > >
> > > > > > >
> > > > > >
> > > > >
> > > >
> > >
> >
>  roleClassNames="org.apache.openejb.core.security.AbstractSecurityService$Group">
> > > > > > > > > > > > >> > > > > > >      </Realm>
> > > > > > > > > > > > >> > > > > > >
> > > > > > > > > > > > >> > > > > > > so simply implement a custom
> LoginModule
> > > > > instead
> > > > > > > of
> > > > > > > > a
> > > > > > > > > > > realm
> > > > > > > > > > > > >> > > > > > >
> > > > > > > > > > > > >> > > > > > > wdyt?
> > > > > > > > > > > > >> > > > > > >
> > > > > > > > > > > > >> > > > > > > - Romain
> > > > > > > > > > > > >> > > > > > >
> > > > > > > > > > > > >> > > > > > >
> > > > > > > > > > > > >> > > > > > > 2012/6/1 José Luis Cetina <
> > > > > maxtorzito@gmail.com
> > > > > > >
> > > > > > > > > > > > >> > > > > > >
> > > > > > > > > > > > >> > > > > > > > Sorry, i use DataSourceRealm, i have
> > my
> > > > > > > > > > user/pass/roles
> > > > > > > > > > > in
> > > > > > > > > > > > >> the
> > > > > > > > > > > > >> > > DB.
> > > > > > > > > > > > >> > > > > > > >
> > > > > > > > > > > > >> > > > > > > >
> > > > > > > > > > > > >> > > > > > > >
> > > > > > > > > > > > >> > > > > > > > 2012/5/31 Romain Manni-Bucau <
> > > > > > > > rmannibucau@gmail.com
> > > > > > > > > >
> > > > > > > > > > > > >> > > > > > > >
> > > > > > > > > > > > >> > > > > > > > > can't you do it with an embedded
> > one?
> > > > > > > > > > > > >> > > > > > > > >
> > > > > > > > > > > > >> > > > > > > > > well DataSourceRealm doesn't use
> > JAAS
> > > by
> > > > > > > > default i
> > > > > > > > > > > > think,
> > > > > > > > > > > > >> > maybe
> > > > > > > > > > > > >> > > > > > that's
> > > > > > > > > > > > >> > > > > > > > the
> > > > > > > > > > > > >> > > > > > > > > issue
> > > > > > > > > > > > >> > > > > > > > >
> > > > > > > > > > > > >> > > > > > > > > - Romain
> > > > > > > > > > > > >> > > > > > > > >
> > > > > > > > > > > > >> > > > > > > > >
> > > > > > > > > > > > >> > > > > > > > > 2012/6/1 José Luis Cetina <
> > > > > > > maxtorzito@gmail.com
> > > > > > > > >
> > > > > > > > > > > > >> > > > > > > > >
> > > > > > > > > > > > >> > > > > > > > > > OK, i can create a sample, but i
> > use
> > > > > > > > > > > DataSourceRealm,
> > > > > > > > > > > > >> are
> > > > > > > > > > > > >> > you
> > > > > > > > > > > > >> > > > > gonna
> > > > > > > > > > > > >> > > > > > > > > > configure your database?
> > > > > > > > > > > > >> > > > > > > > > >
> > > > > > > > > > > > >> > > > > > > > > > 2012/5/31 Romain Manni-Bucau <
> > > > > > > > > > rmannibucau@gmail.com
> > > > > > > > > > > >
> > > > > > > > > > > > >> > > > > > > > > >
> > > > > > > > > > > > >> > > > > > > > > > > can you have a try in an EJB
> > > please?
> > > > > > (just
> > > > > > > > try
> > > > > > > > > > to
> > > > > > > > > > > > add
> > > > > > > > > > > > >> > > > > @Stateless
> > > > > > > > > > > > >> > > > > > on
> > > > > > > > > > > > >> > > > > > > > > your
> > > > > > > > > > > > >> > > > > > > > > > > managed bean for instance)
> > > > > > > > > > > > >> > > > > > > > > > >
> > > > > > > > > > > > >> > > > > > > > > > > can you share a sample easy to
> > > run?
> > > > > > > > > > > > >> > > > > > > > > > >
> > > > > > > > > > > > >> > > > > > > > > > > - Romain
> > > > > > > > > > > > >> > > > > > > > > > >
> > > > > > > > > > > > >> > > > > > > > > > >
> > > > > > > > > > > > >> > > > > > > > > > > 2012/6/1 José Luis Cetina <
> > > > > > > > > maxtorzito@gmail.com
> > > > > > > > > > >
> > > > > > > > > > > > >> > > > > > > > > > >
> > > > > > > > > > > > >> > > > > > > > > > > > Yes, im using JAAS
> > > > > > > > > > > > >> > > > > > > > > > > >
> > > > > > > > > > > > >> > > > > > > > > > > > 2012/5/31 Romain
> Manni-Bucau <
> > > > > > > > > > > > rmannibucau@gmail.com
> > > > > > > > > > > > >> >
> > > > > > > > > > > > >> > > > > > > > > > > >
> > > > > > > > > > > > >> > > > > > > > > > > > > Hi,
> > > > > > > > > > > > >> > > > > > > > > > > > >
> > > > > > > > > > > > >> > > > > > > > > > > > > Do you use jaas?
> > > > > > > > > > > > >> > > > > > > > > > > > >
> > > > > > > > > > > > >> > > > > > > > > > > > > - Romain
> > > > > > > > > > > > >> > > > > > > > > > > > > Le 31 mai 2012 20:14,
> "José
> > > Luis
> > > > > > > > Cetina" <
> > > > > > > > > > > > >> > > > > > maxtorzito@gmail.com
> > > > > > > > > > > > >> > > > > > > >
> > > > > > > > > > > > >> > > > > > > > a
> > > > > > > > > > > > >> > > > > > > > > > > écrit
> > > > > > > > > > > > >> > > > > > > > > > > > :
> > > > > > > > > > > > >> > > > > > > > > > > > >
> > > > > > > > > > > > >> > > > > > > > > > > > > > Hi i have this scenario:
> > > > > > > > > > > > >> > > > > > > > > > > > > >
> > > > > > > > > > > > >> > > > > > > > > > > > > > I have a page
> login.xhtml,
> > > > this
> > > > > > page
> > > > > > > > > has a
> > > > > > > > > > > > >> > > ManagedBean
> > > > > > > > > > > > >> > > > > > > (@Named)
> > > > > > > > > > > > >> > > > > > > > > > this
> > > > > > > > > > > > >> > > > > > > > > > > > > > managedbean use the
> > > > > > > > > > request.login(user,pass)
> > > > > > > > > > > > >> > method.
> > > > > > > > > > > > >> > > > > > > > > > > > > >
> > > > > > > > > > > > >> > > > > > > > > > > > > > When i do this:
> > > > > > > > > > > > >> > > > > > > > > > > > > >
> > > > > > > > > > > > >> > > > > > > > > > > > > > managedbean class:
> > > > > > > > > > > > >> > > > > > > > > > > > > >
> > > > > > > > > > > > >> > > > > > > > > > > > > > @Resource
> > > > > > > > > > > > >> > > > > > > > > > > > > > private EJBContext
> > > ejbContext;
> > > > > > > > > > > > >> > > > > > > > > > > > > > .
> > > > > > > > > > > > >> > > > > > > > > > > > > > .
> > > > > > > > > > > > >> > > > > > > > > > > > > >
> request.login(user,pass);
> > > > > > > > > > > > >> > > > > > > > > > > > > > String name =
> > > > > > > > > > > > >> > > > ejbContext.getCallerPrincipal().getName();
> > > > > > > > > > > > >> > > > > > > > > > > > > >
> > > > > > > > > > > > >> > > > > > > > > > > > > > I get "guest" as my user
> > > name.
> > > > > > But i
> > > > > > > > > > expect
> > > > > > > > > > > > the
> > > > > > > > > > > > >> > name
> > > > > > > > > > > > >> > > of
> > > > > > > > > > > > >> > > > > my
> > > > > > > > > > > > >> > > > > > > user
> > > > > > > > > > > > >> > > > > > > > > (of
> > > > > > > > > > > > >> > > > > > > > > > > > > course
> > > > > > > > > > > > >> > > > > > > > > > > > > > is not guest)
> > > > > > > > > > > > >> > > > > > > > > > > > > >
> > > > > > > > > > > > >> > > > > > > > > > > > > > If the login was
> > successful
> > > my
> > > > > > login
> > > > > > > > > page
> > > > > > > > > > > > >> navigate
> > > > > > > > > > > > >> > to
> > > > > > > > > > > > >> > > > > other
> > > > > > > > > > > > >> > > > > > > > page
> > > > > > > > > > > > >> > > > > > > > > > lets
> > > > > > > > > > > > >> > > > > > > > > > > > say
> > > > > > > > > > > > >> > > > > > > > > > > > > > pageb.xhtml
> > > > > > > > > > > > >> > > > > > > > > > > > > >
> > > > > > > > > > > > >> > > > > > > > > > > > > > If i create a
> managedbean
> > > > > (@Named)
> > > > > > > for
> > > > > > > > > > > > >> pageb.xhtml
> > > > > > > > > > > > >> > > and
> > > > > > > > > > > > >> > > > in
> > > > > > > > > > > > >> > > > > > > that
> > > > > > > > > > > > >> > > > > > > > > > > > > managedbean
> > > > > > > > > > > > >> > > > > > > > > > > > > > i use again:
> > > > > > > > > > > > >> > > > > > > > > > > > > > String name =
> > > > > > > > > > > > >> > > > ejbContext.getCallerPrincipal().getName();
> > > > > > > > > > > > >> > > > > > > > > > > > > > then, here i get my
> > > "correct"
> > > > > name
> > > > > > > of
> > > > > > > > > the
> > > > > > > > > > > user
> > > > > > > > > > > > >> (not
> > > > > > > > > > > > >> > > > > guest).
> > > > > > > > > > > > >> > > > > > > > > > > > > >
> > > > > > > > > > > > >> > > > > > > > > > > > > > I dont know if this is
> the
> > > > > desire
> > > > > > > > > > behaviour
> > > > > > > > > > > or
> > > > > > > > > > > > >> if
> > > > > > > > > > > > >> > > this
> > > > > > > > > > > > >> > > > > > > happend
> > > > > > > > > > > > >> > > > > > > > > > > because
> > > > > > > > > > > > >> > > > > > > > > > > > > the
> > > > > > > > > > > > >> > > > > > > > > > > > > > http request isnt
> > finished?
> > > > > > > > > > > > >> > > > > > > > > > > > > >
> > > > > > > > > > > > >> > > > > > > > > > > > > > other question why if i
> > call
> > > > > > > > > > > > >> > > > > > > > > > > > > > the
> > > > > > > > > > > >  ejbContext.getCallerPrincipal().getName();
> > > > > > > > > > > > >> > > before
> > > > > > > > > > > > >> > > > > the
> > > > > > > > > > > > >> > > > > > > > > > > > > request.login()
> > > > > > > > > > > > >> > > > > > > > > > > > > > method i get again
> > "guest",
> > > > why
> > > > > > not
> > > > > > > > > null?
> > > > > > > > > > > > >> > > > > > > > > > > > > >
> > > > > > > > > > > > >> > > > > > > > > > > > > > If this question is for
> > > > > > > tomee(openejb)
> > > > > > > > > or
> > > > > > > > > > > > >> tomcat?
> > > > > > > > > > > > >> > > > > > > > > > > > > >
> > > > > > > > > > > > >> > > > > > > > > > > > > > Thanks
> > > > > > > > > > > > >> > > > > > > > > > > > > >
> > > > > > > > > > > > >> > > > > > > > > > > > > >
> > > > > > > > > > > > >> > > > > > > > > > > > > >
> > > > > > > > > > > > >> > > > > > > > >
> > > > > > > > > > > > >> > > >
> > > > > > > > > > > >
> > > > > > >
> > -------------------------------------------------------------------
> > > > > > > > > > > > >> > > > > > > > > > > > > > *SCJA. José Luis Cetina*
> > > > > > > > > > > > >> > > > > > > > > > > > > >
> > > > > > > > > > > > >> > > > > > > > >
> > > > > > > > > > > > >> > > >
> > > > > > > > > > > >
> > > > > > >
> > -------------------------------------------------------------------
> > > > > > > > > > > > >> > > > > > > > > > > > > >
> > > > > > > > > > > > >> > > > > > > > > > > > >
> > > > > > > > > > > > >> > > > > > > > > > > >
> > > > > > > > > > > > >> > > > > > > > > > > >
> > > > > > > > > > > > >> > > > > > > > > > > >
> > > > > > > > > > > > >> > > > > > > > > > > > --
> > > > > > > > > > > > >> > > > > > > > > > > >
> > > > > > > > > > > > >> > > > > > >
> > > > > > > > > > > > >> >
> > > > > > > > > >
> > > > > -------------------------------------------------------------------
> > > > > > > > > > > > >> > > > > > > > > > > > *SCJA. José Luis Cetina*
> > > > > > > > > > > > >> > > > > > > > > > > >
> > > > > > > > > > > > >> > > > > > >
> > > > > > > > > > > > >> >
> > > > > > > > > >
> > > > > -------------------------------------------------------------------
> > > > > > > > > > > > >> > > > > > > > > > > >
> > > > > > > > > > > > >> > > > > > > > > > >
> > > > > > > > > > > > >> > > > > > > > > >
> > > > > > > > > > > > >> > > > > > > > > >
> > > > > > > > > > > > >> > > > > > > > > >
> > > > > > > > > > > > >> > > > > > > > > > --
> > > > > > > > > > > > >> > > > > > > > > >
> > > > > > > > > > > > >> > > > >
> > > > > > > > > > > > >>
> > > > > > > > >
> > > > -------------------------------------------------------------------
> > > > > > > > > > > > >> > > > > > > > > > *SCJA. José Luis Cetina*
> > > > > > > > > > > > >> > > > > > > > > >
> > > > > > > > > > > > >> > > > >
> > > > > > > > > > > > >>
> > > > > > > > >
> > > > -------------------------------------------------------------------
> > > > > > > > > > > > >> > > > > > > > > >
> > > > > > > > > > > > >> > > > > > > > >
> > > > > > > > > > > > >> > > > > > > >
> > > > > > > > > > > > >> > > > > > > >
> > > > > > > > > > > > >> > > > > > > >
> > > > > > > > > > > > >> > > > > > > > --
> > > > > > > > > > > > >> > > > > > > >
> > > > > > > > > > > > >> > >
> > > > > > > > > > >
> > > > > >
> -------------------------------------------------------------------
> > > > > > > > > > > > >> > > > > > > > *SCJA. José Luis Cetina*
> > > > > > > > > > > > >> > > > > > > >
> > > > > > > > > > > > >> > >
> > > > > > > > > > >
> > > > > >
> -------------------------------------------------------------------
> > > > > > > > > > > > >> > > > > > > >
> > > > > > > > > > > > >> > > > > > >
> > > > > > > > > > > > >> > > > > >
> > > > > > > > > > > > >> > > > > >
> > > > > > > > > > > > >> > > > > >
> > > > > > > > > > > > >> > > > > > --
> > > > > > > > > > > > >> > > > > >
> > > > > > > > > > > > >>
> > > > > > > > >
> > > > -------------------------------------------------------------------
> > > > > > > > > > > > >> > > > > > *SCJA. José Luis Cetina*
> > > > > > > > > > > > >> > > > > >
> > > > > > > > > > > > >>
> > > > > > > > >
> > > > -------------------------------------------------------------------
> > > > > > > > > > > > >> > > > > >
> > > > > > > > > > > > >> > > > >
> > > > > > > > > > > > >> > > >
> > > > > > > > > > > > >> > > >
> > > > > > > > > > > > >> > > >
> > > > > > > > > > > > >> > > > --
> > > > > > > > > > > > >> > > >
> > > > > > > > > > > >
> > > > > > >
> > -------------------------------------------------------------------
> > > > > > > > > > > > >> > > > *SCJA. José Luis Cetina*
> > > > > > > > > > > > >> > > >
> > > > > > > > > > > >
> > > > > > >
> > -------------------------------------------------------------------
> > > > > > > > > > > > >> > > >
> > > > > > > > > > > > >> > >
> > > > > > > > > > > > >> >
> > > > > > > > > > > > >> >
> > > > > > > > > > > > >> >
> > > > > > > > > > > > >> > --
> > > > > > > > > > > > >> >
> > > > > > > > > >
> > > > > -------------------------------------------------------------------
> > > > > > > > > > > > >> > *SCJA. José Luis Cetina*
> > > > > > > > > > > > >> >
> > > > > > > > > >
> > > > > -------------------------------------------------------------------
> > > > > > > > > > > > >> >
> > > > > > > > > > > > >>
> > > > > > > > > > > > >
> > > > > > > > > > > > >
> > > > > > > > > > > > >
> > > > > > > > > > > > > --
> > > > > > > > > > > > >
> > > > > > > >
> > > -------------------------------------------------------------------
> > > > > > > > > > > > > *SCJA. José Luis Cetina*
> > > > > > > > > > > > >
> > > > > > > >
> > > -------------------------------------------------------------------
> > > > > > > > > > > > >
> > > > > > > > > > > > >
> > > > > > > > > > > >
> > > > > > > > > > > >
> > > > > > > > > > > > --
> > > > > > > > > > > >
> > > > > > >
> > -------------------------------------------------------------------
> > > > > > > > > > > > *SCJA. José Luis Cetina*
> > > > > > > > > > > >
> > > > > > >
> > -------------------------------------------------------------------
> > > > > > > > > > > >
> > > > > > > > > > >
> > > > > > > > > >
> > > > > > > > > >
> > > > > > > > > >
> > > > > > > > > > --
> > > > > > > > > >
> > > > > -------------------------------------------------------------------
> > > > > > > > > > *SCJA. José Luis Cetina*
> > > > > > > > > >
> > > > > -------------------------------------------------------------------
> > > > > > > > > >
> > > > > > > > >
> > > > > > > >
> > > > > > > >
> > > > > > > >
> > > > > > > > --
> > > > > > > >
> > > -------------------------------------------------------------------
> > > > > > > > *SCJA. José Luis Cetina*
> > > > > > > >
> > > -------------------------------------------------------------------
> > > > > > > >
> > > > > > >
> > > > > >
> > > > > >
> > > > > >
> > > > > > --
> > > > > >
> -------------------------------------------------------------------
> > > > > > *SCJA. José Luis Cetina*
> > > > > >
> -------------------------------------------------------------------
> > > > > >
> > > > >
> > > >
> > > >
> > > >
> > > > --
> > > > -------------------------------------------------------------------
> > > > *SCJA. José Luis Cetina*
> > > > -------------------------------------------------------------------
> > > >
> > >
> >
> >
> >
> > --
> > -------------------------------------------------------------------
> > *SCJA. José Luis Cetina*
> > -------------------------------------------------------------------
> >
>



-- 
-------------------------------------------------------------------
*SCJA. José Luis Cetina*
-------------------------------------------------------------------

Re: Guest user

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

just commited, a new commit will come where this class will automatically
be added normally

- Romain


2012/6/1 José Luis Cetina <ma...@gmail.com>

> im getting a ClassNotFound
>
> Caused by: java.lang.ClassNotFoundException:
> org.apache.tomee.catalina.TomEERealm
>
> 2012/5/31 Romain Manni-Bucau <rm...@gmail.com>
>
> > my sample is working, too late to add test but manually it works
> >
> > so i guess it should work for you
> >
> > the question now is should we add it automatically?
> >
> > - Romain
> >
> >
> > 2012/6/1 José Luis Cetina <ma...@gmail.com>
> >
> > > Oooh great, with this i can get the principal user in the first
> request?
> > or
> > > this is something that you gonna fix?
> > >
> > > 2012/5/31 Romain Manni-Bucau <rm...@gmail.com>
> > >
> > > > that's brand new ;)
> > > >
> > > > just added it, it mainly delegate to the real realm but add the
> > principal
> > > > info to openejb/tomee security service which is used in ejbcontext
> impl
> > > (to
> > > > make it short)
> > > >
> > > > - Romain
> > > >
> > > >
> > > > 2012/6/1 José Luis Cetina <ma...@gmail.com>
> > > >
> > > > > I have this in my context.xml
> > > > >
> > > > > <Realm className="MyExtendedDataSourceRealm"
> > > > >  dataSourceName="MyDataSource"
> > > > > digest="SHA-256"
> > > > > encodePassword="Base64"
> > > > > queryRealmRolesUser="SELECT rol FROM xxxx WHERE user=?"
> > > > > queryRealmUsers="SELECT pass FROM xxx WHERE user=?"/>
> > > > >
> > > > > As you can see i extend the datasource realm, i have this realm
> > config
> > > in
> > > > > the context.xml in my webapp (not context.xml TomEE).
> > > > >
> > > > > But, as i can see in your example, you surround your realm with
> > > > TomEERealm,
> > > > > if this necessary?. I didn't know this
> > > > >
> > > > >
> > > > >
> > > > > 2012/5/31 Romain Manni-Bucau <rm...@gmail.com>
> > > > >
> > > > > > in my test i used:
> > > > > >
> > > > > >    <Realm className="org.apache.tomee.catalina.TomEERealm">
> > > > > >        <Realm className="org.apache.catalina.realm.JAASRealm"
> > > > > > appName="PropertiesLoginModule"
> > > > > >
> > > > > >
> > > > > >
> > > > >
> > > >
> > >
> >
>  userClassNames="org.apache.openejb.core.security.AbstractSecurityService$User"
> > > > > >
> > > > > >
> > > > > >
> > > > >
> > > >
> > >
> >
>  roleClassNames="org.apache.openejb.core.security.AbstractSecurityService$Group">
> > > > > >        </Realm>
> > > > > >       </Realm>
> > > > > >
> > > > > > but i guess you can replace the jaasrealm by your dsrealm
> > > > > >
> > > > > > - Romain
> > > > > >
> > > > > >
> > > > > > 2012/6/1 José Luis Cetina <ma...@gmail.com>
> > > > > >
> > > > > > > Yes, it seems buggy.
> > > > > > >
> > > > > > > Where i have to replace?
> > > > > > >
> > > > > > > Remember im using DataSourceRealm
> > > > > > >
> > > > > > > 2012/5/31 Romain Manni-Bucau <rm...@gmail.com>
> > > > > > >
> > > > > > > > this is the current status,
> > > > > > > >
> > > > > > > > but IMO it is buggy,
> > > > > > > >
> > > > > > > > i'll commit soon a TomEEJAASRealm to make it working (replace
> > > > > JAASRealm
> > > > > > > in
> > > > > > > > the conf)
> > > > > > > >
> > > > > > > > - Romain
> > > > > > > >
> > > > > > > >
> > > > > > > > 2012/6/1 José Luis Cetina <ma...@gmail.com>
> > > > > > > >
> > > > > > > > > i think we are getting confused.
> > > > > > > > >
> > > > > > > > > If i resume all, this what i asked (the final of the first
> > > post)
> > > > > > > > >
> > > > > > > > > I dont know if this is the desire behavior or if this
> happend
> > > > > becase
> > > > > > > the
> > > > > > > > > httr request isnt finished?
> > > > > > > > > Then you answer me:
> > > > > > > > >
> > > > > > > > > in fact info from ejbcontext are taken in our
> securitymodule
> > > > > > > > >
> > > > > > > > > in tomee we set/unset it from a valve so at the
> beginning/end
> > > of
> > > > > the
> > > > > > > > > request...all between is currently ignored so when you log
> > you
> > > > need
> > > > > > > > another
> > > > > > > > > request to get the updated information (from the tomcat
> > realm)
> > > > > > > > >
> > > > > > > > > "so when you log you need another request to get the
> updated
> > > > > > > information
> > > > > > > > > (from the tomcat realm)
> > > > > > > > >
> > > > > > > > > Then i get guest because is the desire behaviour, after the
> > > first
> > > > > > > > request i
> > > > > > > > > can get the user i expected.
> > > > > > > > >
> > > > > > > > > Then i resume, this is the default behaviour, and works but
> > you
> > > > > need
> > > > > > a
> > > > > > > > > second request.
> > > > > > > > >
> > > > > > > > >
> > > > > > > > >
> > > > > > > > > 2012/5/31 Romain Manni-Bucau <rm...@gmail.com>
> > > > > > > > >
> > > > > > > > > > i think it should work
> > > > > > > > > >
> > > > > > > > > > - Romain
> > > > > > > > > >
> > > > > > > > > >
> > > > > > > > > > 2012/6/1 José Luis Cetina <ma...@gmail.com>
> > > > > > > > > >
> > > > > > > > > > > I mean this:
> > > > > > > > > > >
> > > > > > > > > > > I dont know if this is the desire behaviour or if this
> > > > happend
> > > > > > > > because
> > > > > > > > > > the
> > > > > > > > > > > http request isnt finished?
> > > > > > > > > > >
> > > > > > > > > > >
> > > > > > > > > > >
> > > > > > > > > > > 2012/5/31 José Luis Cetina <ma...@gmail.com>
> > > > > > > > > > >
> > > > > > > > > > > > Ok, the what i asked is correct??
> > > > > > > > > > > >
> > > > > > > > > > > > "I dont know if this is the desire behaviour or if
> this
> > > > > happend
> > > > > > > > > because
> > > > > > > > > > > > the http request isnt finished?"
> > > > > > > > > > > >
> > > > > > > > > > > > 2012/5/31 Romain Manni-Bucau <rm...@gmail.com>
> > > > > > > > > > > >
> > > > > > > > > > > >> ok,
> > > > > > > > > > > >>
> > > > > > > > > > > >> in fact info from ejbcontext are taken in our
> > > > securitymodule
> > > > > > > > > > > >>
> > > > > > > > > > > >> in tomee we set/unset it from a valve so at the
> > > > > beginning/end
> > > > > > of
> > > > > > > > the
> > > > > > > > > > > >> request...all between is currently ignored so when
> you
> > > log
> > > > > you
> > > > > > > > need
> > > > > > > > > > > >> another
> > > > > > > > > > > >> request to get the updated information (from the
> > tomcat
> > > > > realm)
> > > > > > > > > > > >>
> > > > > > > > > > > >> - Romain
> > > > > > > > > > > >>
> > > > > > > > > > > >>
> > > > > > > > > > > >> 2012/6/1 José Luis Cetina <ma...@gmail.com>
> > > > > > > > > > > >>
> > > > > > > > > > > >> > Yes, it work
> > > > > > > > > > > >> >
> > > > > > > > > > > >> > 1) Login (form login) using DataSourceRealm
> > > > > > > > > > > >> >
> > > > > > > > > > > >> >
> > > > > > > > > > > >> > 2) Redirect to page2 from my managedbean
> > > > > > > > > > > >> >
> > > > > > > > > > > >> > 2012/5/31 Romain Manni-Bucau <
> rmannibucau@gmail.com
> > >
> > > > > > > > > > > >> >
> > > > > > > > > > > >> > > so you mean using the flow i described before it
> > > > works?
> > > > > > > > (sorry,
> > > > > > > > > > just
> > > > > > > > > > > >> to
> > > > > > > > > > > >> > be
> > > > > > > > > > > >> > > sure to understand)
> > > > > > > > > > > >> > >
> > > > > > > > > > > >> > > - Romain
> > > > > > > > > > > >> > >
> > > > > > > > > > > >> > >
> > > > > > > > > > > >> > > 2012/6/1 José Luis Cetina <maxtorzito@gmail.com
> >
> > > > > > > > > > > >> > >
> > > > > > > > > > > >> > > > Hi i can login and i can navigate (redirect)
> to
> > my
> > > > > other
> > > > > > > > page,
> > > > > > > > > > > but i
> > > > > > > > > > > >> > dont
> > > > > > > > > > > >> > > > know why im getting guest user in the login
> > mbean,
> > > > > after
> > > > > > > > that
> > > > > > > > > in
> > > > > > > > > > > >> other
> > > > > > > > > > > >> > > > mbean  i get my "real" user.
> > > > > > > > > > > >> > > >
> > > > > > > > > > > >> > > >
> > > > > > > > > > > >> > > > 2012/5/31 Romain Manni-Bucau <
> > > rmannibucau@gmail.com
> > > > >
> > > > > > > > > > > >> > > >
> > > > > > > > > > > >> > > > > maybe
> > > > > > > > > > > >> > > > >
> > > > > > > > > > > >> > > >
> > > > > > > > > > > >> > >
> > > > > > > > > > > >> >
> > > > > > > > > > > >>
> > > > > > > > > > >
> > > > > > > > > >
> > > > > > > > >
> > > > > > > >
> > > > > > >
> > > > > >
> > > > >
> > > >
> > >
> >
> http://rmannibucau.wordpress.com/2012/05/09/tomee-and-its-ssh-connector/but
> > > > > > > > > > > >> > > > > it uses properties file, it just need a
> custom
> > > > login
> > > > > > > > module
> > > > > > > > > > > >> > > > implementation
> > > > > > > > > > > >> > > > > to use a db.
> > > > > > > > > > > >> > > > >
> > > > > > > > > > > >> > > > > well,
> > > > > > > > > > > >> > > > >
> > > > > > > > > > > >> > > > > before can you test it please?
> > > > > > > > > > > >> > > > > 1) login
> > > > > > > > > > > >> > > > > 2) redirect to your page using your bean
> > > > > > > > > > > >> > > > >
> > > > > > > > > > > >> > > > > - Romain
> > > > > > > > > > > >> > > > >
> > > > > > > > > > > >> > > > >
> > > > > > > > > > > >> > > > > 2012/6/1 José Luis Cetina <
> > maxtorzito@gmail.com
> > > >
> > > > > > > > > > > >> > > > >
> > > > > > > > > > > >> > > > > > I have to read and know how to use this, i
> > > > always
> > > > > > use
> > > > > > > > > > > >> DataSource or
> > > > > > > > > > > >> > > > > > JDBCRealm. (with glassfish).
> > > > > > > > > > > >> > > > > > im reading now, do you have something for
> a
> > > > > > > quickstart?
> > > > > > > > > for
> > > > > > > > > > > >> share
> > > > > > > > > > > >> > me
> > > > > > > > > > > >> > > > > >
> > > > > > > > > > > >> > > > > > 2012/5/31 Romain Manni-Bucau <
> > > > > rmannibucau@gmail.com
> > > > > > >
> > > > > > > > > > > >> > > > > >
> > > > > > > > > > > >> > > > > > > having your password in a db is not an
> > issue
> > > > > but i
> > > > > > > > think
> > > > > > > > > > you
> > > > > > > > > > > >> > should
> > > > > > > > > > > >> > > > > > > use org.apache.catalina.realm.JAASRealm
> > > > > > > > > > > >> > > > > > >
> > > > > > > > > > > >> > > > > > > for instance:
> > > > > > > > > > > >> > > > > > >
> > > > > > > > > > > >> > > > > > >     <Realm
> > > > > > > > > className="org.apache.catalina.realm.JAASRealm"
> > > > > > > > > > > >> > > > > > > appName="MyDBLoginModule"
> > > > > > > > > > > >> > > > > > >
> > > > > > > > > > > >> > > > > > >
> > > > > > > > > > > >> > > > > > >
> > > > > > > > > > > >> > > > > >
> > > > > > > > > > > >> > > > >
> > > > > > > > > > > >> > > >
> > > > > > > > > > > >> > >
> > > > > > > > > > > >> >
> > > > > > > > > > > >>
> > > > > > > > > > >
> > > > > > > > > >
> > > > > > > > >
> > > > > > > >
> > > > > > >
> > > > > >
> > > > >
> > > >
> > >
> >
>  userClassNames="org.apache.openejb.core.security.AbstractSecurityService$User"
> > > > > > > > > > > >> > > > > > >
> > > > > > > > > > > >> > > > > > >
> > > > > > > > > > > >> > > > > > >
> > > > > > > > > > > >> > > > > >
> > > > > > > > > > > >> > > > >
> > > > > > > > > > > >> > > >
> > > > > > > > > > > >> > >
> > > > > > > > > > > >> >
> > > > > > > > > > > >>
> > > > > > > > > > >
> > > > > > > > > >
> > > > > > > > >
> > > > > > > >
> > > > > > >
> > > > > >
> > > > >
> > > >
> > >
> >
>  roleClassNames="org.apache.openejb.core.security.AbstractSecurityService$Group">
> > > > > > > > > > > >> > > > > > >      </Realm>
> > > > > > > > > > > >> > > > > > >
> > > > > > > > > > > >> > > > > > > so simply implement a custom LoginModule
> > > > instead
> > > > > > of
> > > > > > > a
> > > > > > > > > > realm
> > > > > > > > > > > >> > > > > > >
> > > > > > > > > > > >> > > > > > > wdyt?
> > > > > > > > > > > >> > > > > > >
> > > > > > > > > > > >> > > > > > > - Romain
> > > > > > > > > > > >> > > > > > >
> > > > > > > > > > > >> > > > > > >
> > > > > > > > > > > >> > > > > > > 2012/6/1 José Luis Cetina <
> > > > maxtorzito@gmail.com
> > > > > >
> > > > > > > > > > > >> > > > > > >
> > > > > > > > > > > >> > > > > > > > Sorry, i use DataSourceRealm, i have
> my
> > > > > > > > > user/pass/roles
> > > > > > > > > > in
> > > > > > > > > > > >> the
> > > > > > > > > > > >> > > DB.
> > > > > > > > > > > >> > > > > > > >
> > > > > > > > > > > >> > > > > > > >
> > > > > > > > > > > >> > > > > > > >
> > > > > > > > > > > >> > > > > > > > 2012/5/31 Romain Manni-Bucau <
> > > > > > > rmannibucau@gmail.com
> > > > > > > > >
> > > > > > > > > > > >> > > > > > > >
> > > > > > > > > > > >> > > > > > > > > can't you do it with an embedded
> one?
> > > > > > > > > > > >> > > > > > > > >
> > > > > > > > > > > >> > > > > > > > > well DataSourceRealm doesn't use
> JAAS
> > by
> > > > > > > default i
> > > > > > > > > > > think,
> > > > > > > > > > > >> > maybe
> > > > > > > > > > > >> > > > > > that's
> > > > > > > > > > > >> > > > > > > > the
> > > > > > > > > > > >> > > > > > > > > issue
> > > > > > > > > > > >> > > > > > > > >
> > > > > > > > > > > >> > > > > > > > > - Romain
> > > > > > > > > > > >> > > > > > > > >
> > > > > > > > > > > >> > > > > > > > >
> > > > > > > > > > > >> > > > > > > > > 2012/6/1 José Luis Cetina <
> > > > > > maxtorzito@gmail.com
> > > > > > > >
> > > > > > > > > > > >> > > > > > > > >
> > > > > > > > > > > >> > > > > > > > > > OK, i can create a sample, but i
> use
> > > > > > > > > > DataSourceRealm,
> > > > > > > > > > > >> are
> > > > > > > > > > > >> > you
> > > > > > > > > > > >> > > > > gonna
> > > > > > > > > > > >> > > > > > > > > > configure your database?
> > > > > > > > > > > >> > > > > > > > > >
> > > > > > > > > > > >> > > > > > > > > > 2012/5/31 Romain Manni-Bucau <
> > > > > > > > > rmannibucau@gmail.com
> > > > > > > > > > >
> > > > > > > > > > > >> > > > > > > > > >
> > > > > > > > > > > >> > > > > > > > > > > can you have a try in an EJB
> > please?
> > > > > (just
> > > > > > > try
> > > > > > > > > to
> > > > > > > > > > > add
> > > > > > > > > > > >> > > > > @Stateless
> > > > > > > > > > > >> > > > > > on
> > > > > > > > > > > >> > > > > > > > > your
> > > > > > > > > > > >> > > > > > > > > > > managed bean for instance)
> > > > > > > > > > > >> > > > > > > > > > >
> > > > > > > > > > > >> > > > > > > > > > > can you share a sample easy to
> > run?
> > > > > > > > > > > >> > > > > > > > > > >
> > > > > > > > > > > >> > > > > > > > > > > - Romain
> > > > > > > > > > > >> > > > > > > > > > >
> > > > > > > > > > > >> > > > > > > > > > >
> > > > > > > > > > > >> > > > > > > > > > > 2012/6/1 José Luis Cetina <
> > > > > > > > maxtorzito@gmail.com
> > > > > > > > > >
> > > > > > > > > > > >> > > > > > > > > > >
> > > > > > > > > > > >> > > > > > > > > > > > Yes, im using JAAS
> > > > > > > > > > > >> > > > > > > > > > > >
> > > > > > > > > > > >> > > > > > > > > > > > 2012/5/31 Romain Manni-Bucau <
> > > > > > > > > > > rmannibucau@gmail.com
> > > > > > > > > > > >> >
> > > > > > > > > > > >> > > > > > > > > > > >
> > > > > > > > > > > >> > > > > > > > > > > > > Hi,
> > > > > > > > > > > >> > > > > > > > > > > > >
> > > > > > > > > > > >> > > > > > > > > > > > > Do you use jaas?
> > > > > > > > > > > >> > > > > > > > > > > > >
> > > > > > > > > > > >> > > > > > > > > > > > > - Romain
> > > > > > > > > > > >> > > > > > > > > > > > > Le 31 mai 2012 20:14, "José
> > Luis
> > > > > > > Cetina" <
> > > > > > > > > > > >> > > > > > maxtorzito@gmail.com
> > > > > > > > > > > >> > > > > > > >
> > > > > > > > > > > >> > > > > > > > a
> > > > > > > > > > > >> > > > > > > > > > > écrit
> > > > > > > > > > > >> > > > > > > > > > > > :
> > > > > > > > > > > >> > > > > > > > > > > > >
> > > > > > > > > > > >> > > > > > > > > > > > > > Hi i have this scenario:
> > > > > > > > > > > >> > > > > > > > > > > > > >
> > > > > > > > > > > >> > > > > > > > > > > > > > I have a page login.xhtml,
> > > this
> > > > > page
> > > > > > > > has a
> > > > > > > > > > > >> > > ManagedBean
> > > > > > > > > > > >> > > > > > > (@Named)
> > > > > > > > > > > >> > > > > > > > > > this
> > > > > > > > > > > >> > > > > > > > > > > > > > managedbean use the
> > > > > > > > > request.login(user,pass)
> > > > > > > > > > > >> > method.
> > > > > > > > > > > >> > > > > > > > > > > > > >
> > > > > > > > > > > >> > > > > > > > > > > > > > When i do this:
> > > > > > > > > > > >> > > > > > > > > > > > > >
> > > > > > > > > > > >> > > > > > > > > > > > > > managedbean class:
> > > > > > > > > > > >> > > > > > > > > > > > > >
> > > > > > > > > > > >> > > > > > > > > > > > > > @Resource
> > > > > > > > > > > >> > > > > > > > > > > > > > private EJBContext
> > ejbContext;
> > > > > > > > > > > >> > > > > > > > > > > > > > .
> > > > > > > > > > > >> > > > > > > > > > > > > > .
> > > > > > > > > > > >> > > > > > > > > > > > > > request.login(user,pass);
> > > > > > > > > > > >> > > > > > > > > > > > > > String name =
> > > > > > > > > > > >> > > > ejbContext.getCallerPrincipal().getName();
> > > > > > > > > > > >> > > > > > > > > > > > > >
> > > > > > > > > > > >> > > > > > > > > > > > > > I get "guest" as my user
> > name.
> > > > > But i
> > > > > > > > > expect
> > > > > > > > > > > the
> > > > > > > > > > > >> > name
> > > > > > > > > > > >> > > of
> > > > > > > > > > > >> > > > > my
> > > > > > > > > > > >> > > > > > > user
> > > > > > > > > > > >> > > > > > > > > (of
> > > > > > > > > > > >> > > > > > > > > > > > > course
> > > > > > > > > > > >> > > > > > > > > > > > > > is not guest)
> > > > > > > > > > > >> > > > > > > > > > > > > >
> > > > > > > > > > > >> > > > > > > > > > > > > > If the login was
> successful
> > my
> > > > > login
> > > > > > > > page
> > > > > > > > > > > >> navigate
> > > > > > > > > > > >> > to
> > > > > > > > > > > >> > > > > other
> > > > > > > > > > > >> > > > > > > > page
> > > > > > > > > > > >> > > > > > > > > > lets
> > > > > > > > > > > >> > > > > > > > > > > > say
> > > > > > > > > > > >> > > > > > > > > > > > > > pageb.xhtml
> > > > > > > > > > > >> > > > > > > > > > > > > >
> > > > > > > > > > > >> > > > > > > > > > > > > > If i create a managedbean
> > > > (@Named)
> > > > > > for
> > > > > > > > > > > >> pageb.xhtml
> > > > > > > > > > > >> > > and
> > > > > > > > > > > >> > > > in
> > > > > > > > > > > >> > > > > > > that
> > > > > > > > > > > >> > > > > > > > > > > > > managedbean
> > > > > > > > > > > >> > > > > > > > > > > > > > i use again:
> > > > > > > > > > > >> > > > > > > > > > > > > > String name =
> > > > > > > > > > > >> > > > ejbContext.getCallerPrincipal().getName();
> > > > > > > > > > > >> > > > > > > > > > > > > > then, here i get my
> > "correct"
> > > > name
> > > > > > of
> > > > > > > > the
> > > > > > > > > > user
> > > > > > > > > > > >> (not
> > > > > > > > > > > >> > > > > guest).
> > > > > > > > > > > >> > > > > > > > > > > > > >
> > > > > > > > > > > >> > > > > > > > > > > > > > I dont know if this is the
> > > > desire
> > > > > > > > > behaviour
> > > > > > > > > > or
> > > > > > > > > > > >> if
> > > > > > > > > > > >> > > this
> > > > > > > > > > > >> > > > > > > happend
> > > > > > > > > > > >> > > > > > > > > > > because
> > > > > > > > > > > >> > > > > > > > > > > > > the
> > > > > > > > > > > >> > > > > > > > > > > > > > http request isnt
> finished?
> > > > > > > > > > > >> > > > > > > > > > > > > >
> > > > > > > > > > > >> > > > > > > > > > > > > > other question why if i
> call
> > > > > > > > > > > >> > > > > > > > > > > > > > the
> > > > > > > > > > >  ejbContext.getCallerPrincipal().getName();
> > > > > > > > > > > >> > > before
> > > > > > > > > > > >> > > > > the
> > > > > > > > > > > >> > > > > > > > > > > > > request.login()
> > > > > > > > > > > >> > > > > > > > > > > > > > method i get again
> "guest",
> > > why
> > > > > not
> > > > > > > > null?
> > > > > > > > > > > >> > > > > > > > > > > > > >
> > > > > > > > > > > >> > > > > > > > > > > > > > If this question is for
> > > > > > tomee(openejb)
> > > > > > > > or
> > > > > > > > > > > >> tomcat?
> > > > > > > > > > > >> > > > > > > > > > > > > >
> > > > > > > > > > > >> > > > > > > > > > > > > > Thanks
> > > > > > > > > > > >> > > > > > > > > > > > > >
> > > > > > > > > > > >> > > > > > > > > > > > > >
> > > > > > > > > > > >> > > > > > > > > > > > > >
> > > > > > > > > > > >> > > > > > > > >
> > > > > > > > > > > >> > > >
> > > > > > > > > > >
> > > > > >
> -------------------------------------------------------------------
> > > > > > > > > > > >> > > > > > > > > > > > > > *SCJA. José Luis Cetina*
> > > > > > > > > > > >> > > > > > > > > > > > > >
> > > > > > > > > > > >> > > > > > > > >
> > > > > > > > > > > >> > > >
> > > > > > > > > > >
> > > > > >
> -------------------------------------------------------------------
> > > > > > > > > > > >> > > > > > > > > > > > > >
> > > > > > > > > > > >> > > > > > > > > > > > >
> > > > > > > > > > > >> > > > > > > > > > > >
> > > > > > > > > > > >> > > > > > > > > > > >
> > > > > > > > > > > >> > > > > > > > > > > >
> > > > > > > > > > > >> > > > > > > > > > > > --
> > > > > > > > > > > >> > > > > > > > > > > >
> > > > > > > > > > > >> > > > > > >
> > > > > > > > > > > >> >
> > > > > > > > >
> > > > -------------------------------------------------------------------
> > > > > > > > > > > >> > > > > > > > > > > > *SCJA. José Luis Cetina*
> > > > > > > > > > > >> > > > > > > > > > > >
> > > > > > > > > > > >> > > > > > >
> > > > > > > > > > > >> >
> > > > > > > > >
> > > > -------------------------------------------------------------------
> > > > > > > > > > > >> > > > > > > > > > > >
> > > > > > > > > > > >> > > > > > > > > > >
> > > > > > > > > > > >> > > > > > > > > >
> > > > > > > > > > > >> > > > > > > > > >
> > > > > > > > > > > >> > > > > > > > > >
> > > > > > > > > > > >> > > > > > > > > > --
> > > > > > > > > > > >> > > > > > > > > >
> > > > > > > > > > > >> > > > >
> > > > > > > > > > > >>
> > > > > > > >
> > > -------------------------------------------------------------------
> > > > > > > > > > > >> > > > > > > > > > *SCJA. José Luis Cetina*
> > > > > > > > > > > >> > > > > > > > > >
> > > > > > > > > > > >> > > > >
> > > > > > > > > > > >>
> > > > > > > >
> > > -------------------------------------------------------------------
> > > > > > > > > > > >> > > > > > > > > >
> > > > > > > > > > > >> > > > > > > > >
> > > > > > > > > > > >> > > > > > > >
> > > > > > > > > > > >> > > > > > > >
> > > > > > > > > > > >> > > > > > > >
> > > > > > > > > > > >> > > > > > > > --
> > > > > > > > > > > >> > > > > > > >
> > > > > > > > > > > >> > >
> > > > > > > > > >
> > > > > -------------------------------------------------------------------
> > > > > > > > > > > >> > > > > > > > *SCJA. José Luis Cetina*
> > > > > > > > > > > >> > > > > > > >
> > > > > > > > > > > >> > >
> > > > > > > > > >
> > > > > -------------------------------------------------------------------
> > > > > > > > > > > >> > > > > > > >
> > > > > > > > > > > >> > > > > > >
> > > > > > > > > > > >> > > > > >
> > > > > > > > > > > >> > > > > >
> > > > > > > > > > > >> > > > > >
> > > > > > > > > > > >> > > > > > --
> > > > > > > > > > > >> > > > > >
> > > > > > > > > > > >>
> > > > > > > >
> > > -------------------------------------------------------------------
> > > > > > > > > > > >> > > > > > *SCJA. José Luis Cetina*
> > > > > > > > > > > >> > > > > >
> > > > > > > > > > > >>
> > > > > > > >
> > > -------------------------------------------------------------------
> > > > > > > > > > > >> > > > > >
> > > > > > > > > > > >> > > > >
> > > > > > > > > > > >> > > >
> > > > > > > > > > > >> > > >
> > > > > > > > > > > >> > > >
> > > > > > > > > > > >> > > > --
> > > > > > > > > > > >> > > >
> > > > > > > > > > >
> > > > > >
> -------------------------------------------------------------------
> > > > > > > > > > > >> > > > *SCJA. José Luis Cetina*
> > > > > > > > > > > >> > > >
> > > > > > > > > > >
> > > > > >
> -------------------------------------------------------------------
> > > > > > > > > > > >> > > >
> > > > > > > > > > > >> > >
> > > > > > > > > > > >> >
> > > > > > > > > > > >> >
> > > > > > > > > > > >> >
> > > > > > > > > > > >> > --
> > > > > > > > > > > >> >
> > > > > > > > >
> > > > -------------------------------------------------------------------
> > > > > > > > > > > >> > *SCJA. José Luis Cetina*
> > > > > > > > > > > >> >
> > > > > > > > >
> > > > -------------------------------------------------------------------
> > > > > > > > > > > >> >
> > > > > > > > > > > >>
> > > > > > > > > > > >
> > > > > > > > > > > >
> > > > > > > > > > > >
> > > > > > > > > > > > --
> > > > > > > > > > > >
> > > > > > >
> > -------------------------------------------------------------------
> > > > > > > > > > > > *SCJA. José Luis Cetina*
> > > > > > > > > > > >
> > > > > > >
> > -------------------------------------------------------------------
> > > > > > > > > > > >
> > > > > > > > > > > >
> > > > > > > > > > >
> > > > > > > > > > >
> > > > > > > > > > > --
> > > > > > > > > > >
> > > > > >
> -------------------------------------------------------------------
> > > > > > > > > > > *SCJA. José Luis Cetina*
> > > > > > > > > > >
> > > > > >
> -------------------------------------------------------------------
> > > > > > > > > > >
> > > > > > > > > >
> > > > > > > > >
> > > > > > > > >
> > > > > > > > >
> > > > > > > > > --
> > > > > > > > >
> > > > -------------------------------------------------------------------
> > > > > > > > > *SCJA. José Luis Cetina*
> > > > > > > > >
> > > > -------------------------------------------------------------------
> > > > > > > > >
> > > > > > > >
> > > > > > >
> > > > > > >
> > > > > > >
> > > > > > > --
> > > > > > >
> > -------------------------------------------------------------------
> > > > > > > *SCJA. José Luis Cetina*
> > > > > > >
> > -------------------------------------------------------------------
> > > > > > >
> > > > > >
> > > > >
> > > > >
> > > > >
> > > > > --
> > > > > -------------------------------------------------------------------
> > > > > *SCJA. José Luis Cetina*
> > > > > -------------------------------------------------------------------
> > > > >
> > > >
> > >
> > >
> > >
> > > --
> > > -------------------------------------------------------------------
> > > *SCJA. José Luis Cetina*
> > > -------------------------------------------------------------------
> > >
> >
>
>
>
> --
> -------------------------------------------------------------------
> *SCJA. José Luis Cetina*
> -------------------------------------------------------------------
>

Re: Guest user

Posted by José Luis Cetina <ma...@gmail.com>.
im getting a ClassNotFound

Caused by: java.lang.ClassNotFoundException:
org.apache.tomee.catalina.TomEERealm

2012/5/31 Romain Manni-Bucau <rm...@gmail.com>

> my sample is working, too late to add test but manually it works
>
> so i guess it should work for you
>
> the question now is should we add it automatically?
>
> - Romain
>
>
> 2012/6/1 José Luis Cetina <ma...@gmail.com>
>
> > Oooh great, with this i can get the principal user in the first request?
> or
> > this is something that you gonna fix?
> >
> > 2012/5/31 Romain Manni-Bucau <rm...@gmail.com>
> >
> > > that's brand new ;)
> > >
> > > just added it, it mainly delegate to the real realm but add the
> principal
> > > info to openejb/tomee security service which is used in ejbcontext impl
> > (to
> > > make it short)
> > >
> > > - Romain
> > >
> > >
> > > 2012/6/1 José Luis Cetina <ma...@gmail.com>
> > >
> > > > I have this in my context.xml
> > > >
> > > > <Realm className="MyExtendedDataSourceRealm"
> > > >  dataSourceName="MyDataSource"
> > > > digest="SHA-256"
> > > > encodePassword="Base64"
> > > > queryRealmRolesUser="SELECT rol FROM xxxx WHERE user=?"
> > > > queryRealmUsers="SELECT pass FROM xxx WHERE user=?"/>
> > > >
> > > > As you can see i extend the datasource realm, i have this realm
> config
> > in
> > > > the context.xml in my webapp (not context.xml TomEE).
> > > >
> > > > But, as i can see in your example, you surround your realm with
> > > TomEERealm,
> > > > if this necessary?. I didn't know this
> > > >
> > > >
> > > >
> > > > 2012/5/31 Romain Manni-Bucau <rm...@gmail.com>
> > > >
> > > > > in my test i used:
> > > > >
> > > > >    <Realm className="org.apache.tomee.catalina.TomEERealm">
> > > > >        <Realm className="org.apache.catalina.realm.JAASRealm"
> > > > > appName="PropertiesLoginModule"
> > > > >
> > > > >
> > > > >
> > > >
> > >
> >
>  userClassNames="org.apache.openejb.core.security.AbstractSecurityService$User"
> > > > >
> > > > >
> > > > >
> > > >
> > >
> >
>  roleClassNames="org.apache.openejb.core.security.AbstractSecurityService$Group">
> > > > >        </Realm>
> > > > >       </Realm>
> > > > >
> > > > > but i guess you can replace the jaasrealm by your dsrealm
> > > > >
> > > > > - Romain
> > > > >
> > > > >
> > > > > 2012/6/1 José Luis Cetina <ma...@gmail.com>
> > > > >
> > > > > > Yes, it seems buggy.
> > > > > >
> > > > > > Where i have to replace?
> > > > > >
> > > > > > Remember im using DataSourceRealm
> > > > > >
> > > > > > 2012/5/31 Romain Manni-Bucau <rm...@gmail.com>
> > > > > >
> > > > > > > this is the current status,
> > > > > > >
> > > > > > > but IMO it is buggy,
> > > > > > >
> > > > > > > i'll commit soon a TomEEJAASRealm to make it working (replace
> > > > JAASRealm
> > > > > > in
> > > > > > > the conf)
> > > > > > >
> > > > > > > - Romain
> > > > > > >
> > > > > > >
> > > > > > > 2012/6/1 José Luis Cetina <ma...@gmail.com>
> > > > > > >
> > > > > > > > i think we are getting confused.
> > > > > > > >
> > > > > > > > If i resume all, this what i asked (the final of the first
> > post)
> > > > > > > >
> > > > > > > > I dont know if this is the desire behavior or if this happend
> > > > becase
> > > > > > the
> > > > > > > > httr request isnt finished?
> > > > > > > > Then you answer me:
> > > > > > > >
> > > > > > > > in fact info from ejbcontext are taken in our securitymodule
> > > > > > > >
> > > > > > > > in tomee we set/unset it from a valve so at the beginning/end
> > of
> > > > the
> > > > > > > > request...all between is currently ignored so when you log
> you
> > > need
> > > > > > > another
> > > > > > > > request to get the updated information (from the tomcat
> realm)
> > > > > > > >
> > > > > > > > "so when you log you need another request to get the updated
> > > > > > information
> > > > > > > > (from the tomcat realm)
> > > > > > > >
> > > > > > > > Then i get guest because is the desire behaviour, after the
> > first
> > > > > > > request i
> > > > > > > > can get the user i expected.
> > > > > > > >
> > > > > > > > Then i resume, this is the default behaviour, and works but
> you
> > > > need
> > > > > a
> > > > > > > > second request.
> > > > > > > >
> > > > > > > >
> > > > > > > >
> > > > > > > > 2012/5/31 Romain Manni-Bucau <rm...@gmail.com>
> > > > > > > >
> > > > > > > > > i think it should work
> > > > > > > > >
> > > > > > > > > - Romain
> > > > > > > > >
> > > > > > > > >
> > > > > > > > > 2012/6/1 José Luis Cetina <ma...@gmail.com>
> > > > > > > > >
> > > > > > > > > > I mean this:
> > > > > > > > > >
> > > > > > > > > > I dont know if this is the desire behaviour or if this
> > > happend
> > > > > > > because
> > > > > > > > > the
> > > > > > > > > > http request isnt finished?
> > > > > > > > > >
> > > > > > > > > >
> > > > > > > > > >
> > > > > > > > > > 2012/5/31 José Luis Cetina <ma...@gmail.com>
> > > > > > > > > >
> > > > > > > > > > > Ok, the what i asked is correct??
> > > > > > > > > > >
> > > > > > > > > > > "I dont know if this is the desire behaviour or if this
> > > > happend
> > > > > > > > because
> > > > > > > > > > > the http request isnt finished?"
> > > > > > > > > > >
> > > > > > > > > > > 2012/5/31 Romain Manni-Bucau <rm...@gmail.com>
> > > > > > > > > > >
> > > > > > > > > > >> ok,
> > > > > > > > > > >>
> > > > > > > > > > >> in fact info from ejbcontext are taken in our
> > > securitymodule
> > > > > > > > > > >>
> > > > > > > > > > >> in tomee we set/unset it from a valve so at the
> > > > beginning/end
> > > > > of
> > > > > > > the
> > > > > > > > > > >> request...all between is currently ignored so when you
> > log
> > > > you
> > > > > > > need
> > > > > > > > > > >> another
> > > > > > > > > > >> request to get the updated information (from the
> tomcat
> > > > realm)
> > > > > > > > > > >>
> > > > > > > > > > >> - Romain
> > > > > > > > > > >>
> > > > > > > > > > >>
> > > > > > > > > > >> 2012/6/1 José Luis Cetina <ma...@gmail.com>
> > > > > > > > > > >>
> > > > > > > > > > >> > Yes, it work
> > > > > > > > > > >> >
> > > > > > > > > > >> > 1) Login (form login) using DataSourceRealm
> > > > > > > > > > >> >
> > > > > > > > > > >> >
> > > > > > > > > > >> > 2) Redirect to page2 from my managedbean
> > > > > > > > > > >> >
> > > > > > > > > > >> > 2012/5/31 Romain Manni-Bucau <rmannibucau@gmail.com
> >
> > > > > > > > > > >> >
> > > > > > > > > > >> > > so you mean using the flow i described before it
> > > works?
> > > > > > > (sorry,
> > > > > > > > > just
> > > > > > > > > > >> to
> > > > > > > > > > >> > be
> > > > > > > > > > >> > > sure to understand)
> > > > > > > > > > >> > >
> > > > > > > > > > >> > > - Romain
> > > > > > > > > > >> > >
> > > > > > > > > > >> > >
> > > > > > > > > > >> > > 2012/6/1 José Luis Cetina <ma...@gmail.com>
> > > > > > > > > > >> > >
> > > > > > > > > > >> > > > Hi i can login and i can navigate (redirect) to
> my
> > > > other
> > > > > > > page,
> > > > > > > > > > but i
> > > > > > > > > > >> > dont
> > > > > > > > > > >> > > > know why im getting guest user in the login
> mbean,
> > > > after
> > > > > > > that
> > > > > > > > in
> > > > > > > > > > >> other
> > > > > > > > > > >> > > > mbean  i get my "real" user.
> > > > > > > > > > >> > > >
> > > > > > > > > > >> > > >
> > > > > > > > > > >> > > > 2012/5/31 Romain Manni-Bucau <
> > rmannibucau@gmail.com
> > > >
> > > > > > > > > > >> > > >
> > > > > > > > > > >> > > > > maybe
> > > > > > > > > > >> > > > >
> > > > > > > > > > >> > > >
> > > > > > > > > > >> > >
> > > > > > > > > > >> >
> > > > > > > > > > >>
> > > > > > > > > >
> > > > > > > > >
> > > > > > > >
> > > > > > >
> > > > > >
> > > > >
> > > >
> > >
> >
> http://rmannibucau.wordpress.com/2012/05/09/tomee-and-its-ssh-connector/but
> > > > > > > > > > >> > > > > it uses properties file, it just need a custom
> > > login
> > > > > > > module
> > > > > > > > > > >> > > > implementation
> > > > > > > > > > >> > > > > to use a db.
> > > > > > > > > > >> > > > >
> > > > > > > > > > >> > > > > well,
> > > > > > > > > > >> > > > >
> > > > > > > > > > >> > > > > before can you test it please?
> > > > > > > > > > >> > > > > 1) login
> > > > > > > > > > >> > > > > 2) redirect to your page using your bean
> > > > > > > > > > >> > > > >
> > > > > > > > > > >> > > > > - Romain
> > > > > > > > > > >> > > > >
> > > > > > > > > > >> > > > >
> > > > > > > > > > >> > > > > 2012/6/1 José Luis Cetina <
> maxtorzito@gmail.com
> > >
> > > > > > > > > > >> > > > >
> > > > > > > > > > >> > > > > > I have to read and know how to use this, i
> > > always
> > > > > use
> > > > > > > > > > >> DataSource or
> > > > > > > > > > >> > > > > > JDBCRealm. (with glassfish).
> > > > > > > > > > >> > > > > > im reading now, do you have something for a
> > > > > > quickstart?
> > > > > > > > for
> > > > > > > > > > >> share
> > > > > > > > > > >> > me
> > > > > > > > > > >> > > > > >
> > > > > > > > > > >> > > > > > 2012/5/31 Romain Manni-Bucau <
> > > > rmannibucau@gmail.com
> > > > > >
> > > > > > > > > > >> > > > > >
> > > > > > > > > > >> > > > > > > having your password in a db is not an
> issue
> > > > but i
> > > > > > > think
> > > > > > > > > you
> > > > > > > > > > >> > should
> > > > > > > > > > >> > > > > > > use org.apache.catalina.realm.JAASRealm
> > > > > > > > > > >> > > > > > >
> > > > > > > > > > >> > > > > > > for instance:
> > > > > > > > > > >> > > > > > >
> > > > > > > > > > >> > > > > > >     <Realm
> > > > > > > > className="org.apache.catalina.realm.JAASRealm"
> > > > > > > > > > >> > > > > > > appName="MyDBLoginModule"
> > > > > > > > > > >> > > > > > >
> > > > > > > > > > >> > > > > > >
> > > > > > > > > > >> > > > > > >
> > > > > > > > > > >> > > > > >
> > > > > > > > > > >> > > > >
> > > > > > > > > > >> > > >
> > > > > > > > > > >> > >
> > > > > > > > > > >> >
> > > > > > > > > > >>
> > > > > > > > > >
> > > > > > > > >
> > > > > > > >
> > > > > > >
> > > > > >
> > > > >
> > > >
> > >
> >
>  userClassNames="org.apache.openejb.core.security.AbstractSecurityService$User"
> > > > > > > > > > >> > > > > > >
> > > > > > > > > > >> > > > > > >
> > > > > > > > > > >> > > > > > >
> > > > > > > > > > >> > > > > >
> > > > > > > > > > >> > > > >
> > > > > > > > > > >> > > >
> > > > > > > > > > >> > >
> > > > > > > > > > >> >
> > > > > > > > > > >>
> > > > > > > > > >
> > > > > > > > >
> > > > > > > >
> > > > > > >
> > > > > >
> > > > >
> > > >
> > >
> >
>  roleClassNames="org.apache.openejb.core.security.AbstractSecurityService$Group">
> > > > > > > > > > >> > > > > > >      </Realm>
> > > > > > > > > > >> > > > > > >
> > > > > > > > > > >> > > > > > > so simply implement a custom LoginModule
> > > instead
> > > > > of
> > > > > > a
> > > > > > > > > realm
> > > > > > > > > > >> > > > > > >
> > > > > > > > > > >> > > > > > > wdyt?
> > > > > > > > > > >> > > > > > >
> > > > > > > > > > >> > > > > > > - Romain
> > > > > > > > > > >> > > > > > >
> > > > > > > > > > >> > > > > > >
> > > > > > > > > > >> > > > > > > 2012/6/1 José Luis Cetina <
> > > maxtorzito@gmail.com
> > > > >
> > > > > > > > > > >> > > > > > >
> > > > > > > > > > >> > > > > > > > Sorry, i use DataSourceRealm, i have my
> > > > > > > > user/pass/roles
> > > > > > > > > in
> > > > > > > > > > >> the
> > > > > > > > > > >> > > DB.
> > > > > > > > > > >> > > > > > > >
> > > > > > > > > > >> > > > > > > >
> > > > > > > > > > >> > > > > > > >
> > > > > > > > > > >> > > > > > > > 2012/5/31 Romain Manni-Bucau <
> > > > > > rmannibucau@gmail.com
> > > > > > > >
> > > > > > > > > > >> > > > > > > >
> > > > > > > > > > >> > > > > > > > > can't you do it with an embedded one?
> > > > > > > > > > >> > > > > > > > >
> > > > > > > > > > >> > > > > > > > > well DataSourceRealm doesn't use JAAS
> by
> > > > > > default i
> > > > > > > > > > think,
> > > > > > > > > > >> > maybe
> > > > > > > > > > >> > > > > > that's
> > > > > > > > > > >> > > > > > > > the
> > > > > > > > > > >> > > > > > > > > issue
> > > > > > > > > > >> > > > > > > > >
> > > > > > > > > > >> > > > > > > > > - Romain
> > > > > > > > > > >> > > > > > > > >
> > > > > > > > > > >> > > > > > > > >
> > > > > > > > > > >> > > > > > > > > 2012/6/1 José Luis Cetina <
> > > > > maxtorzito@gmail.com
> > > > > > >
> > > > > > > > > > >> > > > > > > > >
> > > > > > > > > > >> > > > > > > > > > OK, i can create a sample, but i use
> > > > > > > > > DataSourceRealm,
> > > > > > > > > > >> are
> > > > > > > > > > >> > you
> > > > > > > > > > >> > > > > gonna
> > > > > > > > > > >> > > > > > > > > > configure your database?
> > > > > > > > > > >> > > > > > > > > >
> > > > > > > > > > >> > > > > > > > > > 2012/5/31 Romain Manni-Bucau <
> > > > > > > > rmannibucau@gmail.com
> > > > > > > > > >
> > > > > > > > > > >> > > > > > > > > >
> > > > > > > > > > >> > > > > > > > > > > can you have a try in an EJB
> please?
> > > > (just
> > > > > > try
> > > > > > > > to
> > > > > > > > > > add
> > > > > > > > > > >> > > > > @Stateless
> > > > > > > > > > >> > > > > > on
> > > > > > > > > > >> > > > > > > > > your
> > > > > > > > > > >> > > > > > > > > > > managed bean for instance)
> > > > > > > > > > >> > > > > > > > > > >
> > > > > > > > > > >> > > > > > > > > > > can you share a sample easy to
> run?
> > > > > > > > > > >> > > > > > > > > > >
> > > > > > > > > > >> > > > > > > > > > > - Romain
> > > > > > > > > > >> > > > > > > > > > >
> > > > > > > > > > >> > > > > > > > > > >
> > > > > > > > > > >> > > > > > > > > > > 2012/6/1 José Luis Cetina <
> > > > > > > maxtorzito@gmail.com
> > > > > > > > >
> > > > > > > > > > >> > > > > > > > > > >
> > > > > > > > > > >> > > > > > > > > > > > Yes, im using JAAS
> > > > > > > > > > >> > > > > > > > > > > >
> > > > > > > > > > >> > > > > > > > > > > > 2012/5/31 Romain Manni-Bucau <
> > > > > > > > > > rmannibucau@gmail.com
> > > > > > > > > > >> >
> > > > > > > > > > >> > > > > > > > > > > >
> > > > > > > > > > >> > > > > > > > > > > > > Hi,
> > > > > > > > > > >> > > > > > > > > > > > >
> > > > > > > > > > >> > > > > > > > > > > > > Do you use jaas?
> > > > > > > > > > >> > > > > > > > > > > > >
> > > > > > > > > > >> > > > > > > > > > > > > - Romain
> > > > > > > > > > >> > > > > > > > > > > > > Le 31 mai 2012 20:14, "José
> Luis
> > > > > > Cetina" <
> > > > > > > > > > >> > > > > > maxtorzito@gmail.com
> > > > > > > > > > >> > > > > > > >
> > > > > > > > > > >> > > > > > > > a
> > > > > > > > > > >> > > > > > > > > > > écrit
> > > > > > > > > > >> > > > > > > > > > > > :
> > > > > > > > > > >> > > > > > > > > > > > >
> > > > > > > > > > >> > > > > > > > > > > > > > Hi i have this scenario:
> > > > > > > > > > >> > > > > > > > > > > > > >
> > > > > > > > > > >> > > > > > > > > > > > > > I have a page login.xhtml,
> > this
> > > > page
> > > > > > > has a
> > > > > > > > > > >> > > ManagedBean
> > > > > > > > > > >> > > > > > > (@Named)
> > > > > > > > > > >> > > > > > > > > > this
> > > > > > > > > > >> > > > > > > > > > > > > > managedbean use the
> > > > > > > > request.login(user,pass)
> > > > > > > > > > >> > method.
> > > > > > > > > > >> > > > > > > > > > > > > >
> > > > > > > > > > >> > > > > > > > > > > > > > When i do this:
> > > > > > > > > > >> > > > > > > > > > > > > >
> > > > > > > > > > >> > > > > > > > > > > > > > managedbean class:
> > > > > > > > > > >> > > > > > > > > > > > > >
> > > > > > > > > > >> > > > > > > > > > > > > > @Resource
> > > > > > > > > > >> > > > > > > > > > > > > > private EJBContext
> ejbContext;
> > > > > > > > > > >> > > > > > > > > > > > > > .
> > > > > > > > > > >> > > > > > > > > > > > > > .
> > > > > > > > > > >> > > > > > > > > > > > > > request.login(user,pass);
> > > > > > > > > > >> > > > > > > > > > > > > > String name =
> > > > > > > > > > >> > > > ejbContext.getCallerPrincipal().getName();
> > > > > > > > > > >> > > > > > > > > > > > > >
> > > > > > > > > > >> > > > > > > > > > > > > > I get "guest" as my user
> name.
> > > > But i
> > > > > > > > expect
> > > > > > > > > > the
> > > > > > > > > > >> > name
> > > > > > > > > > >> > > of
> > > > > > > > > > >> > > > > my
> > > > > > > > > > >> > > > > > > user
> > > > > > > > > > >> > > > > > > > > (of
> > > > > > > > > > >> > > > > > > > > > > > > course
> > > > > > > > > > >> > > > > > > > > > > > > > is not guest)
> > > > > > > > > > >> > > > > > > > > > > > > >
> > > > > > > > > > >> > > > > > > > > > > > > > If the login was successful
> my
> > > > login
> > > > > > > page
> > > > > > > > > > >> navigate
> > > > > > > > > > >> > to
> > > > > > > > > > >> > > > > other
> > > > > > > > > > >> > > > > > > > page
> > > > > > > > > > >> > > > > > > > > > lets
> > > > > > > > > > >> > > > > > > > > > > > say
> > > > > > > > > > >> > > > > > > > > > > > > > pageb.xhtml
> > > > > > > > > > >> > > > > > > > > > > > > >
> > > > > > > > > > >> > > > > > > > > > > > > > If i create a managedbean
> > > (@Named)
> > > > > for
> > > > > > > > > > >> pageb.xhtml
> > > > > > > > > > >> > > and
> > > > > > > > > > >> > > > in
> > > > > > > > > > >> > > > > > > that
> > > > > > > > > > >> > > > > > > > > > > > > managedbean
> > > > > > > > > > >> > > > > > > > > > > > > > i use again:
> > > > > > > > > > >> > > > > > > > > > > > > > String name =
> > > > > > > > > > >> > > > ejbContext.getCallerPrincipal().getName();
> > > > > > > > > > >> > > > > > > > > > > > > > then, here i get my
> "correct"
> > > name
> > > > > of
> > > > > > > the
> > > > > > > > > user
> > > > > > > > > > >> (not
> > > > > > > > > > >> > > > > guest).
> > > > > > > > > > >> > > > > > > > > > > > > >
> > > > > > > > > > >> > > > > > > > > > > > > > I dont know if this is the
> > > desire
> > > > > > > > behaviour
> > > > > > > > > or
> > > > > > > > > > >> if
> > > > > > > > > > >> > > this
> > > > > > > > > > >> > > > > > > happend
> > > > > > > > > > >> > > > > > > > > > > because
> > > > > > > > > > >> > > > > > > > > > > > > the
> > > > > > > > > > >> > > > > > > > > > > > > > http request isnt finished?
> > > > > > > > > > >> > > > > > > > > > > > > >
> > > > > > > > > > >> > > > > > > > > > > > > > other question why if i call
> > > > > > > > > > >> > > > > > > > > > > > > > the
> > > > > > > > > >  ejbContext.getCallerPrincipal().getName();
> > > > > > > > > > >> > > before
> > > > > > > > > > >> > > > > the
> > > > > > > > > > >> > > > > > > > > > > > > request.login()
> > > > > > > > > > >> > > > > > > > > > > > > > method i get again "guest",
> > why
> > > > not
> > > > > > > null?
> > > > > > > > > > >> > > > > > > > > > > > > >
> > > > > > > > > > >> > > > > > > > > > > > > > If this question is for
> > > > > tomee(openejb)
> > > > > > > or
> > > > > > > > > > >> tomcat?
> > > > > > > > > > >> > > > > > > > > > > > > >
> > > > > > > > > > >> > > > > > > > > > > > > > Thanks
> > > > > > > > > > >> > > > > > > > > > > > > >
> > > > > > > > > > >> > > > > > > > > > > > > >
> > > > > > > > > > >> > > > > > > > > > > > > >
> > > > > > > > > > >> > > > > > > > >
> > > > > > > > > > >> > > >
> > > > > > > > > >
> > > > > -------------------------------------------------------------------
> > > > > > > > > > >> > > > > > > > > > > > > > *SCJA. José Luis Cetina*
> > > > > > > > > > >> > > > > > > > > > > > > >
> > > > > > > > > > >> > > > > > > > >
> > > > > > > > > > >> > > >
> > > > > > > > > >
> > > > > -------------------------------------------------------------------
> > > > > > > > > > >> > > > > > > > > > > > > >
> > > > > > > > > > >> > > > > > > > > > > > >
> > > > > > > > > > >> > > > > > > > > > > >
> > > > > > > > > > >> > > > > > > > > > > >
> > > > > > > > > > >> > > > > > > > > > > >
> > > > > > > > > > >> > > > > > > > > > > > --
> > > > > > > > > > >> > > > > > > > > > > >
> > > > > > > > > > >> > > > > > >
> > > > > > > > > > >> >
> > > > > > > >
> > > -------------------------------------------------------------------
> > > > > > > > > > >> > > > > > > > > > > > *SCJA. José Luis Cetina*
> > > > > > > > > > >> > > > > > > > > > > >
> > > > > > > > > > >> > > > > > >
> > > > > > > > > > >> >
> > > > > > > >
> > > -------------------------------------------------------------------
> > > > > > > > > > >> > > > > > > > > > > >
> > > > > > > > > > >> > > > > > > > > > >
> > > > > > > > > > >> > > > > > > > > >
> > > > > > > > > > >> > > > > > > > > >
> > > > > > > > > > >> > > > > > > > > >
> > > > > > > > > > >> > > > > > > > > > --
> > > > > > > > > > >> > > > > > > > > >
> > > > > > > > > > >> > > > >
> > > > > > > > > > >>
> > > > > > >
> > -------------------------------------------------------------------
> > > > > > > > > > >> > > > > > > > > > *SCJA. José Luis Cetina*
> > > > > > > > > > >> > > > > > > > > >
> > > > > > > > > > >> > > > >
> > > > > > > > > > >>
> > > > > > >
> > -------------------------------------------------------------------
> > > > > > > > > > >> > > > > > > > > >
> > > > > > > > > > >> > > > > > > > >
> > > > > > > > > > >> > > > > > > >
> > > > > > > > > > >> > > > > > > >
> > > > > > > > > > >> > > > > > > >
> > > > > > > > > > >> > > > > > > > --
> > > > > > > > > > >> > > > > > > >
> > > > > > > > > > >> > >
> > > > > > > > >
> > > > -------------------------------------------------------------------
> > > > > > > > > > >> > > > > > > > *SCJA. José Luis Cetina*
> > > > > > > > > > >> > > > > > > >
> > > > > > > > > > >> > >
> > > > > > > > >
> > > > -------------------------------------------------------------------
> > > > > > > > > > >> > > > > > > >
> > > > > > > > > > >> > > > > > >
> > > > > > > > > > >> > > > > >
> > > > > > > > > > >> > > > > >
> > > > > > > > > > >> > > > > >
> > > > > > > > > > >> > > > > > --
> > > > > > > > > > >> > > > > >
> > > > > > > > > > >>
> > > > > > >
> > -------------------------------------------------------------------
> > > > > > > > > > >> > > > > > *SCJA. José Luis Cetina*
> > > > > > > > > > >> > > > > >
> > > > > > > > > > >>
> > > > > > >
> > -------------------------------------------------------------------
> > > > > > > > > > >> > > > > >
> > > > > > > > > > >> > > > >
> > > > > > > > > > >> > > >
> > > > > > > > > > >> > > >
> > > > > > > > > > >> > > >
> > > > > > > > > > >> > > > --
> > > > > > > > > > >> > > >
> > > > > > > > > >
> > > > > -------------------------------------------------------------------
> > > > > > > > > > >> > > > *SCJA. José Luis Cetina*
> > > > > > > > > > >> > > >
> > > > > > > > > >
> > > > > -------------------------------------------------------------------
> > > > > > > > > > >> > > >
> > > > > > > > > > >> > >
> > > > > > > > > > >> >
> > > > > > > > > > >> >
> > > > > > > > > > >> >
> > > > > > > > > > >> > --
> > > > > > > > > > >> >
> > > > > > > >
> > > -------------------------------------------------------------------
> > > > > > > > > > >> > *SCJA. José Luis Cetina*
> > > > > > > > > > >> >
> > > > > > > >
> > > -------------------------------------------------------------------
> > > > > > > > > > >> >
> > > > > > > > > > >>
> > > > > > > > > > >
> > > > > > > > > > >
> > > > > > > > > > >
> > > > > > > > > > > --
> > > > > > > > > > >
> > > > > >
> -------------------------------------------------------------------
> > > > > > > > > > > *SCJA. José Luis Cetina*
> > > > > > > > > > >
> > > > > >
> -------------------------------------------------------------------
> > > > > > > > > > >
> > > > > > > > > > >
> > > > > > > > > >
> > > > > > > > > >
> > > > > > > > > > --
> > > > > > > > > >
> > > > > -------------------------------------------------------------------
> > > > > > > > > > *SCJA. José Luis Cetina*
> > > > > > > > > >
> > > > > -------------------------------------------------------------------
> > > > > > > > > >
> > > > > > > > >
> > > > > > > >
> > > > > > > >
> > > > > > > >
> > > > > > > > --
> > > > > > > >
> > > -------------------------------------------------------------------
> > > > > > > > *SCJA. José Luis Cetina*
> > > > > > > >
> > > -------------------------------------------------------------------
> > > > > > > >
> > > > > > >
> > > > > >
> > > > > >
> > > > > >
> > > > > > --
> > > > > >
> -------------------------------------------------------------------
> > > > > > *SCJA. José Luis Cetina*
> > > > > >
> -------------------------------------------------------------------
> > > > > >
> > > > >
> > > >
> > > >
> > > >
> > > > --
> > > > -------------------------------------------------------------------
> > > > *SCJA. José Luis Cetina*
> > > > -------------------------------------------------------------------
> > > >
> > >
> >
> >
> >
> > --
> > -------------------------------------------------------------------
> > *SCJA. José Luis Cetina*
> > -------------------------------------------------------------------
> >
>



-- 
-------------------------------------------------------------------
*SCJA. José Luis Cetina*
-------------------------------------------------------------------

Re: Guest user

Posted by Romain Manni-Bucau <rm...@gmail.com>.
my sample is working, too late to add test but manually it works

so i guess it should work for you

the question now is should we add it automatically?

- Romain


2012/6/1 José Luis Cetina <ma...@gmail.com>

> Oooh great, with this i can get the principal user in the first request? or
> this is something that you gonna fix?
>
> 2012/5/31 Romain Manni-Bucau <rm...@gmail.com>
>
> > that's brand new ;)
> >
> > just added it, it mainly delegate to the real realm but add the principal
> > info to openejb/tomee security service which is used in ejbcontext impl
> (to
> > make it short)
> >
> > - Romain
> >
> >
> > 2012/6/1 José Luis Cetina <ma...@gmail.com>
> >
> > > I have this in my context.xml
> > >
> > > <Realm className="MyExtendedDataSourceRealm"
> > >  dataSourceName="MyDataSource"
> > > digest="SHA-256"
> > > encodePassword="Base64"
> > > queryRealmRolesUser="SELECT rol FROM xxxx WHERE user=?"
> > > queryRealmUsers="SELECT pass FROM xxx WHERE user=?"/>
> > >
> > > As you can see i extend the datasource realm, i have this realm config
> in
> > > the context.xml in my webapp (not context.xml TomEE).
> > >
> > > But, as i can see in your example, you surround your realm with
> > TomEERealm,
> > > if this necessary?. I didn't know this
> > >
> > >
> > >
> > > 2012/5/31 Romain Manni-Bucau <rm...@gmail.com>
> > >
> > > > in my test i used:
> > > >
> > > >    <Realm className="org.apache.tomee.catalina.TomEERealm">
> > > >        <Realm className="org.apache.catalina.realm.JAASRealm"
> > > > appName="PropertiesLoginModule"
> > > >
> > > >
> > > >
> > >
> >
>  userClassNames="org.apache.openejb.core.security.AbstractSecurityService$User"
> > > >
> > > >
> > > >
> > >
> >
>  roleClassNames="org.apache.openejb.core.security.AbstractSecurityService$Group">
> > > >        </Realm>
> > > >       </Realm>
> > > >
> > > > but i guess you can replace the jaasrealm by your dsrealm
> > > >
> > > > - Romain
> > > >
> > > >
> > > > 2012/6/1 José Luis Cetina <ma...@gmail.com>
> > > >
> > > > > Yes, it seems buggy.
> > > > >
> > > > > Where i have to replace?
> > > > >
> > > > > Remember im using DataSourceRealm
> > > > >
> > > > > 2012/5/31 Romain Manni-Bucau <rm...@gmail.com>
> > > > >
> > > > > > this is the current status,
> > > > > >
> > > > > > but IMO it is buggy,
> > > > > >
> > > > > > i'll commit soon a TomEEJAASRealm to make it working (replace
> > > JAASRealm
> > > > > in
> > > > > > the conf)
> > > > > >
> > > > > > - Romain
> > > > > >
> > > > > >
> > > > > > 2012/6/1 José Luis Cetina <ma...@gmail.com>
> > > > > >
> > > > > > > i think we are getting confused.
> > > > > > >
> > > > > > > If i resume all, this what i asked (the final of the first
> post)
> > > > > > >
> > > > > > > I dont know if this is the desire behavior or if this happend
> > > becase
> > > > > the
> > > > > > > httr request isnt finished?
> > > > > > > Then you answer me:
> > > > > > >
> > > > > > > in fact info from ejbcontext are taken in our securitymodule
> > > > > > >
> > > > > > > in tomee we set/unset it from a valve so at the beginning/end
> of
> > > the
> > > > > > > request...all between is currently ignored so when you log you
> > need
> > > > > > another
> > > > > > > request to get the updated information (from the tomcat realm)
> > > > > > >
> > > > > > > "so when you log you need another request to get the updated
> > > > > information
> > > > > > > (from the tomcat realm)
> > > > > > >
> > > > > > > Then i get guest because is the desire behaviour, after the
> first
> > > > > > request i
> > > > > > > can get the user i expected.
> > > > > > >
> > > > > > > Then i resume, this is the default behaviour, and works but you
> > > need
> > > > a
> > > > > > > second request.
> > > > > > >
> > > > > > >
> > > > > > >
> > > > > > > 2012/5/31 Romain Manni-Bucau <rm...@gmail.com>
> > > > > > >
> > > > > > > > i think it should work
> > > > > > > >
> > > > > > > > - Romain
> > > > > > > >
> > > > > > > >
> > > > > > > > 2012/6/1 José Luis Cetina <ma...@gmail.com>
> > > > > > > >
> > > > > > > > > I mean this:
> > > > > > > > >
> > > > > > > > > I dont know if this is the desire behaviour or if this
> > happend
> > > > > > because
> > > > > > > > the
> > > > > > > > > http request isnt finished?
> > > > > > > > >
> > > > > > > > >
> > > > > > > > >
> > > > > > > > > 2012/5/31 José Luis Cetina <ma...@gmail.com>
> > > > > > > > >
> > > > > > > > > > Ok, the what i asked is correct??
> > > > > > > > > >
> > > > > > > > > > "I dont know if this is the desire behaviour or if this
> > > happend
> > > > > > > because
> > > > > > > > > > the http request isnt finished?"
> > > > > > > > > >
> > > > > > > > > > 2012/5/31 Romain Manni-Bucau <rm...@gmail.com>
> > > > > > > > > >
> > > > > > > > > >> ok,
> > > > > > > > > >>
> > > > > > > > > >> in fact info from ejbcontext are taken in our
> > securitymodule
> > > > > > > > > >>
> > > > > > > > > >> in tomee we set/unset it from a valve so at the
> > > beginning/end
> > > > of
> > > > > > the
> > > > > > > > > >> request...all between is currently ignored so when you
> log
> > > you
> > > > > > need
> > > > > > > > > >> another
> > > > > > > > > >> request to get the updated information (from the tomcat
> > > realm)
> > > > > > > > > >>
> > > > > > > > > >> - Romain
> > > > > > > > > >>
> > > > > > > > > >>
> > > > > > > > > >> 2012/6/1 José Luis Cetina <ma...@gmail.com>
> > > > > > > > > >>
> > > > > > > > > >> > Yes, it work
> > > > > > > > > >> >
> > > > > > > > > >> > 1) Login (form login) using DataSourceRealm
> > > > > > > > > >> >
> > > > > > > > > >> >
> > > > > > > > > >> > 2) Redirect to page2 from my managedbean
> > > > > > > > > >> >
> > > > > > > > > >> > 2012/5/31 Romain Manni-Bucau <rm...@gmail.com>
> > > > > > > > > >> >
> > > > > > > > > >> > > so you mean using the flow i described before it
> > works?
> > > > > > (sorry,
> > > > > > > > just
> > > > > > > > > >> to
> > > > > > > > > >> > be
> > > > > > > > > >> > > sure to understand)
> > > > > > > > > >> > >
> > > > > > > > > >> > > - Romain
> > > > > > > > > >> > >
> > > > > > > > > >> > >
> > > > > > > > > >> > > 2012/6/1 José Luis Cetina <ma...@gmail.com>
> > > > > > > > > >> > >
> > > > > > > > > >> > > > Hi i can login and i can navigate (redirect) to my
> > > other
> > > > > > page,
> > > > > > > > > but i
> > > > > > > > > >> > dont
> > > > > > > > > >> > > > know why im getting guest user in the login mbean,
> > > after
> > > > > > that
> > > > > > > in
> > > > > > > > > >> other
> > > > > > > > > >> > > > mbean  i get my "real" user.
> > > > > > > > > >> > > >
> > > > > > > > > >> > > >
> > > > > > > > > >> > > > 2012/5/31 Romain Manni-Bucau <
> rmannibucau@gmail.com
> > >
> > > > > > > > > >> > > >
> > > > > > > > > >> > > > > maybe
> > > > > > > > > >> > > > >
> > > > > > > > > >> > > >
> > > > > > > > > >> > >
> > > > > > > > > >> >
> > > > > > > > > >>
> > > > > > > > >
> > > > > > > >
> > > > > > >
> > > > > >
> > > > >
> > > >
> > >
> >
> http://rmannibucau.wordpress.com/2012/05/09/tomee-and-its-ssh-connector/but
> > > > > > > > > >> > > > > it uses properties file, it just need a custom
> > login
> > > > > > module
> > > > > > > > > >> > > > implementation
> > > > > > > > > >> > > > > to use a db.
> > > > > > > > > >> > > > >
> > > > > > > > > >> > > > > well,
> > > > > > > > > >> > > > >
> > > > > > > > > >> > > > > before can you test it please?
> > > > > > > > > >> > > > > 1) login
> > > > > > > > > >> > > > > 2) redirect to your page using your bean
> > > > > > > > > >> > > > >
> > > > > > > > > >> > > > > - Romain
> > > > > > > > > >> > > > >
> > > > > > > > > >> > > > >
> > > > > > > > > >> > > > > 2012/6/1 José Luis Cetina <maxtorzito@gmail.com
> >
> > > > > > > > > >> > > > >
> > > > > > > > > >> > > > > > I have to read and know how to use this, i
> > always
> > > > use
> > > > > > > > > >> DataSource or
> > > > > > > > > >> > > > > > JDBCRealm. (with glassfish).
> > > > > > > > > >> > > > > > im reading now, do you have something for a
> > > > > quickstart?
> > > > > > > for
> > > > > > > > > >> share
> > > > > > > > > >> > me
> > > > > > > > > >> > > > > >
> > > > > > > > > >> > > > > > 2012/5/31 Romain Manni-Bucau <
> > > rmannibucau@gmail.com
> > > > >
> > > > > > > > > >> > > > > >
> > > > > > > > > >> > > > > > > having your password in a db is not an issue
> > > but i
> > > > > > think
> > > > > > > > you
> > > > > > > > > >> > should
> > > > > > > > > >> > > > > > > use org.apache.catalina.realm.JAASRealm
> > > > > > > > > >> > > > > > >
> > > > > > > > > >> > > > > > > for instance:
> > > > > > > > > >> > > > > > >
> > > > > > > > > >> > > > > > >     <Realm
> > > > > > > className="org.apache.catalina.realm.JAASRealm"
> > > > > > > > > >> > > > > > > appName="MyDBLoginModule"
> > > > > > > > > >> > > > > > >
> > > > > > > > > >> > > > > > >
> > > > > > > > > >> > > > > > >
> > > > > > > > > >> > > > > >
> > > > > > > > > >> > > > >
> > > > > > > > > >> > > >
> > > > > > > > > >> > >
> > > > > > > > > >> >
> > > > > > > > > >>
> > > > > > > > >
> > > > > > > >
> > > > > > >
> > > > > >
> > > > >
> > > >
> > >
> >
>  userClassNames="org.apache.openejb.core.security.AbstractSecurityService$User"
> > > > > > > > > >> > > > > > >
> > > > > > > > > >> > > > > > >
> > > > > > > > > >> > > > > > >
> > > > > > > > > >> > > > > >
> > > > > > > > > >> > > > >
> > > > > > > > > >> > > >
> > > > > > > > > >> > >
> > > > > > > > > >> >
> > > > > > > > > >>
> > > > > > > > >
> > > > > > > >
> > > > > > >
> > > > > >
> > > > >
> > > >
> > >
> >
>  roleClassNames="org.apache.openejb.core.security.AbstractSecurityService$Group">
> > > > > > > > > >> > > > > > >      </Realm>
> > > > > > > > > >> > > > > > >
> > > > > > > > > >> > > > > > > so simply implement a custom LoginModule
> > instead
> > > > of
> > > > > a
> > > > > > > > realm
> > > > > > > > > >> > > > > > >
> > > > > > > > > >> > > > > > > wdyt?
> > > > > > > > > >> > > > > > >
> > > > > > > > > >> > > > > > > - Romain
> > > > > > > > > >> > > > > > >
> > > > > > > > > >> > > > > > >
> > > > > > > > > >> > > > > > > 2012/6/1 José Luis Cetina <
> > maxtorzito@gmail.com
> > > >
> > > > > > > > > >> > > > > > >
> > > > > > > > > >> > > > > > > > Sorry, i use DataSourceRealm, i have my
> > > > > > > user/pass/roles
> > > > > > > > in
> > > > > > > > > >> the
> > > > > > > > > >> > > DB.
> > > > > > > > > >> > > > > > > >
> > > > > > > > > >> > > > > > > >
> > > > > > > > > >> > > > > > > >
> > > > > > > > > >> > > > > > > > 2012/5/31 Romain Manni-Bucau <
> > > > > rmannibucau@gmail.com
> > > > > > >
> > > > > > > > > >> > > > > > > >
> > > > > > > > > >> > > > > > > > > can't you do it with an embedded one?
> > > > > > > > > >> > > > > > > > >
> > > > > > > > > >> > > > > > > > > well DataSourceRealm doesn't use JAAS by
> > > > > default i
> > > > > > > > > think,
> > > > > > > > > >> > maybe
> > > > > > > > > >> > > > > > that's
> > > > > > > > > >> > > > > > > > the
> > > > > > > > > >> > > > > > > > > issue
> > > > > > > > > >> > > > > > > > >
> > > > > > > > > >> > > > > > > > > - Romain
> > > > > > > > > >> > > > > > > > >
> > > > > > > > > >> > > > > > > > >
> > > > > > > > > >> > > > > > > > > 2012/6/1 José Luis Cetina <
> > > > maxtorzito@gmail.com
> > > > > >
> > > > > > > > > >> > > > > > > > >
> > > > > > > > > >> > > > > > > > > > OK, i can create a sample, but i use
> > > > > > > > DataSourceRealm,
> > > > > > > > > >> are
> > > > > > > > > >> > you
> > > > > > > > > >> > > > > gonna
> > > > > > > > > >> > > > > > > > > > configure your database?
> > > > > > > > > >> > > > > > > > > >
> > > > > > > > > >> > > > > > > > > > 2012/5/31 Romain Manni-Bucau <
> > > > > > > rmannibucau@gmail.com
> > > > > > > > >
> > > > > > > > > >> > > > > > > > > >
> > > > > > > > > >> > > > > > > > > > > can you have a try in an EJB please?
> > > (just
> > > > > try
> > > > > > > to
> > > > > > > > > add
> > > > > > > > > >> > > > > @Stateless
> > > > > > > > > >> > > > > > on
> > > > > > > > > >> > > > > > > > > your
> > > > > > > > > >> > > > > > > > > > > managed bean for instance)
> > > > > > > > > >> > > > > > > > > > >
> > > > > > > > > >> > > > > > > > > > > can you share a sample easy to run?
> > > > > > > > > >> > > > > > > > > > >
> > > > > > > > > >> > > > > > > > > > > - Romain
> > > > > > > > > >> > > > > > > > > > >
> > > > > > > > > >> > > > > > > > > > >
> > > > > > > > > >> > > > > > > > > > > 2012/6/1 José Luis Cetina <
> > > > > > maxtorzito@gmail.com
> > > > > > > >
> > > > > > > > > >> > > > > > > > > > >
> > > > > > > > > >> > > > > > > > > > > > Yes, im using JAAS
> > > > > > > > > >> > > > > > > > > > > >
> > > > > > > > > >> > > > > > > > > > > > 2012/5/31 Romain Manni-Bucau <
> > > > > > > > > rmannibucau@gmail.com
> > > > > > > > > >> >
> > > > > > > > > >> > > > > > > > > > > >
> > > > > > > > > >> > > > > > > > > > > > > Hi,
> > > > > > > > > >> > > > > > > > > > > > >
> > > > > > > > > >> > > > > > > > > > > > > Do you use jaas?
> > > > > > > > > >> > > > > > > > > > > > >
> > > > > > > > > >> > > > > > > > > > > > > - Romain
> > > > > > > > > >> > > > > > > > > > > > > Le 31 mai 2012 20:14, "José Luis
> > > > > Cetina" <
> > > > > > > > > >> > > > > > maxtorzito@gmail.com
> > > > > > > > > >> > > > > > > >
> > > > > > > > > >> > > > > > > > a
> > > > > > > > > >> > > > > > > > > > > écrit
> > > > > > > > > >> > > > > > > > > > > > :
> > > > > > > > > >> > > > > > > > > > > > >
> > > > > > > > > >> > > > > > > > > > > > > > Hi i have this scenario:
> > > > > > > > > >> > > > > > > > > > > > > >
> > > > > > > > > >> > > > > > > > > > > > > > I have a page login.xhtml,
> this
> > > page
> > > > > > has a
> > > > > > > > > >> > > ManagedBean
> > > > > > > > > >> > > > > > > (@Named)
> > > > > > > > > >> > > > > > > > > > this
> > > > > > > > > >> > > > > > > > > > > > > > managedbean use the
> > > > > > > request.login(user,pass)
> > > > > > > > > >> > method.
> > > > > > > > > >> > > > > > > > > > > > > >
> > > > > > > > > >> > > > > > > > > > > > > > When i do this:
> > > > > > > > > >> > > > > > > > > > > > > >
> > > > > > > > > >> > > > > > > > > > > > > > managedbean class:
> > > > > > > > > >> > > > > > > > > > > > > >
> > > > > > > > > >> > > > > > > > > > > > > > @Resource
> > > > > > > > > >> > > > > > > > > > > > > > private EJBContext ejbContext;
> > > > > > > > > >> > > > > > > > > > > > > > .
> > > > > > > > > >> > > > > > > > > > > > > > .
> > > > > > > > > >> > > > > > > > > > > > > > request.login(user,pass);
> > > > > > > > > >> > > > > > > > > > > > > > String name =
> > > > > > > > > >> > > > ejbContext.getCallerPrincipal().getName();
> > > > > > > > > >> > > > > > > > > > > > > >
> > > > > > > > > >> > > > > > > > > > > > > > I get "guest" as my user name.
> > > But i
> > > > > > > expect
> > > > > > > > > the
> > > > > > > > > >> > name
> > > > > > > > > >> > > of
> > > > > > > > > >> > > > > my
> > > > > > > > > >> > > > > > > user
> > > > > > > > > >> > > > > > > > > (of
> > > > > > > > > >> > > > > > > > > > > > > course
> > > > > > > > > >> > > > > > > > > > > > > > is not guest)
> > > > > > > > > >> > > > > > > > > > > > > >
> > > > > > > > > >> > > > > > > > > > > > > > If the login was successful my
> > > login
> > > > > > page
> > > > > > > > > >> navigate
> > > > > > > > > >> > to
> > > > > > > > > >> > > > > other
> > > > > > > > > >> > > > > > > > page
> > > > > > > > > >> > > > > > > > > > lets
> > > > > > > > > >> > > > > > > > > > > > say
> > > > > > > > > >> > > > > > > > > > > > > > pageb.xhtml
> > > > > > > > > >> > > > > > > > > > > > > >
> > > > > > > > > >> > > > > > > > > > > > > > If i create a managedbean
> > (@Named)
> > > > for
> > > > > > > > > >> pageb.xhtml
> > > > > > > > > >> > > and
> > > > > > > > > >> > > > in
> > > > > > > > > >> > > > > > > that
> > > > > > > > > >> > > > > > > > > > > > > managedbean
> > > > > > > > > >> > > > > > > > > > > > > > i use again:
> > > > > > > > > >> > > > > > > > > > > > > > String name =
> > > > > > > > > >> > > > ejbContext.getCallerPrincipal().getName();
> > > > > > > > > >> > > > > > > > > > > > > > then, here i get my "correct"
> > name
> > > > of
> > > > > > the
> > > > > > > > user
> > > > > > > > > >> (not
> > > > > > > > > >> > > > > guest).
> > > > > > > > > >> > > > > > > > > > > > > >
> > > > > > > > > >> > > > > > > > > > > > > > I dont know if this is the
> > desire
> > > > > > > behaviour
> > > > > > > > or
> > > > > > > > > >> if
> > > > > > > > > >> > > this
> > > > > > > > > >> > > > > > > happend
> > > > > > > > > >> > > > > > > > > > > because
> > > > > > > > > >> > > > > > > > > > > > > the
> > > > > > > > > >> > > > > > > > > > > > > > http request isnt finished?
> > > > > > > > > >> > > > > > > > > > > > > >
> > > > > > > > > >> > > > > > > > > > > > > > other question why if i call
> > > > > > > > > >> > > > > > > > > > > > > > the
> > > > > > > > >  ejbContext.getCallerPrincipal().getName();
> > > > > > > > > >> > > before
> > > > > > > > > >> > > > > the
> > > > > > > > > >> > > > > > > > > > > > > request.login()
> > > > > > > > > >> > > > > > > > > > > > > > method i get again "guest",
> why
> > > not
> > > > > > null?
> > > > > > > > > >> > > > > > > > > > > > > >
> > > > > > > > > >> > > > > > > > > > > > > > If this question is for
> > > > tomee(openejb)
> > > > > > or
> > > > > > > > > >> tomcat?
> > > > > > > > > >> > > > > > > > > > > > > >
> > > > > > > > > >> > > > > > > > > > > > > > Thanks
> > > > > > > > > >> > > > > > > > > > > > > >
> > > > > > > > > >> > > > > > > > > > > > > >
> > > > > > > > > >> > > > > > > > > > > > > >
> > > > > > > > > >> > > > > > > > >
> > > > > > > > > >> > > >
> > > > > > > > >
> > > > -------------------------------------------------------------------
> > > > > > > > > >> > > > > > > > > > > > > > *SCJA. José Luis Cetina*
> > > > > > > > > >> > > > > > > > > > > > > >
> > > > > > > > > >> > > > > > > > >
> > > > > > > > > >> > > >
> > > > > > > > >
> > > > -------------------------------------------------------------------
> > > > > > > > > >> > > > > > > > > > > > > >
> > > > > > > > > >> > > > > > > > > > > > >
> > > > > > > > > >> > > > > > > > > > > >
> > > > > > > > > >> > > > > > > > > > > >
> > > > > > > > > >> > > > > > > > > > > >
> > > > > > > > > >> > > > > > > > > > > > --
> > > > > > > > > >> > > > > > > > > > > >
> > > > > > > > > >> > > > > > >
> > > > > > > > > >> >
> > > > > > >
> > -------------------------------------------------------------------
> > > > > > > > > >> > > > > > > > > > > > *SCJA. José Luis Cetina*
> > > > > > > > > >> > > > > > > > > > > >
> > > > > > > > > >> > > > > > >
> > > > > > > > > >> >
> > > > > > >
> > -------------------------------------------------------------------
> > > > > > > > > >> > > > > > > > > > > >
> > > > > > > > > >> > > > > > > > > > >
> > > > > > > > > >> > > > > > > > > >
> > > > > > > > > >> > > > > > > > > >
> > > > > > > > > >> > > > > > > > > >
> > > > > > > > > >> > > > > > > > > > --
> > > > > > > > > >> > > > > > > > > >
> > > > > > > > > >> > > > >
> > > > > > > > > >>
> > > > > >
> -------------------------------------------------------------------
> > > > > > > > > >> > > > > > > > > > *SCJA. José Luis Cetina*
> > > > > > > > > >> > > > > > > > > >
> > > > > > > > > >> > > > >
> > > > > > > > > >>
> > > > > >
> -------------------------------------------------------------------
> > > > > > > > > >> > > > > > > > > >
> > > > > > > > > >> > > > > > > > >
> > > > > > > > > >> > > > > > > >
> > > > > > > > > >> > > > > > > >
> > > > > > > > > >> > > > > > > >
> > > > > > > > > >> > > > > > > > --
> > > > > > > > > >> > > > > > > >
> > > > > > > > > >> > >
> > > > > > > >
> > > -------------------------------------------------------------------
> > > > > > > > > >> > > > > > > > *SCJA. José Luis Cetina*
> > > > > > > > > >> > > > > > > >
> > > > > > > > > >> > >
> > > > > > > >
> > > -------------------------------------------------------------------
> > > > > > > > > >> > > > > > > >
> > > > > > > > > >> > > > > > >
> > > > > > > > > >> > > > > >
> > > > > > > > > >> > > > > >
> > > > > > > > > >> > > > > >
> > > > > > > > > >> > > > > > --
> > > > > > > > > >> > > > > >
> > > > > > > > > >>
> > > > > >
> -------------------------------------------------------------------
> > > > > > > > > >> > > > > > *SCJA. José Luis Cetina*
> > > > > > > > > >> > > > > >
> > > > > > > > > >>
> > > > > >
> -------------------------------------------------------------------
> > > > > > > > > >> > > > > >
> > > > > > > > > >> > > > >
> > > > > > > > > >> > > >
> > > > > > > > > >> > > >
> > > > > > > > > >> > > >
> > > > > > > > > >> > > > --
> > > > > > > > > >> > > >
> > > > > > > > >
> > > > -------------------------------------------------------------------
> > > > > > > > > >> > > > *SCJA. José Luis Cetina*
> > > > > > > > > >> > > >
> > > > > > > > >
> > > > -------------------------------------------------------------------
> > > > > > > > > >> > > >
> > > > > > > > > >> > >
> > > > > > > > > >> >
> > > > > > > > > >> >
> > > > > > > > > >> >
> > > > > > > > > >> > --
> > > > > > > > > >> >
> > > > > > >
> > -------------------------------------------------------------------
> > > > > > > > > >> > *SCJA. José Luis Cetina*
> > > > > > > > > >> >
> > > > > > >
> > -------------------------------------------------------------------
> > > > > > > > > >> >
> > > > > > > > > >>
> > > > > > > > > >
> > > > > > > > > >
> > > > > > > > > >
> > > > > > > > > > --
> > > > > > > > > >
> > > > > -------------------------------------------------------------------
> > > > > > > > > > *SCJA. José Luis Cetina*
> > > > > > > > > >
> > > > > -------------------------------------------------------------------
> > > > > > > > > >
> > > > > > > > > >
> > > > > > > > >
> > > > > > > > >
> > > > > > > > > --
> > > > > > > > >
> > > > -------------------------------------------------------------------
> > > > > > > > > *SCJA. José Luis Cetina*
> > > > > > > > >
> > > > -------------------------------------------------------------------
> > > > > > > > >
> > > > > > > >
> > > > > > >
> > > > > > >
> > > > > > >
> > > > > > > --
> > > > > > >
> > -------------------------------------------------------------------
> > > > > > > *SCJA. José Luis Cetina*
> > > > > > >
> > -------------------------------------------------------------------
> > > > > > >
> > > > > >
> > > > >
> > > > >
> > > > >
> > > > > --
> > > > > -------------------------------------------------------------------
> > > > > *SCJA. José Luis Cetina*
> > > > > -------------------------------------------------------------------
> > > > >
> > > >
> > >
> > >
> > >
> > > --
> > > -------------------------------------------------------------------
> > > *SCJA. José Luis Cetina*
> > > -------------------------------------------------------------------
> > >
> >
>
>
>
> --
> -------------------------------------------------------------------
> *SCJA. José Luis Cetina*
> -------------------------------------------------------------------
>

Re: Guest user

Posted by José Luis Cetina <ma...@gmail.com>.
Oooh great, with this i can get the principal user in the first request? or
this is something that you gonna fix?

2012/5/31 Romain Manni-Bucau <rm...@gmail.com>

> that's brand new ;)
>
> just added it, it mainly delegate to the real realm but add the principal
> info to openejb/tomee security service which is used in ejbcontext impl (to
> make it short)
>
> - Romain
>
>
> 2012/6/1 José Luis Cetina <ma...@gmail.com>
>
> > I have this in my context.xml
> >
> > <Realm className="MyExtendedDataSourceRealm"
> >  dataSourceName="MyDataSource"
> > digest="SHA-256"
> > encodePassword="Base64"
> > queryRealmRolesUser="SELECT rol FROM xxxx WHERE user=?"
> > queryRealmUsers="SELECT pass FROM xxx WHERE user=?"/>
> >
> > As you can see i extend the datasource realm, i have this realm config in
> > the context.xml in my webapp (not context.xml TomEE).
> >
> > But, as i can see in your example, you surround your realm with
> TomEERealm,
> > if this necessary?. I didn't know this
> >
> >
> >
> > 2012/5/31 Romain Manni-Bucau <rm...@gmail.com>
> >
> > > in my test i used:
> > >
> > >    <Realm className="org.apache.tomee.catalina.TomEERealm">
> > >        <Realm className="org.apache.catalina.realm.JAASRealm"
> > > appName="PropertiesLoginModule"
> > >
> > >
> > >
> >
>  userClassNames="org.apache.openejb.core.security.AbstractSecurityService$User"
> > >
> > >
> > >
> >
>  roleClassNames="org.apache.openejb.core.security.AbstractSecurityService$Group">
> > >        </Realm>
> > >       </Realm>
> > >
> > > but i guess you can replace the jaasrealm by your dsrealm
> > >
> > > - Romain
> > >
> > >
> > > 2012/6/1 José Luis Cetina <ma...@gmail.com>
> > >
> > > > Yes, it seems buggy.
> > > >
> > > > Where i have to replace?
> > > >
> > > > Remember im using DataSourceRealm
> > > >
> > > > 2012/5/31 Romain Manni-Bucau <rm...@gmail.com>
> > > >
> > > > > this is the current status,
> > > > >
> > > > > but IMO it is buggy,
> > > > >
> > > > > i'll commit soon a TomEEJAASRealm to make it working (replace
> > JAASRealm
> > > > in
> > > > > the conf)
> > > > >
> > > > > - Romain
> > > > >
> > > > >
> > > > > 2012/6/1 José Luis Cetina <ma...@gmail.com>
> > > > >
> > > > > > i think we are getting confused.
> > > > > >
> > > > > > If i resume all, this what i asked (the final of the first post)
> > > > > >
> > > > > > I dont know if this is the desire behavior or if this happend
> > becase
> > > > the
> > > > > > httr request isnt finished?
> > > > > > Then you answer me:
> > > > > >
> > > > > > in fact info from ejbcontext are taken in our securitymodule
> > > > > >
> > > > > > in tomee we set/unset it from a valve so at the beginning/end of
> > the
> > > > > > request...all between is currently ignored so when you log you
> need
> > > > > another
> > > > > > request to get the updated information (from the tomcat realm)
> > > > > >
> > > > > > "so when you log you need another request to get the updated
> > > > information
> > > > > > (from the tomcat realm)
> > > > > >
> > > > > > Then i get guest because is the desire behaviour, after the first
> > > > > request i
> > > > > > can get the user i expected.
> > > > > >
> > > > > > Then i resume, this is the default behaviour, and works but you
> > need
> > > a
> > > > > > second request.
> > > > > >
> > > > > >
> > > > > >
> > > > > > 2012/5/31 Romain Manni-Bucau <rm...@gmail.com>
> > > > > >
> > > > > > > i think it should work
> > > > > > >
> > > > > > > - Romain
> > > > > > >
> > > > > > >
> > > > > > > 2012/6/1 José Luis Cetina <ma...@gmail.com>
> > > > > > >
> > > > > > > > I mean this:
> > > > > > > >
> > > > > > > > I dont know if this is the desire behaviour or if this
> happend
> > > > > because
> > > > > > > the
> > > > > > > > http request isnt finished?
> > > > > > > >
> > > > > > > >
> > > > > > > >
> > > > > > > > 2012/5/31 José Luis Cetina <ma...@gmail.com>
> > > > > > > >
> > > > > > > > > Ok, the what i asked is correct??
> > > > > > > > >
> > > > > > > > > "I dont know if this is the desire behaviour or if this
> > happend
> > > > > > because
> > > > > > > > > the http request isnt finished?"
> > > > > > > > >
> > > > > > > > > 2012/5/31 Romain Manni-Bucau <rm...@gmail.com>
> > > > > > > > >
> > > > > > > > >> ok,
> > > > > > > > >>
> > > > > > > > >> in fact info from ejbcontext are taken in our
> securitymodule
> > > > > > > > >>
> > > > > > > > >> in tomee we set/unset it from a valve so at the
> > beginning/end
> > > of
> > > > > the
> > > > > > > > >> request...all between is currently ignored so when you log
> > you
> > > > > need
> > > > > > > > >> another
> > > > > > > > >> request to get the updated information (from the tomcat
> > realm)
> > > > > > > > >>
> > > > > > > > >> - Romain
> > > > > > > > >>
> > > > > > > > >>
> > > > > > > > >> 2012/6/1 José Luis Cetina <ma...@gmail.com>
> > > > > > > > >>
> > > > > > > > >> > Yes, it work
> > > > > > > > >> >
> > > > > > > > >> > 1) Login (form login) using DataSourceRealm
> > > > > > > > >> >
> > > > > > > > >> >
> > > > > > > > >> > 2) Redirect to page2 from my managedbean
> > > > > > > > >> >
> > > > > > > > >> > 2012/5/31 Romain Manni-Bucau <rm...@gmail.com>
> > > > > > > > >> >
> > > > > > > > >> > > so you mean using the flow i described before it
> works?
> > > > > (sorry,
> > > > > > > just
> > > > > > > > >> to
> > > > > > > > >> > be
> > > > > > > > >> > > sure to understand)
> > > > > > > > >> > >
> > > > > > > > >> > > - Romain
> > > > > > > > >> > >
> > > > > > > > >> > >
> > > > > > > > >> > > 2012/6/1 José Luis Cetina <ma...@gmail.com>
> > > > > > > > >> > >
> > > > > > > > >> > > > Hi i can login and i can navigate (redirect) to my
> > other
> > > > > page,
> > > > > > > > but i
> > > > > > > > >> > dont
> > > > > > > > >> > > > know why im getting guest user in the login mbean,
> > after
> > > > > that
> > > > > > in
> > > > > > > > >> other
> > > > > > > > >> > > > mbean  i get my "real" user.
> > > > > > > > >> > > >
> > > > > > > > >> > > >
> > > > > > > > >> > > > 2012/5/31 Romain Manni-Bucau <rmannibucau@gmail.com
> >
> > > > > > > > >> > > >
> > > > > > > > >> > > > > maybe
> > > > > > > > >> > > > >
> > > > > > > > >> > > >
> > > > > > > > >> > >
> > > > > > > > >> >
> > > > > > > > >>
> > > > > > > >
> > > > > > >
> > > > > >
> > > > >
> > > >
> > >
> >
> http://rmannibucau.wordpress.com/2012/05/09/tomee-and-its-ssh-connector/but
> > > > > > > > >> > > > > it uses properties file, it just need a custom
> login
> > > > > module
> > > > > > > > >> > > > implementation
> > > > > > > > >> > > > > to use a db.
> > > > > > > > >> > > > >
> > > > > > > > >> > > > > well,
> > > > > > > > >> > > > >
> > > > > > > > >> > > > > before can you test it please?
> > > > > > > > >> > > > > 1) login
> > > > > > > > >> > > > > 2) redirect to your page using your bean
> > > > > > > > >> > > > >
> > > > > > > > >> > > > > - Romain
> > > > > > > > >> > > > >
> > > > > > > > >> > > > >
> > > > > > > > >> > > > > 2012/6/1 José Luis Cetina <ma...@gmail.com>
> > > > > > > > >> > > > >
> > > > > > > > >> > > > > > I have to read and know how to use this, i
> always
> > > use
> > > > > > > > >> DataSource or
> > > > > > > > >> > > > > > JDBCRealm. (with glassfish).
> > > > > > > > >> > > > > > im reading now, do you have something for a
> > > > quickstart?
> > > > > > for
> > > > > > > > >> share
> > > > > > > > >> > me
> > > > > > > > >> > > > > >
> > > > > > > > >> > > > > > 2012/5/31 Romain Manni-Bucau <
> > rmannibucau@gmail.com
> > > >
> > > > > > > > >> > > > > >
> > > > > > > > >> > > > > > > having your password in a db is not an issue
> > but i
> > > > > think
> > > > > > > you
> > > > > > > > >> > should
> > > > > > > > >> > > > > > > use org.apache.catalina.realm.JAASRealm
> > > > > > > > >> > > > > > >
> > > > > > > > >> > > > > > > for instance:
> > > > > > > > >> > > > > > >
> > > > > > > > >> > > > > > >     <Realm
> > > > > > className="org.apache.catalina.realm.JAASRealm"
> > > > > > > > >> > > > > > > appName="MyDBLoginModule"
> > > > > > > > >> > > > > > >
> > > > > > > > >> > > > > > >
> > > > > > > > >> > > > > > >
> > > > > > > > >> > > > > >
> > > > > > > > >> > > > >
> > > > > > > > >> > > >
> > > > > > > > >> > >
> > > > > > > > >> >
> > > > > > > > >>
> > > > > > > >
> > > > > > >
> > > > > >
> > > > >
> > > >
> > >
> >
>  userClassNames="org.apache.openejb.core.security.AbstractSecurityService$User"
> > > > > > > > >> > > > > > >
> > > > > > > > >> > > > > > >
> > > > > > > > >> > > > > > >
> > > > > > > > >> > > > > >
> > > > > > > > >> > > > >
> > > > > > > > >> > > >
> > > > > > > > >> > >
> > > > > > > > >> >
> > > > > > > > >>
> > > > > > > >
> > > > > > >
> > > > > >
> > > > >
> > > >
> > >
> >
>  roleClassNames="org.apache.openejb.core.security.AbstractSecurityService$Group">
> > > > > > > > >> > > > > > >      </Realm>
> > > > > > > > >> > > > > > >
> > > > > > > > >> > > > > > > so simply implement a custom LoginModule
> instead
> > > of
> > > > a
> > > > > > > realm
> > > > > > > > >> > > > > > >
> > > > > > > > >> > > > > > > wdyt?
> > > > > > > > >> > > > > > >
> > > > > > > > >> > > > > > > - Romain
> > > > > > > > >> > > > > > >
> > > > > > > > >> > > > > > >
> > > > > > > > >> > > > > > > 2012/6/1 José Luis Cetina <
> maxtorzito@gmail.com
> > >
> > > > > > > > >> > > > > > >
> > > > > > > > >> > > > > > > > Sorry, i use DataSourceRealm, i have my
> > > > > > user/pass/roles
> > > > > > > in
> > > > > > > > >> the
> > > > > > > > >> > > DB.
> > > > > > > > >> > > > > > > >
> > > > > > > > >> > > > > > > >
> > > > > > > > >> > > > > > > >
> > > > > > > > >> > > > > > > > 2012/5/31 Romain Manni-Bucau <
> > > > rmannibucau@gmail.com
> > > > > >
> > > > > > > > >> > > > > > > >
> > > > > > > > >> > > > > > > > > can't you do it with an embedded one?
> > > > > > > > >> > > > > > > > >
> > > > > > > > >> > > > > > > > > well DataSourceRealm doesn't use JAAS by
> > > > default i
> > > > > > > > think,
> > > > > > > > >> > maybe
> > > > > > > > >> > > > > > that's
> > > > > > > > >> > > > > > > > the
> > > > > > > > >> > > > > > > > > issue
> > > > > > > > >> > > > > > > > >
> > > > > > > > >> > > > > > > > > - Romain
> > > > > > > > >> > > > > > > > >
> > > > > > > > >> > > > > > > > >
> > > > > > > > >> > > > > > > > > 2012/6/1 José Luis Cetina <
> > > maxtorzito@gmail.com
> > > > >
> > > > > > > > >> > > > > > > > >
> > > > > > > > >> > > > > > > > > > OK, i can create a sample, but i use
> > > > > > > DataSourceRealm,
> > > > > > > > >> are
> > > > > > > > >> > you
> > > > > > > > >> > > > > gonna
> > > > > > > > >> > > > > > > > > > configure your database?
> > > > > > > > >> > > > > > > > > >
> > > > > > > > >> > > > > > > > > > 2012/5/31 Romain Manni-Bucau <
> > > > > > rmannibucau@gmail.com
> > > > > > > >
> > > > > > > > >> > > > > > > > > >
> > > > > > > > >> > > > > > > > > > > can you have a try in an EJB please?
> > (just
> > > > try
> > > > > > to
> > > > > > > > add
> > > > > > > > >> > > > > @Stateless
> > > > > > > > >> > > > > > on
> > > > > > > > >> > > > > > > > > your
> > > > > > > > >> > > > > > > > > > > managed bean for instance)
> > > > > > > > >> > > > > > > > > > >
> > > > > > > > >> > > > > > > > > > > can you share a sample easy to run?
> > > > > > > > >> > > > > > > > > > >
> > > > > > > > >> > > > > > > > > > > - Romain
> > > > > > > > >> > > > > > > > > > >
> > > > > > > > >> > > > > > > > > > >
> > > > > > > > >> > > > > > > > > > > 2012/6/1 José Luis Cetina <
> > > > > maxtorzito@gmail.com
> > > > > > >
> > > > > > > > >> > > > > > > > > > >
> > > > > > > > >> > > > > > > > > > > > Yes, im using JAAS
> > > > > > > > >> > > > > > > > > > > >
> > > > > > > > >> > > > > > > > > > > > 2012/5/31 Romain Manni-Bucau <
> > > > > > > > rmannibucau@gmail.com
> > > > > > > > >> >
> > > > > > > > >> > > > > > > > > > > >
> > > > > > > > >> > > > > > > > > > > > > Hi,
> > > > > > > > >> > > > > > > > > > > > >
> > > > > > > > >> > > > > > > > > > > > > Do you use jaas?
> > > > > > > > >> > > > > > > > > > > > >
> > > > > > > > >> > > > > > > > > > > > > - Romain
> > > > > > > > >> > > > > > > > > > > > > Le 31 mai 2012 20:14, "José Luis
> > > > Cetina" <
> > > > > > > > >> > > > > > maxtorzito@gmail.com
> > > > > > > > >> > > > > > > >
> > > > > > > > >> > > > > > > > a
> > > > > > > > >> > > > > > > > > > > écrit
> > > > > > > > >> > > > > > > > > > > > :
> > > > > > > > >> > > > > > > > > > > > >
> > > > > > > > >> > > > > > > > > > > > > > Hi i have this scenario:
> > > > > > > > >> > > > > > > > > > > > > >
> > > > > > > > >> > > > > > > > > > > > > > I have a page login.xhtml, this
> > page
> > > > > has a
> > > > > > > > >> > > ManagedBean
> > > > > > > > >> > > > > > > (@Named)
> > > > > > > > >> > > > > > > > > > this
> > > > > > > > >> > > > > > > > > > > > > > managedbean use the
> > > > > > request.login(user,pass)
> > > > > > > > >> > method.
> > > > > > > > >> > > > > > > > > > > > > >
> > > > > > > > >> > > > > > > > > > > > > > When i do this:
> > > > > > > > >> > > > > > > > > > > > > >
> > > > > > > > >> > > > > > > > > > > > > > managedbean class:
> > > > > > > > >> > > > > > > > > > > > > >
> > > > > > > > >> > > > > > > > > > > > > > @Resource
> > > > > > > > >> > > > > > > > > > > > > > private EJBContext ejbContext;
> > > > > > > > >> > > > > > > > > > > > > > .
> > > > > > > > >> > > > > > > > > > > > > > .
> > > > > > > > >> > > > > > > > > > > > > > request.login(user,pass);
> > > > > > > > >> > > > > > > > > > > > > > String name =
> > > > > > > > >> > > > ejbContext.getCallerPrincipal().getName();
> > > > > > > > >> > > > > > > > > > > > > >
> > > > > > > > >> > > > > > > > > > > > > > I get "guest" as my user name.
> > But i
> > > > > > expect
> > > > > > > > the
> > > > > > > > >> > name
> > > > > > > > >> > > of
> > > > > > > > >> > > > > my
> > > > > > > > >> > > > > > > user
> > > > > > > > >> > > > > > > > > (of
> > > > > > > > >> > > > > > > > > > > > > course
> > > > > > > > >> > > > > > > > > > > > > > is not guest)
> > > > > > > > >> > > > > > > > > > > > > >
> > > > > > > > >> > > > > > > > > > > > > > If the login was successful my
> > login
> > > > > page
> > > > > > > > >> navigate
> > > > > > > > >> > to
> > > > > > > > >> > > > > other
> > > > > > > > >> > > > > > > > page
> > > > > > > > >> > > > > > > > > > lets
> > > > > > > > >> > > > > > > > > > > > say
> > > > > > > > >> > > > > > > > > > > > > > pageb.xhtml
> > > > > > > > >> > > > > > > > > > > > > >
> > > > > > > > >> > > > > > > > > > > > > > If i create a managedbean
> (@Named)
> > > for
> > > > > > > > >> pageb.xhtml
> > > > > > > > >> > > and
> > > > > > > > >> > > > in
> > > > > > > > >> > > > > > > that
> > > > > > > > >> > > > > > > > > > > > > managedbean
> > > > > > > > >> > > > > > > > > > > > > > i use again:
> > > > > > > > >> > > > > > > > > > > > > > String name =
> > > > > > > > >> > > > ejbContext.getCallerPrincipal().getName();
> > > > > > > > >> > > > > > > > > > > > > > then, here i get my "correct"
> name
> > > of
> > > > > the
> > > > > > > user
> > > > > > > > >> (not
> > > > > > > > >> > > > > guest).
> > > > > > > > >> > > > > > > > > > > > > >
> > > > > > > > >> > > > > > > > > > > > > > I dont know if this is the
> desire
> > > > > > behaviour
> > > > > > > or
> > > > > > > > >> if
> > > > > > > > >> > > this
> > > > > > > > >> > > > > > > happend
> > > > > > > > >> > > > > > > > > > > because
> > > > > > > > >> > > > > > > > > > > > > the
> > > > > > > > >> > > > > > > > > > > > > > http request isnt finished?
> > > > > > > > >> > > > > > > > > > > > > >
> > > > > > > > >> > > > > > > > > > > > > > other question why if i call
> > > > > > > > >> > > > > > > > > > > > > > the
> > > > > > > >  ejbContext.getCallerPrincipal().getName();
> > > > > > > > >> > > before
> > > > > > > > >> > > > > the
> > > > > > > > >> > > > > > > > > > > > > request.login()
> > > > > > > > >> > > > > > > > > > > > > > method i get again "guest", why
> > not
> > > > > null?
> > > > > > > > >> > > > > > > > > > > > > >
> > > > > > > > >> > > > > > > > > > > > > > If this question is for
> > > tomee(openejb)
> > > > > or
> > > > > > > > >> tomcat?
> > > > > > > > >> > > > > > > > > > > > > >
> > > > > > > > >> > > > > > > > > > > > > > Thanks
> > > > > > > > >> > > > > > > > > > > > > >
> > > > > > > > >> > > > > > > > > > > > > >
> > > > > > > > >> > > > > > > > > > > > > >
> > > > > > > > >> > > > > > > > >
> > > > > > > > >> > > >
> > > > > > > >
> > > -------------------------------------------------------------------
> > > > > > > > >> > > > > > > > > > > > > > *SCJA. José Luis Cetina*
> > > > > > > > >> > > > > > > > > > > > > >
> > > > > > > > >> > > > > > > > >
> > > > > > > > >> > > >
> > > > > > > >
> > > -------------------------------------------------------------------
> > > > > > > > >> > > > > > > > > > > > > >
> > > > > > > > >> > > > > > > > > > > > >
> > > > > > > > >> > > > > > > > > > > >
> > > > > > > > >> > > > > > > > > > > >
> > > > > > > > >> > > > > > > > > > > >
> > > > > > > > >> > > > > > > > > > > > --
> > > > > > > > >> > > > > > > > > > > >
> > > > > > > > >> > > > > > >
> > > > > > > > >> >
> > > > > >
> -------------------------------------------------------------------
> > > > > > > > >> > > > > > > > > > > > *SCJA. José Luis Cetina*
> > > > > > > > >> > > > > > > > > > > >
> > > > > > > > >> > > > > > >
> > > > > > > > >> >
> > > > > >
> -------------------------------------------------------------------
> > > > > > > > >> > > > > > > > > > > >
> > > > > > > > >> > > > > > > > > > >
> > > > > > > > >> > > > > > > > > >
> > > > > > > > >> > > > > > > > > >
> > > > > > > > >> > > > > > > > > >
> > > > > > > > >> > > > > > > > > > --
> > > > > > > > >> > > > > > > > > >
> > > > > > > > >> > > > >
> > > > > > > > >>
> > > > > -------------------------------------------------------------------
> > > > > > > > >> > > > > > > > > > *SCJA. José Luis Cetina*
> > > > > > > > >> > > > > > > > > >
> > > > > > > > >> > > > >
> > > > > > > > >>
> > > > > -------------------------------------------------------------------
> > > > > > > > >> > > > > > > > > >
> > > > > > > > >> > > > > > > > >
> > > > > > > > >> > > > > > > >
> > > > > > > > >> > > > > > > >
> > > > > > > > >> > > > > > > >
> > > > > > > > >> > > > > > > > --
> > > > > > > > >> > > > > > > >
> > > > > > > > >> > >
> > > > > > >
> > -------------------------------------------------------------------
> > > > > > > > >> > > > > > > > *SCJA. José Luis Cetina*
> > > > > > > > >> > > > > > > >
> > > > > > > > >> > >
> > > > > > >
> > -------------------------------------------------------------------
> > > > > > > > >> > > > > > > >
> > > > > > > > >> > > > > > >
> > > > > > > > >> > > > > >
> > > > > > > > >> > > > > >
> > > > > > > > >> > > > > >
> > > > > > > > >> > > > > > --
> > > > > > > > >> > > > > >
> > > > > > > > >>
> > > > > -------------------------------------------------------------------
> > > > > > > > >> > > > > > *SCJA. José Luis Cetina*
> > > > > > > > >> > > > > >
> > > > > > > > >>
> > > > > -------------------------------------------------------------------
> > > > > > > > >> > > > > >
> > > > > > > > >> > > > >
> > > > > > > > >> > > >
> > > > > > > > >> > > >
> > > > > > > > >> > > >
> > > > > > > > >> > > > --
> > > > > > > > >> > > >
> > > > > > > >
> > > -------------------------------------------------------------------
> > > > > > > > >> > > > *SCJA. José Luis Cetina*
> > > > > > > > >> > > >
> > > > > > > >
> > > -------------------------------------------------------------------
> > > > > > > > >> > > >
> > > > > > > > >> > >
> > > > > > > > >> >
> > > > > > > > >> >
> > > > > > > > >> >
> > > > > > > > >> > --
> > > > > > > > >> >
> > > > > >
> -------------------------------------------------------------------
> > > > > > > > >> > *SCJA. José Luis Cetina*
> > > > > > > > >> >
> > > > > >
> -------------------------------------------------------------------
> > > > > > > > >> >
> > > > > > > > >>
> > > > > > > > >
> > > > > > > > >
> > > > > > > > >
> > > > > > > > > --
> > > > > > > > >
> > > > -------------------------------------------------------------------
> > > > > > > > > *SCJA. José Luis Cetina*
> > > > > > > > >
> > > > -------------------------------------------------------------------
> > > > > > > > >
> > > > > > > > >
> > > > > > > >
> > > > > > > >
> > > > > > > > --
> > > > > > > >
> > > -------------------------------------------------------------------
> > > > > > > > *SCJA. José Luis Cetina*
> > > > > > > >
> > > -------------------------------------------------------------------
> > > > > > > >
> > > > > > >
> > > > > >
> > > > > >
> > > > > >
> > > > > > --
> > > > > >
> -------------------------------------------------------------------
> > > > > > *SCJA. José Luis Cetina*
> > > > > >
> -------------------------------------------------------------------
> > > > > >
> > > > >
> > > >
> > > >
> > > >
> > > > --
> > > > -------------------------------------------------------------------
> > > > *SCJA. José Luis Cetina*
> > > > -------------------------------------------------------------------
> > > >
> > >
> >
> >
> >
> > --
> > -------------------------------------------------------------------
> > *SCJA. José Luis Cetina*
> > -------------------------------------------------------------------
> >
>



-- 
-------------------------------------------------------------------
*SCJA. José Luis Cetina*
-------------------------------------------------------------------

Re: Guest user

Posted by Romain Manni-Bucau <rm...@gmail.com>.
that's brand new ;)

just added it, it mainly delegate to the real realm but add the principal
info to openejb/tomee security service which is used in ejbcontext impl (to
make it short)

- Romain


2012/6/1 José Luis Cetina <ma...@gmail.com>

> I have this in my context.xml
>
> <Realm className="MyExtendedDataSourceRealm"
>  dataSourceName="MyDataSource"
> digest="SHA-256"
> encodePassword="Base64"
> queryRealmRolesUser="SELECT rol FROM xxxx WHERE user=?"
> queryRealmUsers="SELECT pass FROM xxx WHERE user=?"/>
>
> As you can see i extend the datasource realm, i have this realm config in
> the context.xml in my webapp (not context.xml TomEE).
>
> But, as i can see in your example, you surround your realm with TomEERealm,
> if this necessary?. I didn't know this
>
>
>
> 2012/5/31 Romain Manni-Bucau <rm...@gmail.com>
>
> > in my test i used:
> >
> >    <Realm className="org.apache.tomee.catalina.TomEERealm">
> >        <Realm className="org.apache.catalina.realm.JAASRealm"
> > appName="PropertiesLoginModule"
> >
> >
> >
>  userClassNames="org.apache.openejb.core.security.AbstractSecurityService$User"
> >
> >
> >
>  roleClassNames="org.apache.openejb.core.security.AbstractSecurityService$Group">
> >        </Realm>
> >       </Realm>
> >
> > but i guess you can replace the jaasrealm by your dsrealm
> >
> > - Romain
> >
> >
> > 2012/6/1 José Luis Cetina <ma...@gmail.com>
> >
> > > Yes, it seems buggy.
> > >
> > > Where i have to replace?
> > >
> > > Remember im using DataSourceRealm
> > >
> > > 2012/5/31 Romain Manni-Bucau <rm...@gmail.com>
> > >
> > > > this is the current status,
> > > >
> > > > but IMO it is buggy,
> > > >
> > > > i'll commit soon a TomEEJAASRealm to make it working (replace
> JAASRealm
> > > in
> > > > the conf)
> > > >
> > > > - Romain
> > > >
> > > >
> > > > 2012/6/1 José Luis Cetina <ma...@gmail.com>
> > > >
> > > > > i think we are getting confused.
> > > > >
> > > > > If i resume all, this what i asked (the final of the first post)
> > > > >
> > > > > I dont know if this is the desire behavior or if this happend
> becase
> > > the
> > > > > httr request isnt finished?
> > > > > Then you answer me:
> > > > >
> > > > > in fact info from ejbcontext are taken in our securitymodule
> > > > >
> > > > > in tomee we set/unset it from a valve so at the beginning/end of
> the
> > > > > request...all between is currently ignored so when you log you need
> > > > another
> > > > > request to get the updated information (from the tomcat realm)
> > > > >
> > > > > "so when you log you need another request to get the updated
> > > information
> > > > > (from the tomcat realm)
> > > > >
> > > > > Then i get guest because is the desire behaviour, after the first
> > > > request i
> > > > > can get the user i expected.
> > > > >
> > > > > Then i resume, this is the default behaviour, and works but you
> need
> > a
> > > > > second request.
> > > > >
> > > > >
> > > > >
> > > > > 2012/5/31 Romain Manni-Bucau <rm...@gmail.com>
> > > > >
> > > > > > i think it should work
> > > > > >
> > > > > > - Romain
> > > > > >
> > > > > >
> > > > > > 2012/6/1 José Luis Cetina <ma...@gmail.com>
> > > > > >
> > > > > > > I mean this:
> > > > > > >
> > > > > > > I dont know if this is the desire behaviour or if this happend
> > > > because
> > > > > > the
> > > > > > > http request isnt finished?
> > > > > > >
> > > > > > >
> > > > > > >
> > > > > > > 2012/5/31 José Luis Cetina <ma...@gmail.com>
> > > > > > >
> > > > > > > > Ok, the what i asked is correct??
> > > > > > > >
> > > > > > > > "I dont know if this is the desire behaviour or if this
> happend
> > > > > because
> > > > > > > > the http request isnt finished?"
> > > > > > > >
> > > > > > > > 2012/5/31 Romain Manni-Bucau <rm...@gmail.com>
> > > > > > > >
> > > > > > > >> ok,
> > > > > > > >>
> > > > > > > >> in fact info from ejbcontext are taken in our securitymodule
> > > > > > > >>
> > > > > > > >> in tomee we set/unset it from a valve so at the
> beginning/end
> > of
> > > > the
> > > > > > > >> request...all between is currently ignored so when you log
> you
> > > > need
> > > > > > > >> another
> > > > > > > >> request to get the updated information (from the tomcat
> realm)
> > > > > > > >>
> > > > > > > >> - Romain
> > > > > > > >>
> > > > > > > >>
> > > > > > > >> 2012/6/1 José Luis Cetina <ma...@gmail.com>
> > > > > > > >>
> > > > > > > >> > Yes, it work
> > > > > > > >> >
> > > > > > > >> > 1) Login (form login) using DataSourceRealm
> > > > > > > >> >
> > > > > > > >> >
> > > > > > > >> > 2) Redirect to page2 from my managedbean
> > > > > > > >> >
> > > > > > > >> > 2012/5/31 Romain Manni-Bucau <rm...@gmail.com>
> > > > > > > >> >
> > > > > > > >> > > so you mean using the flow i described before it works?
> > > > (sorry,
> > > > > > just
> > > > > > > >> to
> > > > > > > >> > be
> > > > > > > >> > > sure to understand)
> > > > > > > >> > >
> > > > > > > >> > > - Romain
> > > > > > > >> > >
> > > > > > > >> > >
> > > > > > > >> > > 2012/6/1 José Luis Cetina <ma...@gmail.com>
> > > > > > > >> > >
> > > > > > > >> > > > Hi i can login and i can navigate (redirect) to my
> other
> > > > page,
> > > > > > > but i
> > > > > > > >> > dont
> > > > > > > >> > > > know why im getting guest user in the login mbean,
> after
> > > > that
> > > > > in
> > > > > > > >> other
> > > > > > > >> > > > mbean  i get my "real" user.
> > > > > > > >> > > >
> > > > > > > >> > > >
> > > > > > > >> > > > 2012/5/31 Romain Manni-Bucau <rm...@gmail.com>
> > > > > > > >> > > >
> > > > > > > >> > > > > maybe
> > > > > > > >> > > > >
> > > > > > > >> > > >
> > > > > > > >> > >
> > > > > > > >> >
> > > > > > > >>
> > > > > > >
> > > > > >
> > > > >
> > > >
> > >
> >
> http://rmannibucau.wordpress.com/2012/05/09/tomee-and-its-ssh-connector/but
> > > > > > > >> > > > > it uses properties file, it just need a custom login
> > > > module
> > > > > > > >> > > > implementation
> > > > > > > >> > > > > to use a db.
> > > > > > > >> > > > >
> > > > > > > >> > > > > well,
> > > > > > > >> > > > >
> > > > > > > >> > > > > before can you test it please?
> > > > > > > >> > > > > 1) login
> > > > > > > >> > > > > 2) redirect to your page using your bean
> > > > > > > >> > > > >
> > > > > > > >> > > > > - Romain
> > > > > > > >> > > > >
> > > > > > > >> > > > >
> > > > > > > >> > > > > 2012/6/1 José Luis Cetina <ma...@gmail.com>
> > > > > > > >> > > > >
> > > > > > > >> > > > > > I have to read and know how to use this, i always
> > use
> > > > > > > >> DataSource or
> > > > > > > >> > > > > > JDBCRealm. (with glassfish).
> > > > > > > >> > > > > > im reading now, do you have something for a
> > > quickstart?
> > > > > for
> > > > > > > >> share
> > > > > > > >> > me
> > > > > > > >> > > > > >
> > > > > > > >> > > > > > 2012/5/31 Romain Manni-Bucau <
> rmannibucau@gmail.com
> > >
> > > > > > > >> > > > > >
> > > > > > > >> > > > > > > having your password in a db is not an issue
> but i
> > > > think
> > > > > > you
> > > > > > > >> > should
> > > > > > > >> > > > > > > use org.apache.catalina.realm.JAASRealm
> > > > > > > >> > > > > > >
> > > > > > > >> > > > > > > for instance:
> > > > > > > >> > > > > > >
> > > > > > > >> > > > > > >     <Realm
> > > > > className="org.apache.catalina.realm.JAASRealm"
> > > > > > > >> > > > > > > appName="MyDBLoginModule"
> > > > > > > >> > > > > > >
> > > > > > > >> > > > > > >
> > > > > > > >> > > > > > >
> > > > > > > >> > > > > >
> > > > > > > >> > > > >
> > > > > > > >> > > >
> > > > > > > >> > >
> > > > > > > >> >
> > > > > > > >>
> > > > > > >
> > > > > >
> > > > >
> > > >
> > >
> >
>  userClassNames="org.apache.openejb.core.security.AbstractSecurityService$User"
> > > > > > > >> > > > > > >
> > > > > > > >> > > > > > >
> > > > > > > >> > > > > > >
> > > > > > > >> > > > > >
> > > > > > > >> > > > >
> > > > > > > >> > > >
> > > > > > > >> > >
> > > > > > > >> >
> > > > > > > >>
> > > > > > >
> > > > > >
> > > > >
> > > >
> > >
> >
>  roleClassNames="org.apache.openejb.core.security.AbstractSecurityService$Group">
> > > > > > > >> > > > > > >      </Realm>
> > > > > > > >> > > > > > >
> > > > > > > >> > > > > > > so simply implement a custom LoginModule instead
> > of
> > > a
> > > > > > realm
> > > > > > > >> > > > > > >
> > > > > > > >> > > > > > > wdyt?
> > > > > > > >> > > > > > >
> > > > > > > >> > > > > > > - Romain
> > > > > > > >> > > > > > >
> > > > > > > >> > > > > > >
> > > > > > > >> > > > > > > 2012/6/1 José Luis Cetina <maxtorzito@gmail.com
> >
> > > > > > > >> > > > > > >
> > > > > > > >> > > > > > > > Sorry, i use DataSourceRealm, i have my
> > > > > user/pass/roles
> > > > > > in
> > > > > > > >> the
> > > > > > > >> > > DB.
> > > > > > > >> > > > > > > >
> > > > > > > >> > > > > > > >
> > > > > > > >> > > > > > > >
> > > > > > > >> > > > > > > > 2012/5/31 Romain Manni-Bucau <
> > > rmannibucau@gmail.com
> > > > >
> > > > > > > >> > > > > > > >
> > > > > > > >> > > > > > > > > can't you do it with an embedded one?
> > > > > > > >> > > > > > > > >
> > > > > > > >> > > > > > > > > well DataSourceRealm doesn't use JAAS by
> > > default i
> > > > > > > think,
> > > > > > > >> > maybe
> > > > > > > >> > > > > > that's
> > > > > > > >> > > > > > > > the
> > > > > > > >> > > > > > > > > issue
> > > > > > > >> > > > > > > > >
> > > > > > > >> > > > > > > > > - Romain
> > > > > > > >> > > > > > > > >
> > > > > > > >> > > > > > > > >
> > > > > > > >> > > > > > > > > 2012/6/1 José Luis Cetina <
> > maxtorzito@gmail.com
> > > >
> > > > > > > >> > > > > > > > >
> > > > > > > >> > > > > > > > > > OK, i can create a sample, but i use
> > > > > > DataSourceRealm,
> > > > > > > >> are
> > > > > > > >> > you
> > > > > > > >> > > > > gonna
> > > > > > > >> > > > > > > > > > configure your database?
> > > > > > > >> > > > > > > > > >
> > > > > > > >> > > > > > > > > > 2012/5/31 Romain Manni-Bucau <
> > > > > rmannibucau@gmail.com
> > > > > > >
> > > > > > > >> > > > > > > > > >
> > > > > > > >> > > > > > > > > > > can you have a try in an EJB please?
> (just
> > > try
> > > > > to
> > > > > > > add
> > > > > > > >> > > > > @Stateless
> > > > > > > >> > > > > > on
> > > > > > > >> > > > > > > > > your
> > > > > > > >> > > > > > > > > > > managed bean for instance)
> > > > > > > >> > > > > > > > > > >
> > > > > > > >> > > > > > > > > > > can you share a sample easy to run?
> > > > > > > >> > > > > > > > > > >
> > > > > > > >> > > > > > > > > > > - Romain
> > > > > > > >> > > > > > > > > > >
> > > > > > > >> > > > > > > > > > >
> > > > > > > >> > > > > > > > > > > 2012/6/1 José Luis Cetina <
> > > > maxtorzito@gmail.com
> > > > > >
> > > > > > > >> > > > > > > > > > >
> > > > > > > >> > > > > > > > > > > > Yes, im using JAAS
> > > > > > > >> > > > > > > > > > > >
> > > > > > > >> > > > > > > > > > > > 2012/5/31 Romain Manni-Bucau <
> > > > > > > rmannibucau@gmail.com
> > > > > > > >> >
> > > > > > > >> > > > > > > > > > > >
> > > > > > > >> > > > > > > > > > > > > Hi,
> > > > > > > >> > > > > > > > > > > > >
> > > > > > > >> > > > > > > > > > > > > Do you use jaas?
> > > > > > > >> > > > > > > > > > > > >
> > > > > > > >> > > > > > > > > > > > > - Romain
> > > > > > > >> > > > > > > > > > > > > Le 31 mai 2012 20:14, "José Luis
> > > Cetina" <
> > > > > > > >> > > > > > maxtorzito@gmail.com
> > > > > > > >> > > > > > > >
> > > > > > > >> > > > > > > > a
> > > > > > > >> > > > > > > > > > > écrit
> > > > > > > >> > > > > > > > > > > > :
> > > > > > > >> > > > > > > > > > > > >
> > > > > > > >> > > > > > > > > > > > > > Hi i have this scenario:
> > > > > > > >> > > > > > > > > > > > > >
> > > > > > > >> > > > > > > > > > > > > > I have a page login.xhtml, this
> page
> > > > has a
> > > > > > > >> > > ManagedBean
> > > > > > > >> > > > > > > (@Named)
> > > > > > > >> > > > > > > > > > this
> > > > > > > >> > > > > > > > > > > > > > managedbean use the
> > > > > request.login(user,pass)
> > > > > > > >> > method.
> > > > > > > >> > > > > > > > > > > > > >
> > > > > > > >> > > > > > > > > > > > > > When i do this:
> > > > > > > >> > > > > > > > > > > > > >
> > > > > > > >> > > > > > > > > > > > > > managedbean class:
> > > > > > > >> > > > > > > > > > > > > >
> > > > > > > >> > > > > > > > > > > > > > @Resource
> > > > > > > >> > > > > > > > > > > > > > private EJBContext ejbContext;
> > > > > > > >> > > > > > > > > > > > > > .
> > > > > > > >> > > > > > > > > > > > > > .
> > > > > > > >> > > > > > > > > > > > > > request.login(user,pass);
> > > > > > > >> > > > > > > > > > > > > > String name =
> > > > > > > >> > > > ejbContext.getCallerPrincipal().getName();
> > > > > > > >> > > > > > > > > > > > > >
> > > > > > > >> > > > > > > > > > > > > > I get "guest" as my user name.
> But i
> > > > > expect
> > > > > > > the
> > > > > > > >> > name
> > > > > > > >> > > of
> > > > > > > >> > > > > my
> > > > > > > >> > > > > > > user
> > > > > > > >> > > > > > > > > (of
> > > > > > > >> > > > > > > > > > > > > course
> > > > > > > >> > > > > > > > > > > > > > is not guest)
> > > > > > > >> > > > > > > > > > > > > >
> > > > > > > >> > > > > > > > > > > > > > If the login was successful my
> login
> > > > page
> > > > > > > >> navigate
> > > > > > > >> > to
> > > > > > > >> > > > > other
> > > > > > > >> > > > > > > > page
> > > > > > > >> > > > > > > > > > lets
> > > > > > > >> > > > > > > > > > > > say
> > > > > > > >> > > > > > > > > > > > > > pageb.xhtml
> > > > > > > >> > > > > > > > > > > > > >
> > > > > > > >> > > > > > > > > > > > > > If i create a managedbean (@Named)
> > for
> > > > > > > >> pageb.xhtml
> > > > > > > >> > > and
> > > > > > > >> > > > in
> > > > > > > >> > > > > > > that
> > > > > > > >> > > > > > > > > > > > > managedbean
> > > > > > > >> > > > > > > > > > > > > > i use again:
> > > > > > > >> > > > > > > > > > > > > > String name =
> > > > > > > >> > > > ejbContext.getCallerPrincipal().getName();
> > > > > > > >> > > > > > > > > > > > > > then, here i get my "correct" name
> > of
> > > > the
> > > > > > user
> > > > > > > >> (not
> > > > > > > >> > > > > guest).
> > > > > > > >> > > > > > > > > > > > > >
> > > > > > > >> > > > > > > > > > > > > > I dont know if this is the desire
> > > > > behaviour
> > > > > > or
> > > > > > > >> if
> > > > > > > >> > > this
> > > > > > > >> > > > > > > happend
> > > > > > > >> > > > > > > > > > > because
> > > > > > > >> > > > > > > > > > > > > the
> > > > > > > >> > > > > > > > > > > > > > http request isnt finished?
> > > > > > > >> > > > > > > > > > > > > >
> > > > > > > >> > > > > > > > > > > > > > other question why if i call
> > > > > > > >> > > > > > > > > > > > > > the
> > > > > > >  ejbContext.getCallerPrincipal().getName();
> > > > > > > >> > > before
> > > > > > > >> > > > > the
> > > > > > > >> > > > > > > > > > > > > request.login()
> > > > > > > >> > > > > > > > > > > > > > method i get again "guest", why
> not
> > > > null?
> > > > > > > >> > > > > > > > > > > > > >
> > > > > > > >> > > > > > > > > > > > > > If this question is for
> > tomee(openejb)
> > > > or
> > > > > > > >> tomcat?
> > > > > > > >> > > > > > > > > > > > > >
> > > > > > > >> > > > > > > > > > > > > > Thanks
> > > > > > > >> > > > > > > > > > > > > >
> > > > > > > >> > > > > > > > > > > > > >
> > > > > > > >> > > > > > > > > > > > > >
> > > > > > > >> > > > > > > > >
> > > > > > > >> > > >
> > > > > > >
> > -------------------------------------------------------------------
> > > > > > > >> > > > > > > > > > > > > > *SCJA. José Luis Cetina*
> > > > > > > >> > > > > > > > > > > > > >
> > > > > > > >> > > > > > > > >
> > > > > > > >> > > >
> > > > > > >
> > -------------------------------------------------------------------
> > > > > > > >> > > > > > > > > > > > > >
> > > > > > > >> > > > > > > > > > > > >
> > > > > > > >> > > > > > > > > > > >
> > > > > > > >> > > > > > > > > > > >
> > > > > > > >> > > > > > > > > > > >
> > > > > > > >> > > > > > > > > > > > --
> > > > > > > >> > > > > > > > > > > >
> > > > > > > >> > > > > > >
> > > > > > > >> >
> > > > > -------------------------------------------------------------------
> > > > > > > >> > > > > > > > > > > > *SCJA. José Luis Cetina*
> > > > > > > >> > > > > > > > > > > >
> > > > > > > >> > > > > > >
> > > > > > > >> >
> > > > > -------------------------------------------------------------------
> > > > > > > >> > > > > > > > > > > >
> > > > > > > >> > > > > > > > > > >
> > > > > > > >> > > > > > > > > >
> > > > > > > >> > > > > > > > > >
> > > > > > > >> > > > > > > > > >
> > > > > > > >> > > > > > > > > > --
> > > > > > > >> > > > > > > > > >
> > > > > > > >> > > > >
> > > > > > > >>
> > > > -------------------------------------------------------------------
> > > > > > > >> > > > > > > > > > *SCJA. José Luis Cetina*
> > > > > > > >> > > > > > > > > >
> > > > > > > >> > > > >
> > > > > > > >>
> > > > -------------------------------------------------------------------
> > > > > > > >> > > > > > > > > >
> > > > > > > >> > > > > > > > >
> > > > > > > >> > > > > > > >
> > > > > > > >> > > > > > > >
> > > > > > > >> > > > > > > >
> > > > > > > >> > > > > > > > --
> > > > > > > >> > > > > > > >
> > > > > > > >> > >
> > > > > >
> -------------------------------------------------------------------
> > > > > > > >> > > > > > > > *SCJA. José Luis Cetina*
> > > > > > > >> > > > > > > >
> > > > > > > >> > >
> > > > > >
> -------------------------------------------------------------------
> > > > > > > >> > > > > > > >
> > > > > > > >> > > > > > >
> > > > > > > >> > > > > >
> > > > > > > >> > > > > >
> > > > > > > >> > > > > >
> > > > > > > >> > > > > > --
> > > > > > > >> > > > > >
> > > > > > > >>
> > > > -------------------------------------------------------------------
> > > > > > > >> > > > > > *SCJA. José Luis Cetina*
> > > > > > > >> > > > > >
> > > > > > > >>
> > > > -------------------------------------------------------------------
> > > > > > > >> > > > > >
> > > > > > > >> > > > >
> > > > > > > >> > > >
> > > > > > > >> > > >
> > > > > > > >> > > >
> > > > > > > >> > > > --
> > > > > > > >> > > >
> > > > > > >
> > -------------------------------------------------------------------
> > > > > > > >> > > > *SCJA. José Luis Cetina*
> > > > > > > >> > > >
> > > > > > >
> > -------------------------------------------------------------------
> > > > > > > >> > > >
> > > > > > > >> > >
> > > > > > > >> >
> > > > > > > >> >
> > > > > > > >> >
> > > > > > > >> > --
> > > > > > > >> >
> > > > > -------------------------------------------------------------------
> > > > > > > >> > *SCJA. José Luis Cetina*
> > > > > > > >> >
> > > > > -------------------------------------------------------------------
> > > > > > > >> >
> > > > > > > >>
> > > > > > > >
> > > > > > > >
> > > > > > > >
> > > > > > > > --
> > > > > > > >
> > > -------------------------------------------------------------------
> > > > > > > > *SCJA. José Luis Cetina*
> > > > > > > >
> > > -------------------------------------------------------------------
> > > > > > > >
> > > > > > > >
> > > > > > >
> > > > > > >
> > > > > > > --
> > > > > > >
> > -------------------------------------------------------------------
> > > > > > > *SCJA. José Luis Cetina*
> > > > > > >
> > -------------------------------------------------------------------
> > > > > > >
> > > > > >
> > > > >
> > > > >
> > > > >
> > > > > --
> > > > > -------------------------------------------------------------------
> > > > > *SCJA. José Luis Cetina*
> > > > > -------------------------------------------------------------------
> > > > >
> > > >
> > >
> > >
> > >
> > > --
> > > -------------------------------------------------------------------
> > > *SCJA. José Luis Cetina*
> > > -------------------------------------------------------------------
> > >
> >
>
>
>
> --
> -------------------------------------------------------------------
> *SCJA. José Luis Cetina*
> -------------------------------------------------------------------
>

Re: Guest user

Posted by José Luis Cetina <ma...@gmail.com>.
I have this in my context.xml

<Realm className="MyExtendedDataSourceRealm"
 dataSourceName="MyDataSource"
digest="SHA-256"
encodePassword="Base64"
queryRealmRolesUser="SELECT rol FROM xxxx WHERE user=?"
queryRealmUsers="SELECT pass FROM xxx WHERE user=?"/>

As you can see i extend the datasource realm, i have this realm config in
the context.xml in my webapp (not context.xml TomEE).

But, as i can see in your example, you surround your realm with TomEERealm,
if this necessary?. I didn't know this



2012/5/31 Romain Manni-Bucau <rm...@gmail.com>

> in my test i used:
>
>    <Realm className="org.apache.tomee.catalina.TomEERealm">
>        <Realm className="org.apache.catalina.realm.JAASRealm"
> appName="PropertiesLoginModule"
>
>
>  userClassNames="org.apache.openejb.core.security.AbstractSecurityService$User"
>
>
>  roleClassNames="org.apache.openejb.core.security.AbstractSecurityService$Group">
>        </Realm>
>       </Realm>
>
> but i guess you can replace the jaasrealm by your dsrealm
>
> - Romain
>
>
> 2012/6/1 José Luis Cetina <ma...@gmail.com>
>
> > Yes, it seems buggy.
> >
> > Where i have to replace?
> >
> > Remember im using DataSourceRealm
> >
> > 2012/5/31 Romain Manni-Bucau <rm...@gmail.com>
> >
> > > this is the current status,
> > >
> > > but IMO it is buggy,
> > >
> > > i'll commit soon a TomEEJAASRealm to make it working (replace JAASRealm
> > in
> > > the conf)
> > >
> > > - Romain
> > >
> > >
> > > 2012/6/1 José Luis Cetina <ma...@gmail.com>
> > >
> > > > i think we are getting confused.
> > > >
> > > > If i resume all, this what i asked (the final of the first post)
> > > >
> > > > I dont know if this is the desire behavior or if this happend becase
> > the
> > > > httr request isnt finished?
> > > > Then you answer me:
> > > >
> > > > in fact info from ejbcontext are taken in our securitymodule
> > > >
> > > > in tomee we set/unset it from a valve so at the beginning/end of the
> > > > request...all between is currently ignored so when you log you need
> > > another
> > > > request to get the updated information (from the tomcat realm)
> > > >
> > > > "so when you log you need another request to get the updated
> > information
> > > > (from the tomcat realm)
> > > >
> > > > Then i get guest because is the desire behaviour, after the first
> > > request i
> > > > can get the user i expected.
> > > >
> > > > Then i resume, this is the default behaviour, and works but you need
> a
> > > > second request.
> > > >
> > > >
> > > >
> > > > 2012/5/31 Romain Manni-Bucau <rm...@gmail.com>
> > > >
> > > > > i think it should work
> > > > >
> > > > > - Romain
> > > > >
> > > > >
> > > > > 2012/6/1 José Luis Cetina <ma...@gmail.com>
> > > > >
> > > > > > I mean this:
> > > > > >
> > > > > > I dont know if this is the desire behaviour or if this happend
> > > because
> > > > > the
> > > > > > http request isnt finished?
> > > > > >
> > > > > >
> > > > > >
> > > > > > 2012/5/31 José Luis Cetina <ma...@gmail.com>
> > > > > >
> > > > > > > Ok, the what i asked is correct??
> > > > > > >
> > > > > > > "I dont know if this is the desire behaviour or if this happend
> > > > because
> > > > > > > the http request isnt finished?"
> > > > > > >
> > > > > > > 2012/5/31 Romain Manni-Bucau <rm...@gmail.com>
> > > > > > >
> > > > > > >> ok,
> > > > > > >>
> > > > > > >> in fact info from ejbcontext are taken in our securitymodule
> > > > > > >>
> > > > > > >> in tomee we set/unset it from a valve so at the beginning/end
> of
> > > the
> > > > > > >> request...all between is currently ignored so when you log you
> > > need
> > > > > > >> another
> > > > > > >> request to get the updated information (from the tomcat realm)
> > > > > > >>
> > > > > > >> - Romain
> > > > > > >>
> > > > > > >>
> > > > > > >> 2012/6/1 José Luis Cetina <ma...@gmail.com>
> > > > > > >>
> > > > > > >> > Yes, it work
> > > > > > >> >
> > > > > > >> > 1) Login (form login) using DataSourceRealm
> > > > > > >> >
> > > > > > >> >
> > > > > > >> > 2) Redirect to page2 from my managedbean
> > > > > > >> >
> > > > > > >> > 2012/5/31 Romain Manni-Bucau <rm...@gmail.com>
> > > > > > >> >
> > > > > > >> > > so you mean using the flow i described before it works?
> > > (sorry,
> > > > > just
> > > > > > >> to
> > > > > > >> > be
> > > > > > >> > > sure to understand)
> > > > > > >> > >
> > > > > > >> > > - Romain
> > > > > > >> > >
> > > > > > >> > >
> > > > > > >> > > 2012/6/1 José Luis Cetina <ma...@gmail.com>
> > > > > > >> > >
> > > > > > >> > > > Hi i can login and i can navigate (redirect) to my other
> > > page,
> > > > > > but i
> > > > > > >> > dont
> > > > > > >> > > > know why im getting guest user in the login mbean, after
> > > that
> > > > in
> > > > > > >> other
> > > > > > >> > > > mbean  i get my "real" user.
> > > > > > >> > > >
> > > > > > >> > > >
> > > > > > >> > > > 2012/5/31 Romain Manni-Bucau <rm...@gmail.com>
> > > > > > >> > > >
> > > > > > >> > > > > maybe
> > > > > > >> > > > >
> > > > > > >> > > >
> > > > > > >> > >
> > > > > > >> >
> > > > > > >>
> > > > > >
> > > > >
> > > >
> > >
> >
> http://rmannibucau.wordpress.com/2012/05/09/tomee-and-its-ssh-connector/but
> > > > > > >> > > > > it uses properties file, it just need a custom login
> > > module
> > > > > > >> > > > implementation
> > > > > > >> > > > > to use a db.
> > > > > > >> > > > >
> > > > > > >> > > > > well,
> > > > > > >> > > > >
> > > > > > >> > > > > before can you test it please?
> > > > > > >> > > > > 1) login
> > > > > > >> > > > > 2) redirect to your page using your bean
> > > > > > >> > > > >
> > > > > > >> > > > > - Romain
> > > > > > >> > > > >
> > > > > > >> > > > >
> > > > > > >> > > > > 2012/6/1 José Luis Cetina <ma...@gmail.com>
> > > > > > >> > > > >
> > > > > > >> > > > > > I have to read and know how to use this, i always
> use
> > > > > > >> DataSource or
> > > > > > >> > > > > > JDBCRealm. (with glassfish).
> > > > > > >> > > > > > im reading now, do you have something for a
> > quickstart?
> > > > for
> > > > > > >> share
> > > > > > >> > me
> > > > > > >> > > > > >
> > > > > > >> > > > > > 2012/5/31 Romain Manni-Bucau <rmannibucau@gmail.com
> >
> > > > > > >> > > > > >
> > > > > > >> > > > > > > having your password in a db is not an issue but i
> > > think
> > > > > you
> > > > > > >> > should
> > > > > > >> > > > > > > use org.apache.catalina.realm.JAASRealm
> > > > > > >> > > > > > >
> > > > > > >> > > > > > > for instance:
> > > > > > >> > > > > > >
> > > > > > >> > > > > > >     <Realm
> > > > className="org.apache.catalina.realm.JAASRealm"
> > > > > > >> > > > > > > appName="MyDBLoginModule"
> > > > > > >> > > > > > >
> > > > > > >> > > > > > >
> > > > > > >> > > > > > >
> > > > > > >> > > > > >
> > > > > > >> > > > >
> > > > > > >> > > >
> > > > > > >> > >
> > > > > > >> >
> > > > > > >>
> > > > > >
> > > > >
> > > >
> > >
> >
>  userClassNames="org.apache.openejb.core.security.AbstractSecurityService$User"
> > > > > > >> > > > > > >
> > > > > > >> > > > > > >
> > > > > > >> > > > > > >
> > > > > > >> > > > > >
> > > > > > >> > > > >
> > > > > > >> > > >
> > > > > > >> > >
> > > > > > >> >
> > > > > > >>
> > > > > >
> > > > >
> > > >
> > >
> >
>  roleClassNames="org.apache.openejb.core.security.AbstractSecurityService$Group">
> > > > > > >> > > > > > >      </Realm>
> > > > > > >> > > > > > >
> > > > > > >> > > > > > > so simply implement a custom LoginModule instead
> of
> > a
> > > > > realm
> > > > > > >> > > > > > >
> > > > > > >> > > > > > > wdyt?
> > > > > > >> > > > > > >
> > > > > > >> > > > > > > - Romain
> > > > > > >> > > > > > >
> > > > > > >> > > > > > >
> > > > > > >> > > > > > > 2012/6/1 José Luis Cetina <ma...@gmail.com>
> > > > > > >> > > > > > >
> > > > > > >> > > > > > > > Sorry, i use DataSourceRealm, i have my
> > > > user/pass/roles
> > > > > in
> > > > > > >> the
> > > > > > >> > > DB.
> > > > > > >> > > > > > > >
> > > > > > >> > > > > > > >
> > > > > > >> > > > > > > >
> > > > > > >> > > > > > > > 2012/5/31 Romain Manni-Bucau <
> > rmannibucau@gmail.com
> > > >
> > > > > > >> > > > > > > >
> > > > > > >> > > > > > > > > can't you do it with an embedded one?
> > > > > > >> > > > > > > > >
> > > > > > >> > > > > > > > > well DataSourceRealm doesn't use JAAS by
> > default i
> > > > > > think,
> > > > > > >> > maybe
> > > > > > >> > > > > > that's
> > > > > > >> > > > > > > > the
> > > > > > >> > > > > > > > > issue
> > > > > > >> > > > > > > > >
> > > > > > >> > > > > > > > > - Romain
> > > > > > >> > > > > > > > >
> > > > > > >> > > > > > > > >
> > > > > > >> > > > > > > > > 2012/6/1 José Luis Cetina <
> maxtorzito@gmail.com
> > >
> > > > > > >> > > > > > > > >
> > > > > > >> > > > > > > > > > OK, i can create a sample, but i use
> > > > > DataSourceRealm,
> > > > > > >> are
> > > > > > >> > you
> > > > > > >> > > > > gonna
> > > > > > >> > > > > > > > > > configure your database?
> > > > > > >> > > > > > > > > >
> > > > > > >> > > > > > > > > > 2012/5/31 Romain Manni-Bucau <
> > > > rmannibucau@gmail.com
> > > > > >
> > > > > > >> > > > > > > > > >
> > > > > > >> > > > > > > > > > > can you have a try in an EJB please? (just
> > try
> > > > to
> > > > > > add
> > > > > > >> > > > > @Stateless
> > > > > > >> > > > > > on
> > > > > > >> > > > > > > > > your
> > > > > > >> > > > > > > > > > > managed bean for instance)
> > > > > > >> > > > > > > > > > >
> > > > > > >> > > > > > > > > > > can you share a sample easy to run?
> > > > > > >> > > > > > > > > > >
> > > > > > >> > > > > > > > > > > - Romain
> > > > > > >> > > > > > > > > > >
> > > > > > >> > > > > > > > > > >
> > > > > > >> > > > > > > > > > > 2012/6/1 José Luis Cetina <
> > > maxtorzito@gmail.com
> > > > >
> > > > > > >> > > > > > > > > > >
> > > > > > >> > > > > > > > > > > > Yes, im using JAAS
> > > > > > >> > > > > > > > > > > >
> > > > > > >> > > > > > > > > > > > 2012/5/31 Romain Manni-Bucau <
> > > > > > rmannibucau@gmail.com
> > > > > > >> >
> > > > > > >> > > > > > > > > > > >
> > > > > > >> > > > > > > > > > > > > Hi,
> > > > > > >> > > > > > > > > > > > >
> > > > > > >> > > > > > > > > > > > > Do you use jaas?
> > > > > > >> > > > > > > > > > > > >
> > > > > > >> > > > > > > > > > > > > - Romain
> > > > > > >> > > > > > > > > > > > > Le 31 mai 2012 20:14, "José Luis
> > Cetina" <
> > > > > > >> > > > > > maxtorzito@gmail.com
> > > > > > >> > > > > > > >
> > > > > > >> > > > > > > > a
> > > > > > >> > > > > > > > > > > écrit
> > > > > > >> > > > > > > > > > > > :
> > > > > > >> > > > > > > > > > > > >
> > > > > > >> > > > > > > > > > > > > > Hi i have this scenario:
> > > > > > >> > > > > > > > > > > > > >
> > > > > > >> > > > > > > > > > > > > > I have a page login.xhtml, this page
> > > has a
> > > > > > >> > > ManagedBean
> > > > > > >> > > > > > > (@Named)
> > > > > > >> > > > > > > > > > this
> > > > > > >> > > > > > > > > > > > > > managedbean use the
> > > > request.login(user,pass)
> > > > > > >> > method.
> > > > > > >> > > > > > > > > > > > > >
> > > > > > >> > > > > > > > > > > > > > When i do this:
> > > > > > >> > > > > > > > > > > > > >
> > > > > > >> > > > > > > > > > > > > > managedbean class:
> > > > > > >> > > > > > > > > > > > > >
> > > > > > >> > > > > > > > > > > > > > @Resource
> > > > > > >> > > > > > > > > > > > > > private EJBContext ejbContext;
> > > > > > >> > > > > > > > > > > > > > .
> > > > > > >> > > > > > > > > > > > > > .
> > > > > > >> > > > > > > > > > > > > > request.login(user,pass);
> > > > > > >> > > > > > > > > > > > > > String name =
> > > > > > >> > > > ejbContext.getCallerPrincipal().getName();
> > > > > > >> > > > > > > > > > > > > >
> > > > > > >> > > > > > > > > > > > > > I get "guest" as my user name. But i
> > > > expect
> > > > > > the
> > > > > > >> > name
> > > > > > >> > > of
> > > > > > >> > > > > my
> > > > > > >> > > > > > > user
> > > > > > >> > > > > > > > > (of
> > > > > > >> > > > > > > > > > > > > course
> > > > > > >> > > > > > > > > > > > > > is not guest)
> > > > > > >> > > > > > > > > > > > > >
> > > > > > >> > > > > > > > > > > > > > If the login was successful my login
> > > page
> > > > > > >> navigate
> > > > > > >> > to
> > > > > > >> > > > > other
> > > > > > >> > > > > > > > page
> > > > > > >> > > > > > > > > > lets
> > > > > > >> > > > > > > > > > > > say
> > > > > > >> > > > > > > > > > > > > > pageb.xhtml
> > > > > > >> > > > > > > > > > > > > >
> > > > > > >> > > > > > > > > > > > > > If i create a managedbean (@Named)
> for
> > > > > > >> pageb.xhtml
> > > > > > >> > > and
> > > > > > >> > > > in
> > > > > > >> > > > > > > that
> > > > > > >> > > > > > > > > > > > > managedbean
> > > > > > >> > > > > > > > > > > > > > i use again:
> > > > > > >> > > > > > > > > > > > > > String name =
> > > > > > >> > > > ejbContext.getCallerPrincipal().getName();
> > > > > > >> > > > > > > > > > > > > > then, here i get my "correct" name
> of
> > > the
> > > > > user
> > > > > > >> (not
> > > > > > >> > > > > guest).
> > > > > > >> > > > > > > > > > > > > >
> > > > > > >> > > > > > > > > > > > > > I dont know if this is the desire
> > > > behaviour
> > > > > or
> > > > > > >> if
> > > > > > >> > > this
> > > > > > >> > > > > > > happend
> > > > > > >> > > > > > > > > > > because
> > > > > > >> > > > > > > > > > > > > the
> > > > > > >> > > > > > > > > > > > > > http request isnt finished?
> > > > > > >> > > > > > > > > > > > > >
> > > > > > >> > > > > > > > > > > > > > other question why if i call
> > > > > > >> > > > > > > > > > > > > > the
> > > > > >  ejbContext.getCallerPrincipal().getName();
> > > > > > >> > > before
> > > > > > >> > > > > the
> > > > > > >> > > > > > > > > > > > > request.login()
> > > > > > >> > > > > > > > > > > > > > method i get again "guest", why not
> > > null?
> > > > > > >> > > > > > > > > > > > > >
> > > > > > >> > > > > > > > > > > > > > If this question is for
> tomee(openejb)
> > > or
> > > > > > >> tomcat?
> > > > > > >> > > > > > > > > > > > > >
> > > > > > >> > > > > > > > > > > > > > Thanks
> > > > > > >> > > > > > > > > > > > > >
> > > > > > >> > > > > > > > > > > > > >
> > > > > > >> > > > > > > > > > > > > >
> > > > > > >> > > > > > > > >
> > > > > > >> > > >
> > > > > >
> -------------------------------------------------------------------
> > > > > > >> > > > > > > > > > > > > > *SCJA. José Luis Cetina*
> > > > > > >> > > > > > > > > > > > > >
> > > > > > >> > > > > > > > >
> > > > > > >> > > >
> > > > > >
> -------------------------------------------------------------------
> > > > > > >> > > > > > > > > > > > > >
> > > > > > >> > > > > > > > > > > > >
> > > > > > >> > > > > > > > > > > >
> > > > > > >> > > > > > > > > > > >
> > > > > > >> > > > > > > > > > > >
> > > > > > >> > > > > > > > > > > > --
> > > > > > >> > > > > > > > > > > >
> > > > > > >> > > > > > >
> > > > > > >> >
> > > > -------------------------------------------------------------------
> > > > > > >> > > > > > > > > > > > *SCJA. José Luis Cetina*
> > > > > > >> > > > > > > > > > > >
> > > > > > >> > > > > > >
> > > > > > >> >
> > > > -------------------------------------------------------------------
> > > > > > >> > > > > > > > > > > >
> > > > > > >> > > > > > > > > > >
> > > > > > >> > > > > > > > > >
> > > > > > >> > > > > > > > > >
> > > > > > >> > > > > > > > > >
> > > > > > >> > > > > > > > > > --
> > > > > > >> > > > > > > > > >
> > > > > > >> > > > >
> > > > > > >>
> > > -------------------------------------------------------------------
> > > > > > >> > > > > > > > > > *SCJA. José Luis Cetina*
> > > > > > >> > > > > > > > > >
> > > > > > >> > > > >
> > > > > > >>
> > > -------------------------------------------------------------------
> > > > > > >> > > > > > > > > >
> > > > > > >> > > > > > > > >
> > > > > > >> > > > > > > >
> > > > > > >> > > > > > > >
> > > > > > >> > > > > > > >
> > > > > > >> > > > > > > > --
> > > > > > >> > > > > > > >
> > > > > > >> > >
> > > > > -------------------------------------------------------------------
> > > > > > >> > > > > > > > *SCJA. José Luis Cetina*
> > > > > > >> > > > > > > >
> > > > > > >> > >
> > > > > -------------------------------------------------------------------
> > > > > > >> > > > > > > >
> > > > > > >> > > > > > >
> > > > > > >> > > > > >
> > > > > > >> > > > > >
> > > > > > >> > > > > >
> > > > > > >> > > > > > --
> > > > > > >> > > > > >
> > > > > > >>
> > > -------------------------------------------------------------------
> > > > > > >> > > > > > *SCJA. José Luis Cetina*
> > > > > > >> > > > > >
> > > > > > >>
> > > -------------------------------------------------------------------
> > > > > > >> > > > > >
> > > > > > >> > > > >
> > > > > > >> > > >
> > > > > > >> > > >
> > > > > > >> > > >
> > > > > > >> > > > --
> > > > > > >> > > >
> > > > > >
> -------------------------------------------------------------------
> > > > > > >> > > > *SCJA. José Luis Cetina*
> > > > > > >> > > >
> > > > > >
> -------------------------------------------------------------------
> > > > > > >> > > >
> > > > > > >> > >
> > > > > > >> >
> > > > > > >> >
> > > > > > >> >
> > > > > > >> > --
> > > > > > >> >
> > > > -------------------------------------------------------------------
> > > > > > >> > *SCJA. José Luis Cetina*
> > > > > > >> >
> > > > -------------------------------------------------------------------
> > > > > > >> >
> > > > > > >>
> > > > > > >
> > > > > > >
> > > > > > >
> > > > > > > --
> > > > > > >
> > -------------------------------------------------------------------
> > > > > > > *SCJA. José Luis Cetina*
> > > > > > >
> > -------------------------------------------------------------------
> > > > > > >
> > > > > > >
> > > > > >
> > > > > >
> > > > > > --
> > > > > >
> -------------------------------------------------------------------
> > > > > > *SCJA. José Luis Cetina*
> > > > > >
> -------------------------------------------------------------------
> > > > > >
> > > > >
> > > >
> > > >
> > > >
> > > > --
> > > > -------------------------------------------------------------------
> > > > *SCJA. José Luis Cetina*
> > > > -------------------------------------------------------------------
> > > >
> > >
> >
> >
> >
> > --
> > -------------------------------------------------------------------
> > *SCJA. José Luis Cetina*
> > -------------------------------------------------------------------
> >
>



-- 
-------------------------------------------------------------------
*SCJA. José Luis Cetina*
-------------------------------------------------------------------

Re: Guest user

Posted by Romain Manni-Bucau <rm...@gmail.com>.
here a sample:
http://svn.apache.org/repos/asf/openejb/trunk/openejb/examples/cdi-ejbcontext-jaas/

- Romain


2012/6/1 Romain Manni-Bucau <rm...@gmail.com>

> in my test i used:
>
>     <Realm className="org.apache.tomee.catalina.TomEERealm">
>         <Realm className="org.apache.catalina.realm.JAASRealm"
> appName="PropertiesLoginModule"
>
>  userClassNames="org.apache.openejb.core.security.AbstractSecurityService$User"
>
>  roleClassNames="org.apache.openejb.core.security.AbstractSecurityService$Group">
>         </Realm>
>       </Realm>
>
> but i guess you can replace the jaasrealm by your dsrealm
>
> - Romain
>
>
> 2012/6/1 José Luis Cetina <ma...@gmail.com>
>
>> Yes, it seems buggy.
>>
>> Where i have to replace?
>>
>> Remember im using DataSourceRealm
>>
>> 2012/5/31 Romain Manni-Bucau <rm...@gmail.com>
>>
>> > this is the current status,
>> >
>> > but IMO it is buggy,
>> >
>> > i'll commit soon a TomEEJAASRealm to make it working (replace JAASRealm
>> in
>> > the conf)
>> >
>> > - Romain
>> >
>> >
>> > 2012/6/1 José Luis Cetina <ma...@gmail.com>
>> >
>> > > i think we are getting confused.
>> > >
>> > > If i resume all, this what i asked (the final of the first post)
>> > >
>> > > I dont know if this is the desire behavior or if this happend becase
>> the
>> > > httr request isnt finished?
>> > > Then you answer me:
>> > >
>> > > in fact info from ejbcontext are taken in our securitymodule
>> > >
>> > > in tomee we set/unset it from a valve so at the beginning/end of the
>> > > request...all between is currently ignored so when you log you need
>> > another
>> > > request to get the updated information (from the tomcat realm)
>> > >
>> > > "so when you log you need another request to get the updated
>> information
>> > > (from the tomcat realm)
>> > >
>> > > Then i get guest because is the desire behaviour, after the first
>> > request i
>> > > can get the user i expected.
>> > >
>> > > Then i resume, this is the default behaviour, and works but you need a
>> > > second request.
>> > >
>> > >
>> > >
>> > > 2012/5/31 Romain Manni-Bucau <rm...@gmail.com>
>> > >
>> > > > i think it should work
>> > > >
>> > > > - Romain
>> > > >
>> > > >
>> > > > 2012/6/1 José Luis Cetina <ma...@gmail.com>
>> > > >
>> > > > > I mean this:
>> > > > >
>> > > > > I dont know if this is the desire behaviour or if this happend
>> > because
>> > > > the
>> > > > > http request isnt finished?
>> > > > >
>> > > > >
>> > > > >
>> > > > > 2012/5/31 José Luis Cetina <ma...@gmail.com>
>> > > > >
>> > > > > > Ok, the what i asked is correct??
>> > > > > >
>> > > > > > "I dont know if this is the desire behaviour or if this happend
>> > > because
>> > > > > > the http request isnt finished?"
>> > > > > >
>> > > > > > 2012/5/31 Romain Manni-Bucau <rm...@gmail.com>
>> > > > > >
>> > > > > >> ok,
>> > > > > >>
>> > > > > >> in fact info from ejbcontext are taken in our securitymodule
>> > > > > >>
>> > > > > >> in tomee we set/unset it from a valve so at the beginning/end
>> of
>> > the
>> > > > > >> request...all between is currently ignored so when you log you
>> > need
>> > > > > >> another
>> > > > > >> request to get the updated information (from the tomcat realm)
>> > > > > >>
>> > > > > >> - Romain
>> > > > > >>
>> > > > > >>
>> > > > > >> 2012/6/1 José Luis Cetina <ma...@gmail.com>
>> > > > > >>
>> > > > > >> > Yes, it work
>> > > > > >> >
>> > > > > >> > 1) Login (form login) using DataSourceRealm
>> > > > > >> >
>> > > > > >> >
>> > > > > >> > 2) Redirect to page2 from my managedbean
>> > > > > >> >
>> > > > > >> > 2012/5/31 Romain Manni-Bucau <rm...@gmail.com>
>> > > > > >> >
>> > > > > >> > > so you mean using the flow i described before it works?
>> > (sorry,
>> > > > just
>> > > > > >> to
>> > > > > >> > be
>> > > > > >> > > sure to understand)
>> > > > > >> > >
>> > > > > >> > > - Romain
>> > > > > >> > >
>> > > > > >> > >
>> > > > > >> > > 2012/6/1 José Luis Cetina <ma...@gmail.com>
>> > > > > >> > >
>> > > > > >> > > > Hi i can login and i can navigate (redirect) to my other
>> > page,
>> > > > > but i
>> > > > > >> > dont
>> > > > > >> > > > know why im getting guest user in the login mbean, after
>> > that
>> > > in
>> > > > > >> other
>> > > > > >> > > > mbean  i get my "real" user.
>> > > > > >> > > >
>> > > > > >> > > >
>> > > > > >> > > > 2012/5/31 Romain Manni-Bucau <rm...@gmail.com>
>> > > > > >> > > >
>> > > > > >> > > > > maybe
>> > > > > >> > > > >
>> > > > > >> > > >
>> > > > > >> > >
>> > > > > >> >
>> > > > > >>
>> > > > >
>> > > >
>> > >
>> >
>> http://rmannibucau.wordpress.com/2012/05/09/tomee-and-its-ssh-connector/but
>> > > > > >> > > > > it uses properties file, it just need a custom login
>> > module
>> > > > > >> > > > implementation
>> > > > > >> > > > > to use a db.
>> > > > > >> > > > >
>> > > > > >> > > > > well,
>> > > > > >> > > > >
>> > > > > >> > > > > before can you test it please?
>> > > > > >> > > > > 1) login
>> > > > > >> > > > > 2) redirect to your page using your bean
>> > > > > >> > > > >
>> > > > > >> > > > > - Romain
>> > > > > >> > > > >
>> > > > > >> > > > >
>> > > > > >> > > > > 2012/6/1 José Luis Cetina <ma...@gmail.com>
>> > > > > >> > > > >
>> > > > > >> > > > > > I have to read and know how to use this, i always use
>> > > > > >> DataSource or
>> > > > > >> > > > > > JDBCRealm. (with glassfish).
>> > > > > >> > > > > > im reading now, do you have something for a
>> quickstart?
>> > > for
>> > > > > >> share
>> > > > > >> > me
>> > > > > >> > > > > >
>> > > > > >> > > > > > 2012/5/31 Romain Manni-Bucau <rm...@gmail.com>
>> > > > > >> > > > > >
>> > > > > >> > > > > > > having your password in a db is not an issue but i
>> > think
>> > > > you
>> > > > > >> > should
>> > > > > >> > > > > > > use org.apache.catalina.realm.JAASRealm
>> > > > > >> > > > > > >
>> > > > > >> > > > > > > for instance:
>> > > > > >> > > > > > >
>> > > > > >> > > > > > >     <Realm
>> > > className="org.apache.catalina.realm.JAASRealm"
>> > > > > >> > > > > > > appName="MyDBLoginModule"
>> > > > > >> > > > > > >
>> > > > > >> > > > > > >
>> > > > > >> > > > > > >
>> > > > > >> > > > > >
>> > > > > >> > > > >
>> > > > > >> > > >
>> > > > > >> > >
>> > > > > >> >
>> > > > > >>
>> > > > >
>> > > >
>> > >
>> >
>>  userClassNames="org.apache.openejb.core.security.AbstractSecurityService$User"
>> > > > > >> > > > > > >
>> > > > > >> > > > > > >
>> > > > > >> > > > > > >
>> > > > > >> > > > > >
>> > > > > >> > > > >
>> > > > > >> > > >
>> > > > > >> > >
>> > > > > >> >
>> > > > > >>
>> > > > >
>> > > >
>> > >
>> >
>>  roleClassNames="org.apache.openejb.core.security.AbstractSecurityService$Group">
>> > > > > >> > > > > > >      </Realm>
>> > > > > >> > > > > > >
>> > > > > >> > > > > > > so simply implement a custom LoginModule instead
>> of a
>> > > > realm
>> > > > > >> > > > > > >
>> > > > > >> > > > > > > wdyt?
>> > > > > >> > > > > > >
>> > > > > >> > > > > > > - Romain
>> > > > > >> > > > > > >
>> > > > > >> > > > > > >
>> > > > > >> > > > > > > 2012/6/1 José Luis Cetina <ma...@gmail.com>
>> > > > > >> > > > > > >
>> > > > > >> > > > > > > > Sorry, i use DataSourceRealm, i have my
>> > > user/pass/roles
>> > > > in
>> > > > > >> the
>> > > > > >> > > DB.
>> > > > > >> > > > > > > >
>> > > > > >> > > > > > > >
>> > > > > >> > > > > > > >
>> > > > > >> > > > > > > > 2012/5/31 Romain Manni-Bucau <
>> rmannibucau@gmail.com
>> > >
>> > > > > >> > > > > > > >
>> > > > > >> > > > > > > > > can't you do it with an embedded one?
>> > > > > >> > > > > > > > >
>> > > > > >> > > > > > > > > well DataSourceRealm doesn't use JAAS by
>> default i
>> > > > > think,
>> > > > > >> > maybe
>> > > > > >> > > > > > that's
>> > > > > >> > > > > > > > the
>> > > > > >> > > > > > > > > issue
>> > > > > >> > > > > > > > >
>> > > > > >> > > > > > > > > - Romain
>> > > > > >> > > > > > > > >
>> > > > > >> > > > > > > > >
>> > > > > >> > > > > > > > > 2012/6/1 José Luis Cetina <
>> maxtorzito@gmail.com>
>> > > > > >> > > > > > > > >
>> > > > > >> > > > > > > > > > OK, i can create a sample, but i use
>> > > > DataSourceRealm,
>> > > > > >> are
>> > > > > >> > you
>> > > > > >> > > > > gonna
>> > > > > >> > > > > > > > > > configure your database?
>> > > > > >> > > > > > > > > >
>> > > > > >> > > > > > > > > > 2012/5/31 Romain Manni-Bucau <
>> > > rmannibucau@gmail.com
>> > > > >
>> > > > > >> > > > > > > > > >
>> > > > > >> > > > > > > > > > > can you have a try in an EJB please? (just
>> try
>> > > to
>> > > > > add
>> > > > > >> > > > > @Stateless
>> > > > > >> > > > > > on
>> > > > > >> > > > > > > > > your
>> > > > > >> > > > > > > > > > > managed bean for instance)
>> > > > > >> > > > > > > > > > >
>> > > > > >> > > > > > > > > > > can you share a sample easy to run?
>> > > > > >> > > > > > > > > > >
>> > > > > >> > > > > > > > > > > - Romain
>> > > > > >> > > > > > > > > > >
>> > > > > >> > > > > > > > > > >
>> > > > > >> > > > > > > > > > > 2012/6/1 José Luis Cetina <
>> > maxtorzito@gmail.com
>> > > >
>> > > > > >> > > > > > > > > > >
>> > > > > >> > > > > > > > > > > > Yes, im using JAAS
>> > > > > >> > > > > > > > > > > >
>> > > > > >> > > > > > > > > > > > 2012/5/31 Romain Manni-Bucau <
>> > > > > rmannibucau@gmail.com
>> > > > > >> >
>> > > > > >> > > > > > > > > > > >
>> > > > > >> > > > > > > > > > > > > Hi,
>> > > > > >> > > > > > > > > > > > >
>> > > > > >> > > > > > > > > > > > > Do you use jaas?
>> > > > > >> > > > > > > > > > > > >
>> > > > > >> > > > > > > > > > > > > - Romain
>> > > > > >> > > > > > > > > > > > > Le 31 mai 2012 20:14, "José Luis
>> Cetina" <
>> > > > > >> > > > > > maxtorzito@gmail.com
>> > > > > >> > > > > > > >
>> > > > > >> > > > > > > > a
>> > > > > >> > > > > > > > > > > écrit
>> > > > > >> > > > > > > > > > > > :
>> > > > > >> > > > > > > > > > > > >
>> > > > > >> > > > > > > > > > > > > > Hi i have this scenario:
>> > > > > >> > > > > > > > > > > > > >
>> > > > > >> > > > > > > > > > > > > > I have a page login.xhtml, this page
>> > has a
>> > > > > >> > > ManagedBean
>> > > > > >> > > > > > > (@Named)
>> > > > > >> > > > > > > > > > this
>> > > > > >> > > > > > > > > > > > > > managedbean use the
>> > > request.login(user,pass)
>> > > > > >> > method.
>> > > > > >> > > > > > > > > > > > > >
>> > > > > >> > > > > > > > > > > > > > When i do this:
>> > > > > >> > > > > > > > > > > > > >
>> > > > > >> > > > > > > > > > > > > > managedbean class:
>> > > > > >> > > > > > > > > > > > > >
>> > > > > >> > > > > > > > > > > > > > @Resource
>> > > > > >> > > > > > > > > > > > > > private EJBContext ejbContext;
>> > > > > >> > > > > > > > > > > > > > .
>> > > > > >> > > > > > > > > > > > > > .
>> > > > > >> > > > > > > > > > > > > > request.login(user,pass);
>> > > > > >> > > > > > > > > > > > > > String name =
>> > > > > >> > > > ejbContext.getCallerPrincipal().getName();
>> > > > > >> > > > > > > > > > > > > >
>> > > > > >> > > > > > > > > > > > > > I get "guest" as my user name. But i
>> > > expect
>> > > > > the
>> > > > > >> > name
>> > > > > >> > > of
>> > > > > >> > > > > my
>> > > > > >> > > > > > > user
>> > > > > >> > > > > > > > > (of
>> > > > > >> > > > > > > > > > > > > course
>> > > > > >> > > > > > > > > > > > > > is not guest)
>> > > > > >> > > > > > > > > > > > > >
>> > > > > >> > > > > > > > > > > > > > If the login was successful my login
>> > page
>> > > > > >> navigate
>> > > > > >> > to
>> > > > > >> > > > > other
>> > > > > >> > > > > > > > page
>> > > > > >> > > > > > > > > > lets
>> > > > > >> > > > > > > > > > > > say
>> > > > > >> > > > > > > > > > > > > > pageb.xhtml
>> > > > > >> > > > > > > > > > > > > >
>> > > > > >> > > > > > > > > > > > > > If i create a managedbean (@Named)
>> for
>> > > > > >> pageb.xhtml
>> > > > > >> > > and
>> > > > > >> > > > in
>> > > > > >> > > > > > > that
>> > > > > >> > > > > > > > > > > > > managedbean
>> > > > > >> > > > > > > > > > > > > > i use again:
>> > > > > >> > > > > > > > > > > > > > String name =
>> > > > > >> > > > ejbContext.getCallerPrincipal().getName();
>> > > > > >> > > > > > > > > > > > > > then, here i get my "correct" name of
>> > the
>> > > > user
>> > > > > >> (not
>> > > > > >> > > > > guest).
>> > > > > >> > > > > > > > > > > > > >
>> > > > > >> > > > > > > > > > > > > > I dont know if this is the desire
>> > > behaviour
>> > > > or
>> > > > > >> if
>> > > > > >> > > this
>> > > > > >> > > > > > > happend
>> > > > > >> > > > > > > > > > > because
>> > > > > >> > > > > > > > > > > > > the
>> > > > > >> > > > > > > > > > > > > > http request isnt finished?
>> > > > > >> > > > > > > > > > > > > >
>> > > > > >> > > > > > > > > > > > > > other question why if i call
>> > > > > >> > > > > > > > > > > > > > the
>> > > > >  ejbContext.getCallerPrincipal().getName();
>> > > > > >> > > before
>> > > > > >> > > > > the
>> > > > > >> > > > > > > > > > > > > request.login()
>> > > > > >> > > > > > > > > > > > > > method i get again "guest", why not
>> > null?
>> > > > > >> > > > > > > > > > > > > >
>> > > > > >> > > > > > > > > > > > > > If this question is for
>> tomee(openejb)
>> > or
>> > > > > >> tomcat?
>> > > > > >> > > > > > > > > > > > > >
>> > > > > >> > > > > > > > > > > > > > Thanks
>> > > > > >> > > > > > > > > > > > > >
>> > > > > >> > > > > > > > > > > > > >
>> > > > > >> > > > > > > > > > > > > >
>> > > > > >> > > > > > > > >
>> > > > > >> > > >
>> > > > >
>> -------------------------------------------------------------------
>> > > > > >> > > > > > > > > > > > > > *SCJA. José Luis Cetina*
>> > > > > >> > > > > > > > > > > > > >
>> > > > > >> > > > > > > > >
>> > > > > >> > > >
>> > > > >
>> -------------------------------------------------------------------
>> > > > > >> > > > > > > > > > > > > >
>> > > > > >> > > > > > > > > > > > >
>> > > > > >> > > > > > > > > > > >
>> > > > > >> > > > > > > > > > > >
>> > > > > >> > > > > > > > > > > >
>> > > > > >> > > > > > > > > > > > --
>> > > > > >> > > > > > > > > > > >
>> > > > > >> > > > > > >
>> > > > > >> >
>> > > -------------------------------------------------------------------
>> > > > > >> > > > > > > > > > > > *SCJA. José Luis Cetina*
>> > > > > >> > > > > > > > > > > >
>> > > > > >> > > > > > >
>> > > > > >> >
>> > > -------------------------------------------------------------------
>> > > > > >> > > > > > > > > > > >
>> > > > > >> > > > > > > > > > >
>> > > > > >> > > > > > > > > >
>> > > > > >> > > > > > > > > >
>> > > > > >> > > > > > > > > >
>> > > > > >> > > > > > > > > > --
>> > > > > >> > > > > > > > > >
>> > > > > >> > > > >
>> > > > > >>
>> > -------------------------------------------------------------------
>> > > > > >> > > > > > > > > > *SCJA. José Luis Cetina*
>> > > > > >> > > > > > > > > >
>> > > > > >> > > > >
>> > > > > >>
>> > -------------------------------------------------------------------
>> > > > > >> > > > > > > > > >
>> > > > > >> > > > > > > > >
>> > > > > >> > > > > > > >
>> > > > > >> > > > > > > >
>> > > > > >> > > > > > > >
>> > > > > >> > > > > > > > --
>> > > > > >> > > > > > > >
>> > > > > >> > >
>> > > > -------------------------------------------------------------------
>> > > > > >> > > > > > > > *SCJA. José Luis Cetina*
>> > > > > >> > > > > > > >
>> > > > > >> > >
>> > > > -------------------------------------------------------------------
>> > > > > >> > > > > > > >
>> > > > > >> > > > > > >
>> > > > > >> > > > > >
>> > > > > >> > > > > >
>> > > > > >> > > > > >
>> > > > > >> > > > > > --
>> > > > > >> > > > > >
>> > > > > >>
>> > -------------------------------------------------------------------
>> > > > > >> > > > > > *SCJA. José Luis Cetina*
>> > > > > >> > > > > >
>> > > > > >>
>> > -------------------------------------------------------------------
>> > > > > >> > > > > >
>> > > > > >> > > > >
>> > > > > >> > > >
>> > > > > >> > > >
>> > > > > >> > > >
>> > > > > >> > > > --
>> > > > > >> > > >
>> > > > >
>> -------------------------------------------------------------------
>> > > > > >> > > > *SCJA. José Luis Cetina*
>> > > > > >> > > >
>> > > > >
>> -------------------------------------------------------------------
>> > > > > >> > > >
>> > > > > >> > >
>> > > > > >> >
>> > > > > >> >
>> > > > > >> >
>> > > > > >> > --
>> > > > > >> >
>> > > -------------------------------------------------------------------
>> > > > > >> > *SCJA. José Luis Cetina*
>> > > > > >> >
>> > > -------------------------------------------------------------------
>> > > > > >> >
>> > > > > >>
>> > > > > >
>> > > > > >
>> > > > > >
>> > > > > > --
>> > > > > >
>> -------------------------------------------------------------------
>> > > > > > *SCJA. José Luis Cetina*
>> > > > > >
>> -------------------------------------------------------------------
>> > > > > >
>> > > > > >
>> > > > >
>> > > > >
>> > > > > --
>> > > > >
>> -------------------------------------------------------------------
>> > > > > *SCJA. José Luis Cetina*
>> > > > >
>> -------------------------------------------------------------------
>> > > > >
>> > > >
>> > >
>> > >
>> > >
>> > > --
>> > > -------------------------------------------------------------------
>> > > *SCJA. José Luis Cetina*
>> > > -------------------------------------------------------------------
>> > >
>> >
>>
>>
>>
>> --
>> -------------------------------------------------------------------
>> *SCJA. José Luis Cetina*
>> -------------------------------------------------------------------
>>
>
>

Re: Guest user

Posted by Romain Manni-Bucau <rm...@gmail.com>.
in my test i used:

    <Realm className="org.apache.tomee.catalina.TomEERealm">
        <Realm className="org.apache.catalina.realm.JAASRealm"
appName="PropertiesLoginModule"

 userClassNames="org.apache.openejb.core.security.AbstractSecurityService$User"

 roleClassNames="org.apache.openejb.core.security.AbstractSecurityService$Group">
        </Realm>
      </Realm>

but i guess you can replace the jaasrealm by your dsrealm

- Romain


2012/6/1 José Luis Cetina <ma...@gmail.com>

> Yes, it seems buggy.
>
> Where i have to replace?
>
> Remember im using DataSourceRealm
>
> 2012/5/31 Romain Manni-Bucau <rm...@gmail.com>
>
> > this is the current status,
> >
> > but IMO it is buggy,
> >
> > i'll commit soon a TomEEJAASRealm to make it working (replace JAASRealm
> in
> > the conf)
> >
> > - Romain
> >
> >
> > 2012/6/1 José Luis Cetina <ma...@gmail.com>
> >
> > > i think we are getting confused.
> > >
> > > If i resume all, this what i asked (the final of the first post)
> > >
> > > I dont know if this is the desire behavior or if this happend becase
> the
> > > httr request isnt finished?
> > > Then you answer me:
> > >
> > > in fact info from ejbcontext are taken in our securitymodule
> > >
> > > in tomee we set/unset it from a valve so at the beginning/end of the
> > > request...all between is currently ignored so when you log you need
> > another
> > > request to get the updated information (from the tomcat realm)
> > >
> > > "so when you log you need another request to get the updated
> information
> > > (from the tomcat realm)
> > >
> > > Then i get guest because is the desire behaviour, after the first
> > request i
> > > can get the user i expected.
> > >
> > > Then i resume, this is the default behaviour, and works but you need a
> > > second request.
> > >
> > >
> > >
> > > 2012/5/31 Romain Manni-Bucau <rm...@gmail.com>
> > >
> > > > i think it should work
> > > >
> > > > - Romain
> > > >
> > > >
> > > > 2012/6/1 José Luis Cetina <ma...@gmail.com>
> > > >
> > > > > I mean this:
> > > > >
> > > > > I dont know if this is the desire behaviour or if this happend
> > because
> > > > the
> > > > > http request isnt finished?
> > > > >
> > > > >
> > > > >
> > > > > 2012/5/31 José Luis Cetina <ma...@gmail.com>
> > > > >
> > > > > > Ok, the what i asked is correct??
> > > > > >
> > > > > > "I dont know if this is the desire behaviour or if this happend
> > > because
> > > > > > the http request isnt finished?"
> > > > > >
> > > > > > 2012/5/31 Romain Manni-Bucau <rm...@gmail.com>
> > > > > >
> > > > > >> ok,
> > > > > >>
> > > > > >> in fact info from ejbcontext are taken in our securitymodule
> > > > > >>
> > > > > >> in tomee we set/unset it from a valve so at the beginning/end of
> > the
> > > > > >> request...all between is currently ignored so when you log you
> > need
> > > > > >> another
> > > > > >> request to get the updated information (from the tomcat realm)
> > > > > >>
> > > > > >> - Romain
> > > > > >>
> > > > > >>
> > > > > >> 2012/6/1 José Luis Cetina <ma...@gmail.com>
> > > > > >>
> > > > > >> > Yes, it work
> > > > > >> >
> > > > > >> > 1) Login (form login) using DataSourceRealm
> > > > > >> >
> > > > > >> >
> > > > > >> > 2) Redirect to page2 from my managedbean
> > > > > >> >
> > > > > >> > 2012/5/31 Romain Manni-Bucau <rm...@gmail.com>
> > > > > >> >
> > > > > >> > > so you mean using the flow i described before it works?
> > (sorry,
> > > > just
> > > > > >> to
> > > > > >> > be
> > > > > >> > > sure to understand)
> > > > > >> > >
> > > > > >> > > - Romain
> > > > > >> > >
> > > > > >> > >
> > > > > >> > > 2012/6/1 José Luis Cetina <ma...@gmail.com>
> > > > > >> > >
> > > > > >> > > > Hi i can login and i can navigate (redirect) to my other
> > page,
> > > > > but i
> > > > > >> > dont
> > > > > >> > > > know why im getting guest user in the login mbean, after
> > that
> > > in
> > > > > >> other
> > > > > >> > > > mbean  i get my "real" user.
> > > > > >> > > >
> > > > > >> > > >
> > > > > >> > > > 2012/5/31 Romain Manni-Bucau <rm...@gmail.com>
> > > > > >> > > >
> > > > > >> > > > > maybe
> > > > > >> > > > >
> > > > > >> > > >
> > > > > >> > >
> > > > > >> >
> > > > > >>
> > > > >
> > > >
> > >
> >
> http://rmannibucau.wordpress.com/2012/05/09/tomee-and-its-ssh-connector/but
> > > > > >> > > > > it uses properties file, it just need a custom login
> > module
> > > > > >> > > > implementation
> > > > > >> > > > > to use a db.
> > > > > >> > > > >
> > > > > >> > > > > well,
> > > > > >> > > > >
> > > > > >> > > > > before can you test it please?
> > > > > >> > > > > 1) login
> > > > > >> > > > > 2) redirect to your page using your bean
> > > > > >> > > > >
> > > > > >> > > > > - Romain
> > > > > >> > > > >
> > > > > >> > > > >
> > > > > >> > > > > 2012/6/1 José Luis Cetina <ma...@gmail.com>
> > > > > >> > > > >
> > > > > >> > > > > > I have to read and know how to use this, i always use
> > > > > >> DataSource or
> > > > > >> > > > > > JDBCRealm. (with glassfish).
> > > > > >> > > > > > im reading now, do you have something for a
> quickstart?
> > > for
> > > > > >> share
> > > > > >> > me
> > > > > >> > > > > >
> > > > > >> > > > > > 2012/5/31 Romain Manni-Bucau <rm...@gmail.com>
> > > > > >> > > > > >
> > > > > >> > > > > > > having your password in a db is not an issue but i
> > think
> > > > you
> > > > > >> > should
> > > > > >> > > > > > > use org.apache.catalina.realm.JAASRealm
> > > > > >> > > > > > >
> > > > > >> > > > > > > for instance:
> > > > > >> > > > > > >
> > > > > >> > > > > > >     <Realm
> > > className="org.apache.catalina.realm.JAASRealm"
> > > > > >> > > > > > > appName="MyDBLoginModule"
> > > > > >> > > > > > >
> > > > > >> > > > > > >
> > > > > >> > > > > > >
> > > > > >> > > > > >
> > > > > >> > > > >
> > > > > >> > > >
> > > > > >> > >
> > > > > >> >
> > > > > >>
> > > > >
> > > >
> > >
> >
>  userClassNames="org.apache.openejb.core.security.AbstractSecurityService$User"
> > > > > >> > > > > > >
> > > > > >> > > > > > >
> > > > > >> > > > > > >
> > > > > >> > > > > >
> > > > > >> > > > >
> > > > > >> > > >
> > > > > >> > >
> > > > > >> >
> > > > > >>
> > > > >
> > > >
> > >
> >
>  roleClassNames="org.apache.openejb.core.security.AbstractSecurityService$Group">
> > > > > >> > > > > > >      </Realm>
> > > > > >> > > > > > >
> > > > > >> > > > > > > so simply implement a custom LoginModule instead of
> a
> > > > realm
> > > > > >> > > > > > >
> > > > > >> > > > > > > wdyt?
> > > > > >> > > > > > >
> > > > > >> > > > > > > - Romain
> > > > > >> > > > > > >
> > > > > >> > > > > > >
> > > > > >> > > > > > > 2012/6/1 José Luis Cetina <ma...@gmail.com>
> > > > > >> > > > > > >
> > > > > >> > > > > > > > Sorry, i use DataSourceRealm, i have my
> > > user/pass/roles
> > > > in
> > > > > >> the
> > > > > >> > > DB.
> > > > > >> > > > > > > >
> > > > > >> > > > > > > >
> > > > > >> > > > > > > >
> > > > > >> > > > > > > > 2012/5/31 Romain Manni-Bucau <
> rmannibucau@gmail.com
> > >
> > > > > >> > > > > > > >
> > > > > >> > > > > > > > > can't you do it with an embedded one?
> > > > > >> > > > > > > > >
> > > > > >> > > > > > > > > well DataSourceRealm doesn't use JAAS by
> default i
> > > > > think,
> > > > > >> > maybe
> > > > > >> > > > > > that's
> > > > > >> > > > > > > > the
> > > > > >> > > > > > > > > issue
> > > > > >> > > > > > > > >
> > > > > >> > > > > > > > > - Romain
> > > > > >> > > > > > > > >
> > > > > >> > > > > > > > >
> > > > > >> > > > > > > > > 2012/6/1 José Luis Cetina <maxtorzito@gmail.com
> >
> > > > > >> > > > > > > > >
> > > > > >> > > > > > > > > > OK, i can create a sample, but i use
> > > > DataSourceRealm,
> > > > > >> are
> > > > > >> > you
> > > > > >> > > > > gonna
> > > > > >> > > > > > > > > > configure your database?
> > > > > >> > > > > > > > > >
> > > > > >> > > > > > > > > > 2012/5/31 Romain Manni-Bucau <
> > > rmannibucau@gmail.com
> > > > >
> > > > > >> > > > > > > > > >
> > > > > >> > > > > > > > > > > can you have a try in an EJB please? (just
> try
> > > to
> > > > > add
> > > > > >> > > > > @Stateless
> > > > > >> > > > > > on
> > > > > >> > > > > > > > > your
> > > > > >> > > > > > > > > > > managed bean for instance)
> > > > > >> > > > > > > > > > >
> > > > > >> > > > > > > > > > > can you share a sample easy to run?
> > > > > >> > > > > > > > > > >
> > > > > >> > > > > > > > > > > - Romain
> > > > > >> > > > > > > > > > >
> > > > > >> > > > > > > > > > >
> > > > > >> > > > > > > > > > > 2012/6/1 José Luis Cetina <
> > maxtorzito@gmail.com
> > > >
> > > > > >> > > > > > > > > > >
> > > > > >> > > > > > > > > > > > Yes, im using JAAS
> > > > > >> > > > > > > > > > > >
> > > > > >> > > > > > > > > > > > 2012/5/31 Romain Manni-Bucau <
> > > > > rmannibucau@gmail.com
> > > > > >> >
> > > > > >> > > > > > > > > > > >
> > > > > >> > > > > > > > > > > > > Hi,
> > > > > >> > > > > > > > > > > > >
> > > > > >> > > > > > > > > > > > > Do you use jaas?
> > > > > >> > > > > > > > > > > > >
> > > > > >> > > > > > > > > > > > > - Romain
> > > > > >> > > > > > > > > > > > > Le 31 mai 2012 20:14, "José Luis
> Cetina" <
> > > > > >> > > > > > maxtorzito@gmail.com
> > > > > >> > > > > > > >
> > > > > >> > > > > > > > a
> > > > > >> > > > > > > > > > > écrit
> > > > > >> > > > > > > > > > > > :
> > > > > >> > > > > > > > > > > > >
> > > > > >> > > > > > > > > > > > > > Hi i have this scenario:
> > > > > >> > > > > > > > > > > > > >
> > > > > >> > > > > > > > > > > > > > I have a page login.xhtml, this page
> > has a
> > > > > >> > > ManagedBean
> > > > > >> > > > > > > (@Named)
> > > > > >> > > > > > > > > > this
> > > > > >> > > > > > > > > > > > > > managedbean use the
> > > request.login(user,pass)
> > > > > >> > method.
> > > > > >> > > > > > > > > > > > > >
> > > > > >> > > > > > > > > > > > > > When i do this:
> > > > > >> > > > > > > > > > > > > >
> > > > > >> > > > > > > > > > > > > > managedbean class:
> > > > > >> > > > > > > > > > > > > >
> > > > > >> > > > > > > > > > > > > > @Resource
> > > > > >> > > > > > > > > > > > > > private EJBContext ejbContext;
> > > > > >> > > > > > > > > > > > > > .
> > > > > >> > > > > > > > > > > > > > .
> > > > > >> > > > > > > > > > > > > > request.login(user,pass);
> > > > > >> > > > > > > > > > > > > > String name =
> > > > > >> > > > ejbContext.getCallerPrincipal().getName();
> > > > > >> > > > > > > > > > > > > >
> > > > > >> > > > > > > > > > > > > > I get "guest" as my user name. But i
> > > expect
> > > > > the
> > > > > >> > name
> > > > > >> > > of
> > > > > >> > > > > my
> > > > > >> > > > > > > user
> > > > > >> > > > > > > > > (of
> > > > > >> > > > > > > > > > > > > course
> > > > > >> > > > > > > > > > > > > > is not guest)
> > > > > >> > > > > > > > > > > > > >
> > > > > >> > > > > > > > > > > > > > If the login was successful my login
> > page
> > > > > >> navigate
> > > > > >> > to
> > > > > >> > > > > other
> > > > > >> > > > > > > > page
> > > > > >> > > > > > > > > > lets
> > > > > >> > > > > > > > > > > > say
> > > > > >> > > > > > > > > > > > > > pageb.xhtml
> > > > > >> > > > > > > > > > > > > >
> > > > > >> > > > > > > > > > > > > > If i create a managedbean (@Named) for
> > > > > >> pageb.xhtml
> > > > > >> > > and
> > > > > >> > > > in
> > > > > >> > > > > > > that
> > > > > >> > > > > > > > > > > > > managedbean
> > > > > >> > > > > > > > > > > > > > i use again:
> > > > > >> > > > > > > > > > > > > > String name =
> > > > > >> > > > ejbContext.getCallerPrincipal().getName();
> > > > > >> > > > > > > > > > > > > > then, here i get my "correct" name of
> > the
> > > > user
> > > > > >> (not
> > > > > >> > > > > guest).
> > > > > >> > > > > > > > > > > > > >
> > > > > >> > > > > > > > > > > > > > I dont know if this is the desire
> > > behaviour
> > > > or
> > > > > >> if
> > > > > >> > > this
> > > > > >> > > > > > > happend
> > > > > >> > > > > > > > > > > because
> > > > > >> > > > > > > > > > > > > the
> > > > > >> > > > > > > > > > > > > > http request isnt finished?
> > > > > >> > > > > > > > > > > > > >
> > > > > >> > > > > > > > > > > > > > other question why if i call
> > > > > >> > > > > > > > > > > > > > the
> > > > >  ejbContext.getCallerPrincipal().getName();
> > > > > >> > > before
> > > > > >> > > > > the
> > > > > >> > > > > > > > > > > > > request.login()
> > > > > >> > > > > > > > > > > > > > method i get again "guest", why not
> > null?
> > > > > >> > > > > > > > > > > > > >
> > > > > >> > > > > > > > > > > > > > If this question is for tomee(openejb)
> > or
> > > > > >> tomcat?
> > > > > >> > > > > > > > > > > > > >
> > > > > >> > > > > > > > > > > > > > Thanks
> > > > > >> > > > > > > > > > > > > >
> > > > > >> > > > > > > > > > > > > >
> > > > > >> > > > > > > > > > > > > >
> > > > > >> > > > > > > > >
> > > > > >> > > >
> > > > > -------------------------------------------------------------------
> > > > > >> > > > > > > > > > > > > > *SCJA. José Luis Cetina*
> > > > > >> > > > > > > > > > > > > >
> > > > > >> > > > > > > > >
> > > > > >> > > >
> > > > > -------------------------------------------------------------------
> > > > > >> > > > > > > > > > > > > >
> > > > > >> > > > > > > > > > > > >
> > > > > >> > > > > > > > > > > >
> > > > > >> > > > > > > > > > > >
> > > > > >> > > > > > > > > > > >
> > > > > >> > > > > > > > > > > > --
> > > > > >> > > > > > > > > > > >
> > > > > >> > > > > > >
> > > > > >> >
> > > -------------------------------------------------------------------
> > > > > >> > > > > > > > > > > > *SCJA. José Luis Cetina*
> > > > > >> > > > > > > > > > > >
> > > > > >> > > > > > >
> > > > > >> >
> > > -------------------------------------------------------------------
> > > > > >> > > > > > > > > > > >
> > > > > >> > > > > > > > > > >
> > > > > >> > > > > > > > > >
> > > > > >> > > > > > > > > >
> > > > > >> > > > > > > > > >
> > > > > >> > > > > > > > > > --
> > > > > >> > > > > > > > > >
> > > > > >> > > > >
> > > > > >>
> > -------------------------------------------------------------------
> > > > > >> > > > > > > > > > *SCJA. José Luis Cetina*
> > > > > >> > > > > > > > > >
> > > > > >> > > > >
> > > > > >>
> > -------------------------------------------------------------------
> > > > > >> > > > > > > > > >
> > > > > >> > > > > > > > >
> > > > > >> > > > > > > >
> > > > > >> > > > > > > >
> > > > > >> > > > > > > >
> > > > > >> > > > > > > > --
> > > > > >> > > > > > > >
> > > > > >> > >
> > > > -------------------------------------------------------------------
> > > > > >> > > > > > > > *SCJA. José Luis Cetina*
> > > > > >> > > > > > > >
> > > > > >> > >
> > > > -------------------------------------------------------------------
> > > > > >> > > > > > > >
> > > > > >> > > > > > >
> > > > > >> > > > > >
> > > > > >> > > > > >
> > > > > >> > > > > >
> > > > > >> > > > > > --
> > > > > >> > > > > >
> > > > > >>
> > -------------------------------------------------------------------
> > > > > >> > > > > > *SCJA. José Luis Cetina*
> > > > > >> > > > > >
> > > > > >>
> > -------------------------------------------------------------------
> > > > > >> > > > > >
> > > > > >> > > > >
> > > > > >> > > >
> > > > > >> > > >
> > > > > >> > > >
> > > > > >> > > > --
> > > > > >> > > >
> > > > > -------------------------------------------------------------------
> > > > > >> > > > *SCJA. José Luis Cetina*
> > > > > >> > > >
> > > > > -------------------------------------------------------------------
> > > > > >> > > >
> > > > > >> > >
> > > > > >> >
> > > > > >> >
> > > > > >> >
> > > > > >> > --
> > > > > >> >
> > > -------------------------------------------------------------------
> > > > > >> > *SCJA. José Luis Cetina*
> > > > > >> >
> > > -------------------------------------------------------------------
> > > > > >> >
> > > > > >>
> > > > > >
> > > > > >
> > > > > >
> > > > > > --
> > > > > >
> -------------------------------------------------------------------
> > > > > > *SCJA. José Luis Cetina*
> > > > > >
> -------------------------------------------------------------------
> > > > > >
> > > > > >
> > > > >
> > > > >
> > > > > --
> > > > > -------------------------------------------------------------------
> > > > > *SCJA. José Luis Cetina*
> > > > > -------------------------------------------------------------------
> > > > >
> > > >
> > >
> > >
> > >
> > > --
> > > -------------------------------------------------------------------
> > > *SCJA. José Luis Cetina*
> > > -------------------------------------------------------------------
> > >
> >
>
>
>
> --
> -------------------------------------------------------------------
> *SCJA. José Luis Cetina*
> -------------------------------------------------------------------
>

Re: Guest user

Posted by José Luis Cetina <ma...@gmail.com>.
Yes, it seems buggy.

Where i have to replace?

Remember im using DataSourceRealm

2012/5/31 Romain Manni-Bucau <rm...@gmail.com>

> this is the current status,
>
> but IMO it is buggy,
>
> i'll commit soon a TomEEJAASRealm to make it working (replace JAASRealm in
> the conf)
>
> - Romain
>
>
> 2012/6/1 José Luis Cetina <ma...@gmail.com>
>
> > i think we are getting confused.
> >
> > If i resume all, this what i asked (the final of the first post)
> >
> > I dont know if this is the desire behavior or if this happend becase the
> > httr request isnt finished?
> > Then you answer me:
> >
> > in fact info from ejbcontext are taken in our securitymodule
> >
> > in tomee we set/unset it from a valve so at the beginning/end of the
> > request...all between is currently ignored so when you log you need
> another
> > request to get the updated information (from the tomcat realm)
> >
> > "so when you log you need another request to get the updated information
> > (from the tomcat realm)
> >
> > Then i get guest because is the desire behaviour, after the first
> request i
> > can get the user i expected.
> >
> > Then i resume, this is the default behaviour, and works but you need a
> > second request.
> >
> >
> >
> > 2012/5/31 Romain Manni-Bucau <rm...@gmail.com>
> >
> > > i think it should work
> > >
> > > - Romain
> > >
> > >
> > > 2012/6/1 José Luis Cetina <ma...@gmail.com>
> > >
> > > > I mean this:
> > > >
> > > > I dont know if this is the desire behaviour or if this happend
> because
> > > the
> > > > http request isnt finished?
> > > >
> > > >
> > > >
> > > > 2012/5/31 José Luis Cetina <ma...@gmail.com>
> > > >
> > > > > Ok, the what i asked is correct??
> > > > >
> > > > > "I dont know if this is the desire behaviour or if this happend
> > because
> > > > > the http request isnt finished?"
> > > > >
> > > > > 2012/5/31 Romain Manni-Bucau <rm...@gmail.com>
> > > > >
> > > > >> ok,
> > > > >>
> > > > >> in fact info from ejbcontext are taken in our securitymodule
> > > > >>
> > > > >> in tomee we set/unset it from a valve so at the beginning/end of
> the
> > > > >> request...all between is currently ignored so when you log you
> need
> > > > >> another
> > > > >> request to get the updated information (from the tomcat realm)
> > > > >>
> > > > >> - Romain
> > > > >>
> > > > >>
> > > > >> 2012/6/1 José Luis Cetina <ma...@gmail.com>
> > > > >>
> > > > >> > Yes, it work
> > > > >> >
> > > > >> > 1) Login (form login) using DataSourceRealm
> > > > >> >
> > > > >> >
> > > > >> > 2) Redirect to page2 from my managedbean
> > > > >> >
> > > > >> > 2012/5/31 Romain Manni-Bucau <rm...@gmail.com>
> > > > >> >
> > > > >> > > so you mean using the flow i described before it works?
> (sorry,
> > > just
> > > > >> to
> > > > >> > be
> > > > >> > > sure to understand)
> > > > >> > >
> > > > >> > > - Romain
> > > > >> > >
> > > > >> > >
> > > > >> > > 2012/6/1 José Luis Cetina <ma...@gmail.com>
> > > > >> > >
> > > > >> > > > Hi i can login and i can navigate (redirect) to my other
> page,
> > > > but i
> > > > >> > dont
> > > > >> > > > know why im getting guest user in the login mbean, after
> that
> > in
> > > > >> other
> > > > >> > > > mbean  i get my "real" user.
> > > > >> > > >
> > > > >> > > >
> > > > >> > > > 2012/5/31 Romain Manni-Bucau <rm...@gmail.com>
> > > > >> > > >
> > > > >> > > > > maybe
> > > > >> > > > >
> > > > >> > > >
> > > > >> > >
> > > > >> >
> > > > >>
> > > >
> > >
> >
> http://rmannibucau.wordpress.com/2012/05/09/tomee-and-its-ssh-connector/but
> > > > >> > > > > it uses properties file, it just need a custom login
> module
> > > > >> > > > implementation
> > > > >> > > > > to use a db.
> > > > >> > > > >
> > > > >> > > > > well,
> > > > >> > > > >
> > > > >> > > > > before can you test it please?
> > > > >> > > > > 1) login
> > > > >> > > > > 2) redirect to your page using your bean
> > > > >> > > > >
> > > > >> > > > > - Romain
> > > > >> > > > >
> > > > >> > > > >
> > > > >> > > > > 2012/6/1 José Luis Cetina <ma...@gmail.com>
> > > > >> > > > >
> > > > >> > > > > > I have to read and know how to use this, i always use
> > > > >> DataSource or
> > > > >> > > > > > JDBCRealm. (with glassfish).
> > > > >> > > > > > im reading now, do you have something for a quickstart?
> > for
> > > > >> share
> > > > >> > me
> > > > >> > > > > >
> > > > >> > > > > > 2012/5/31 Romain Manni-Bucau <rm...@gmail.com>
> > > > >> > > > > >
> > > > >> > > > > > > having your password in a db is not an issue but i
> think
> > > you
> > > > >> > should
> > > > >> > > > > > > use org.apache.catalina.realm.JAASRealm
> > > > >> > > > > > >
> > > > >> > > > > > > for instance:
> > > > >> > > > > > >
> > > > >> > > > > > >     <Realm
> > className="org.apache.catalina.realm.JAASRealm"
> > > > >> > > > > > > appName="MyDBLoginModule"
> > > > >> > > > > > >
> > > > >> > > > > > >
> > > > >> > > > > > >
> > > > >> > > > > >
> > > > >> > > > >
> > > > >> > > >
> > > > >> > >
> > > > >> >
> > > > >>
> > > >
> > >
> >
>  userClassNames="org.apache.openejb.core.security.AbstractSecurityService$User"
> > > > >> > > > > > >
> > > > >> > > > > > >
> > > > >> > > > > > >
> > > > >> > > > > >
> > > > >> > > > >
> > > > >> > > >
> > > > >> > >
> > > > >> >
> > > > >>
> > > >
> > >
> >
>  roleClassNames="org.apache.openejb.core.security.AbstractSecurityService$Group">
> > > > >> > > > > > >      </Realm>
> > > > >> > > > > > >
> > > > >> > > > > > > so simply implement a custom LoginModule instead of a
> > > realm
> > > > >> > > > > > >
> > > > >> > > > > > > wdyt?
> > > > >> > > > > > >
> > > > >> > > > > > > - Romain
> > > > >> > > > > > >
> > > > >> > > > > > >
> > > > >> > > > > > > 2012/6/1 José Luis Cetina <ma...@gmail.com>
> > > > >> > > > > > >
> > > > >> > > > > > > > Sorry, i use DataSourceRealm, i have my
> > user/pass/roles
> > > in
> > > > >> the
> > > > >> > > DB.
> > > > >> > > > > > > >
> > > > >> > > > > > > >
> > > > >> > > > > > > >
> > > > >> > > > > > > > 2012/5/31 Romain Manni-Bucau <rmannibucau@gmail.com
> >
> > > > >> > > > > > > >
> > > > >> > > > > > > > > can't you do it with an embedded one?
> > > > >> > > > > > > > >
> > > > >> > > > > > > > > well DataSourceRealm doesn't use JAAS by default i
> > > > think,
> > > > >> > maybe
> > > > >> > > > > > that's
> > > > >> > > > > > > > the
> > > > >> > > > > > > > > issue
> > > > >> > > > > > > > >
> > > > >> > > > > > > > > - Romain
> > > > >> > > > > > > > >
> > > > >> > > > > > > > >
> > > > >> > > > > > > > > 2012/6/1 José Luis Cetina <ma...@gmail.com>
> > > > >> > > > > > > > >
> > > > >> > > > > > > > > > OK, i can create a sample, but i use
> > > DataSourceRealm,
> > > > >> are
> > > > >> > you
> > > > >> > > > > gonna
> > > > >> > > > > > > > > > configure your database?
> > > > >> > > > > > > > > >
> > > > >> > > > > > > > > > 2012/5/31 Romain Manni-Bucau <
> > rmannibucau@gmail.com
> > > >
> > > > >> > > > > > > > > >
> > > > >> > > > > > > > > > > can you have a try in an EJB please? (just try
> > to
> > > > add
> > > > >> > > > > @Stateless
> > > > >> > > > > > on
> > > > >> > > > > > > > > your
> > > > >> > > > > > > > > > > managed bean for instance)
> > > > >> > > > > > > > > > >
> > > > >> > > > > > > > > > > can you share a sample easy to run?
> > > > >> > > > > > > > > > >
> > > > >> > > > > > > > > > > - Romain
> > > > >> > > > > > > > > > >
> > > > >> > > > > > > > > > >
> > > > >> > > > > > > > > > > 2012/6/1 José Luis Cetina <
> maxtorzito@gmail.com
> > >
> > > > >> > > > > > > > > > >
> > > > >> > > > > > > > > > > > Yes, im using JAAS
> > > > >> > > > > > > > > > > >
> > > > >> > > > > > > > > > > > 2012/5/31 Romain Manni-Bucau <
> > > > rmannibucau@gmail.com
> > > > >> >
> > > > >> > > > > > > > > > > >
> > > > >> > > > > > > > > > > > > Hi,
> > > > >> > > > > > > > > > > > >
> > > > >> > > > > > > > > > > > > Do you use jaas?
> > > > >> > > > > > > > > > > > >
> > > > >> > > > > > > > > > > > > - Romain
> > > > >> > > > > > > > > > > > > Le 31 mai 2012 20:14, "José Luis Cetina" <
> > > > >> > > > > > maxtorzito@gmail.com
> > > > >> > > > > > > >
> > > > >> > > > > > > > a
> > > > >> > > > > > > > > > > écrit
> > > > >> > > > > > > > > > > > :
> > > > >> > > > > > > > > > > > >
> > > > >> > > > > > > > > > > > > > Hi i have this scenario:
> > > > >> > > > > > > > > > > > > >
> > > > >> > > > > > > > > > > > > > I have a page login.xhtml, this page
> has a
> > > > >> > > ManagedBean
> > > > >> > > > > > > (@Named)
> > > > >> > > > > > > > > > this
> > > > >> > > > > > > > > > > > > > managedbean use the
> > request.login(user,pass)
> > > > >> > method.
> > > > >> > > > > > > > > > > > > >
> > > > >> > > > > > > > > > > > > > When i do this:
> > > > >> > > > > > > > > > > > > >
> > > > >> > > > > > > > > > > > > > managedbean class:
> > > > >> > > > > > > > > > > > > >
> > > > >> > > > > > > > > > > > > > @Resource
> > > > >> > > > > > > > > > > > > > private EJBContext ejbContext;
> > > > >> > > > > > > > > > > > > > .
> > > > >> > > > > > > > > > > > > > .
> > > > >> > > > > > > > > > > > > > request.login(user,pass);
> > > > >> > > > > > > > > > > > > > String name =
> > > > >> > > > ejbContext.getCallerPrincipal().getName();
> > > > >> > > > > > > > > > > > > >
> > > > >> > > > > > > > > > > > > > I get "guest" as my user name. But i
> > expect
> > > > the
> > > > >> > name
> > > > >> > > of
> > > > >> > > > > my
> > > > >> > > > > > > user
> > > > >> > > > > > > > > (of
> > > > >> > > > > > > > > > > > > course
> > > > >> > > > > > > > > > > > > > is not guest)
> > > > >> > > > > > > > > > > > > >
> > > > >> > > > > > > > > > > > > > If the login was successful my login
> page
> > > > >> navigate
> > > > >> > to
> > > > >> > > > > other
> > > > >> > > > > > > > page
> > > > >> > > > > > > > > > lets
> > > > >> > > > > > > > > > > > say
> > > > >> > > > > > > > > > > > > > pageb.xhtml
> > > > >> > > > > > > > > > > > > >
> > > > >> > > > > > > > > > > > > > If i create a managedbean (@Named) for
> > > > >> pageb.xhtml
> > > > >> > > and
> > > > >> > > > in
> > > > >> > > > > > > that
> > > > >> > > > > > > > > > > > > managedbean
> > > > >> > > > > > > > > > > > > > i use again:
> > > > >> > > > > > > > > > > > > > String name =
> > > > >> > > > ejbContext.getCallerPrincipal().getName();
> > > > >> > > > > > > > > > > > > > then, here i get my "correct" name of
> the
> > > user
> > > > >> (not
> > > > >> > > > > guest).
> > > > >> > > > > > > > > > > > > >
> > > > >> > > > > > > > > > > > > > I dont know if this is the desire
> > behaviour
> > > or
> > > > >> if
> > > > >> > > this
> > > > >> > > > > > > happend
> > > > >> > > > > > > > > > > because
> > > > >> > > > > > > > > > > > > the
> > > > >> > > > > > > > > > > > > > http request isnt finished?
> > > > >> > > > > > > > > > > > > >
> > > > >> > > > > > > > > > > > > > other question why if i call
> > > > >> > > > > > > > > > > > > > the
> > > >  ejbContext.getCallerPrincipal().getName();
> > > > >> > > before
> > > > >> > > > > the
> > > > >> > > > > > > > > > > > > request.login()
> > > > >> > > > > > > > > > > > > > method i get again "guest", why not
> null?
> > > > >> > > > > > > > > > > > > >
> > > > >> > > > > > > > > > > > > > If this question is for tomee(openejb)
> or
> > > > >> tomcat?
> > > > >> > > > > > > > > > > > > >
> > > > >> > > > > > > > > > > > > > Thanks
> > > > >> > > > > > > > > > > > > >
> > > > >> > > > > > > > > > > > > >
> > > > >> > > > > > > > > > > > > >
> > > > >> > > > > > > > >
> > > > >> > > >
> > > > -------------------------------------------------------------------
> > > > >> > > > > > > > > > > > > > *SCJA. José Luis Cetina*
> > > > >> > > > > > > > > > > > > >
> > > > >> > > > > > > > >
> > > > >> > > >
> > > > -------------------------------------------------------------------
> > > > >> > > > > > > > > > > > > >
> > > > >> > > > > > > > > > > > >
> > > > >> > > > > > > > > > > >
> > > > >> > > > > > > > > > > >
> > > > >> > > > > > > > > > > >
> > > > >> > > > > > > > > > > > --
> > > > >> > > > > > > > > > > >
> > > > >> > > > > > >
> > > > >> >
> > -------------------------------------------------------------------
> > > > >> > > > > > > > > > > > *SCJA. José Luis Cetina*
> > > > >> > > > > > > > > > > >
> > > > >> > > > > > >
> > > > >> >
> > -------------------------------------------------------------------
> > > > >> > > > > > > > > > > >
> > > > >> > > > > > > > > > >
> > > > >> > > > > > > > > >
> > > > >> > > > > > > > > >
> > > > >> > > > > > > > > >
> > > > >> > > > > > > > > > --
> > > > >> > > > > > > > > >
> > > > >> > > > >
> > > > >>
> -------------------------------------------------------------------
> > > > >> > > > > > > > > > *SCJA. José Luis Cetina*
> > > > >> > > > > > > > > >
> > > > >> > > > >
> > > > >>
> -------------------------------------------------------------------
> > > > >> > > > > > > > > >
> > > > >> > > > > > > > >
> > > > >> > > > > > > >
> > > > >> > > > > > > >
> > > > >> > > > > > > >
> > > > >> > > > > > > > --
> > > > >> > > > > > > >
> > > > >> > >
> > > -------------------------------------------------------------------
> > > > >> > > > > > > > *SCJA. José Luis Cetina*
> > > > >> > > > > > > >
> > > > >> > >
> > > -------------------------------------------------------------------
> > > > >> > > > > > > >
> > > > >> > > > > > >
> > > > >> > > > > >
> > > > >> > > > > >
> > > > >> > > > > >
> > > > >> > > > > > --
> > > > >> > > > > >
> > > > >>
> -------------------------------------------------------------------
> > > > >> > > > > > *SCJA. José Luis Cetina*
> > > > >> > > > > >
> > > > >>
> -------------------------------------------------------------------
> > > > >> > > > > >
> > > > >> > > > >
> > > > >> > > >
> > > > >> > > >
> > > > >> > > >
> > > > >> > > > --
> > > > >> > > >
> > > > -------------------------------------------------------------------
> > > > >> > > > *SCJA. José Luis Cetina*
> > > > >> > > >
> > > > -------------------------------------------------------------------
> > > > >> > > >
> > > > >> > >
> > > > >> >
> > > > >> >
> > > > >> >
> > > > >> > --
> > > > >> >
> > -------------------------------------------------------------------
> > > > >> > *SCJA. José Luis Cetina*
> > > > >> >
> > -------------------------------------------------------------------
> > > > >> >
> > > > >>
> > > > >
> > > > >
> > > > >
> > > > > --
> > > > > -------------------------------------------------------------------
> > > > > *SCJA. José Luis Cetina*
> > > > > -------------------------------------------------------------------
> > > > >
> > > > >
> > > >
> > > >
> > > > --
> > > > -------------------------------------------------------------------
> > > > *SCJA. José Luis Cetina*
> > > > -------------------------------------------------------------------
> > > >
> > >
> >
> >
> >
> > --
> > -------------------------------------------------------------------
> > *SCJA. José Luis Cetina*
> > -------------------------------------------------------------------
> >
>



-- 
-------------------------------------------------------------------
*SCJA. José Luis Cetina*
-------------------------------------------------------------------

Re: Guest user

Posted by Romain Manni-Bucau <rm...@gmail.com>.
this is the current status,

but IMO it is buggy,

i'll commit soon a TomEEJAASRealm to make it working (replace JAASRealm in
the conf)

- Romain


2012/6/1 José Luis Cetina <ma...@gmail.com>

> i think we are getting confused.
>
> If i resume all, this what i asked (the final of the first post)
>
> I dont know if this is the desire behavior or if this happend becase the
> httr request isnt finished?
> Then you answer me:
>
> in fact info from ejbcontext are taken in our securitymodule
>
> in tomee we set/unset it from a valve so at the beginning/end of the
> request...all between is currently ignored so when you log you need another
> request to get the updated information (from the tomcat realm)
>
> "so when you log you need another request to get the updated information
> (from the tomcat realm)
>
> Then i get guest because is the desire behaviour, after the first request i
> can get the user i expected.
>
> Then i resume, this is the default behaviour, and works but you need a
> second request.
>
>
>
> 2012/5/31 Romain Manni-Bucau <rm...@gmail.com>
>
> > i think it should work
> >
> > - Romain
> >
> >
> > 2012/6/1 José Luis Cetina <ma...@gmail.com>
> >
> > > I mean this:
> > >
> > > I dont know if this is the desire behaviour or if this happend because
> > the
> > > http request isnt finished?
> > >
> > >
> > >
> > > 2012/5/31 José Luis Cetina <ma...@gmail.com>
> > >
> > > > Ok, the what i asked is correct??
> > > >
> > > > "I dont know if this is the desire behaviour or if this happend
> because
> > > > the http request isnt finished?"
> > > >
> > > > 2012/5/31 Romain Manni-Bucau <rm...@gmail.com>
> > > >
> > > >> ok,
> > > >>
> > > >> in fact info from ejbcontext are taken in our securitymodule
> > > >>
> > > >> in tomee we set/unset it from a valve so at the beginning/end of the
> > > >> request...all between is currently ignored so when you log you need
> > > >> another
> > > >> request to get the updated information (from the tomcat realm)
> > > >>
> > > >> - Romain
> > > >>
> > > >>
> > > >> 2012/6/1 José Luis Cetina <ma...@gmail.com>
> > > >>
> > > >> > Yes, it work
> > > >> >
> > > >> > 1) Login (form login) using DataSourceRealm
> > > >> >
> > > >> >
> > > >> > 2) Redirect to page2 from my managedbean
> > > >> >
> > > >> > 2012/5/31 Romain Manni-Bucau <rm...@gmail.com>
> > > >> >
> > > >> > > so you mean using the flow i described before it works? (sorry,
> > just
> > > >> to
> > > >> > be
> > > >> > > sure to understand)
> > > >> > >
> > > >> > > - Romain
> > > >> > >
> > > >> > >
> > > >> > > 2012/6/1 José Luis Cetina <ma...@gmail.com>
> > > >> > >
> > > >> > > > Hi i can login and i can navigate (redirect) to my other page,
> > > but i
> > > >> > dont
> > > >> > > > know why im getting guest user in the login mbean, after that
> in
> > > >> other
> > > >> > > > mbean  i get my "real" user.
> > > >> > > >
> > > >> > > >
> > > >> > > > 2012/5/31 Romain Manni-Bucau <rm...@gmail.com>
> > > >> > > >
> > > >> > > > > maybe
> > > >> > > > >
> > > >> > > >
> > > >> > >
> > > >> >
> > > >>
> > >
> >
> http://rmannibucau.wordpress.com/2012/05/09/tomee-and-its-ssh-connector/but
> > > >> > > > > it uses properties file, it just need a custom login module
> > > >> > > > implementation
> > > >> > > > > to use a db.
> > > >> > > > >
> > > >> > > > > well,
> > > >> > > > >
> > > >> > > > > before can you test it please?
> > > >> > > > > 1) login
> > > >> > > > > 2) redirect to your page using your bean
> > > >> > > > >
> > > >> > > > > - Romain
> > > >> > > > >
> > > >> > > > >
> > > >> > > > > 2012/6/1 José Luis Cetina <ma...@gmail.com>
> > > >> > > > >
> > > >> > > > > > I have to read and know how to use this, i always use
> > > >> DataSource or
> > > >> > > > > > JDBCRealm. (with glassfish).
> > > >> > > > > > im reading now, do you have something for a quickstart?
> for
> > > >> share
> > > >> > me
> > > >> > > > > >
> > > >> > > > > > 2012/5/31 Romain Manni-Bucau <rm...@gmail.com>
> > > >> > > > > >
> > > >> > > > > > > having your password in a db is not an issue but i think
> > you
> > > >> > should
> > > >> > > > > > > use org.apache.catalina.realm.JAASRealm
> > > >> > > > > > >
> > > >> > > > > > > for instance:
> > > >> > > > > > >
> > > >> > > > > > >     <Realm
> className="org.apache.catalina.realm.JAASRealm"
> > > >> > > > > > > appName="MyDBLoginModule"
> > > >> > > > > > >
> > > >> > > > > > >
> > > >> > > > > > >
> > > >> > > > > >
> > > >> > > > >
> > > >> > > >
> > > >> > >
> > > >> >
> > > >>
> > >
> >
>  userClassNames="org.apache.openejb.core.security.AbstractSecurityService$User"
> > > >> > > > > > >
> > > >> > > > > > >
> > > >> > > > > > >
> > > >> > > > > >
> > > >> > > > >
> > > >> > > >
> > > >> > >
> > > >> >
> > > >>
> > >
> >
>  roleClassNames="org.apache.openejb.core.security.AbstractSecurityService$Group">
> > > >> > > > > > >      </Realm>
> > > >> > > > > > >
> > > >> > > > > > > so simply implement a custom LoginModule instead of a
> > realm
> > > >> > > > > > >
> > > >> > > > > > > wdyt?
> > > >> > > > > > >
> > > >> > > > > > > - Romain
> > > >> > > > > > >
> > > >> > > > > > >
> > > >> > > > > > > 2012/6/1 José Luis Cetina <ma...@gmail.com>
> > > >> > > > > > >
> > > >> > > > > > > > Sorry, i use DataSourceRealm, i have my
> user/pass/roles
> > in
> > > >> the
> > > >> > > DB.
> > > >> > > > > > > >
> > > >> > > > > > > >
> > > >> > > > > > > >
> > > >> > > > > > > > 2012/5/31 Romain Manni-Bucau <rm...@gmail.com>
> > > >> > > > > > > >
> > > >> > > > > > > > > can't you do it with an embedded one?
> > > >> > > > > > > > >
> > > >> > > > > > > > > well DataSourceRealm doesn't use JAAS by default i
> > > think,
> > > >> > maybe
> > > >> > > > > > that's
> > > >> > > > > > > > the
> > > >> > > > > > > > > issue
> > > >> > > > > > > > >
> > > >> > > > > > > > > - Romain
> > > >> > > > > > > > >
> > > >> > > > > > > > >
> > > >> > > > > > > > > 2012/6/1 José Luis Cetina <ma...@gmail.com>
> > > >> > > > > > > > >
> > > >> > > > > > > > > > OK, i can create a sample, but i use
> > DataSourceRealm,
> > > >> are
> > > >> > you
> > > >> > > > > gonna
> > > >> > > > > > > > > > configure your database?
> > > >> > > > > > > > > >
> > > >> > > > > > > > > > 2012/5/31 Romain Manni-Bucau <
> rmannibucau@gmail.com
> > >
> > > >> > > > > > > > > >
> > > >> > > > > > > > > > > can you have a try in an EJB please? (just try
> to
> > > add
> > > >> > > > > @Stateless
> > > >> > > > > > on
> > > >> > > > > > > > > your
> > > >> > > > > > > > > > > managed bean for instance)
> > > >> > > > > > > > > > >
> > > >> > > > > > > > > > > can you share a sample easy to run?
> > > >> > > > > > > > > > >
> > > >> > > > > > > > > > > - Romain
> > > >> > > > > > > > > > >
> > > >> > > > > > > > > > >
> > > >> > > > > > > > > > > 2012/6/1 José Luis Cetina <maxtorzito@gmail.com
> >
> > > >> > > > > > > > > > >
> > > >> > > > > > > > > > > > Yes, im using JAAS
> > > >> > > > > > > > > > > >
> > > >> > > > > > > > > > > > 2012/5/31 Romain Manni-Bucau <
> > > rmannibucau@gmail.com
> > > >> >
> > > >> > > > > > > > > > > >
> > > >> > > > > > > > > > > > > Hi,
> > > >> > > > > > > > > > > > >
> > > >> > > > > > > > > > > > > Do you use jaas?
> > > >> > > > > > > > > > > > >
> > > >> > > > > > > > > > > > > - Romain
> > > >> > > > > > > > > > > > > Le 31 mai 2012 20:14, "José Luis Cetina" <
> > > >> > > > > > maxtorzito@gmail.com
> > > >> > > > > > > >
> > > >> > > > > > > > a
> > > >> > > > > > > > > > > écrit
> > > >> > > > > > > > > > > > :
> > > >> > > > > > > > > > > > >
> > > >> > > > > > > > > > > > > > Hi i have this scenario:
> > > >> > > > > > > > > > > > > >
> > > >> > > > > > > > > > > > > > I have a page login.xhtml, this page has a
> > > >> > > ManagedBean
> > > >> > > > > > > (@Named)
> > > >> > > > > > > > > > this
> > > >> > > > > > > > > > > > > > managedbean use the
> request.login(user,pass)
> > > >> > method.
> > > >> > > > > > > > > > > > > >
> > > >> > > > > > > > > > > > > > When i do this:
> > > >> > > > > > > > > > > > > >
> > > >> > > > > > > > > > > > > > managedbean class:
> > > >> > > > > > > > > > > > > >
> > > >> > > > > > > > > > > > > > @Resource
> > > >> > > > > > > > > > > > > > private EJBContext ejbContext;
> > > >> > > > > > > > > > > > > > .
> > > >> > > > > > > > > > > > > > .
> > > >> > > > > > > > > > > > > > request.login(user,pass);
> > > >> > > > > > > > > > > > > > String name =
> > > >> > > > ejbContext.getCallerPrincipal().getName();
> > > >> > > > > > > > > > > > > >
> > > >> > > > > > > > > > > > > > I get "guest" as my user name. But i
> expect
> > > the
> > > >> > name
> > > >> > > of
> > > >> > > > > my
> > > >> > > > > > > user
> > > >> > > > > > > > > (of
> > > >> > > > > > > > > > > > > course
> > > >> > > > > > > > > > > > > > is not guest)
> > > >> > > > > > > > > > > > > >
> > > >> > > > > > > > > > > > > > If the login was successful my login page
> > > >> navigate
> > > >> > to
> > > >> > > > > other
> > > >> > > > > > > > page
> > > >> > > > > > > > > > lets
> > > >> > > > > > > > > > > > say
> > > >> > > > > > > > > > > > > > pageb.xhtml
> > > >> > > > > > > > > > > > > >
> > > >> > > > > > > > > > > > > > If i create a managedbean (@Named) for
> > > >> pageb.xhtml
> > > >> > > and
> > > >> > > > in
> > > >> > > > > > > that
> > > >> > > > > > > > > > > > > managedbean
> > > >> > > > > > > > > > > > > > i use again:
> > > >> > > > > > > > > > > > > > String name =
> > > >> > > > ejbContext.getCallerPrincipal().getName();
> > > >> > > > > > > > > > > > > > then, here i get my "correct" name of the
> > user
> > > >> (not
> > > >> > > > > guest).
> > > >> > > > > > > > > > > > > >
> > > >> > > > > > > > > > > > > > I dont know if this is the desire
> behaviour
> > or
> > > >> if
> > > >> > > this
> > > >> > > > > > > happend
> > > >> > > > > > > > > > > because
> > > >> > > > > > > > > > > > > the
> > > >> > > > > > > > > > > > > > http request isnt finished?
> > > >> > > > > > > > > > > > > >
> > > >> > > > > > > > > > > > > > other question why if i call
> > > >> > > > > > > > > > > > > > the
> > >  ejbContext.getCallerPrincipal().getName();
> > > >> > > before
> > > >> > > > > the
> > > >> > > > > > > > > > > > > request.login()
> > > >> > > > > > > > > > > > > > method i get again "guest", why not null?
> > > >> > > > > > > > > > > > > >
> > > >> > > > > > > > > > > > > > If this question is for tomee(openejb) or
> > > >> tomcat?
> > > >> > > > > > > > > > > > > >
> > > >> > > > > > > > > > > > > > Thanks
> > > >> > > > > > > > > > > > > >
> > > >> > > > > > > > > > > > > >
> > > >> > > > > > > > > > > > > >
> > > >> > > > > > > > >
> > > >> > > >
> > > -------------------------------------------------------------------
> > > >> > > > > > > > > > > > > > *SCJA. José Luis Cetina*
> > > >> > > > > > > > > > > > > >
> > > >> > > > > > > > >
> > > >> > > >
> > > -------------------------------------------------------------------
> > > >> > > > > > > > > > > > > >
> > > >> > > > > > > > > > > > >
> > > >> > > > > > > > > > > >
> > > >> > > > > > > > > > > >
> > > >> > > > > > > > > > > >
> > > >> > > > > > > > > > > > --
> > > >> > > > > > > > > > > >
> > > >> > > > > > >
> > > >> >
> -------------------------------------------------------------------
> > > >> > > > > > > > > > > > *SCJA. José Luis Cetina*
> > > >> > > > > > > > > > > >
> > > >> > > > > > >
> > > >> >
> -------------------------------------------------------------------
> > > >> > > > > > > > > > > >
> > > >> > > > > > > > > > >
> > > >> > > > > > > > > >
> > > >> > > > > > > > > >
> > > >> > > > > > > > > >
> > > >> > > > > > > > > > --
> > > >> > > > > > > > > >
> > > >> > > > >
> > > >> -------------------------------------------------------------------
> > > >> > > > > > > > > > *SCJA. José Luis Cetina*
> > > >> > > > > > > > > >
> > > >> > > > >
> > > >> -------------------------------------------------------------------
> > > >> > > > > > > > > >
> > > >> > > > > > > > >
> > > >> > > > > > > >
> > > >> > > > > > > >
> > > >> > > > > > > >
> > > >> > > > > > > > --
> > > >> > > > > > > >
> > > >> > >
> > -------------------------------------------------------------------
> > > >> > > > > > > > *SCJA. José Luis Cetina*
> > > >> > > > > > > >
> > > >> > >
> > -------------------------------------------------------------------
> > > >> > > > > > > >
> > > >> > > > > > >
> > > >> > > > > >
> > > >> > > > > >
> > > >> > > > > >
> > > >> > > > > > --
> > > >> > > > > >
> > > >> -------------------------------------------------------------------
> > > >> > > > > > *SCJA. José Luis Cetina*
> > > >> > > > > >
> > > >> -------------------------------------------------------------------
> > > >> > > > > >
> > > >> > > > >
> > > >> > > >
> > > >> > > >
> > > >> > > >
> > > >> > > > --
> > > >> > > >
> > > -------------------------------------------------------------------
> > > >> > > > *SCJA. José Luis Cetina*
> > > >> > > >
> > > -------------------------------------------------------------------
> > > >> > > >
> > > >> > >
> > > >> >
> > > >> >
> > > >> >
> > > >> > --
> > > >> >
> -------------------------------------------------------------------
> > > >> > *SCJA. José Luis Cetina*
> > > >> >
> -------------------------------------------------------------------
> > > >> >
> > > >>
> > > >
> > > >
> > > >
> > > > --
> > > > -------------------------------------------------------------------
> > > > *SCJA. José Luis Cetina*
> > > > -------------------------------------------------------------------
> > > >
> > > >
> > >
> > >
> > > --
> > > -------------------------------------------------------------------
> > > *SCJA. José Luis Cetina*
> > > -------------------------------------------------------------------
> > >
> >
>
>
>
> --
> -------------------------------------------------------------------
> *SCJA. José Luis Cetina*
> -------------------------------------------------------------------
>

Re: Guest user

Posted by José Luis Cetina <ma...@gmail.com>.
i think we are getting confused.

If i resume all, this what i asked (the final of the first post)

I dont know if this is the desire behavior or if this happend becase the
httr request isnt finished?
Then you answer me:

in fact info from ejbcontext are taken in our securitymodule

in tomee we set/unset it from a valve so at the beginning/end of the
request...all between is currently ignored so when you log you need another
request to get the updated information (from the tomcat realm)

"so when you log you need another request to get the updated information
(from the tomcat realm)

Then i get guest because is the desire behaviour, after the first request i
can get the user i expected.

Then i resume, this is the default behaviour, and works but you need a
second request.



2012/5/31 Romain Manni-Bucau <rm...@gmail.com>

> i think it should work
>
> - Romain
>
>
> 2012/6/1 José Luis Cetina <ma...@gmail.com>
>
> > I mean this:
> >
> > I dont know if this is the desire behaviour or if this happend because
> the
> > http request isnt finished?
> >
> >
> >
> > 2012/5/31 José Luis Cetina <ma...@gmail.com>
> >
> > > Ok, the what i asked is correct??
> > >
> > > "I dont know if this is the desire behaviour or if this happend because
> > > the http request isnt finished?"
> > >
> > > 2012/5/31 Romain Manni-Bucau <rm...@gmail.com>
> > >
> > >> ok,
> > >>
> > >> in fact info from ejbcontext are taken in our securitymodule
> > >>
> > >> in tomee we set/unset it from a valve so at the beginning/end of the
> > >> request...all between is currently ignored so when you log you need
> > >> another
> > >> request to get the updated information (from the tomcat realm)
> > >>
> > >> - Romain
> > >>
> > >>
> > >> 2012/6/1 José Luis Cetina <ma...@gmail.com>
> > >>
> > >> > Yes, it work
> > >> >
> > >> > 1) Login (form login) using DataSourceRealm
> > >> >
> > >> >
> > >> > 2) Redirect to page2 from my managedbean
> > >> >
> > >> > 2012/5/31 Romain Manni-Bucau <rm...@gmail.com>
> > >> >
> > >> > > so you mean using the flow i described before it works? (sorry,
> just
> > >> to
> > >> > be
> > >> > > sure to understand)
> > >> > >
> > >> > > - Romain
> > >> > >
> > >> > >
> > >> > > 2012/6/1 José Luis Cetina <ma...@gmail.com>
> > >> > >
> > >> > > > Hi i can login and i can navigate (redirect) to my other page,
> > but i
> > >> > dont
> > >> > > > know why im getting guest user in the login mbean, after that in
> > >> other
> > >> > > > mbean  i get my "real" user.
> > >> > > >
> > >> > > >
> > >> > > > 2012/5/31 Romain Manni-Bucau <rm...@gmail.com>
> > >> > > >
> > >> > > > > maybe
> > >> > > > >
> > >> > > >
> > >> > >
> > >> >
> > >>
> >
> http://rmannibucau.wordpress.com/2012/05/09/tomee-and-its-ssh-connector/but
> > >> > > > > it uses properties file, it just need a custom login module
> > >> > > > implementation
> > >> > > > > to use a db.
> > >> > > > >
> > >> > > > > well,
> > >> > > > >
> > >> > > > > before can you test it please?
> > >> > > > > 1) login
> > >> > > > > 2) redirect to your page using your bean
> > >> > > > >
> > >> > > > > - Romain
> > >> > > > >
> > >> > > > >
> > >> > > > > 2012/6/1 José Luis Cetina <ma...@gmail.com>
> > >> > > > >
> > >> > > > > > I have to read and know how to use this, i always use
> > >> DataSource or
> > >> > > > > > JDBCRealm. (with glassfish).
> > >> > > > > > im reading now, do you have something for a quickstart? for
> > >> share
> > >> > me
> > >> > > > > >
> > >> > > > > > 2012/5/31 Romain Manni-Bucau <rm...@gmail.com>
> > >> > > > > >
> > >> > > > > > > having your password in a db is not an issue but i think
> you
> > >> > should
> > >> > > > > > > use org.apache.catalina.realm.JAASRealm
> > >> > > > > > >
> > >> > > > > > > for instance:
> > >> > > > > > >
> > >> > > > > > >     <Realm className="org.apache.catalina.realm.JAASRealm"
> > >> > > > > > > appName="MyDBLoginModule"
> > >> > > > > > >
> > >> > > > > > >
> > >> > > > > > >
> > >> > > > > >
> > >> > > > >
> > >> > > >
> > >> > >
> > >> >
> > >>
> >
>  userClassNames="org.apache.openejb.core.security.AbstractSecurityService$User"
> > >> > > > > > >
> > >> > > > > > >
> > >> > > > > > >
> > >> > > > > >
> > >> > > > >
> > >> > > >
> > >> > >
> > >> >
> > >>
> >
>  roleClassNames="org.apache.openejb.core.security.AbstractSecurityService$Group">
> > >> > > > > > >      </Realm>
> > >> > > > > > >
> > >> > > > > > > so simply implement a custom LoginModule instead of a
> realm
> > >> > > > > > >
> > >> > > > > > > wdyt?
> > >> > > > > > >
> > >> > > > > > > - Romain
> > >> > > > > > >
> > >> > > > > > >
> > >> > > > > > > 2012/6/1 José Luis Cetina <ma...@gmail.com>
> > >> > > > > > >
> > >> > > > > > > > Sorry, i use DataSourceRealm, i have my user/pass/roles
> in
> > >> the
> > >> > > DB.
> > >> > > > > > > >
> > >> > > > > > > >
> > >> > > > > > > >
> > >> > > > > > > > 2012/5/31 Romain Manni-Bucau <rm...@gmail.com>
> > >> > > > > > > >
> > >> > > > > > > > > can't you do it with an embedded one?
> > >> > > > > > > > >
> > >> > > > > > > > > well DataSourceRealm doesn't use JAAS by default i
> > think,
> > >> > maybe
> > >> > > > > > that's
> > >> > > > > > > > the
> > >> > > > > > > > > issue
> > >> > > > > > > > >
> > >> > > > > > > > > - Romain
> > >> > > > > > > > >
> > >> > > > > > > > >
> > >> > > > > > > > > 2012/6/1 José Luis Cetina <ma...@gmail.com>
> > >> > > > > > > > >
> > >> > > > > > > > > > OK, i can create a sample, but i use
> DataSourceRealm,
> > >> are
> > >> > you
> > >> > > > > gonna
> > >> > > > > > > > > > configure your database?
> > >> > > > > > > > > >
> > >> > > > > > > > > > 2012/5/31 Romain Manni-Bucau <rmannibucau@gmail.com
> >
> > >> > > > > > > > > >
> > >> > > > > > > > > > > can you have a try in an EJB please? (just try to
> > add
> > >> > > > > @Stateless
> > >> > > > > > on
> > >> > > > > > > > > your
> > >> > > > > > > > > > > managed bean for instance)
> > >> > > > > > > > > > >
> > >> > > > > > > > > > > can you share a sample easy to run?
> > >> > > > > > > > > > >
> > >> > > > > > > > > > > - Romain
> > >> > > > > > > > > > >
> > >> > > > > > > > > > >
> > >> > > > > > > > > > > 2012/6/1 José Luis Cetina <ma...@gmail.com>
> > >> > > > > > > > > > >
> > >> > > > > > > > > > > > Yes, im using JAAS
> > >> > > > > > > > > > > >
> > >> > > > > > > > > > > > 2012/5/31 Romain Manni-Bucau <
> > rmannibucau@gmail.com
> > >> >
> > >> > > > > > > > > > > >
> > >> > > > > > > > > > > > > Hi,
> > >> > > > > > > > > > > > >
> > >> > > > > > > > > > > > > Do you use jaas?
> > >> > > > > > > > > > > > >
> > >> > > > > > > > > > > > > - Romain
> > >> > > > > > > > > > > > > Le 31 mai 2012 20:14, "José Luis Cetina" <
> > >> > > > > > maxtorzito@gmail.com
> > >> > > > > > > >
> > >> > > > > > > > a
> > >> > > > > > > > > > > écrit
> > >> > > > > > > > > > > > :
> > >> > > > > > > > > > > > >
> > >> > > > > > > > > > > > > > Hi i have this scenario:
> > >> > > > > > > > > > > > > >
> > >> > > > > > > > > > > > > > I have a page login.xhtml, this page has a
> > >> > > ManagedBean
> > >> > > > > > > (@Named)
> > >> > > > > > > > > > this
> > >> > > > > > > > > > > > > > managedbean use the request.login(user,pass)
> > >> > method.
> > >> > > > > > > > > > > > > >
> > >> > > > > > > > > > > > > > When i do this:
> > >> > > > > > > > > > > > > >
> > >> > > > > > > > > > > > > > managedbean class:
> > >> > > > > > > > > > > > > >
> > >> > > > > > > > > > > > > > @Resource
> > >> > > > > > > > > > > > > > private EJBContext ejbContext;
> > >> > > > > > > > > > > > > > .
> > >> > > > > > > > > > > > > > .
> > >> > > > > > > > > > > > > > request.login(user,pass);
> > >> > > > > > > > > > > > > > String name =
> > >> > > > ejbContext.getCallerPrincipal().getName();
> > >> > > > > > > > > > > > > >
> > >> > > > > > > > > > > > > > I get "guest" as my user name. But i expect
> > the
> > >> > name
> > >> > > of
> > >> > > > > my
> > >> > > > > > > user
> > >> > > > > > > > > (of
> > >> > > > > > > > > > > > > course
> > >> > > > > > > > > > > > > > is not guest)
> > >> > > > > > > > > > > > > >
> > >> > > > > > > > > > > > > > If the login was successful my login page
> > >> navigate
> > >> > to
> > >> > > > > other
> > >> > > > > > > > page
> > >> > > > > > > > > > lets
> > >> > > > > > > > > > > > say
> > >> > > > > > > > > > > > > > pageb.xhtml
> > >> > > > > > > > > > > > > >
> > >> > > > > > > > > > > > > > If i create a managedbean (@Named) for
> > >> pageb.xhtml
> > >> > > and
> > >> > > > in
> > >> > > > > > > that
> > >> > > > > > > > > > > > > managedbean
> > >> > > > > > > > > > > > > > i use again:
> > >> > > > > > > > > > > > > > String name =
> > >> > > > ejbContext.getCallerPrincipal().getName();
> > >> > > > > > > > > > > > > > then, here i get my "correct" name of the
> user
> > >> (not
> > >> > > > > guest).
> > >> > > > > > > > > > > > > >
> > >> > > > > > > > > > > > > > I dont know if this is the desire behaviour
> or
> > >> if
> > >> > > this
> > >> > > > > > > happend
> > >> > > > > > > > > > > because
> > >> > > > > > > > > > > > > the
> > >> > > > > > > > > > > > > > http request isnt finished?
> > >> > > > > > > > > > > > > >
> > >> > > > > > > > > > > > > > other question why if i call
> > >> > > > > > > > > > > > > > the
> >  ejbContext.getCallerPrincipal().getName();
> > >> > > before
> > >> > > > > the
> > >> > > > > > > > > > > > > request.login()
> > >> > > > > > > > > > > > > > method i get again "guest", why not null?
> > >> > > > > > > > > > > > > >
> > >> > > > > > > > > > > > > > If this question is for tomee(openejb) or
> > >> tomcat?
> > >> > > > > > > > > > > > > >
> > >> > > > > > > > > > > > > > Thanks
> > >> > > > > > > > > > > > > >
> > >> > > > > > > > > > > > > >
> > >> > > > > > > > > > > > > >
> > >> > > > > > > > >
> > >> > > >
> > -------------------------------------------------------------------
> > >> > > > > > > > > > > > > > *SCJA. José Luis Cetina*
> > >> > > > > > > > > > > > > >
> > >> > > > > > > > >
> > >> > > >
> > -------------------------------------------------------------------
> > >> > > > > > > > > > > > > >
> > >> > > > > > > > > > > > >
> > >> > > > > > > > > > > >
> > >> > > > > > > > > > > >
> > >> > > > > > > > > > > >
> > >> > > > > > > > > > > > --
> > >> > > > > > > > > > > >
> > >> > > > > > >
> > >> > -------------------------------------------------------------------
> > >> > > > > > > > > > > > *SCJA. José Luis Cetina*
> > >> > > > > > > > > > > >
> > >> > > > > > >
> > >> > -------------------------------------------------------------------
> > >> > > > > > > > > > > >
> > >> > > > > > > > > > >
> > >> > > > > > > > > >
> > >> > > > > > > > > >
> > >> > > > > > > > > >
> > >> > > > > > > > > > --
> > >> > > > > > > > > >
> > >> > > > >
> > >> -------------------------------------------------------------------
> > >> > > > > > > > > > *SCJA. José Luis Cetina*
> > >> > > > > > > > > >
> > >> > > > >
> > >> -------------------------------------------------------------------
> > >> > > > > > > > > >
> > >> > > > > > > > >
> > >> > > > > > > >
> > >> > > > > > > >
> > >> > > > > > > >
> > >> > > > > > > > --
> > >> > > > > > > >
> > >> > >
> -------------------------------------------------------------------
> > >> > > > > > > > *SCJA. José Luis Cetina*
> > >> > > > > > > >
> > >> > >
> -------------------------------------------------------------------
> > >> > > > > > > >
> > >> > > > > > >
> > >> > > > > >
> > >> > > > > >
> > >> > > > > >
> > >> > > > > > --
> > >> > > > > >
> > >> -------------------------------------------------------------------
> > >> > > > > > *SCJA. José Luis Cetina*
> > >> > > > > >
> > >> -------------------------------------------------------------------
> > >> > > > > >
> > >> > > > >
> > >> > > >
> > >> > > >
> > >> > > >
> > >> > > > --
> > >> > > >
> > -------------------------------------------------------------------
> > >> > > > *SCJA. José Luis Cetina*
> > >> > > >
> > -------------------------------------------------------------------
> > >> > > >
> > >> > >
> > >> >
> > >> >
> > >> >
> > >> > --
> > >> > -------------------------------------------------------------------
> > >> > *SCJA. José Luis Cetina*
> > >> > -------------------------------------------------------------------
> > >> >
> > >>
> > >
> > >
> > >
> > > --
> > > -------------------------------------------------------------------
> > > *SCJA. José Luis Cetina*
> > > -------------------------------------------------------------------
> > >
> > >
> >
> >
> > --
> > -------------------------------------------------------------------
> > *SCJA. José Luis Cetina*
> > -------------------------------------------------------------------
> >
>



-- 
-------------------------------------------------------------------
*SCJA. José Luis Cetina*
-------------------------------------------------------------------

Re: Guest user

Posted by Romain Manni-Bucau <rm...@gmail.com>.
i think it should work

- Romain


2012/6/1 José Luis Cetina <ma...@gmail.com>

> I mean this:
>
> I dont know if this is the desire behaviour or if this happend because the
> http request isnt finished?
>
>
>
> 2012/5/31 José Luis Cetina <ma...@gmail.com>
>
> > Ok, the what i asked is correct??
> >
> > "I dont know if this is the desire behaviour or if this happend because
> > the http request isnt finished?"
> >
> > 2012/5/31 Romain Manni-Bucau <rm...@gmail.com>
> >
> >> ok,
> >>
> >> in fact info from ejbcontext are taken in our securitymodule
> >>
> >> in tomee we set/unset it from a valve so at the beginning/end of the
> >> request...all between is currently ignored so when you log you need
> >> another
> >> request to get the updated information (from the tomcat realm)
> >>
> >> - Romain
> >>
> >>
> >> 2012/6/1 José Luis Cetina <ma...@gmail.com>
> >>
> >> > Yes, it work
> >> >
> >> > 1) Login (form login) using DataSourceRealm
> >> >
> >> >
> >> > 2) Redirect to page2 from my managedbean
> >> >
> >> > 2012/5/31 Romain Manni-Bucau <rm...@gmail.com>
> >> >
> >> > > so you mean using the flow i described before it works? (sorry, just
> >> to
> >> > be
> >> > > sure to understand)
> >> > >
> >> > > - Romain
> >> > >
> >> > >
> >> > > 2012/6/1 José Luis Cetina <ma...@gmail.com>
> >> > >
> >> > > > Hi i can login and i can navigate (redirect) to my other page,
> but i
> >> > dont
> >> > > > know why im getting guest user in the login mbean, after that in
> >> other
> >> > > > mbean  i get my "real" user.
> >> > > >
> >> > > >
> >> > > > 2012/5/31 Romain Manni-Bucau <rm...@gmail.com>
> >> > > >
> >> > > > > maybe
> >> > > > >
> >> > > >
> >> > >
> >> >
> >>
> http://rmannibucau.wordpress.com/2012/05/09/tomee-and-its-ssh-connector/but
> >> > > > > it uses properties file, it just need a custom login module
> >> > > > implementation
> >> > > > > to use a db.
> >> > > > >
> >> > > > > well,
> >> > > > >
> >> > > > > before can you test it please?
> >> > > > > 1) login
> >> > > > > 2) redirect to your page using your bean
> >> > > > >
> >> > > > > - Romain
> >> > > > >
> >> > > > >
> >> > > > > 2012/6/1 José Luis Cetina <ma...@gmail.com>
> >> > > > >
> >> > > > > > I have to read and know how to use this, i always use
> >> DataSource or
> >> > > > > > JDBCRealm. (with glassfish).
> >> > > > > > im reading now, do you have something for a quickstart? for
> >> share
> >> > me
> >> > > > > >
> >> > > > > > 2012/5/31 Romain Manni-Bucau <rm...@gmail.com>
> >> > > > > >
> >> > > > > > > having your password in a db is not an issue but i think you
> >> > should
> >> > > > > > > use org.apache.catalina.realm.JAASRealm
> >> > > > > > >
> >> > > > > > > for instance:
> >> > > > > > >
> >> > > > > > >     <Realm className="org.apache.catalina.realm.JAASRealm"
> >> > > > > > > appName="MyDBLoginModule"
> >> > > > > > >
> >> > > > > > >
> >> > > > > > >
> >> > > > > >
> >> > > > >
> >> > > >
> >> > >
> >> >
> >>
>  userClassNames="org.apache.openejb.core.security.AbstractSecurityService$User"
> >> > > > > > >
> >> > > > > > >
> >> > > > > > >
> >> > > > > >
> >> > > > >
> >> > > >
> >> > >
> >> >
> >>
>  roleClassNames="org.apache.openejb.core.security.AbstractSecurityService$Group">
> >> > > > > > >      </Realm>
> >> > > > > > >
> >> > > > > > > so simply implement a custom LoginModule instead of a realm
> >> > > > > > >
> >> > > > > > > wdyt?
> >> > > > > > >
> >> > > > > > > - Romain
> >> > > > > > >
> >> > > > > > >
> >> > > > > > > 2012/6/1 José Luis Cetina <ma...@gmail.com>
> >> > > > > > >
> >> > > > > > > > Sorry, i use DataSourceRealm, i have my user/pass/roles in
> >> the
> >> > > DB.
> >> > > > > > > >
> >> > > > > > > >
> >> > > > > > > >
> >> > > > > > > > 2012/5/31 Romain Manni-Bucau <rm...@gmail.com>
> >> > > > > > > >
> >> > > > > > > > > can't you do it with an embedded one?
> >> > > > > > > > >
> >> > > > > > > > > well DataSourceRealm doesn't use JAAS by default i
> think,
> >> > maybe
> >> > > > > > that's
> >> > > > > > > > the
> >> > > > > > > > > issue
> >> > > > > > > > >
> >> > > > > > > > > - Romain
> >> > > > > > > > >
> >> > > > > > > > >
> >> > > > > > > > > 2012/6/1 José Luis Cetina <ma...@gmail.com>
> >> > > > > > > > >
> >> > > > > > > > > > OK, i can create a sample, but i use DataSourceRealm,
> >> are
> >> > you
> >> > > > > gonna
> >> > > > > > > > > > configure your database?
> >> > > > > > > > > >
> >> > > > > > > > > > 2012/5/31 Romain Manni-Bucau <rm...@gmail.com>
> >> > > > > > > > > >
> >> > > > > > > > > > > can you have a try in an EJB please? (just try to
> add
> >> > > > > @Stateless
> >> > > > > > on
> >> > > > > > > > > your
> >> > > > > > > > > > > managed bean for instance)
> >> > > > > > > > > > >
> >> > > > > > > > > > > can you share a sample easy to run?
> >> > > > > > > > > > >
> >> > > > > > > > > > > - Romain
> >> > > > > > > > > > >
> >> > > > > > > > > > >
> >> > > > > > > > > > > 2012/6/1 José Luis Cetina <ma...@gmail.com>
> >> > > > > > > > > > >
> >> > > > > > > > > > > > Yes, im using JAAS
> >> > > > > > > > > > > >
> >> > > > > > > > > > > > 2012/5/31 Romain Manni-Bucau <
> rmannibucau@gmail.com
> >> >
> >> > > > > > > > > > > >
> >> > > > > > > > > > > > > Hi,
> >> > > > > > > > > > > > >
> >> > > > > > > > > > > > > Do you use jaas?
> >> > > > > > > > > > > > >
> >> > > > > > > > > > > > > - Romain
> >> > > > > > > > > > > > > Le 31 mai 2012 20:14, "José Luis Cetina" <
> >> > > > > > maxtorzito@gmail.com
> >> > > > > > > >
> >> > > > > > > > a
> >> > > > > > > > > > > écrit
> >> > > > > > > > > > > > :
> >> > > > > > > > > > > > >
> >> > > > > > > > > > > > > > Hi i have this scenario:
> >> > > > > > > > > > > > > >
> >> > > > > > > > > > > > > > I have a page login.xhtml, this page has a
> >> > > ManagedBean
> >> > > > > > > (@Named)
> >> > > > > > > > > > this
> >> > > > > > > > > > > > > > managedbean use the request.login(user,pass)
> >> > method.
> >> > > > > > > > > > > > > >
> >> > > > > > > > > > > > > > When i do this:
> >> > > > > > > > > > > > > >
> >> > > > > > > > > > > > > > managedbean class:
> >> > > > > > > > > > > > > >
> >> > > > > > > > > > > > > > @Resource
> >> > > > > > > > > > > > > > private EJBContext ejbContext;
> >> > > > > > > > > > > > > > .
> >> > > > > > > > > > > > > > .
> >> > > > > > > > > > > > > > request.login(user,pass);
> >> > > > > > > > > > > > > > String name =
> >> > > > ejbContext.getCallerPrincipal().getName();
> >> > > > > > > > > > > > > >
> >> > > > > > > > > > > > > > I get "guest" as my user name. But i expect
> the
> >> > name
> >> > > of
> >> > > > > my
> >> > > > > > > user
> >> > > > > > > > > (of
> >> > > > > > > > > > > > > course
> >> > > > > > > > > > > > > > is not guest)
> >> > > > > > > > > > > > > >
> >> > > > > > > > > > > > > > If the login was successful my login page
> >> navigate
> >> > to
> >> > > > > other
> >> > > > > > > > page
> >> > > > > > > > > > lets
> >> > > > > > > > > > > > say
> >> > > > > > > > > > > > > > pageb.xhtml
> >> > > > > > > > > > > > > >
> >> > > > > > > > > > > > > > If i create a managedbean (@Named) for
> >> pageb.xhtml
> >> > > and
> >> > > > in
> >> > > > > > > that
> >> > > > > > > > > > > > > managedbean
> >> > > > > > > > > > > > > > i use again:
> >> > > > > > > > > > > > > > String name =
> >> > > > ejbContext.getCallerPrincipal().getName();
> >> > > > > > > > > > > > > > then, here i get my "correct" name of the user
> >> (not
> >> > > > > guest).
> >> > > > > > > > > > > > > >
> >> > > > > > > > > > > > > > I dont know if this is the desire behaviour or
> >> if
> >> > > this
> >> > > > > > > happend
> >> > > > > > > > > > > because
> >> > > > > > > > > > > > > the
> >> > > > > > > > > > > > > > http request isnt finished?
> >> > > > > > > > > > > > > >
> >> > > > > > > > > > > > > > other question why if i call
> >> > > > > > > > > > > > > > the
>  ejbContext.getCallerPrincipal().getName();
> >> > > before
> >> > > > > the
> >> > > > > > > > > > > > > request.login()
> >> > > > > > > > > > > > > > method i get again "guest", why not null?
> >> > > > > > > > > > > > > >
> >> > > > > > > > > > > > > > If this question is for tomee(openejb) or
> >> tomcat?
> >> > > > > > > > > > > > > >
> >> > > > > > > > > > > > > > Thanks
> >> > > > > > > > > > > > > >
> >> > > > > > > > > > > > > >
> >> > > > > > > > > > > > > >
> >> > > > > > > > >
> >> > > >
> -------------------------------------------------------------------
> >> > > > > > > > > > > > > > *SCJA. José Luis Cetina*
> >> > > > > > > > > > > > > >
> >> > > > > > > > >
> >> > > >
> -------------------------------------------------------------------
> >> > > > > > > > > > > > > >
> >> > > > > > > > > > > > >
> >> > > > > > > > > > > >
> >> > > > > > > > > > > >
> >> > > > > > > > > > > >
> >> > > > > > > > > > > > --
> >> > > > > > > > > > > >
> >> > > > > > >
> >> > -------------------------------------------------------------------
> >> > > > > > > > > > > > *SCJA. José Luis Cetina*
> >> > > > > > > > > > > >
> >> > > > > > >
> >> > -------------------------------------------------------------------
> >> > > > > > > > > > > >
> >> > > > > > > > > > >
> >> > > > > > > > > >
> >> > > > > > > > > >
> >> > > > > > > > > >
> >> > > > > > > > > > --
> >> > > > > > > > > >
> >> > > > >
> >> -------------------------------------------------------------------
> >> > > > > > > > > > *SCJA. José Luis Cetina*
> >> > > > > > > > > >
> >> > > > >
> >> -------------------------------------------------------------------
> >> > > > > > > > > >
> >> > > > > > > > >
> >> > > > > > > >
> >> > > > > > > >
> >> > > > > > > >
> >> > > > > > > > --
> >> > > > > > > >
> >> > > -------------------------------------------------------------------
> >> > > > > > > > *SCJA. José Luis Cetina*
> >> > > > > > > >
> >> > > -------------------------------------------------------------------
> >> > > > > > > >
> >> > > > > > >
> >> > > > > >
> >> > > > > >
> >> > > > > >
> >> > > > > > --
> >> > > > > >
> >> -------------------------------------------------------------------
> >> > > > > > *SCJA. José Luis Cetina*
> >> > > > > >
> >> -------------------------------------------------------------------
> >> > > > > >
> >> > > > >
> >> > > >
> >> > > >
> >> > > >
> >> > > > --
> >> > > >
> -------------------------------------------------------------------
> >> > > > *SCJA. José Luis Cetina*
> >> > > >
> -------------------------------------------------------------------
> >> > > >
> >> > >
> >> >
> >> >
> >> >
> >> > --
> >> > -------------------------------------------------------------------
> >> > *SCJA. José Luis Cetina*
> >> > -------------------------------------------------------------------
> >> >
> >>
> >
> >
> >
> > --
> > -------------------------------------------------------------------
> > *SCJA. José Luis Cetina*
> > -------------------------------------------------------------------
> >
> >
>
>
> --
> -------------------------------------------------------------------
> *SCJA. José Luis Cetina*
> -------------------------------------------------------------------
>

Re: Guest user

Posted by José Luis Cetina <ma...@gmail.com>.
I mean this:

I dont know if this is the desire behaviour or if this happend because the
http request isnt finished?



2012/5/31 José Luis Cetina <ma...@gmail.com>

> Ok, the what i asked is correct??
>
> "I dont know if this is the desire behaviour or if this happend because
> the http request isnt finished?"
>
> 2012/5/31 Romain Manni-Bucau <rm...@gmail.com>
>
>> ok,
>>
>> in fact info from ejbcontext are taken in our securitymodule
>>
>> in tomee we set/unset it from a valve so at the beginning/end of the
>> request...all between is currently ignored so when you log you need
>> another
>> request to get the updated information (from the tomcat realm)
>>
>> - Romain
>>
>>
>> 2012/6/1 José Luis Cetina <ma...@gmail.com>
>>
>> > Yes, it work
>> >
>> > 1) Login (form login) using DataSourceRealm
>> >
>> >
>> > 2) Redirect to page2 from my managedbean
>> >
>> > 2012/5/31 Romain Manni-Bucau <rm...@gmail.com>
>> >
>> > > so you mean using the flow i described before it works? (sorry, just
>> to
>> > be
>> > > sure to understand)
>> > >
>> > > - Romain
>> > >
>> > >
>> > > 2012/6/1 José Luis Cetina <ma...@gmail.com>
>> > >
>> > > > Hi i can login and i can navigate (redirect) to my other page, but i
>> > dont
>> > > > know why im getting guest user in the login mbean, after that in
>> other
>> > > > mbean  i get my "real" user.
>> > > >
>> > > >
>> > > > 2012/5/31 Romain Manni-Bucau <rm...@gmail.com>
>> > > >
>> > > > > maybe
>> > > > >
>> > > >
>> > >
>> >
>> http://rmannibucau.wordpress.com/2012/05/09/tomee-and-its-ssh-connector/but
>> > > > > it uses properties file, it just need a custom login module
>> > > > implementation
>> > > > > to use a db.
>> > > > >
>> > > > > well,
>> > > > >
>> > > > > before can you test it please?
>> > > > > 1) login
>> > > > > 2) redirect to your page using your bean
>> > > > >
>> > > > > - Romain
>> > > > >
>> > > > >
>> > > > > 2012/6/1 José Luis Cetina <ma...@gmail.com>
>> > > > >
>> > > > > > I have to read and know how to use this, i always use
>> DataSource or
>> > > > > > JDBCRealm. (with glassfish).
>> > > > > > im reading now, do you have something for a quickstart? for
>> share
>> > me
>> > > > > >
>> > > > > > 2012/5/31 Romain Manni-Bucau <rm...@gmail.com>
>> > > > > >
>> > > > > > > having your password in a db is not an issue but i think you
>> > should
>> > > > > > > use org.apache.catalina.realm.JAASRealm
>> > > > > > >
>> > > > > > > for instance:
>> > > > > > >
>> > > > > > >     <Realm className="org.apache.catalina.realm.JAASRealm"
>> > > > > > > appName="MyDBLoginModule"
>> > > > > > >
>> > > > > > >
>> > > > > > >
>> > > > > >
>> > > > >
>> > > >
>> > >
>> >
>>  userClassNames="org.apache.openejb.core.security.AbstractSecurityService$User"
>> > > > > > >
>> > > > > > >
>> > > > > > >
>> > > > > >
>> > > > >
>> > > >
>> > >
>> >
>>  roleClassNames="org.apache.openejb.core.security.AbstractSecurityService$Group">
>> > > > > > >      </Realm>
>> > > > > > >
>> > > > > > > so simply implement a custom LoginModule instead of a realm
>> > > > > > >
>> > > > > > > wdyt?
>> > > > > > >
>> > > > > > > - Romain
>> > > > > > >
>> > > > > > >
>> > > > > > > 2012/6/1 José Luis Cetina <ma...@gmail.com>
>> > > > > > >
>> > > > > > > > Sorry, i use DataSourceRealm, i have my user/pass/roles in
>> the
>> > > DB.
>> > > > > > > >
>> > > > > > > >
>> > > > > > > >
>> > > > > > > > 2012/5/31 Romain Manni-Bucau <rm...@gmail.com>
>> > > > > > > >
>> > > > > > > > > can't you do it with an embedded one?
>> > > > > > > > >
>> > > > > > > > > well DataSourceRealm doesn't use JAAS by default i think,
>> > maybe
>> > > > > > that's
>> > > > > > > > the
>> > > > > > > > > issue
>> > > > > > > > >
>> > > > > > > > > - Romain
>> > > > > > > > >
>> > > > > > > > >
>> > > > > > > > > 2012/6/1 José Luis Cetina <ma...@gmail.com>
>> > > > > > > > >
>> > > > > > > > > > OK, i can create a sample, but i use DataSourceRealm,
>> are
>> > you
>> > > > > gonna
>> > > > > > > > > > configure your database?
>> > > > > > > > > >
>> > > > > > > > > > 2012/5/31 Romain Manni-Bucau <rm...@gmail.com>
>> > > > > > > > > >
>> > > > > > > > > > > can you have a try in an EJB please? (just try to add
>> > > > > @Stateless
>> > > > > > on
>> > > > > > > > > your
>> > > > > > > > > > > managed bean for instance)
>> > > > > > > > > > >
>> > > > > > > > > > > can you share a sample easy to run?
>> > > > > > > > > > >
>> > > > > > > > > > > - Romain
>> > > > > > > > > > >
>> > > > > > > > > > >
>> > > > > > > > > > > 2012/6/1 José Luis Cetina <ma...@gmail.com>
>> > > > > > > > > > >
>> > > > > > > > > > > > Yes, im using JAAS
>> > > > > > > > > > > >
>> > > > > > > > > > > > 2012/5/31 Romain Manni-Bucau <rmannibucau@gmail.com
>> >
>> > > > > > > > > > > >
>> > > > > > > > > > > > > Hi,
>> > > > > > > > > > > > >
>> > > > > > > > > > > > > Do you use jaas?
>> > > > > > > > > > > > >
>> > > > > > > > > > > > > - Romain
>> > > > > > > > > > > > > Le 31 mai 2012 20:14, "José Luis Cetina" <
>> > > > > > maxtorzito@gmail.com
>> > > > > > > >
>> > > > > > > > a
>> > > > > > > > > > > écrit
>> > > > > > > > > > > > :
>> > > > > > > > > > > > >
>> > > > > > > > > > > > > > Hi i have this scenario:
>> > > > > > > > > > > > > >
>> > > > > > > > > > > > > > I have a page login.xhtml, this page has a
>> > > ManagedBean
>> > > > > > > (@Named)
>> > > > > > > > > > this
>> > > > > > > > > > > > > > managedbean use the request.login(user,pass)
>> > method.
>> > > > > > > > > > > > > >
>> > > > > > > > > > > > > > When i do this:
>> > > > > > > > > > > > > >
>> > > > > > > > > > > > > > managedbean class:
>> > > > > > > > > > > > > >
>> > > > > > > > > > > > > > @Resource
>> > > > > > > > > > > > > > private EJBContext ejbContext;
>> > > > > > > > > > > > > > .
>> > > > > > > > > > > > > > .
>> > > > > > > > > > > > > > request.login(user,pass);
>> > > > > > > > > > > > > > String name =
>> > > > ejbContext.getCallerPrincipal().getName();
>> > > > > > > > > > > > > >
>> > > > > > > > > > > > > > I get "guest" as my user name. But i expect the
>> > name
>> > > of
>> > > > > my
>> > > > > > > user
>> > > > > > > > > (of
>> > > > > > > > > > > > > course
>> > > > > > > > > > > > > > is not guest)
>> > > > > > > > > > > > > >
>> > > > > > > > > > > > > > If the login was successful my login page
>> navigate
>> > to
>> > > > > other
>> > > > > > > > page
>> > > > > > > > > > lets
>> > > > > > > > > > > > say
>> > > > > > > > > > > > > > pageb.xhtml
>> > > > > > > > > > > > > >
>> > > > > > > > > > > > > > If i create a managedbean (@Named) for
>> pageb.xhtml
>> > > and
>> > > > in
>> > > > > > > that
>> > > > > > > > > > > > > managedbean
>> > > > > > > > > > > > > > i use again:
>> > > > > > > > > > > > > > String name =
>> > > > ejbContext.getCallerPrincipal().getName();
>> > > > > > > > > > > > > > then, here i get my "correct" name of the user
>> (not
>> > > > > guest).
>> > > > > > > > > > > > > >
>> > > > > > > > > > > > > > I dont know if this is the desire behaviour or
>> if
>> > > this
>> > > > > > > happend
>> > > > > > > > > > > because
>> > > > > > > > > > > > > the
>> > > > > > > > > > > > > > http request isnt finished?
>> > > > > > > > > > > > > >
>> > > > > > > > > > > > > > other question why if i call
>> > > > > > > > > > > > > > the  ejbContext.getCallerPrincipal().getName();
>> > > before
>> > > > > the
>> > > > > > > > > > > > > request.login()
>> > > > > > > > > > > > > > method i get again "guest", why not null?
>> > > > > > > > > > > > > >
>> > > > > > > > > > > > > > If this question is for tomee(openejb) or
>> tomcat?
>> > > > > > > > > > > > > >
>> > > > > > > > > > > > > > Thanks
>> > > > > > > > > > > > > >
>> > > > > > > > > > > > > >
>> > > > > > > > > > > > > >
>> > > > > > > > >
>> > > > -------------------------------------------------------------------
>> > > > > > > > > > > > > > *SCJA. José Luis Cetina*
>> > > > > > > > > > > > > >
>> > > > > > > > >
>> > > > -------------------------------------------------------------------
>> > > > > > > > > > > > > >
>> > > > > > > > > > > > >
>> > > > > > > > > > > >
>> > > > > > > > > > > >
>> > > > > > > > > > > >
>> > > > > > > > > > > > --
>> > > > > > > > > > > >
>> > > > > > >
>> > -------------------------------------------------------------------
>> > > > > > > > > > > > *SCJA. José Luis Cetina*
>> > > > > > > > > > > >
>> > > > > > >
>> > -------------------------------------------------------------------
>> > > > > > > > > > > >
>> > > > > > > > > > >
>> > > > > > > > > >
>> > > > > > > > > >
>> > > > > > > > > >
>> > > > > > > > > > --
>> > > > > > > > > >
>> > > > >
>> -------------------------------------------------------------------
>> > > > > > > > > > *SCJA. José Luis Cetina*
>> > > > > > > > > >
>> > > > >
>> -------------------------------------------------------------------
>> > > > > > > > > >
>> > > > > > > > >
>> > > > > > > >
>> > > > > > > >
>> > > > > > > >
>> > > > > > > > --
>> > > > > > > >
>> > > -------------------------------------------------------------------
>> > > > > > > > *SCJA. José Luis Cetina*
>> > > > > > > >
>> > > -------------------------------------------------------------------
>> > > > > > > >
>> > > > > > >
>> > > > > >
>> > > > > >
>> > > > > >
>> > > > > > --
>> > > > > >
>> -------------------------------------------------------------------
>> > > > > > *SCJA. José Luis Cetina*
>> > > > > >
>> -------------------------------------------------------------------
>> > > > > >
>> > > > >
>> > > >
>> > > >
>> > > >
>> > > > --
>> > > > -------------------------------------------------------------------
>> > > > *SCJA. José Luis Cetina*
>> > > > -------------------------------------------------------------------
>> > > >
>> > >
>> >
>> >
>> >
>> > --
>> > -------------------------------------------------------------------
>> > *SCJA. José Luis Cetina*
>> > -------------------------------------------------------------------
>> >
>>
>
>
>
> --
> -------------------------------------------------------------------
> *SCJA. José Luis Cetina*
> -------------------------------------------------------------------
>
>


-- 
-------------------------------------------------------------------
*SCJA. José Luis Cetina*
-------------------------------------------------------------------

Re: Guest user

Posted by José Luis Cetina <ma...@gmail.com>.
Ok, the what i asked is correct??

"I dont know if this is the desire behaviour or if this happend because the
http request isnt finished?"

2012/5/31 Romain Manni-Bucau <rm...@gmail.com>

> ok,
>
> in fact info from ejbcontext are taken in our securitymodule
>
> in tomee we set/unset it from a valve so at the beginning/end of the
> request...all between is currently ignored so when you log you need another
> request to get the updated information (from the tomcat realm)
>
> - Romain
>
>
> 2012/6/1 José Luis Cetina <ma...@gmail.com>
>
> > Yes, it work
> >
> > 1) Login (form login) using DataSourceRealm
> >
> >
> > 2) Redirect to page2 from my managedbean
> >
> > 2012/5/31 Romain Manni-Bucau <rm...@gmail.com>
> >
> > > so you mean using the flow i described before it works? (sorry, just to
> > be
> > > sure to understand)
> > >
> > > - Romain
> > >
> > >
> > > 2012/6/1 José Luis Cetina <ma...@gmail.com>
> > >
> > > > Hi i can login and i can navigate (redirect) to my other page, but i
> > dont
> > > > know why im getting guest user in the login mbean, after that in
> other
> > > > mbean  i get my "real" user.
> > > >
> > > >
> > > > 2012/5/31 Romain Manni-Bucau <rm...@gmail.com>
> > > >
> > > > > maybe
> > > > >
> > > >
> > >
> >
> http://rmannibucau.wordpress.com/2012/05/09/tomee-and-its-ssh-connector/but
> > > > > it uses properties file, it just need a custom login module
> > > > implementation
> > > > > to use a db.
> > > > >
> > > > > well,
> > > > >
> > > > > before can you test it please?
> > > > > 1) login
> > > > > 2) redirect to your page using your bean
> > > > >
> > > > > - Romain
> > > > >
> > > > >
> > > > > 2012/6/1 José Luis Cetina <ma...@gmail.com>
> > > > >
> > > > > > I have to read and know how to use this, i always use DataSource
> or
> > > > > > JDBCRealm. (with glassfish).
> > > > > > im reading now, do you have something for a quickstart? for share
> > me
> > > > > >
> > > > > > 2012/5/31 Romain Manni-Bucau <rm...@gmail.com>
> > > > > >
> > > > > > > having your password in a db is not an issue but i think you
> > should
> > > > > > > use org.apache.catalina.realm.JAASRealm
> > > > > > >
> > > > > > > for instance:
> > > > > > >
> > > > > > >     <Realm className="org.apache.catalina.realm.JAASRealm"
> > > > > > > appName="MyDBLoginModule"
> > > > > > >
> > > > > > >
> > > > > > >
> > > > > >
> > > > >
> > > >
> > >
> >
>  userClassNames="org.apache.openejb.core.security.AbstractSecurityService$User"
> > > > > > >
> > > > > > >
> > > > > > >
> > > > > >
> > > > >
> > > >
> > >
> >
>  roleClassNames="org.apache.openejb.core.security.AbstractSecurityService$Group">
> > > > > > >      </Realm>
> > > > > > >
> > > > > > > so simply implement a custom LoginModule instead of a realm
> > > > > > >
> > > > > > > wdyt?
> > > > > > >
> > > > > > > - Romain
> > > > > > >
> > > > > > >
> > > > > > > 2012/6/1 José Luis Cetina <ma...@gmail.com>
> > > > > > >
> > > > > > > > Sorry, i use DataSourceRealm, i have my user/pass/roles in
> the
> > > DB.
> > > > > > > >
> > > > > > > >
> > > > > > > >
> > > > > > > > 2012/5/31 Romain Manni-Bucau <rm...@gmail.com>
> > > > > > > >
> > > > > > > > > can't you do it with an embedded one?
> > > > > > > > >
> > > > > > > > > well DataSourceRealm doesn't use JAAS by default i think,
> > maybe
> > > > > > that's
> > > > > > > > the
> > > > > > > > > issue
> > > > > > > > >
> > > > > > > > > - Romain
> > > > > > > > >
> > > > > > > > >
> > > > > > > > > 2012/6/1 José Luis Cetina <ma...@gmail.com>
> > > > > > > > >
> > > > > > > > > > OK, i can create a sample, but i use DataSourceRealm, are
> > you
> > > > > gonna
> > > > > > > > > > configure your database?
> > > > > > > > > >
> > > > > > > > > > 2012/5/31 Romain Manni-Bucau <rm...@gmail.com>
> > > > > > > > > >
> > > > > > > > > > > can you have a try in an EJB please? (just try to add
> > > > > @Stateless
> > > > > > on
> > > > > > > > > your
> > > > > > > > > > > managed bean for instance)
> > > > > > > > > > >
> > > > > > > > > > > can you share a sample easy to run?
> > > > > > > > > > >
> > > > > > > > > > > - Romain
> > > > > > > > > > >
> > > > > > > > > > >
> > > > > > > > > > > 2012/6/1 José Luis Cetina <ma...@gmail.com>
> > > > > > > > > > >
> > > > > > > > > > > > Yes, im using JAAS
> > > > > > > > > > > >
> > > > > > > > > > > > 2012/5/31 Romain Manni-Bucau <rm...@gmail.com>
> > > > > > > > > > > >
> > > > > > > > > > > > > Hi,
> > > > > > > > > > > > >
> > > > > > > > > > > > > Do you use jaas?
> > > > > > > > > > > > >
> > > > > > > > > > > > > - Romain
> > > > > > > > > > > > > Le 31 mai 2012 20:14, "José Luis Cetina" <
> > > > > > maxtorzito@gmail.com
> > > > > > > >
> > > > > > > > a
> > > > > > > > > > > écrit
> > > > > > > > > > > > :
> > > > > > > > > > > > >
> > > > > > > > > > > > > > Hi i have this scenario:
> > > > > > > > > > > > > >
> > > > > > > > > > > > > > I have a page login.xhtml, this page has a
> > > ManagedBean
> > > > > > > (@Named)
> > > > > > > > > > this
> > > > > > > > > > > > > > managedbean use the request.login(user,pass)
> > method.
> > > > > > > > > > > > > >
> > > > > > > > > > > > > > When i do this:
> > > > > > > > > > > > > >
> > > > > > > > > > > > > > managedbean class:
> > > > > > > > > > > > > >
> > > > > > > > > > > > > > @Resource
> > > > > > > > > > > > > > private EJBContext ejbContext;
> > > > > > > > > > > > > > .
> > > > > > > > > > > > > > .
> > > > > > > > > > > > > > request.login(user,pass);
> > > > > > > > > > > > > > String name =
> > > > ejbContext.getCallerPrincipal().getName();
> > > > > > > > > > > > > >
> > > > > > > > > > > > > > I get "guest" as my user name. But i expect the
> > name
> > > of
> > > > > my
> > > > > > > user
> > > > > > > > > (of
> > > > > > > > > > > > > course
> > > > > > > > > > > > > > is not guest)
> > > > > > > > > > > > > >
> > > > > > > > > > > > > > If the login was successful my login page
> navigate
> > to
> > > > > other
> > > > > > > > page
> > > > > > > > > > lets
> > > > > > > > > > > > say
> > > > > > > > > > > > > > pageb.xhtml
> > > > > > > > > > > > > >
> > > > > > > > > > > > > > If i create a managedbean (@Named) for
> pageb.xhtml
> > > and
> > > > in
> > > > > > > that
> > > > > > > > > > > > > managedbean
> > > > > > > > > > > > > > i use again:
> > > > > > > > > > > > > > String name =
> > > > ejbContext.getCallerPrincipal().getName();
> > > > > > > > > > > > > > then, here i get my "correct" name of the user
> (not
> > > > > guest).
> > > > > > > > > > > > > >
> > > > > > > > > > > > > > I dont know if this is the desire behaviour or if
> > > this
> > > > > > > happend
> > > > > > > > > > > because
> > > > > > > > > > > > > the
> > > > > > > > > > > > > > http request isnt finished?
> > > > > > > > > > > > > >
> > > > > > > > > > > > > > other question why if i call
> > > > > > > > > > > > > > the  ejbContext.getCallerPrincipal().getName();
> > > before
> > > > > the
> > > > > > > > > > > > > request.login()
> > > > > > > > > > > > > > method i get again "guest", why not null?
> > > > > > > > > > > > > >
> > > > > > > > > > > > > > If this question is for tomee(openejb) or tomcat?
> > > > > > > > > > > > > >
> > > > > > > > > > > > > > Thanks
> > > > > > > > > > > > > >
> > > > > > > > > > > > > >
> > > > > > > > > > > > > >
> > > > > > > > >
> > > > -------------------------------------------------------------------
> > > > > > > > > > > > > > *SCJA. José Luis Cetina*
> > > > > > > > > > > > > >
> > > > > > > > >
> > > > -------------------------------------------------------------------
> > > > > > > > > > > > > >
> > > > > > > > > > > > >
> > > > > > > > > > > >
> > > > > > > > > > > >
> > > > > > > > > > > >
> > > > > > > > > > > > --
> > > > > > > > > > > >
> > > > > > >
> > -------------------------------------------------------------------
> > > > > > > > > > > > *SCJA. José Luis Cetina*
> > > > > > > > > > > >
> > > > > > >
> > -------------------------------------------------------------------
> > > > > > > > > > > >
> > > > > > > > > > >
> > > > > > > > > >
> > > > > > > > > >
> > > > > > > > > >
> > > > > > > > > > --
> > > > > > > > > >
> > > > > -------------------------------------------------------------------
> > > > > > > > > > *SCJA. José Luis Cetina*
> > > > > > > > > >
> > > > > -------------------------------------------------------------------
> > > > > > > > > >
> > > > > > > > >
> > > > > > > >
> > > > > > > >
> > > > > > > >
> > > > > > > > --
> > > > > > > >
> > > -------------------------------------------------------------------
> > > > > > > > *SCJA. José Luis Cetina*
> > > > > > > >
> > > -------------------------------------------------------------------
> > > > > > > >
> > > > > > >
> > > > > >
> > > > > >
> > > > > >
> > > > > > --
> > > > > >
> -------------------------------------------------------------------
> > > > > > *SCJA. José Luis Cetina*
> > > > > >
> -------------------------------------------------------------------
> > > > > >
> > > > >
> > > >
> > > >
> > > >
> > > > --
> > > > -------------------------------------------------------------------
> > > > *SCJA. José Luis Cetina*
> > > > -------------------------------------------------------------------
> > > >
> > >
> >
> >
> >
> > --
> > -------------------------------------------------------------------
> > *SCJA. José Luis Cetina*
> > -------------------------------------------------------------------
> >
>



-- 
-------------------------------------------------------------------
*SCJA. José Luis Cetina*
-------------------------------------------------------------------

Re: Guest user

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

in fact info from ejbcontext are taken in our securitymodule

in tomee we set/unset it from a valve so at the beginning/end of the
request...all between is currently ignored so when you log you need another
request to get the updated information (from the tomcat realm)

- Romain


2012/6/1 José Luis Cetina <ma...@gmail.com>

> Yes, it work
>
> 1) Login (form login) using DataSourceRealm
>
>
> 2) Redirect to page2 from my managedbean
>
> 2012/5/31 Romain Manni-Bucau <rm...@gmail.com>
>
> > so you mean using the flow i described before it works? (sorry, just to
> be
> > sure to understand)
> >
> > - Romain
> >
> >
> > 2012/6/1 José Luis Cetina <ma...@gmail.com>
> >
> > > Hi i can login and i can navigate (redirect) to my other page, but i
> dont
> > > know why im getting guest user in the login mbean, after that in other
> > > mbean  i get my "real" user.
> > >
> > >
> > > 2012/5/31 Romain Manni-Bucau <rm...@gmail.com>
> > >
> > > > maybe
> > > >
> > >
> >
> http://rmannibucau.wordpress.com/2012/05/09/tomee-and-its-ssh-connector/but
> > > > it uses properties file, it just need a custom login module
> > > implementation
> > > > to use a db.
> > > >
> > > > well,
> > > >
> > > > before can you test it please?
> > > > 1) login
> > > > 2) redirect to your page using your bean
> > > >
> > > > - Romain
> > > >
> > > >
> > > > 2012/6/1 José Luis Cetina <ma...@gmail.com>
> > > >
> > > > > I have to read and know how to use this, i always use DataSource or
> > > > > JDBCRealm. (with glassfish).
> > > > > im reading now, do you have something for a quickstart? for share
> me
> > > > >
> > > > > 2012/5/31 Romain Manni-Bucau <rm...@gmail.com>
> > > > >
> > > > > > having your password in a db is not an issue but i think you
> should
> > > > > > use org.apache.catalina.realm.JAASRealm
> > > > > >
> > > > > > for instance:
> > > > > >
> > > > > >     <Realm className="org.apache.catalina.realm.JAASRealm"
> > > > > > appName="MyDBLoginModule"
> > > > > >
> > > > > >
> > > > > >
> > > > >
> > > >
> > >
> >
>  userClassNames="org.apache.openejb.core.security.AbstractSecurityService$User"
> > > > > >
> > > > > >
> > > > > >
> > > > >
> > > >
> > >
> >
>  roleClassNames="org.apache.openejb.core.security.AbstractSecurityService$Group">
> > > > > >      </Realm>
> > > > > >
> > > > > > so simply implement a custom LoginModule instead of a realm
> > > > > >
> > > > > > wdyt?
> > > > > >
> > > > > > - Romain
> > > > > >
> > > > > >
> > > > > > 2012/6/1 José Luis Cetina <ma...@gmail.com>
> > > > > >
> > > > > > > Sorry, i use DataSourceRealm, i have my user/pass/roles in the
> > DB.
> > > > > > >
> > > > > > >
> > > > > > >
> > > > > > > 2012/5/31 Romain Manni-Bucau <rm...@gmail.com>
> > > > > > >
> > > > > > > > can't you do it with an embedded one?
> > > > > > > >
> > > > > > > > well DataSourceRealm doesn't use JAAS by default i think,
> maybe
> > > > > that's
> > > > > > > the
> > > > > > > > issue
> > > > > > > >
> > > > > > > > - Romain
> > > > > > > >
> > > > > > > >
> > > > > > > > 2012/6/1 José Luis Cetina <ma...@gmail.com>
> > > > > > > >
> > > > > > > > > OK, i can create a sample, but i use DataSourceRealm, are
> you
> > > > gonna
> > > > > > > > > configure your database?
> > > > > > > > >
> > > > > > > > > 2012/5/31 Romain Manni-Bucau <rm...@gmail.com>
> > > > > > > > >
> > > > > > > > > > can you have a try in an EJB please? (just try to add
> > > > @Stateless
> > > > > on
> > > > > > > > your
> > > > > > > > > > managed bean for instance)
> > > > > > > > > >
> > > > > > > > > > can you share a sample easy to run?
> > > > > > > > > >
> > > > > > > > > > - Romain
> > > > > > > > > >
> > > > > > > > > >
> > > > > > > > > > 2012/6/1 José Luis Cetina <ma...@gmail.com>
> > > > > > > > > >
> > > > > > > > > > > Yes, im using JAAS
> > > > > > > > > > >
> > > > > > > > > > > 2012/5/31 Romain Manni-Bucau <rm...@gmail.com>
> > > > > > > > > > >
> > > > > > > > > > > > Hi,
> > > > > > > > > > > >
> > > > > > > > > > > > Do you use jaas?
> > > > > > > > > > > >
> > > > > > > > > > > > - Romain
> > > > > > > > > > > > Le 31 mai 2012 20:14, "José Luis Cetina" <
> > > > > maxtorzito@gmail.com
> > > > > > >
> > > > > > > a
> > > > > > > > > > écrit
> > > > > > > > > > > :
> > > > > > > > > > > >
> > > > > > > > > > > > > Hi i have this scenario:
> > > > > > > > > > > > >
> > > > > > > > > > > > > I have a page login.xhtml, this page has a
> > ManagedBean
> > > > > > (@Named)
> > > > > > > > > this
> > > > > > > > > > > > > managedbean use the request.login(user,pass)
> method.
> > > > > > > > > > > > >
> > > > > > > > > > > > > When i do this:
> > > > > > > > > > > > >
> > > > > > > > > > > > > managedbean class:
> > > > > > > > > > > > >
> > > > > > > > > > > > > @Resource
> > > > > > > > > > > > > private EJBContext ejbContext;
> > > > > > > > > > > > > .
> > > > > > > > > > > > > .
> > > > > > > > > > > > > request.login(user,pass);
> > > > > > > > > > > > > String name =
> > > ejbContext.getCallerPrincipal().getName();
> > > > > > > > > > > > >
> > > > > > > > > > > > > I get "guest" as my user name. But i expect the
> name
> > of
> > > > my
> > > > > > user
> > > > > > > > (of
> > > > > > > > > > > > course
> > > > > > > > > > > > > is not guest)
> > > > > > > > > > > > >
> > > > > > > > > > > > > If the login was successful my login page navigate
> to
> > > > other
> > > > > > > page
> > > > > > > > > lets
> > > > > > > > > > > say
> > > > > > > > > > > > > pageb.xhtml
> > > > > > > > > > > > >
> > > > > > > > > > > > > If i create a managedbean (@Named) for pageb.xhtml
> > and
> > > in
> > > > > > that
> > > > > > > > > > > > managedbean
> > > > > > > > > > > > > i use again:
> > > > > > > > > > > > > String name =
> > > ejbContext.getCallerPrincipal().getName();
> > > > > > > > > > > > > then, here i get my "correct" name of the user (not
> > > > guest).
> > > > > > > > > > > > >
> > > > > > > > > > > > > I dont know if this is the desire behaviour or if
> > this
> > > > > > happend
> > > > > > > > > > because
> > > > > > > > > > > > the
> > > > > > > > > > > > > http request isnt finished?
> > > > > > > > > > > > >
> > > > > > > > > > > > > other question why if i call
> > > > > > > > > > > > > the  ejbContext.getCallerPrincipal().getName();
> > before
> > > > the
> > > > > > > > > > > > request.login()
> > > > > > > > > > > > > method i get again "guest", why not null?
> > > > > > > > > > > > >
> > > > > > > > > > > > > If this question is for tomee(openejb) or tomcat?
> > > > > > > > > > > > >
> > > > > > > > > > > > > Thanks
> > > > > > > > > > > > >
> > > > > > > > > > > > >
> > > > > > > > > > > > >
> > > > > > > >
> > > -------------------------------------------------------------------
> > > > > > > > > > > > > *SCJA. José Luis Cetina*
> > > > > > > > > > > > >
> > > > > > > >
> > > -------------------------------------------------------------------
> > > > > > > > > > > > >
> > > > > > > > > > > >
> > > > > > > > > > >
> > > > > > > > > > >
> > > > > > > > > > >
> > > > > > > > > > > --
> > > > > > > > > > >
> > > > > >
> -------------------------------------------------------------------
> > > > > > > > > > > *SCJA. José Luis Cetina*
> > > > > > > > > > >
> > > > > >
> -------------------------------------------------------------------
> > > > > > > > > > >
> > > > > > > > > >
> > > > > > > > >
> > > > > > > > >
> > > > > > > > >
> > > > > > > > > --
> > > > > > > > >
> > > > -------------------------------------------------------------------
> > > > > > > > > *SCJA. José Luis Cetina*
> > > > > > > > >
> > > > -------------------------------------------------------------------
> > > > > > > > >
> > > > > > > >
> > > > > > >
> > > > > > >
> > > > > > >
> > > > > > > --
> > > > > > >
> > -------------------------------------------------------------------
> > > > > > > *SCJA. José Luis Cetina*
> > > > > > >
> > -------------------------------------------------------------------
> > > > > > >
> > > > > >
> > > > >
> > > > >
> > > > >
> > > > > --
> > > > > -------------------------------------------------------------------
> > > > > *SCJA. José Luis Cetina*
> > > > > -------------------------------------------------------------------
> > > > >
> > > >
> > >
> > >
> > >
> > > --
> > > -------------------------------------------------------------------
> > > *SCJA. José Luis Cetina*
> > > -------------------------------------------------------------------
> > >
> >
>
>
>
> --
> -------------------------------------------------------------------
> *SCJA. José Luis Cetina*
> -------------------------------------------------------------------
>

Re: Guest user

Posted by José Luis Cetina <ma...@gmail.com>.
Yes, it work

1) Login (form login) using DataSourceRealm


2) Redirect to page2 from my managedbean

2012/5/31 Romain Manni-Bucau <rm...@gmail.com>

> so you mean using the flow i described before it works? (sorry, just to be
> sure to understand)
>
> - Romain
>
>
> 2012/6/1 José Luis Cetina <ma...@gmail.com>
>
> > Hi i can login and i can navigate (redirect) to my other page, but i dont
> > know why im getting guest user in the login mbean, after that in other
> > mbean  i get my "real" user.
> >
> >
> > 2012/5/31 Romain Manni-Bucau <rm...@gmail.com>
> >
> > > maybe
> > >
> >
> http://rmannibucau.wordpress.com/2012/05/09/tomee-and-its-ssh-connector/but
> > > it uses properties file, it just need a custom login module
> > implementation
> > > to use a db.
> > >
> > > well,
> > >
> > > before can you test it please?
> > > 1) login
> > > 2) redirect to your page using your bean
> > >
> > > - Romain
> > >
> > >
> > > 2012/6/1 José Luis Cetina <ma...@gmail.com>
> > >
> > > > I have to read and know how to use this, i always use DataSource or
> > > > JDBCRealm. (with glassfish).
> > > > im reading now, do you have something for a quickstart? for share me
> > > >
> > > > 2012/5/31 Romain Manni-Bucau <rm...@gmail.com>
> > > >
> > > > > having your password in a db is not an issue but i think you should
> > > > > use org.apache.catalina.realm.JAASRealm
> > > > >
> > > > > for instance:
> > > > >
> > > > >     <Realm className="org.apache.catalina.realm.JAASRealm"
> > > > > appName="MyDBLoginModule"
> > > > >
> > > > >
> > > > >
> > > >
> > >
> >
>  userClassNames="org.apache.openejb.core.security.AbstractSecurityService$User"
> > > > >
> > > > >
> > > > >
> > > >
> > >
> >
>  roleClassNames="org.apache.openejb.core.security.AbstractSecurityService$Group">
> > > > >      </Realm>
> > > > >
> > > > > so simply implement a custom LoginModule instead of a realm
> > > > >
> > > > > wdyt?
> > > > >
> > > > > - Romain
> > > > >
> > > > >
> > > > > 2012/6/1 José Luis Cetina <ma...@gmail.com>
> > > > >
> > > > > > Sorry, i use DataSourceRealm, i have my user/pass/roles in the
> DB.
> > > > > >
> > > > > >
> > > > > >
> > > > > > 2012/5/31 Romain Manni-Bucau <rm...@gmail.com>
> > > > > >
> > > > > > > can't you do it with an embedded one?
> > > > > > >
> > > > > > > well DataSourceRealm doesn't use JAAS by default i think, maybe
> > > > that's
> > > > > > the
> > > > > > > issue
> > > > > > >
> > > > > > > - Romain
> > > > > > >
> > > > > > >
> > > > > > > 2012/6/1 José Luis Cetina <ma...@gmail.com>
> > > > > > >
> > > > > > > > OK, i can create a sample, but i use DataSourceRealm, are you
> > > gonna
> > > > > > > > configure your database?
> > > > > > > >
> > > > > > > > 2012/5/31 Romain Manni-Bucau <rm...@gmail.com>
> > > > > > > >
> > > > > > > > > can you have a try in an EJB please? (just try to add
> > > @Stateless
> > > > on
> > > > > > > your
> > > > > > > > > managed bean for instance)
> > > > > > > > >
> > > > > > > > > can you share a sample easy to run?
> > > > > > > > >
> > > > > > > > > - Romain
> > > > > > > > >
> > > > > > > > >
> > > > > > > > > 2012/6/1 José Luis Cetina <ma...@gmail.com>
> > > > > > > > >
> > > > > > > > > > Yes, im using JAAS
> > > > > > > > > >
> > > > > > > > > > 2012/5/31 Romain Manni-Bucau <rm...@gmail.com>
> > > > > > > > > >
> > > > > > > > > > > Hi,
> > > > > > > > > > >
> > > > > > > > > > > Do you use jaas?
> > > > > > > > > > >
> > > > > > > > > > > - Romain
> > > > > > > > > > > Le 31 mai 2012 20:14, "José Luis Cetina" <
> > > > maxtorzito@gmail.com
> > > > > >
> > > > > > a
> > > > > > > > > écrit
> > > > > > > > > > :
> > > > > > > > > > >
> > > > > > > > > > > > Hi i have this scenario:
> > > > > > > > > > > >
> > > > > > > > > > > > I have a page login.xhtml, this page has a
> ManagedBean
> > > > > (@Named)
> > > > > > > > this
> > > > > > > > > > > > managedbean use the request.login(user,pass) method.
> > > > > > > > > > > >
> > > > > > > > > > > > When i do this:
> > > > > > > > > > > >
> > > > > > > > > > > > managedbean class:
> > > > > > > > > > > >
> > > > > > > > > > > > @Resource
> > > > > > > > > > > > private EJBContext ejbContext;
> > > > > > > > > > > > .
> > > > > > > > > > > > .
> > > > > > > > > > > > request.login(user,pass);
> > > > > > > > > > > > String name =
> > ejbContext.getCallerPrincipal().getName();
> > > > > > > > > > > >
> > > > > > > > > > > > I get "guest" as my user name. But i expect the name
> of
> > > my
> > > > > user
> > > > > > > (of
> > > > > > > > > > > course
> > > > > > > > > > > > is not guest)
> > > > > > > > > > > >
> > > > > > > > > > > > If the login was successful my login page navigate to
> > > other
> > > > > > page
> > > > > > > > lets
> > > > > > > > > > say
> > > > > > > > > > > > pageb.xhtml
> > > > > > > > > > > >
> > > > > > > > > > > > If i create a managedbean (@Named) for pageb.xhtml
> and
> > in
> > > > > that
> > > > > > > > > > > managedbean
> > > > > > > > > > > > i use again:
> > > > > > > > > > > > String name =
> > ejbContext.getCallerPrincipal().getName();
> > > > > > > > > > > > then, here i get my "correct" name of the user (not
> > > guest).
> > > > > > > > > > > >
> > > > > > > > > > > > I dont know if this is the desire behaviour or if
> this
> > > > > happend
> > > > > > > > > because
> > > > > > > > > > > the
> > > > > > > > > > > > http request isnt finished?
> > > > > > > > > > > >
> > > > > > > > > > > > other question why if i call
> > > > > > > > > > > > the  ejbContext.getCallerPrincipal().getName();
> before
> > > the
> > > > > > > > > > > request.login()
> > > > > > > > > > > > method i get again "guest", why not null?
> > > > > > > > > > > >
> > > > > > > > > > > > If this question is for tomee(openejb) or tomcat?
> > > > > > > > > > > >
> > > > > > > > > > > > Thanks
> > > > > > > > > > > >
> > > > > > > > > > > >
> > > > > > > > > > > >
> > > > > > >
> > -------------------------------------------------------------------
> > > > > > > > > > > > *SCJA. José Luis Cetina*
> > > > > > > > > > > >
> > > > > > >
> > -------------------------------------------------------------------
> > > > > > > > > > > >
> > > > > > > > > > >
> > > > > > > > > >
> > > > > > > > > >
> > > > > > > > > >
> > > > > > > > > > --
> > > > > > > > > >
> > > > > -------------------------------------------------------------------
> > > > > > > > > > *SCJA. José Luis Cetina*
> > > > > > > > > >
> > > > > -------------------------------------------------------------------
> > > > > > > > > >
> > > > > > > > >
> > > > > > > >
> > > > > > > >
> > > > > > > >
> > > > > > > > --
> > > > > > > >
> > > -------------------------------------------------------------------
> > > > > > > > *SCJA. José Luis Cetina*
> > > > > > > >
> > > -------------------------------------------------------------------
> > > > > > > >
> > > > > > >
> > > > > >
> > > > > >
> > > > > >
> > > > > > --
> > > > > >
> -------------------------------------------------------------------
> > > > > > *SCJA. José Luis Cetina*
> > > > > >
> -------------------------------------------------------------------
> > > > > >
> > > > >
> > > >
> > > >
> > > >
> > > > --
> > > > -------------------------------------------------------------------
> > > > *SCJA. José Luis Cetina*
> > > > -------------------------------------------------------------------
> > > >
> > >
> >
> >
> >
> > --
> > -------------------------------------------------------------------
> > *SCJA. José Luis Cetina*
> > -------------------------------------------------------------------
> >
>



-- 
-------------------------------------------------------------------
*SCJA. José Luis Cetina*
-------------------------------------------------------------------

Re: Guest user

Posted by Romain Manni-Bucau <rm...@gmail.com>.
so you mean using the flow i described before it works? (sorry, just to be
sure to understand)

- Romain


2012/6/1 José Luis Cetina <ma...@gmail.com>

> Hi i can login and i can navigate (redirect) to my other page, but i dont
> know why im getting guest user in the login mbean, after that in other
> mbean  i get my "real" user.
>
>
> 2012/5/31 Romain Manni-Bucau <rm...@gmail.com>
>
> > maybe
> >
> http://rmannibucau.wordpress.com/2012/05/09/tomee-and-its-ssh-connector/but
> > it uses properties file, it just need a custom login module
> implementation
> > to use a db.
> >
> > well,
> >
> > before can you test it please?
> > 1) login
> > 2) redirect to your page using your bean
> >
> > - Romain
> >
> >
> > 2012/6/1 José Luis Cetina <ma...@gmail.com>
> >
> > > I have to read and know how to use this, i always use DataSource or
> > > JDBCRealm. (with glassfish).
> > > im reading now, do you have something for a quickstart? for share me
> > >
> > > 2012/5/31 Romain Manni-Bucau <rm...@gmail.com>
> > >
> > > > having your password in a db is not an issue but i think you should
> > > > use org.apache.catalina.realm.JAASRealm
> > > >
> > > > for instance:
> > > >
> > > >     <Realm className="org.apache.catalina.realm.JAASRealm"
> > > > appName="MyDBLoginModule"
> > > >
> > > >
> > > >
> > >
> >
>  userClassNames="org.apache.openejb.core.security.AbstractSecurityService$User"
> > > >
> > > >
> > > >
> > >
> >
>  roleClassNames="org.apache.openejb.core.security.AbstractSecurityService$Group">
> > > >      </Realm>
> > > >
> > > > so simply implement a custom LoginModule instead of a realm
> > > >
> > > > wdyt?
> > > >
> > > > - Romain
> > > >
> > > >
> > > > 2012/6/1 José Luis Cetina <ma...@gmail.com>
> > > >
> > > > > Sorry, i use DataSourceRealm, i have my user/pass/roles in the DB.
> > > > >
> > > > >
> > > > >
> > > > > 2012/5/31 Romain Manni-Bucau <rm...@gmail.com>
> > > > >
> > > > > > can't you do it with an embedded one?
> > > > > >
> > > > > > well DataSourceRealm doesn't use JAAS by default i think, maybe
> > > that's
> > > > > the
> > > > > > issue
> > > > > >
> > > > > > - Romain
> > > > > >
> > > > > >
> > > > > > 2012/6/1 José Luis Cetina <ma...@gmail.com>
> > > > > >
> > > > > > > OK, i can create a sample, but i use DataSourceRealm, are you
> > gonna
> > > > > > > configure your database?
> > > > > > >
> > > > > > > 2012/5/31 Romain Manni-Bucau <rm...@gmail.com>
> > > > > > >
> > > > > > > > can you have a try in an EJB please? (just try to add
> > @Stateless
> > > on
> > > > > > your
> > > > > > > > managed bean for instance)
> > > > > > > >
> > > > > > > > can you share a sample easy to run?
> > > > > > > >
> > > > > > > > - Romain
> > > > > > > >
> > > > > > > >
> > > > > > > > 2012/6/1 José Luis Cetina <ma...@gmail.com>
> > > > > > > >
> > > > > > > > > Yes, im using JAAS
> > > > > > > > >
> > > > > > > > > 2012/5/31 Romain Manni-Bucau <rm...@gmail.com>
> > > > > > > > >
> > > > > > > > > > Hi,
> > > > > > > > > >
> > > > > > > > > > Do you use jaas?
> > > > > > > > > >
> > > > > > > > > > - Romain
> > > > > > > > > > Le 31 mai 2012 20:14, "José Luis Cetina" <
> > > maxtorzito@gmail.com
> > > > >
> > > > > a
> > > > > > > > écrit
> > > > > > > > > :
> > > > > > > > > >
> > > > > > > > > > > Hi i have this scenario:
> > > > > > > > > > >
> > > > > > > > > > > I have a page login.xhtml, this page has a ManagedBean
> > > > (@Named)
> > > > > > > this
> > > > > > > > > > > managedbean use the request.login(user,pass) method.
> > > > > > > > > > >
> > > > > > > > > > > When i do this:
> > > > > > > > > > >
> > > > > > > > > > > managedbean class:
> > > > > > > > > > >
> > > > > > > > > > > @Resource
> > > > > > > > > > > private EJBContext ejbContext;
> > > > > > > > > > > .
> > > > > > > > > > > .
> > > > > > > > > > > request.login(user,pass);
> > > > > > > > > > > String name =
> ejbContext.getCallerPrincipal().getName();
> > > > > > > > > > >
> > > > > > > > > > > I get "guest" as my user name. But i expect the name of
> > my
> > > > user
> > > > > > (of
> > > > > > > > > > course
> > > > > > > > > > > is not guest)
> > > > > > > > > > >
> > > > > > > > > > > If the login was successful my login page navigate to
> > other
> > > > > page
> > > > > > > lets
> > > > > > > > > say
> > > > > > > > > > > pageb.xhtml
> > > > > > > > > > >
> > > > > > > > > > > If i create a managedbean (@Named) for pageb.xhtml and
> in
> > > > that
> > > > > > > > > > managedbean
> > > > > > > > > > > i use again:
> > > > > > > > > > > String name =
> ejbContext.getCallerPrincipal().getName();
> > > > > > > > > > > then, here i get my "correct" name of the user (not
> > guest).
> > > > > > > > > > >
> > > > > > > > > > > I dont know if this is the desire behaviour or if this
> > > > happend
> > > > > > > > because
> > > > > > > > > > the
> > > > > > > > > > > http request isnt finished?
> > > > > > > > > > >
> > > > > > > > > > > other question why if i call
> > > > > > > > > > > the  ejbContext.getCallerPrincipal().getName(); before
> > the
> > > > > > > > > > request.login()
> > > > > > > > > > > method i get again "guest", why not null?
> > > > > > > > > > >
> > > > > > > > > > > If this question is for tomee(openejb) or tomcat?
> > > > > > > > > > >
> > > > > > > > > > > Thanks
> > > > > > > > > > >
> > > > > > > > > > >
> > > > > > > > > > >
> > > > > >
> -------------------------------------------------------------------
> > > > > > > > > > > *SCJA. José Luis Cetina*
> > > > > > > > > > >
> > > > > >
> -------------------------------------------------------------------
> > > > > > > > > > >
> > > > > > > > > >
> > > > > > > > >
> > > > > > > > >
> > > > > > > > >
> > > > > > > > > --
> > > > > > > > >
> > > > -------------------------------------------------------------------
> > > > > > > > > *SCJA. José Luis Cetina*
> > > > > > > > >
> > > > -------------------------------------------------------------------
> > > > > > > > >
> > > > > > > >
> > > > > > >
> > > > > > >
> > > > > > >
> > > > > > > --
> > > > > > >
> > -------------------------------------------------------------------
> > > > > > > *SCJA. José Luis Cetina*
> > > > > > >
> > -------------------------------------------------------------------
> > > > > > >
> > > > > >
> > > > >
> > > > >
> > > > >
> > > > > --
> > > > > -------------------------------------------------------------------
> > > > > *SCJA. José Luis Cetina*
> > > > > -------------------------------------------------------------------
> > > > >
> > > >
> > >
> > >
> > >
> > > --
> > > -------------------------------------------------------------------
> > > *SCJA. José Luis Cetina*
> > > -------------------------------------------------------------------
> > >
> >
>
>
>
> --
> -------------------------------------------------------------------
> *SCJA. José Luis Cetina*
> -------------------------------------------------------------------
>

Re: Guest user

Posted by José Luis Cetina <ma...@gmail.com>.
Hi i can login and i can navigate (redirect) to my other page, but i dont
know why im getting guest user in the login mbean, after that in other
mbean  i get my "real" user.


2012/5/31 Romain Manni-Bucau <rm...@gmail.com>

> maybe
> http://rmannibucau.wordpress.com/2012/05/09/tomee-and-its-ssh-connector/but
> it uses properties file, it just need a custom login module implementation
> to use a db.
>
> well,
>
> before can you test it please?
> 1) login
> 2) redirect to your page using your bean
>
> - Romain
>
>
> 2012/6/1 José Luis Cetina <ma...@gmail.com>
>
> > I have to read and know how to use this, i always use DataSource or
> > JDBCRealm. (with glassfish).
> > im reading now, do you have something for a quickstart? for share me
> >
> > 2012/5/31 Romain Manni-Bucau <rm...@gmail.com>
> >
> > > having your password in a db is not an issue but i think you should
> > > use org.apache.catalina.realm.JAASRealm
> > >
> > > for instance:
> > >
> > >     <Realm className="org.apache.catalina.realm.JAASRealm"
> > > appName="MyDBLoginModule"
> > >
> > >
> > >
> >
>  userClassNames="org.apache.openejb.core.security.AbstractSecurityService$User"
> > >
> > >
> > >
> >
>  roleClassNames="org.apache.openejb.core.security.AbstractSecurityService$Group">
> > >      </Realm>
> > >
> > > so simply implement a custom LoginModule instead of a realm
> > >
> > > wdyt?
> > >
> > > - Romain
> > >
> > >
> > > 2012/6/1 José Luis Cetina <ma...@gmail.com>
> > >
> > > > Sorry, i use DataSourceRealm, i have my user/pass/roles in the DB.
> > > >
> > > >
> > > >
> > > > 2012/5/31 Romain Manni-Bucau <rm...@gmail.com>
> > > >
> > > > > can't you do it with an embedded one?
> > > > >
> > > > > well DataSourceRealm doesn't use JAAS by default i think, maybe
> > that's
> > > > the
> > > > > issue
> > > > >
> > > > > - Romain
> > > > >
> > > > >
> > > > > 2012/6/1 José Luis Cetina <ma...@gmail.com>
> > > > >
> > > > > > OK, i can create a sample, but i use DataSourceRealm, are you
> gonna
> > > > > > configure your database?
> > > > > >
> > > > > > 2012/5/31 Romain Manni-Bucau <rm...@gmail.com>
> > > > > >
> > > > > > > can you have a try in an EJB please? (just try to add
> @Stateless
> > on
> > > > > your
> > > > > > > managed bean for instance)
> > > > > > >
> > > > > > > can you share a sample easy to run?
> > > > > > >
> > > > > > > - Romain
> > > > > > >
> > > > > > >
> > > > > > > 2012/6/1 José Luis Cetina <ma...@gmail.com>
> > > > > > >
> > > > > > > > Yes, im using JAAS
> > > > > > > >
> > > > > > > > 2012/5/31 Romain Manni-Bucau <rm...@gmail.com>
> > > > > > > >
> > > > > > > > > Hi,
> > > > > > > > >
> > > > > > > > > Do you use jaas?
> > > > > > > > >
> > > > > > > > > - Romain
> > > > > > > > > Le 31 mai 2012 20:14, "José Luis Cetina" <
> > maxtorzito@gmail.com
> > > >
> > > > a
> > > > > > > écrit
> > > > > > > > :
> > > > > > > > >
> > > > > > > > > > Hi i have this scenario:
> > > > > > > > > >
> > > > > > > > > > I have a page login.xhtml, this page has a ManagedBean
> > > (@Named)
> > > > > > this
> > > > > > > > > > managedbean use the request.login(user,pass) method.
> > > > > > > > > >
> > > > > > > > > > When i do this:
> > > > > > > > > >
> > > > > > > > > > managedbean class:
> > > > > > > > > >
> > > > > > > > > > @Resource
> > > > > > > > > > private EJBContext ejbContext;
> > > > > > > > > > .
> > > > > > > > > > .
> > > > > > > > > > request.login(user,pass);
> > > > > > > > > > String name = ejbContext.getCallerPrincipal().getName();
> > > > > > > > > >
> > > > > > > > > > I get "guest" as my user name. But i expect the name of
> my
> > > user
> > > > > (of
> > > > > > > > > course
> > > > > > > > > > is not guest)
> > > > > > > > > >
> > > > > > > > > > If the login was successful my login page navigate to
> other
> > > > page
> > > > > > lets
> > > > > > > > say
> > > > > > > > > > pageb.xhtml
> > > > > > > > > >
> > > > > > > > > > If i create a managedbean (@Named) for pageb.xhtml and in
> > > that
> > > > > > > > > managedbean
> > > > > > > > > > i use again:
> > > > > > > > > > String name = ejbContext.getCallerPrincipal().getName();
> > > > > > > > > > then, here i get my "correct" name of the user (not
> guest).
> > > > > > > > > >
> > > > > > > > > > I dont know if this is the desire behaviour or if this
> > > happend
> > > > > > > because
> > > > > > > > > the
> > > > > > > > > > http request isnt finished?
> > > > > > > > > >
> > > > > > > > > > other question why if i call
> > > > > > > > > > the  ejbContext.getCallerPrincipal().getName(); before
> the
> > > > > > > > > request.login()
> > > > > > > > > > method i get again "guest", why not null?
> > > > > > > > > >
> > > > > > > > > > If this question is for tomee(openejb) or tomcat?
> > > > > > > > > >
> > > > > > > > > > Thanks
> > > > > > > > > >
> > > > > > > > > >
> > > > > > > > > >
> > > > > -------------------------------------------------------------------
> > > > > > > > > > *SCJA. José Luis Cetina*
> > > > > > > > > >
> > > > > -------------------------------------------------------------------
> > > > > > > > > >
> > > > > > > > >
> > > > > > > >
> > > > > > > >
> > > > > > > >
> > > > > > > > --
> > > > > > > >
> > > -------------------------------------------------------------------
> > > > > > > > *SCJA. José Luis Cetina*
> > > > > > > >
> > > -------------------------------------------------------------------
> > > > > > > >
> > > > > > >
> > > > > >
> > > > > >
> > > > > >
> > > > > > --
> > > > > >
> -------------------------------------------------------------------
> > > > > > *SCJA. José Luis Cetina*
> > > > > >
> -------------------------------------------------------------------
> > > > > >
> > > > >
> > > >
> > > >
> > > >
> > > > --
> > > > -------------------------------------------------------------------
> > > > *SCJA. José Luis Cetina*
> > > > -------------------------------------------------------------------
> > > >
> > >
> >
> >
> >
> > --
> > -------------------------------------------------------------------
> > *SCJA. José Luis Cetina*
> > -------------------------------------------------------------------
> >
>



-- 
-------------------------------------------------------------------
*SCJA. José Luis Cetina*
-------------------------------------------------------------------

Re: Guest user

Posted by Romain Manni-Bucau <rm...@gmail.com>.
maybe
http://rmannibucau.wordpress.com/2012/05/09/tomee-and-its-ssh-connector/ but
it uses properties file, it just need a custom login module implementation
to use a db.

well,

before can you test it please?
1) login
2) redirect to your page using your bean

- Romain


2012/6/1 José Luis Cetina <ma...@gmail.com>

> I have to read and know how to use this, i always use DataSource or
> JDBCRealm. (with glassfish).
> im reading now, do you have something for a quickstart? for share me
>
> 2012/5/31 Romain Manni-Bucau <rm...@gmail.com>
>
> > having your password in a db is not an issue but i think you should
> > use org.apache.catalina.realm.JAASRealm
> >
> > for instance:
> >
> >     <Realm className="org.apache.catalina.realm.JAASRealm"
> > appName="MyDBLoginModule"
> >
> >
> >
>  userClassNames="org.apache.openejb.core.security.AbstractSecurityService$User"
> >
> >
> >
>  roleClassNames="org.apache.openejb.core.security.AbstractSecurityService$Group">
> >      </Realm>
> >
> > so simply implement a custom LoginModule instead of a realm
> >
> > wdyt?
> >
> > - Romain
> >
> >
> > 2012/6/1 José Luis Cetina <ma...@gmail.com>
> >
> > > Sorry, i use DataSourceRealm, i have my user/pass/roles in the DB.
> > >
> > >
> > >
> > > 2012/5/31 Romain Manni-Bucau <rm...@gmail.com>
> > >
> > > > can't you do it with an embedded one?
> > > >
> > > > well DataSourceRealm doesn't use JAAS by default i think, maybe
> that's
> > > the
> > > > issue
> > > >
> > > > - Romain
> > > >
> > > >
> > > > 2012/6/1 José Luis Cetina <ma...@gmail.com>
> > > >
> > > > > OK, i can create a sample, but i use DataSourceRealm, are you gonna
> > > > > configure your database?
> > > > >
> > > > > 2012/5/31 Romain Manni-Bucau <rm...@gmail.com>
> > > > >
> > > > > > can you have a try in an EJB please? (just try to add @Stateless
> on
> > > > your
> > > > > > managed bean for instance)
> > > > > >
> > > > > > can you share a sample easy to run?
> > > > > >
> > > > > > - Romain
> > > > > >
> > > > > >
> > > > > > 2012/6/1 José Luis Cetina <ma...@gmail.com>
> > > > > >
> > > > > > > Yes, im using JAAS
> > > > > > >
> > > > > > > 2012/5/31 Romain Manni-Bucau <rm...@gmail.com>
> > > > > > >
> > > > > > > > Hi,
> > > > > > > >
> > > > > > > > Do you use jaas?
> > > > > > > >
> > > > > > > > - Romain
> > > > > > > > Le 31 mai 2012 20:14, "José Luis Cetina" <
> maxtorzito@gmail.com
> > >
> > > a
> > > > > > écrit
> > > > > > > :
> > > > > > > >
> > > > > > > > > Hi i have this scenario:
> > > > > > > > >
> > > > > > > > > I have a page login.xhtml, this page has a ManagedBean
> > (@Named)
> > > > > this
> > > > > > > > > managedbean use the request.login(user,pass) method.
> > > > > > > > >
> > > > > > > > > When i do this:
> > > > > > > > >
> > > > > > > > > managedbean class:
> > > > > > > > >
> > > > > > > > > @Resource
> > > > > > > > > private EJBContext ejbContext;
> > > > > > > > > .
> > > > > > > > > .
> > > > > > > > > request.login(user,pass);
> > > > > > > > > String name = ejbContext.getCallerPrincipal().getName();
> > > > > > > > >
> > > > > > > > > I get "guest" as my user name. But i expect the name of my
> > user
> > > > (of
> > > > > > > > course
> > > > > > > > > is not guest)
> > > > > > > > >
> > > > > > > > > If the login was successful my login page navigate to other
> > > page
> > > > > lets
> > > > > > > say
> > > > > > > > > pageb.xhtml
> > > > > > > > >
> > > > > > > > > If i create a managedbean (@Named) for pageb.xhtml and in
> > that
> > > > > > > > managedbean
> > > > > > > > > i use again:
> > > > > > > > > String name = ejbContext.getCallerPrincipal().getName();
> > > > > > > > > then, here i get my "correct" name of the user (not guest).
> > > > > > > > >
> > > > > > > > > I dont know if this is the desire behaviour or if this
> > happend
> > > > > > because
> > > > > > > > the
> > > > > > > > > http request isnt finished?
> > > > > > > > >
> > > > > > > > > other question why if i call
> > > > > > > > > the  ejbContext.getCallerPrincipal().getName(); before the
> > > > > > > > request.login()
> > > > > > > > > method i get again "guest", why not null?
> > > > > > > > >
> > > > > > > > > If this question is for tomee(openejb) or tomcat?
> > > > > > > > >
> > > > > > > > > Thanks
> > > > > > > > >
> > > > > > > > >
> > > > > > > > >
> > > > -------------------------------------------------------------------
> > > > > > > > > *SCJA. José Luis Cetina*
> > > > > > > > >
> > > > -------------------------------------------------------------------
> > > > > > > > >
> > > > > > > >
> > > > > > >
> > > > > > >
> > > > > > >
> > > > > > > --
> > > > > > >
> > -------------------------------------------------------------------
> > > > > > > *SCJA. José Luis Cetina*
> > > > > > >
> > -------------------------------------------------------------------
> > > > > > >
> > > > > >
> > > > >
> > > > >
> > > > >
> > > > > --
> > > > > -------------------------------------------------------------------
> > > > > *SCJA. José Luis Cetina*
> > > > > -------------------------------------------------------------------
> > > > >
> > > >
> > >
> > >
> > >
> > > --
> > > -------------------------------------------------------------------
> > > *SCJA. José Luis Cetina*
> > > -------------------------------------------------------------------
> > >
> >
>
>
>
> --
> -------------------------------------------------------------------
> *SCJA. José Luis Cetina*
> -------------------------------------------------------------------
>

Re: Guest user

Posted by José Luis Cetina <ma...@gmail.com>.
I have to read and know how to use this, i always use DataSource or
JDBCRealm. (with glassfish).
im reading now, do you have something for a quickstart? for share me

2012/5/31 Romain Manni-Bucau <rm...@gmail.com>

> having your password in a db is not an issue but i think you should
> use org.apache.catalina.realm.JAASRealm
>
> for instance:
>
>     <Realm className="org.apache.catalina.realm.JAASRealm"
> appName="MyDBLoginModule"
>
>
>  userClassNames="org.apache.openejb.core.security.AbstractSecurityService$User"
>
>
>  roleClassNames="org.apache.openejb.core.security.AbstractSecurityService$Group">
>      </Realm>
>
> so simply implement a custom LoginModule instead of a realm
>
> wdyt?
>
> - Romain
>
>
> 2012/6/1 José Luis Cetina <ma...@gmail.com>
>
> > Sorry, i use DataSourceRealm, i have my user/pass/roles in the DB.
> >
> >
> >
> > 2012/5/31 Romain Manni-Bucau <rm...@gmail.com>
> >
> > > can't you do it with an embedded one?
> > >
> > > well DataSourceRealm doesn't use JAAS by default i think, maybe that's
> > the
> > > issue
> > >
> > > - Romain
> > >
> > >
> > > 2012/6/1 José Luis Cetina <ma...@gmail.com>
> > >
> > > > OK, i can create a sample, but i use DataSourceRealm, are you gonna
> > > > configure your database?
> > > >
> > > > 2012/5/31 Romain Manni-Bucau <rm...@gmail.com>
> > > >
> > > > > can you have a try in an EJB please? (just try to add @Stateless on
> > > your
> > > > > managed bean for instance)
> > > > >
> > > > > can you share a sample easy to run?
> > > > >
> > > > > - Romain
> > > > >
> > > > >
> > > > > 2012/6/1 José Luis Cetina <ma...@gmail.com>
> > > > >
> > > > > > Yes, im using JAAS
> > > > > >
> > > > > > 2012/5/31 Romain Manni-Bucau <rm...@gmail.com>
> > > > > >
> > > > > > > Hi,
> > > > > > >
> > > > > > > Do you use jaas?
> > > > > > >
> > > > > > > - Romain
> > > > > > > Le 31 mai 2012 20:14, "José Luis Cetina" <maxtorzito@gmail.com
> >
> > a
> > > > > écrit
> > > > > > :
> > > > > > >
> > > > > > > > Hi i have this scenario:
> > > > > > > >
> > > > > > > > I have a page login.xhtml, this page has a ManagedBean
> (@Named)
> > > > this
> > > > > > > > managedbean use the request.login(user,pass) method.
> > > > > > > >
> > > > > > > > When i do this:
> > > > > > > >
> > > > > > > > managedbean class:
> > > > > > > >
> > > > > > > > @Resource
> > > > > > > > private EJBContext ejbContext;
> > > > > > > > .
> > > > > > > > .
> > > > > > > > request.login(user,pass);
> > > > > > > > String name = ejbContext.getCallerPrincipal().getName();
> > > > > > > >
> > > > > > > > I get "guest" as my user name. But i expect the name of my
> user
> > > (of
> > > > > > > course
> > > > > > > > is not guest)
> > > > > > > >
> > > > > > > > If the login was successful my login page navigate to other
> > page
> > > > lets
> > > > > > say
> > > > > > > > pageb.xhtml
> > > > > > > >
> > > > > > > > If i create a managedbean (@Named) for pageb.xhtml and in
> that
> > > > > > > managedbean
> > > > > > > > i use again:
> > > > > > > > String name = ejbContext.getCallerPrincipal().getName();
> > > > > > > > then, here i get my "correct" name of the user (not guest).
> > > > > > > >
> > > > > > > > I dont know if this is the desire behaviour or if this
> happend
> > > > > because
> > > > > > > the
> > > > > > > > http request isnt finished?
> > > > > > > >
> > > > > > > > other question why if i call
> > > > > > > > the  ejbContext.getCallerPrincipal().getName(); before the
> > > > > > > request.login()
> > > > > > > > method i get again "guest", why not null?
> > > > > > > >
> > > > > > > > If this question is for tomee(openejb) or tomcat?
> > > > > > > >
> > > > > > > > Thanks
> > > > > > > >
> > > > > > > >
> > > > > > > >
> > > -------------------------------------------------------------------
> > > > > > > > *SCJA. José Luis Cetina*
> > > > > > > >
> > > -------------------------------------------------------------------
> > > > > > > >
> > > > > > >
> > > > > >
> > > > > >
> > > > > >
> > > > > > --
> > > > > >
> -------------------------------------------------------------------
> > > > > > *SCJA. José Luis Cetina*
> > > > > >
> -------------------------------------------------------------------
> > > > > >
> > > > >
> > > >
> > > >
> > > >
> > > > --
> > > > -------------------------------------------------------------------
> > > > *SCJA. José Luis Cetina*
> > > > -------------------------------------------------------------------
> > > >
> > >
> >
> >
> >
> > --
> > -------------------------------------------------------------------
> > *SCJA. José Luis Cetina*
> > -------------------------------------------------------------------
> >
>



-- 
-------------------------------------------------------------------
*SCJA. José Luis Cetina*
-------------------------------------------------------------------

Re: Guest user

Posted by Romain Manni-Bucau <rm...@gmail.com>.
having your password in a db is not an issue but i think you should
use org.apache.catalina.realm.JAASRealm

for instance:

     <Realm className="org.apache.catalina.realm.JAASRealm"
appName="MyDBLoginModule"

 userClassNames="org.apache.openejb.core.security.AbstractSecurityService$User"

 roleClassNames="org.apache.openejb.core.security.AbstractSecurityService$Group">
      </Realm>

so simply implement a custom LoginModule instead of a realm

wdyt?

- Romain


2012/6/1 José Luis Cetina <ma...@gmail.com>

> Sorry, i use DataSourceRealm, i have my user/pass/roles in the DB.
>
>
>
> 2012/5/31 Romain Manni-Bucau <rm...@gmail.com>
>
> > can't you do it with an embedded one?
> >
> > well DataSourceRealm doesn't use JAAS by default i think, maybe that's
> the
> > issue
> >
> > - Romain
> >
> >
> > 2012/6/1 José Luis Cetina <ma...@gmail.com>
> >
> > > OK, i can create a sample, but i use DataSourceRealm, are you gonna
> > > configure your database?
> > >
> > > 2012/5/31 Romain Manni-Bucau <rm...@gmail.com>
> > >
> > > > can you have a try in an EJB please? (just try to add @Stateless on
> > your
> > > > managed bean for instance)
> > > >
> > > > can you share a sample easy to run?
> > > >
> > > > - Romain
> > > >
> > > >
> > > > 2012/6/1 José Luis Cetina <ma...@gmail.com>
> > > >
> > > > > Yes, im using JAAS
> > > > >
> > > > > 2012/5/31 Romain Manni-Bucau <rm...@gmail.com>
> > > > >
> > > > > > Hi,
> > > > > >
> > > > > > Do you use jaas?
> > > > > >
> > > > > > - Romain
> > > > > > Le 31 mai 2012 20:14, "José Luis Cetina" <ma...@gmail.com>
> a
> > > > écrit
> > > > > :
> > > > > >
> > > > > > > Hi i have this scenario:
> > > > > > >
> > > > > > > I have a page login.xhtml, this page has a ManagedBean (@Named)
> > > this
> > > > > > > managedbean use the request.login(user,pass) method.
> > > > > > >
> > > > > > > When i do this:
> > > > > > >
> > > > > > > managedbean class:
> > > > > > >
> > > > > > > @Resource
> > > > > > > private EJBContext ejbContext;
> > > > > > > .
> > > > > > > .
> > > > > > > request.login(user,pass);
> > > > > > > String name = ejbContext.getCallerPrincipal().getName();
> > > > > > >
> > > > > > > I get "guest" as my user name. But i expect the name of my user
> > (of
> > > > > > course
> > > > > > > is not guest)
> > > > > > >
> > > > > > > If the login was successful my login page navigate to other
> page
> > > lets
> > > > > say
> > > > > > > pageb.xhtml
> > > > > > >
> > > > > > > If i create a managedbean (@Named) for pageb.xhtml and in that
> > > > > > managedbean
> > > > > > > i use again:
> > > > > > > String name = ejbContext.getCallerPrincipal().getName();
> > > > > > > then, here i get my "correct" name of the user (not guest).
> > > > > > >
> > > > > > > I dont know if this is the desire behaviour or if this happend
> > > > because
> > > > > > the
> > > > > > > http request isnt finished?
> > > > > > >
> > > > > > > other question why if i call
> > > > > > > the  ejbContext.getCallerPrincipal().getName(); before the
> > > > > > request.login()
> > > > > > > method i get again "guest", why not null?
> > > > > > >
> > > > > > > If this question is for tomee(openejb) or tomcat?
> > > > > > >
> > > > > > > Thanks
> > > > > > >
> > > > > > >
> > > > > > >
> > -------------------------------------------------------------------
> > > > > > > *SCJA. José Luis Cetina*
> > > > > > >
> > -------------------------------------------------------------------
> > > > > > >
> > > > > >
> > > > >
> > > > >
> > > > >
> > > > > --
> > > > > -------------------------------------------------------------------
> > > > > *SCJA. José Luis Cetina*
> > > > > -------------------------------------------------------------------
> > > > >
> > > >
> > >
> > >
> > >
> > > --
> > > -------------------------------------------------------------------
> > > *SCJA. José Luis Cetina*
> > > -------------------------------------------------------------------
> > >
> >
>
>
>
> --
> -------------------------------------------------------------------
> *SCJA. José Luis Cetina*
> -------------------------------------------------------------------
>

Re: Guest user

Posted by José Luis Cetina <ma...@gmail.com>.
Sorry, i use DataSourceRealm, i have my user/pass/roles in the DB.



2012/5/31 Romain Manni-Bucau <rm...@gmail.com>

> can't you do it with an embedded one?
>
> well DataSourceRealm doesn't use JAAS by default i think, maybe that's the
> issue
>
> - Romain
>
>
> 2012/6/1 José Luis Cetina <ma...@gmail.com>
>
> > OK, i can create a sample, but i use DataSourceRealm, are you gonna
> > configure your database?
> >
> > 2012/5/31 Romain Manni-Bucau <rm...@gmail.com>
> >
> > > can you have a try in an EJB please? (just try to add @Stateless on
> your
> > > managed bean for instance)
> > >
> > > can you share a sample easy to run?
> > >
> > > - Romain
> > >
> > >
> > > 2012/6/1 José Luis Cetina <ma...@gmail.com>
> > >
> > > > Yes, im using JAAS
> > > >
> > > > 2012/5/31 Romain Manni-Bucau <rm...@gmail.com>
> > > >
> > > > > Hi,
> > > > >
> > > > > Do you use jaas?
> > > > >
> > > > > - Romain
> > > > > Le 31 mai 2012 20:14, "José Luis Cetina" <ma...@gmail.com> a
> > > écrit
> > > > :
> > > > >
> > > > > > Hi i have this scenario:
> > > > > >
> > > > > > I have a page login.xhtml, this page has a ManagedBean (@Named)
> > this
> > > > > > managedbean use the request.login(user,pass) method.
> > > > > >
> > > > > > When i do this:
> > > > > >
> > > > > > managedbean class:
> > > > > >
> > > > > > @Resource
> > > > > > private EJBContext ejbContext;
> > > > > > .
> > > > > > .
> > > > > > request.login(user,pass);
> > > > > > String name = ejbContext.getCallerPrincipal().getName();
> > > > > >
> > > > > > I get "guest" as my user name. But i expect the name of my user
> (of
> > > > > course
> > > > > > is not guest)
> > > > > >
> > > > > > If the login was successful my login page navigate to other page
> > lets
> > > > say
> > > > > > pageb.xhtml
> > > > > >
> > > > > > If i create a managedbean (@Named) for pageb.xhtml and in that
> > > > > managedbean
> > > > > > i use again:
> > > > > > String name = ejbContext.getCallerPrincipal().getName();
> > > > > > then, here i get my "correct" name of the user (not guest).
> > > > > >
> > > > > > I dont know if this is the desire behaviour or if this happend
> > > because
> > > > > the
> > > > > > http request isnt finished?
> > > > > >
> > > > > > other question why if i call
> > > > > > the  ejbContext.getCallerPrincipal().getName(); before the
> > > > > request.login()
> > > > > > method i get again "guest", why not null?
> > > > > >
> > > > > > If this question is for tomee(openejb) or tomcat?
> > > > > >
> > > > > > Thanks
> > > > > >
> > > > > >
> > > > > >
> -------------------------------------------------------------------
> > > > > > *SCJA. José Luis Cetina*
> > > > > >
> -------------------------------------------------------------------
> > > > > >
> > > > >
> > > >
> > > >
> > > >
> > > > --
> > > > -------------------------------------------------------------------
> > > > *SCJA. José Luis Cetina*
> > > > -------------------------------------------------------------------
> > > >
> > >
> >
> >
> >
> > --
> > -------------------------------------------------------------------
> > *SCJA. José Luis Cetina*
> > -------------------------------------------------------------------
> >
>



-- 
-------------------------------------------------------------------
*SCJA. José Luis Cetina*
-------------------------------------------------------------------

Re: Guest user

Posted by Romain Manni-Bucau <rm...@gmail.com>.
can't you do it with an embedded one?

well DataSourceRealm doesn't use JAAS by default i think, maybe that's the
issue

- Romain


2012/6/1 José Luis Cetina <ma...@gmail.com>

> OK, i can create a sample, but i use DataSourceRealm, are you gonna
> configure your database?
>
> 2012/5/31 Romain Manni-Bucau <rm...@gmail.com>
>
> > can you have a try in an EJB please? (just try to add @Stateless on your
> > managed bean for instance)
> >
> > can you share a sample easy to run?
> >
> > - Romain
> >
> >
> > 2012/6/1 José Luis Cetina <ma...@gmail.com>
> >
> > > Yes, im using JAAS
> > >
> > > 2012/5/31 Romain Manni-Bucau <rm...@gmail.com>
> > >
> > > > Hi,
> > > >
> > > > Do you use jaas?
> > > >
> > > > - Romain
> > > > Le 31 mai 2012 20:14, "José Luis Cetina" <ma...@gmail.com> a
> > écrit
> > > :
> > > >
> > > > > Hi i have this scenario:
> > > > >
> > > > > I have a page login.xhtml, this page has a ManagedBean (@Named)
> this
> > > > > managedbean use the request.login(user,pass) method.
> > > > >
> > > > > When i do this:
> > > > >
> > > > > managedbean class:
> > > > >
> > > > > @Resource
> > > > > private EJBContext ejbContext;
> > > > > .
> > > > > .
> > > > > request.login(user,pass);
> > > > > String name = ejbContext.getCallerPrincipal().getName();
> > > > >
> > > > > I get "guest" as my user name. But i expect the name of my user (of
> > > > course
> > > > > is not guest)
> > > > >
> > > > > If the login was successful my login page navigate to other page
> lets
> > > say
> > > > > pageb.xhtml
> > > > >
> > > > > If i create a managedbean (@Named) for pageb.xhtml and in that
> > > > managedbean
> > > > > i use again:
> > > > > String name = ejbContext.getCallerPrincipal().getName();
> > > > > then, here i get my "correct" name of the user (not guest).
> > > > >
> > > > > I dont know if this is the desire behaviour or if this happend
> > because
> > > > the
> > > > > http request isnt finished?
> > > > >
> > > > > other question why if i call
> > > > > the  ejbContext.getCallerPrincipal().getName(); before the
> > > > request.login()
> > > > > method i get again "guest", why not null?
> > > > >
> > > > > If this question is for tomee(openejb) or tomcat?
> > > > >
> > > > > Thanks
> > > > >
> > > > >
> > > > > -------------------------------------------------------------------
> > > > > *SCJA. José Luis Cetina*
> > > > > -------------------------------------------------------------------
> > > > >
> > > >
> > >
> > >
> > >
> > > --
> > > -------------------------------------------------------------------
> > > *SCJA. José Luis Cetina*
> > > -------------------------------------------------------------------
> > >
> >
>
>
>
> --
> -------------------------------------------------------------------
> *SCJA. José Luis Cetina*
> -------------------------------------------------------------------
>

Re: Guest user

Posted by José Luis Cetina <ma...@gmail.com>.
OK, i can create a sample, but i use DataSourceRealm, are you gonna
configure your database?

2012/5/31 Romain Manni-Bucau <rm...@gmail.com>

> can you have a try in an EJB please? (just try to add @Stateless on your
> managed bean for instance)
>
> can you share a sample easy to run?
>
> - Romain
>
>
> 2012/6/1 José Luis Cetina <ma...@gmail.com>
>
> > Yes, im using JAAS
> >
> > 2012/5/31 Romain Manni-Bucau <rm...@gmail.com>
> >
> > > Hi,
> > >
> > > Do you use jaas?
> > >
> > > - Romain
> > > Le 31 mai 2012 20:14, "José Luis Cetina" <ma...@gmail.com> a
> écrit
> > :
> > >
> > > > Hi i have this scenario:
> > > >
> > > > I have a page login.xhtml, this page has a ManagedBean (@Named) this
> > > > managedbean use the request.login(user,pass) method.
> > > >
> > > > When i do this:
> > > >
> > > > managedbean class:
> > > >
> > > > @Resource
> > > > private EJBContext ejbContext;
> > > > .
> > > > .
> > > > request.login(user,pass);
> > > > String name = ejbContext.getCallerPrincipal().getName();
> > > >
> > > > I get "guest" as my user name. But i expect the name of my user (of
> > > course
> > > > is not guest)
> > > >
> > > > If the login was successful my login page navigate to other page lets
> > say
> > > > pageb.xhtml
> > > >
> > > > If i create a managedbean (@Named) for pageb.xhtml and in that
> > > managedbean
> > > > i use again:
> > > > String name = ejbContext.getCallerPrincipal().getName();
> > > > then, here i get my "correct" name of the user (not guest).
> > > >
> > > > I dont know if this is the desire behaviour or if this happend
> because
> > > the
> > > > http request isnt finished?
> > > >
> > > > other question why if i call
> > > > the  ejbContext.getCallerPrincipal().getName(); before the
> > > request.login()
> > > > method i get again "guest", why not null?
> > > >
> > > > If this question is for tomee(openejb) or tomcat?
> > > >
> > > > Thanks
> > > >
> > > >
> > > > -------------------------------------------------------------------
> > > > *SCJA. José Luis Cetina*
> > > > -------------------------------------------------------------------
> > > >
> > >
> >
> >
> >
> > --
> > -------------------------------------------------------------------
> > *SCJA. José Luis Cetina*
> > -------------------------------------------------------------------
> >
>



-- 
-------------------------------------------------------------------
*SCJA. José Luis Cetina*
-------------------------------------------------------------------

Re: Guest user

Posted by Romain Manni-Bucau <rm...@gmail.com>.
can you have a try in an EJB please? (just try to add @Stateless on your
managed bean for instance)

can you share a sample easy to run?

- Romain


2012/6/1 José Luis Cetina <ma...@gmail.com>

> Yes, im using JAAS
>
> 2012/5/31 Romain Manni-Bucau <rm...@gmail.com>
>
> > Hi,
> >
> > Do you use jaas?
> >
> > - Romain
> > Le 31 mai 2012 20:14, "José Luis Cetina" <ma...@gmail.com> a écrit
> :
> >
> > > Hi i have this scenario:
> > >
> > > I have a page login.xhtml, this page has a ManagedBean (@Named) this
> > > managedbean use the request.login(user,pass) method.
> > >
> > > When i do this:
> > >
> > > managedbean class:
> > >
> > > @Resource
> > > private EJBContext ejbContext;
> > > .
> > > .
> > > request.login(user,pass);
> > > String name = ejbContext.getCallerPrincipal().getName();
> > >
> > > I get "guest" as my user name. But i expect the name of my user (of
> > course
> > > is not guest)
> > >
> > > If the login was successful my login page navigate to other page lets
> say
> > > pageb.xhtml
> > >
> > > If i create a managedbean (@Named) for pageb.xhtml and in that
> > managedbean
> > > i use again:
> > > String name = ejbContext.getCallerPrincipal().getName();
> > > then, here i get my "correct" name of the user (not guest).
> > >
> > > I dont know if this is the desire behaviour or if this happend because
> > the
> > > http request isnt finished?
> > >
> > > other question why if i call
> > > the  ejbContext.getCallerPrincipal().getName(); before the
> > request.login()
> > > method i get again "guest", why not null?
> > >
> > > If this question is for tomee(openejb) or tomcat?
> > >
> > > Thanks
> > >
> > >
> > > -------------------------------------------------------------------
> > > *SCJA. José Luis Cetina*
> > > -------------------------------------------------------------------
> > >
> >
>
>
>
> --
> -------------------------------------------------------------------
> *SCJA. José Luis Cetina*
> -------------------------------------------------------------------
>

Re: Guest user

Posted by José Luis Cetina <ma...@gmail.com>.
Yes, im using JAAS

2012/5/31 Romain Manni-Bucau <rm...@gmail.com>

> Hi,
>
> Do you use jaas?
>
> - Romain
> Le 31 mai 2012 20:14, "José Luis Cetina" <ma...@gmail.com> a écrit :
>
> > Hi i have this scenario:
> >
> > I have a page login.xhtml, this page has a ManagedBean (@Named) this
> > managedbean use the request.login(user,pass) method.
> >
> > When i do this:
> >
> > managedbean class:
> >
> > @Resource
> > private EJBContext ejbContext;
> > .
> > .
> > request.login(user,pass);
> > String name = ejbContext.getCallerPrincipal().getName();
> >
> > I get "guest" as my user name. But i expect the name of my user (of
> course
> > is not guest)
> >
> > If the login was successful my login page navigate to other page lets say
> > pageb.xhtml
> >
> > If i create a managedbean (@Named) for pageb.xhtml and in that
> managedbean
> > i use again:
> > String name = ejbContext.getCallerPrincipal().getName();
> > then, here i get my "correct" name of the user (not guest).
> >
> > I dont know if this is the desire behaviour or if this happend because
> the
> > http request isnt finished?
> >
> > other question why if i call
> > the  ejbContext.getCallerPrincipal().getName(); before the
> request.login()
> > method i get again "guest", why not null?
> >
> > If this question is for tomee(openejb) or tomcat?
> >
> > Thanks
> >
> >
> > -------------------------------------------------------------------
> > *SCJA. José Luis Cetina*
> > -------------------------------------------------------------------
> >
>



-- 
-------------------------------------------------------------------
*SCJA. José Luis Cetina*
-------------------------------------------------------------------

Re: Guest user

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

Do you use jaas?

- Romain
Le 31 mai 2012 20:14, "José Luis Cetina" <ma...@gmail.com> a écrit :

> Hi i have this scenario:
>
> I have a page login.xhtml, this page has a ManagedBean (@Named) this
> managedbean use the request.login(user,pass) method.
>
> When i do this:
>
> managedbean class:
>
> @Resource
> private EJBContext ejbContext;
> .
> .
> request.login(user,pass);
> String name = ejbContext.getCallerPrincipal().getName();
>
> I get "guest" as my user name. But i expect the name of my user (of course
> is not guest)
>
> If the login was successful my login page navigate to other page lets say
> pageb.xhtml
>
> If i create a managedbean (@Named) for pageb.xhtml and in that managedbean
> i use again:
> String name = ejbContext.getCallerPrincipal().getName();
> then, here i get my "correct" name of the user (not guest).
>
> I dont know if this is the desire behaviour or if this happend because the
> http request isnt finished?
>
> other question why if i call
> the  ejbContext.getCallerPrincipal().getName(); before the request.login()
> method i get again "guest", why not null?
>
> If this question is for tomee(openejb) or tomcat?
>
> Thanks
>
>
> -------------------------------------------------------------------
> *SCJA. José Luis Cetina*
> -------------------------------------------------------------------
>