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 <maxtorz...@gmail.com>

> Sorry, i use DataSourceRealm, i have my user/pass/roles in the DB.
>
>
>
> 2012/5/31 Romain Manni-Bucau <rmannibu...@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 <maxtorz...@gmail.com>
> >
> > > OK, i can create a sample, but i use DataSourceRealm, are you gonna
> > > configure your database?
> > >
> > > 2012/5/31 Romain Manni-Bucau <rmannibu...@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 <maxtorz...@gmail.com>
> > > >
> > > > > Yes, im using JAAS
> > > > >
> > > > > 2012/5/31 Romain Manni-Bucau <rmannibu...@gmail.com>
> > > > >
> > > > > > Hi,
> > > > > >
> > > > > > Do you use jaas?
> > > > > >
> > > > > > - Romain
> > > > > > Le 31 mai 2012 20:14, "José Luis Cetina" <maxtorz...@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*
> -------------------------------------------------------------------
>

Reply via email to