You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by ignicolist <ig...@gmail.com> on 2007/08/08 13:30:13 UTC

JSF Authentication

Hi,  i need some help, i have a aplication in jsf, with a sql database using
hibernate, and i want implement a login and logout, but i dont know how, i
google much, but all the solutions are so complicated. so i have a example
with a filter, and a put that filter block the pages for non log users, but
i dont know the sufs about sessions and so on... anyone have some example
working for i use in my aplication? 

I just want a simple login logout example, using a filter for sessions. 


Tks for all the help...
-- 
View this message in context: http://www.nabble.com/JSF-Authentication-tf4235729.html#a12051322
Sent from the MyFaces - Users mailing list archive at Nabble.com.


Re: JSF Authentication

Posted by ignicolist <ig...@gmail.com>.
Ok tks! for the help! 



Martin Ahrer wrote:
> 
> Have you been thinking of using the Spring based security framework called
> acegi. Even form based authentication can be done with minimal efforts.
> And if you are familiar with Spring it's even simpler! Check their web
> site at http://www.acegisecurity.org/ If you should need help with this I
> can help.
> 
> Martin - http://www.martinahrer.at/blog/
> 
> 
> 
> ignicolist wrote:
>> 
>> Hi,  i need some help, i have a aplication in jsf, with a sql database
>> using hibernate, and i want implement a login and logout, but i dont know
>> how, i google much, but all the solutions are so complicated. so i have a
>> example with a filter, and a put that filter block the pages for non log
>> users, but i dont know the sufs about sessions and so on... anyone have
>> some example working for i use in my aplication? 
>> 
>> I just want a simple login logout example, using a filter for sessions. 
>> 
>> Tks for all the help...
>> 
> 
> 

-- 
View this message in context: http://www.nabble.com/JSF-Authentication-tf4235729.html#a12061776
Sent from the MyFaces - Users mailing list archive at Nabble.com.


Re: JSF Authentication

Posted by Martin Ahrer <ma...@gmx.at>.
Have you been thinking of using the Spring based security framework called
acegi. Even form based authentication can be done with minimal efforts. And
if you are familiar with Spring it's even simpler! Check their web site at
http://www.acegisecurity.org/ If you should need help with this I can help.

Martin - http://www.martinahrer.at/blog/



ignicolist wrote:
> 
> Hi,  i need some help, i have a aplication in jsf, with a sql database
> using hibernate, and i want implement a login and logout, but i dont know
> how, i google much, but all the solutions are so complicated. so i have a
> example with a filter, and a put that filter block the pages for non log
> users, but i dont know the sufs about sessions and so on... anyone have
> some example working for i use in my aplication? 
> 
> I just want a simple login logout example, using a filter for sessions. 
> 
> Tks for all the help...
> 

-- 
View this message in context: http://www.nabble.com/JSF-Authentication-tf4235729.html#a12060735
Sent from the MyFaces - Users mailing list archive at Nabble.com.


Re: JSF Authentication

Posted by Luka Surija <lu...@iytim.hr>.
Perhaps, with PhaseListener:

public class AuthenticationPhaseListener implements PhaseListener {
   
    /** Creates a new instance of AuthenticationPhaseListener */
    public AuthenticationPhaseListener() {
    }

    public void afterPhase(PhaseEvent phaseEvent) {       
        FacesContext context = phaseEvent.getFacesContext();
        if(userLoged(context))
            return;
       
        String path=context.getViewRoot().getViewId();
        if(!"/login.xhtml".equals(path)){
            context.responseComplete();
            
context.getApplication().getNavigationHandler().handleNavigation(context,null,navigate_to_login_screen);
           
        }
           
       
    }

    public void beforePhase(PhaseEvent phaseEvent) {
    }

    public PhaseId getPhaseId() {
        return PhaseId.RESTORE_VIEW;
    }

    private boolean userLoged(FacesContext context) {
        
if(context.getExternalContext().getSessionMap().get("logedUser")!=null)
            return true;
        else
            return false;
    }
   
}

ignicolist wrote:
> Hi,  i need some help, i have a aplication in jsf, with a sql database using
> hibernate, and i want implement a login and logout, but i dont know how, i
> google much, but all the solutions are so complicated. so i have a example
> with a filter, and a put that filter block the pages for non log users, but
> i dont know the sufs about sessions and so on... anyone have some example
> working for i use in my aplication? 
>
> I just want a simple login logout example, using a filter for sessions. 
>
>
> Tks for all the help...
>   


Re: JSF Authentication

Posted by ignicolist <ig...@gmail.com>.
ok i will try! 

Tks

Michał 'Gandalf' Stawicki wrote:
> 
> Write a bean to store login info and use PhaseListener to check if
> user is logged in if he wants to access pages that need hi to be
> logged in, and redirect to login page if he is not.
> 
> there were some good articles describing this approach. unfortunately
> I can't share my code.
> 
> 
> On 08/08/07, ignicolist <ig...@gmail.com> wrote:
>>
>> is if you could send to me i would apreciate very much.
>>
>> TKS
>>
>>
>> Anton Gavazuk wrote:
>> >
>> > What you mean  - "filter for sessions"?
>> > I can send you some pieces of my own app with login\logut funcs
>> >
>> > 2007/8/8, ignicolist <ig...@gmail.com>:
>> >>
>> >>
>> >> Hi,  i need some help, i have a aplication in jsf, with a sql database
>> >> using
>> >> hibernate, and i want implement a login and logout, but i dont know
>> how,
>> >> i
>> >> google much, but all the solutions are so complicated. so i have a
>> >> example
>> >> with a filter, and a put that filter block the pages for non log
>> users,
>> >> but
>> >> i dont know the sufs about sessions and so on... anyone have some
>> example
>> >> working for i use in my aplication?
>> >>
>> >> I just want a simple login logout example, using a filter for
>> sessions.
>> >>
>> >>
>> >> Tks for all the help...
>> >> --
>> >> View this message in context:
>> >> http://www.nabble.com/JSF-Authentication-tf4235729.html#a12051322
>> >> Sent from the MyFaces - Users mailing list archive at Nabble.com.
>> >>
>> >>
>> >
>> >
>>
>> --
>> View this message in context:
>> http://www.nabble.com/JSF-Authentication-tf4235729.html#a12053317
>> Sent from the MyFaces - Users mailing list archive at Nabble.com.
>>
>>
> 
> 
> -- 
> Michał Stawicki
> 
> stawicki@gmail.com
> http://stawicki.jasliska.pl
> 
> 

-- 
View this message in context: http://www.nabble.com/JSF-Authentication-tf4235729.html#a12054062
Sent from the MyFaces - Users mailing list archive at Nabble.com.


Re: JSF Authentication

Posted by ignicolist <ig...@gmail.com>.
Tks for the help. i will try this aproach.


Anton Gavazuk wrote:
> 
> My approach - maybe you will find some errors.
> 
> Simple JSF Bean
> public class LoginBean extends BaseBean {
> 
>     private String login;
>     private String password;
>     private String lang;
> 
>     public String getLogin() {
>         return login;
>     }
> 
>     public void setLogin(final String login) {
>         this.login = login;
>     }
> 
>     public String getPassword() {
>         return password;
>     }
> 
>     public void setPassword(final String password) {
>         this.password = password;
>     }
> 
>     public String getLang() {
>         return lang;
>     }
> 
>     public void setLang(final String lang) {
>         this.lang = lang;
>     }
> 
>     /**
>      *
>      * @return
>      */
>     public String loginProcess() {
>         log.debug("loginProcess()");
>         String result = "error";
>         try {
>             ServiceLocator loc = ServiceLocator.getInstance();
>             IUserManager man = (IUserManager) loc
>                     .getObject(ServiceLocator.USER_MANAGER);
>             SystemUser user = man
>                     .loginUser(this.getLogin(), this.getPassword());
>             CurrentUserInfoBean cur = getCurrentUser();
> 
>             cur.setUserLogin(user.getLogin());
>             cur.setUserId(user.getId());
>             cur.setCurrentHotel(man.getLastHotel(user.getId()).getId());
>             cur.setWhenLoggedIn(new Date());
>             return "success";
> 
>         } catch (Exception ex) {
>             log.error(ex);
>             addLoginNotFoundMessage();
>         }
>         return result;
>     }
> 
> Snippet from BaseBean
> 
>    public CurrentUserInfoBean getCurrentUser() {
>         log.debug("getCurrentUser()");
>         Object o =
> getApplication().createValueBinding("#{currentUserInfo}")
>                 .getValue(getFacesContext());
>         if (o == null) {
>             CurrentUserInfoBean bean = new CurrentUserInfoBean();
>             updateCurrentUserInfoBean(bean);
>         }
>         return (CurrentUserInfoBean) getApplication().createValueBinding(
>                 "#{currentUserInfo}").getValue(getFacesContext());
>     }
> 
>     /**
>      *
>      * @param bean
>      */
>     public void updateCurrentUserInfoBean(final CurrentUserInfoBean bean)
> {
>         log.debug("updateCurrentUserInfoBean() param :" + bean);
>        
> getApplication().createValueBinding("#{currentUserInfo}").setValue(
>                 getFacesContext(), bean);
>     }
> 
> And faces-config.xml
> <managed-bean>
>         <managed-bean-name>currentUserInfo</managed-bean-name>
>         <managed-bean-class>com.hms.view.bean.session.CurrentUserInfoBean
> </managed-bean-class>
>         <managed-bean-scope>session</managed-bean-scope>
>     </managed-bean>
> 
> 
> 
> How I use PhaseListener
> 
> public void afterPhase(PhaseEvent phaseEvent) {
>         log.debug("AfterPhase working");
>         FacesContext fc = phaseEvent.getFacesContext();
>         boolean loginPage =
> fc.getViewRoot().getViewId().lastIndexOf("login")
>> -1 ? true
>                 : false;
>         if (!loginPage && !SessionUtils.isUserLoggedIn()) {
>             log.debug("User is not logged - redirecting to login page");
>             NavigationHandler nh = fc.getApplication
> ().getNavigationHandler();
>             nh.handleNavigation(fc, null, "notLogged");
>         } else {
>             log.debug("User is logged in - go to page "
>                     + fc.getViewRoot().getViewId());
>         }
>         log.debug(fc);
>     }
> 
> 
> 2007/8/8, Michał 'Gandalf' Stawicki <st...@gmail.com>:
>>
>> Write a bean to store login info and use PhaseListener to check if
>> user is logged in if he wants to access pages that need hi to be
>> logged in, and redirect to login page if he is not.
>>
>> there were some good articles describing this approach. unfortunately
>> I can't share my code.
>>
>>
>> On 08/08/07, ignicolist <ig...@gmail.com> wrote:
>> >
>> > is if you could send to me i would apreciate very much.
>> >
>> > TKS
>> >
>> >
>> > Anton Gavazuk wrote:
>> > >
>> > > What you mean  - "filter for sessions"?
>> > > I can send you some pieces of my own app with login\logut funcs
>> > >
>> > > 2007/8/8, ignicolist <ig...@gmail.com>:
>> > >>
>> > >>
>> > >> Hi,  i need some help, i have a aplication in jsf, with a sql
>> database
>> > >> using
>> > >> hibernate, and i want implement a login and logout, but i dont know
>> how,
>> > >> i
>> > >> google much, but all the solutions are so complicated. so i have a
>> > >> example
>> > >> with a filter, and a put that filter block the pages for non log
>> users,
>> > >> but
>> > >> i dont know the sufs about sessions and so on... anyone have some
>> example
>> > >> working for i use in my aplication?
>> > >>
>> > >> I just want a simple login logout example, using a filter for
>> sessions.
>> > >>
>> > >>
>> > >> Tks for all the help...
>> > >> --
>> > >> View this message in context:
>> > >> http://www.nabble.com/JSF-Authentication-tf4235729.html#a12051322
>> > >> Sent from the MyFaces - Users mailing list archive at Nabble.com.
>> > >>
>> > >>
>> > >
>> > >
>> >
>> > --
>> > View this message in context:
>> http://www.nabble.com/JSF-Authentication-tf4235729.html#a12053317
>> > Sent from the MyFaces - Users mailing list archive at Nabble.com.
>> >
>> >
>>
>>
>> --
>> Michał Stawicki
>>
>> stawicki@gmail.com
>> http://stawicki.jasliska.pl
>>
> 
> 

-- 
View this message in context: http://www.nabble.com/JSF-Authentication-tf4235729.html#a12054521
Sent from the MyFaces - Users mailing list archive at Nabble.com.


Re: JSF Authentication

Posted by Anton Gavazuk <an...@gmail.com>.
You put in the method the logic, which define, loggid user or not - for
example, check an atrib in session

2007/8/15, Ronald <rj...@googlemail.com>:
>
>
> hi, this looks like something i am looking for.
> What does the code for SessionUtils.isUserLoggedIn()
> look like?
>
> cheers,
>
> RJ
>
>
>
> Anton Gavazuk wrote:
> >
> > My approach - maybe you will find some errors.
> >
> > Simple JSF Bean
> > public class LoginBean extends BaseBean {
> >
> >     private String login;
> >     private String password;
> >     private String lang;
> >
> >     public String getLogin() {
> >         return login;
> >     }
> >
> >     public void setLogin(final String login) {
> >         this.login = login;
> >     }
> >
> >     public String getPassword() {
> >         return password;
> >     }
> >
> >     public void setPassword(final String password) {
> >         this.password = password;
> >     }
> >
> >     public String getLang() {
> >         return lang;
> >     }
> >
> >     public void setLang(final String lang) {
> >         this.lang = lang;
> >     }
> >
> >     /**
> >      *
> >      * @return
> >      */
> >     public String loginProcess() {
> >         log.debug("loginProcess()");
> >         String result = "error";
> >         try {
> >             ServiceLocator loc = ServiceLocator.getInstance();
> >             IUserManager man = (IUserManager) loc
> >                     .getObject(ServiceLocator.USER_MANAGER);
> >             SystemUser user = man
> >                     .loginUser(this.getLogin(), this.getPassword());
> >             CurrentUserInfoBean cur = getCurrentUser();
> >
> >             cur.setUserLogin(user.getLogin());
> >             cur.setUserId(user.getId());
> >             cur.setCurrentHotel(man.getLastHotel(user.getId()).getId());
> >             cur.setWhenLoggedIn(new Date());
> >             return "success";
> >
> >         } catch (Exception ex) {
> >             log.error(ex);
> >             addLoginNotFoundMessage();
> >         }
> >         return result;
> >     }
> >
> > Snippet from BaseBean
> >
> >    public CurrentUserInfoBean getCurrentUser() {
> >         log.debug("getCurrentUser()");
> >         Object o =
> > getApplication().createValueBinding("#{currentUserInfo}")
> >                 .getValue(getFacesContext());
> >         if (o == null) {
> >             CurrentUserInfoBean bean = new CurrentUserInfoBean();
> >             updateCurrentUserInfoBean(bean);
> >         }
> >         return (CurrentUserInfoBean)
> getApplication().createValueBinding(
> >                 "#{currentUserInfo}").getValue(getFacesContext());
> >     }
> >
> >     /**
> >      *
> >      * @param bean
> >      */
> >     public void updateCurrentUserInfoBean(final CurrentUserInfoBean
> bean)
> > {
> >         log.debug("updateCurrentUserInfoBean() param :" + bean);
> >
> > getApplication().createValueBinding("#{currentUserInfo}").setValue(
> >                 getFacesContext(), bean);
> >     }
> >
> > And faces-config.xml
> > <managed-bean>
> >         <managed-bean-name>currentUserInfo</managed-bean-name>
> >         <managed-bean-class>
> com.hms.view.bean.session.CurrentUserInfoBean
> > </managed-bean-class>
> >         <managed-bean-scope>session</managed-bean-scope>
> >     </managed-bean>
> >
> >
> >
> > How I use PhaseListener
> >
> > public void afterPhase(PhaseEvent phaseEvent) {
> >         log.debug("AfterPhase working");
> >         FacesContext fc = phaseEvent.getFacesContext();
> >         boolean loginPage =
> > fc.getViewRoot().getViewId().lastIndexOf("login")
> >> -1 ? true
> >                 : false;
> >         if (!loginPage && !SessionUtils.isUserLoggedIn()) {
> >             log.debug("User is not logged - redirecting to login page");
> >             NavigationHandler nh = fc.getApplication
> > ().getNavigationHandler();
> >             nh.handleNavigation(fc, null, "notLogged");
> >         } else {
> >             log.debug("User is logged in - go to page "
> >                     + fc.getViewRoot().getViewId());
> >         }
> >         log.debug(fc);
> >     }
> >
> >
> > 2007/8/8, Michał 'Gandalf' Stawicki <st...@gmail.com>:
> >>
> >> Write a bean to store login info and use PhaseListener to check if
> >> user is logged in if he wants to access pages that need hi to be
> >> logged in, and redirect to login page if he is not.
> >>
> >> there were some good articles describing this approach. unfortunately
> >> I can't share my code.
> >>
> >>
> >> On 08/08/07, ignicolist <ig...@gmail.com> wrote:
> >> >
> >> > is if you could send to me i would apreciate very much.
> >> >
> >> > TKS
> >> >
> >> >
> >> > Anton Gavazuk wrote:
> >> > >
> >> > > What you mean  - "filter for sessions"?
> >> > > I can send you some pieces of my own app with login\logut funcs
> >> > >
> >> > > 2007/8/8, ignicolist <ig...@gmail.com>:
> >> > >>
> >> > >>
> >> > >> Hi,  i need some help, i have a aplication in jsf, with a sql
> >> database
> >> > >> using
> >> > >> hibernate, and i want implement a login and logout, but i dont
> know
> >> how,
> >> > >> i
> >> > >> google much, but all the solutions are so complicated. so i have a
> >> > >> example
> >> > >> with a filter, and a put that filter block the pages for non log
> >> users,
> >> > >> but
> >> > >> i dont know the sufs about sessions and so on... anyone have some
> >> example
> >> > >> working for i use in my aplication?
> >> > >>
> >> > >> I just want a simple login logout example, using a filter for
> >> sessions.
> >> > >>
> >> > >>
> >> > >> Tks for all the help...
> >> > >> --
> >> > >> View this message in context:
> >> > >> http://www.nabble.com/JSF-Authentication-tf4235729.html#a12051322
> >> > >> Sent from the MyFaces - Users mailing list archive at Nabble.com.
> >> > >>
> >> > >>
> >> > >
> >> > >
> >> >
> >> > --
> >> > View this message in context:
> >> http://www.nabble.com/JSF-Authentication-tf4235729.html#a12053317
> >> > Sent from the MyFaces - Users mailing list archive at Nabble.com.
> >> >
> >> >
> >>
> >>
> >> --
> >> Michał Stawicki
> >>
> >> stawicki@gmail.com
> >> http://stawicki.jasliska.pl
> >>
> >
> >
>
> --
> View this message in context:
> http://www.nabble.com/JSF-Authentication-tf4235729.html#a12160834
> Sent from the MyFaces - Users mailing list archive at Nabble.com.
>
>

Re: JSF Authentication

Posted by Ronald <rj...@googlemail.com>.
hi, this looks like something i am looking for.
What does the code for SessionUtils.isUserLoggedIn()
look like?

cheers,

RJ



Anton Gavazuk wrote:
> 
> My approach - maybe you will find some errors.
> 
> Simple JSF Bean
> public class LoginBean extends BaseBean {
> 
>     private String login;
>     private String password;
>     private String lang;
> 
>     public String getLogin() {
>         return login;
>     }
> 
>     public void setLogin(final String login) {
>         this.login = login;
>     }
> 
>     public String getPassword() {
>         return password;
>     }
> 
>     public void setPassword(final String password) {
>         this.password = password;
>     }
> 
>     public String getLang() {
>         return lang;
>     }
> 
>     public void setLang(final String lang) {
>         this.lang = lang;
>     }
> 
>     /**
>      *
>      * @return
>      */
>     public String loginProcess() {
>         log.debug("loginProcess()");
>         String result = "error";
>         try {
>             ServiceLocator loc = ServiceLocator.getInstance();
>             IUserManager man = (IUserManager) loc
>                     .getObject(ServiceLocator.USER_MANAGER);
>             SystemUser user = man
>                     .loginUser(this.getLogin(), this.getPassword());
>             CurrentUserInfoBean cur = getCurrentUser();
> 
>             cur.setUserLogin(user.getLogin());
>             cur.setUserId(user.getId());
>             cur.setCurrentHotel(man.getLastHotel(user.getId()).getId());
>             cur.setWhenLoggedIn(new Date());
>             return "success";
> 
>         } catch (Exception ex) {
>             log.error(ex);
>             addLoginNotFoundMessage();
>         }
>         return result;
>     }
> 
> Snippet from BaseBean
> 
>    public CurrentUserInfoBean getCurrentUser() {
>         log.debug("getCurrentUser()");
>         Object o =
> getApplication().createValueBinding("#{currentUserInfo}")
>                 .getValue(getFacesContext());
>         if (o == null) {
>             CurrentUserInfoBean bean = new CurrentUserInfoBean();
>             updateCurrentUserInfoBean(bean);
>         }
>         return (CurrentUserInfoBean) getApplication().createValueBinding(
>                 "#{currentUserInfo}").getValue(getFacesContext());
>     }
> 
>     /**
>      *
>      * @param bean
>      */
>     public void updateCurrentUserInfoBean(final CurrentUserInfoBean bean)
> {
>         log.debug("updateCurrentUserInfoBean() param :" + bean);
>        
> getApplication().createValueBinding("#{currentUserInfo}").setValue(
>                 getFacesContext(), bean);
>     }
> 
> And faces-config.xml
> <managed-bean>
>         <managed-bean-name>currentUserInfo</managed-bean-name>
>         <managed-bean-class>com.hms.view.bean.session.CurrentUserInfoBean
> </managed-bean-class>
>         <managed-bean-scope>session</managed-bean-scope>
>     </managed-bean>
> 
> 
> 
> How I use PhaseListener
> 
> public void afterPhase(PhaseEvent phaseEvent) {
>         log.debug("AfterPhase working");
>         FacesContext fc = phaseEvent.getFacesContext();
>         boolean loginPage =
> fc.getViewRoot().getViewId().lastIndexOf("login")
>> -1 ? true
>                 : false;
>         if (!loginPage && !SessionUtils.isUserLoggedIn()) {
>             log.debug("User is not logged - redirecting to login page");
>             NavigationHandler nh = fc.getApplication
> ().getNavigationHandler();
>             nh.handleNavigation(fc, null, "notLogged");
>         } else {
>             log.debug("User is logged in - go to page "
>                     + fc.getViewRoot().getViewId());
>         }
>         log.debug(fc);
>     }
> 
> 
> 2007/8/8, Michał 'Gandalf' Stawicki <st...@gmail.com>:
>>
>> Write a bean to store login info and use PhaseListener to check if
>> user is logged in if he wants to access pages that need hi to be
>> logged in, and redirect to login page if he is not.
>>
>> there were some good articles describing this approach. unfortunately
>> I can't share my code.
>>
>>
>> On 08/08/07, ignicolist <ig...@gmail.com> wrote:
>> >
>> > is if you could send to me i would apreciate very much.
>> >
>> > TKS
>> >
>> >
>> > Anton Gavazuk wrote:
>> > >
>> > > What you mean  - "filter for sessions"?
>> > > I can send you some pieces of my own app with login\logut funcs
>> > >
>> > > 2007/8/8, ignicolist <ig...@gmail.com>:
>> > >>
>> > >>
>> > >> Hi,  i need some help, i have a aplication in jsf, with a sql
>> database
>> > >> using
>> > >> hibernate, and i want implement a login and logout, but i dont know
>> how,
>> > >> i
>> > >> google much, but all the solutions are so complicated. so i have a
>> > >> example
>> > >> with a filter, and a put that filter block the pages for non log
>> users,
>> > >> but
>> > >> i dont know the sufs about sessions and so on... anyone have some
>> example
>> > >> working for i use in my aplication?
>> > >>
>> > >> I just want a simple login logout example, using a filter for
>> sessions.
>> > >>
>> > >>
>> > >> Tks for all the help...
>> > >> --
>> > >> View this message in context:
>> > >> http://www.nabble.com/JSF-Authentication-tf4235729.html#a12051322
>> > >> Sent from the MyFaces - Users mailing list archive at Nabble.com.
>> > >>
>> > >>
>> > >
>> > >
>> >
>> > --
>> > View this message in context:
>> http://www.nabble.com/JSF-Authentication-tf4235729.html#a12053317
>> > Sent from the MyFaces - Users mailing list archive at Nabble.com.
>> >
>> >
>>
>>
>> --
>> Michał Stawicki
>>
>> stawicki@gmail.com
>> http://stawicki.jasliska.pl
>>
> 
> 

-- 
View this message in context: http://www.nabble.com/JSF-Authentication-tf4235729.html#a12160834
Sent from the MyFaces - Users mailing list archive at Nabble.com.


Re: JSF Authentication

Posted by Anton Gavazuk <an...@gmail.com>.
My approach - maybe you will find some errors.

Simple JSF Bean
public class LoginBean extends BaseBean {

    private String login;
    private String password;
    private String lang;

    public String getLogin() {
        return login;
    }

    public void setLogin(final String login) {
        this.login = login;
    }

    public String getPassword() {
        return password;
    }

    public void setPassword(final String password) {
        this.password = password;
    }

    public String getLang() {
        return lang;
    }

    public void setLang(final String lang) {
        this.lang = lang;
    }

    /**
     *
     * @return
     */
    public String loginProcess() {
        log.debug("loginProcess()");
        String result = "error";
        try {
            ServiceLocator loc = ServiceLocator.getInstance();
            IUserManager man = (IUserManager) loc
                    .getObject(ServiceLocator.USER_MANAGER);
            SystemUser user = man
                    .loginUser(this.getLogin(), this.getPassword());
            CurrentUserInfoBean cur = getCurrentUser();

            cur.setUserLogin(user.getLogin());
            cur.setUserId(user.getId());
            cur.setCurrentHotel(man.getLastHotel(user.getId()).getId());
            cur.setWhenLoggedIn(new Date());
            return "success";

        } catch (Exception ex) {
            log.error(ex);
            addLoginNotFoundMessage();
        }
        return result;
    }

Snippet from BaseBean

   public CurrentUserInfoBean getCurrentUser() {
        log.debug("getCurrentUser()");
        Object o = getApplication().createValueBinding("#{currentUserInfo}")
                .getValue(getFacesContext());
        if (o == null) {
            CurrentUserInfoBean bean = new CurrentUserInfoBean();
            updateCurrentUserInfoBean(bean);
        }
        return (CurrentUserInfoBean) getApplication().createValueBinding(
                "#{currentUserInfo}").getValue(getFacesContext());
    }

    /**
     *
     * @param bean
     */
    public void updateCurrentUserInfoBean(final CurrentUserInfoBean bean) {
        log.debug("updateCurrentUserInfoBean() param :" + bean);
        getApplication().createValueBinding("#{currentUserInfo}").setValue(
                getFacesContext(), bean);
    }

And faces-config.xml
<managed-bean>
        <managed-bean-name>currentUserInfo</managed-bean-name>
        <managed-bean-class>com.hms.view.bean.session.CurrentUserInfoBean
</managed-bean-class>
        <managed-bean-scope>session</managed-bean-scope>
    </managed-bean>



How I use PhaseListener

public void afterPhase(PhaseEvent phaseEvent) {
        log.debug("AfterPhase working");
        FacesContext fc = phaseEvent.getFacesContext();
        boolean loginPage = fc.getViewRoot().getViewId().lastIndexOf("login")
> -1 ? true
                : false;
        if (!loginPage && !SessionUtils.isUserLoggedIn()) {
            log.debug("User is not logged - redirecting to login page");
            NavigationHandler nh = fc.getApplication
().getNavigationHandler();
            nh.handleNavigation(fc, null, "notLogged");
        } else {
            log.debug("User is logged in - go to page "
                    + fc.getViewRoot().getViewId());
        }
        log.debug(fc);
    }


2007/8/8, Michał 'Gandalf' Stawicki <st...@gmail.com>:
>
> Write a bean to store login info and use PhaseListener to check if
> user is logged in if he wants to access pages that need hi to be
> logged in, and redirect to login page if he is not.
>
> there were some good articles describing this approach. unfortunately
> I can't share my code.
>
>
> On 08/08/07, ignicolist <ig...@gmail.com> wrote:
> >
> > is if you could send to me i would apreciate very much.
> >
> > TKS
> >
> >
> > Anton Gavazuk wrote:
> > >
> > > What you mean  - "filter for sessions"?
> > > I can send you some pieces of my own app with login\logut funcs
> > >
> > > 2007/8/8, ignicolist <ig...@gmail.com>:
> > >>
> > >>
> > >> Hi,  i need some help, i have a aplication in jsf, with a sql
> database
> > >> using
> > >> hibernate, and i want implement a login and logout, but i dont know
> how,
> > >> i
> > >> google much, but all the solutions are so complicated. so i have a
> > >> example
> > >> with a filter, and a put that filter block the pages for non log
> users,
> > >> but
> > >> i dont know the sufs about sessions and so on... anyone have some
> example
> > >> working for i use in my aplication?
> > >>
> > >> I just want a simple login logout example, using a filter for
> sessions.
> > >>
> > >>
> > >> Tks for all the help...
> > >> --
> > >> View this message in context:
> > >> http://www.nabble.com/JSF-Authentication-tf4235729.html#a12051322
> > >> Sent from the MyFaces - Users mailing list archive at Nabble.com.
> > >>
> > >>
> > >
> > >
> >
> > --
> > View this message in context:
> http://www.nabble.com/JSF-Authentication-tf4235729.html#a12053317
> > Sent from the MyFaces - Users mailing list archive at Nabble.com.
> >
> >
>
>
> --
> Michał Stawicki
>
> stawicki@gmail.com
> http://stawicki.jasliska.pl
>

Re: JSF Authentication

Posted by Michał 'Gandalf' Stawicki <st...@gmail.com>.
Write a bean to store login info and use PhaseListener to check if
user is logged in if he wants to access pages that need hi to be
logged in, and redirect to login page if he is not.

there were some good articles describing this approach. unfortunately
I can't share my code.


On 08/08/07, ignicolist <ig...@gmail.com> wrote:
>
> is if you could send to me i would apreciate very much.
>
> TKS
>
>
> Anton Gavazuk wrote:
> >
> > What you mean  - "filter for sessions"?
> > I can send you some pieces of my own app with login\logut funcs
> >
> > 2007/8/8, ignicolist <ig...@gmail.com>:
> >>
> >>
> >> Hi,  i need some help, i have a aplication in jsf, with a sql database
> >> using
> >> hibernate, and i want implement a login and logout, but i dont know how,
> >> i
> >> google much, but all the solutions are so complicated. so i have a
> >> example
> >> with a filter, and a put that filter block the pages for non log users,
> >> but
> >> i dont know the sufs about sessions and so on... anyone have some example
> >> working for i use in my aplication?
> >>
> >> I just want a simple login logout example, using a filter for sessions.
> >>
> >>
> >> Tks for all the help...
> >> --
> >> View this message in context:
> >> http://www.nabble.com/JSF-Authentication-tf4235729.html#a12051322
> >> Sent from the MyFaces - Users mailing list archive at Nabble.com.
> >>
> >>
> >
> >
>
> --
> View this message in context: http://www.nabble.com/JSF-Authentication-tf4235729.html#a12053317
> Sent from the MyFaces - Users mailing list archive at Nabble.com.
>
>


-- 
Michał Stawicki

stawicki@gmail.com
http://stawicki.jasliska.pl

Re: JSF Authentication

Posted by ignicolist <ig...@gmail.com>.
is if you could send to me i would apreciate very much. 

TKS   


Anton Gavazuk wrote:
> 
> What you mean  - "filter for sessions"?
> I can send you some pieces of my own app with login\logut funcs
> 
> 2007/8/8, ignicolist <ig...@gmail.com>:
>>
>>
>> Hi,  i need some help, i have a aplication in jsf, with a sql database
>> using
>> hibernate, and i want implement a login and logout, but i dont know how,
>> i
>> google much, but all the solutions are so complicated. so i have a
>> example
>> with a filter, and a put that filter block the pages for non log users,
>> but
>> i dont know the sufs about sessions and so on... anyone have some example
>> working for i use in my aplication?
>>
>> I just want a simple login logout example, using a filter for sessions.
>>
>>
>> Tks for all the help...
>> --
>> View this message in context:
>> http://www.nabble.com/JSF-Authentication-tf4235729.html#a12051322
>> Sent from the MyFaces - Users mailing list archive at Nabble.com.
>>
>>
> 
> 

-- 
View this message in context: http://www.nabble.com/JSF-Authentication-tf4235729.html#a12053317
Sent from the MyFaces - Users mailing list archive at Nabble.com.


Re: JSF Authentication

Posted by Anton Gavazuk <an...@gmail.com>.
What you mean  - "filter for sessions"?
I can send you some pieces of my own app with login\logut funcs

2007/8/8, ignicolist <ig...@gmail.com>:
>
>
> Hi,  i need some help, i have a aplication in jsf, with a sql database
> using
> hibernate, and i want implement a login and logout, but i dont know how, i
> google much, but all the solutions are so complicated. so i have a example
> with a filter, and a put that filter block the pages for non log users,
> but
> i dont know the sufs about sessions and so on... anyone have some example
> working for i use in my aplication?
>
> I just want a simple login logout example, using a filter for sessions.
>
>
> Tks for all the help...
> --
> View this message in context:
> http://www.nabble.com/JSF-Authentication-tf4235729.html#a12051322
> Sent from the MyFaces - Users mailing list archive at Nabble.com.
>
>

RE: JSF Authentication

Posted by "Kito D. Mann" <km...@virtua.com>.
Thanks!

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Kito D. Mann - Author, JavaServer Faces in Action
http://www.virtua.com - JSF/Java EE consulting, training, and mentoring
http://www.JSFCentral.com - JavaServer Faces FAQ, news, and info

* Sign up for the JSF Central newsletter! http://oi.vresp.com/?fid=ac048d0e17 *


> -----Original Message-----
> From: ignicolist [mailto:ignicolist@gmail.com]
> Sent: Wednesday, August 08, 2007 1:12 PM
> To: users@myfaces.apache.org
> Subject: RE: JSF Authentication
> 
> 
> Tks kito, and good Book You write. Congr!
> 
> 
> kito99 wrote:
> >
> >
> >> -----Original Message-----
> >> From: ignicolist [mailto:ignicolist@gmail.com]
> >> Sent: Wednesday, August 08, 2007 10:28 AM
> >> To: users@myfaces.apache.org
> >> Subject: RE: JSF Authentication
> >>
> >>
> >> My way is like in the book: JavaServer Faces JSF in Action Manning i
> >> think
> >> its a good solution but i dont know how to put the example in the
> book
> >> in my
> >> aplication.
> >>
> >
> > The book uses the filter approach, but the PhaseListener approach is
> fine
> > if the only resources you want to authorize are JSF views. You can
> get a
> > revised version of the book's case study app (that uses Spring and
> > Hibernate) from http://code.google.com/p/projecttrack/. It doesn't
> include
> > a PhaseListener example, but the code is pretty similar (I can send
> it to
> > you off-line if you're interested).
> >
> > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> > Kito D. Mann - Author, JavaServer Faces in Action
> > http://www.virtua.com - JSF/Java EE consulting, training, and
> mentoring
> > http://www.JSFCentral.com - JavaServer Faces FAQ, news, and info
> >
> > * Sign up for the JSF Central newsletter!
> > http://oi.vresp.com/?fid=ac048d0e17 *
> >
> >>
> >>
> >> hatrang wrote:
> >> >
> >> > Is your way like the one in the JSF: the complete reference book?
> I
> >> > haven't tried it yet, but I prefer this one than the filter thing.
> >> >
> >> > -----Original Message-----
> >> > From: Michał 'Gandalf' Stawicki [mailto:stawicki@gmail.com]
> >> > Sent: Wednesday, August 08, 2007 10:01 AM
> >> > To: MyFaces Discussion
> >> > Subject: Re: JSF Authentication
> >> >
> >> > Write a bean to store login info and use PhaseListener to check if
> >> > user is logged in if he wants to access pages that need hi to be
> >> > logged in, and redirect to login page if he is not.
> >> >
> >> > there were some good articles describing this approach.
> unfortunately
> >> > I can't share my code.
> >> >
> >> >
> >> > On 08/08/07, ignicolist <ig...@gmail.com> wrote:
> >> >>
> >> >> is if you could send to me i would apreciate very much.
> >> >>
> >> >> TKS
> >> >>
> >> >>
> >> >> Anton Gavazuk wrote:
> >> >> >
> >> >> > What you mean  - "filter for sessions"?
> >> >> > I can send you some pieces of my own app with login\logut funcs
> >> >> >
> >> >> > 2007/8/8, ignicolist <ig...@gmail.com>:
> >> >> >>
> >> >> >>
> >> >> >> Hi,  i need some help, i have a aplication in jsf, with a sql
> >> database
> >> >> >> using
> >> >> >> hibernate, and i want implement a login and logout, but i dont
> >> know
> >> >> how,
> >> >> >> i
> >> >> >> google much, but all the solutions are so complicated. so i
> have
> >> a
> >> >> >> example
> >> >> >> with a filter, and a put that filter block the pages for non
> log
> >> >> users,
> >> >> >> but
> >> >> >> i dont know the sufs about sessions and so on... anyone have
> some
> >> >> example
> >> >> >> working for i use in my aplication?
> >> >> >>
> >> >> >> I just want a simple login logout example, using a filter for
> >> >> sessions.
> >> >> >>
> >> >> >>
> >> >> >> Tks for all the help...
> >> >> >> --
> >> >> >> View this message in context:
> >> >> >> http://www.nabble.com/JSF-Authentication-
> tf4235729.html#a12051322
> >> >> >> Sent from the MyFaces - Users mailing list archive at
> Nabble.com.
> >> >> >>
> >> >> >>
> >> >> >
> >> >> >
> >> >>
> >> >> --
> >> >> View this message in context:
> >> >> http://www.nabble.com/JSF-Authentication-tf4235729.html#a12053317
> >> >> Sent from the MyFaces - Users mailing list archive at Nabble.com.
> >> >>
> >> >>
> >> >
> >> >
> >> > --
> >> > Michał Stawicki
> >> >
> >> > stawicki@gmail.com
> >> > http://stawicki.jasliska.pl
> >> >
> >> >
> >> >
> >> > NOTICE: This message (including any attachments) from Momentum
> >> Systems,
> >> > Inc. contains information that is PRIVILEGED and CONFIDENTIAL.  If
> >> you are
> >> > not an intended recipient, you are hereby notified that any
> >> dissemination
> >> > of this message is strictly prohibited.  If you have received this
> >> message
> >> > in error, please do not read, copy or forward this message.
> Please
> >> > permanently delete all copies and any attachments and notify the
> >> sender
> >> > immediately by reply email or by calling our Office at
> 703.740.9300.
> >> >
> >> >
> >>
> >> --
> >> View this message in context: http://www.nabble.com/JSF-
> Authentication-
> >> tf4235729.html#a12054402
> >> Sent from the MyFaces - Users mailing list archive at Nabble.com.
> >
> >
> >
> 
> --
> View this message in context: http://www.nabble.com/JSF-Authentication-
> tf4235729.html#a12057863
> Sent from the MyFaces - Users mailing list archive at Nabble.com.


RE: JSF Authentication

Posted by ignicolist <ig...@gmail.com>.
Tks kito, and good Book You write. Congr!


kito99 wrote:
> 
> 
>> -----Original Message-----
>> From: ignicolist [mailto:ignicolist@gmail.com]
>> Sent: Wednesday, August 08, 2007 10:28 AM
>> To: users@myfaces.apache.org
>> Subject: RE: JSF Authentication
>> 
>> 
>> My way is like in the book: JavaServer Faces JSF in Action Manning i
>> think
>> its a good solution but i dont know how to put the example in the book
>> in my
>> aplication.
>> 
> 
> The book uses the filter approach, but the PhaseListener approach is fine
> if the only resources you want to authorize are JSF views. You can get a
> revised version of the book's case study app (that uses Spring and
> Hibernate) from http://code.google.com/p/projecttrack/. It doesn't include
> a PhaseListener example, but the code is pretty similar (I can send it to
> you off-line if you're interested).
> 
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> Kito D. Mann - Author, JavaServer Faces in Action
> http://www.virtua.com - JSF/Java EE consulting, training, and mentoring
> http://www.JSFCentral.com - JavaServer Faces FAQ, news, and info
> 
> * Sign up for the JSF Central newsletter!
> http://oi.vresp.com/?fid=ac048d0e17 *
> 
>> 
>> 
>> hatrang wrote:
>> >
>> > Is your way like the one in the JSF: the complete reference book? I
>> > haven't tried it yet, but I prefer this one than the filter thing.
>> >
>> > -----Original Message-----
>> > From: Michał 'Gandalf' Stawicki [mailto:stawicki@gmail.com]
>> > Sent: Wednesday, August 08, 2007 10:01 AM
>> > To: MyFaces Discussion
>> > Subject: Re: JSF Authentication
>> >
>> > Write a bean to store login info and use PhaseListener to check if
>> > user is logged in if he wants to access pages that need hi to be
>> > logged in, and redirect to login page if he is not.
>> >
>> > there were some good articles describing this approach. unfortunately
>> > I can't share my code.
>> >
>> >
>> > On 08/08/07, ignicolist <ig...@gmail.com> wrote:
>> >>
>> >> is if you could send to me i would apreciate very much.
>> >>
>> >> TKS
>> >>
>> >>
>> >> Anton Gavazuk wrote:
>> >> >
>> >> > What you mean  - "filter for sessions"?
>> >> > I can send you some pieces of my own app with login\logut funcs
>> >> >
>> >> > 2007/8/8, ignicolist <ig...@gmail.com>:
>> >> >>
>> >> >>
>> >> >> Hi,  i need some help, i have a aplication in jsf, with a sql
>> database
>> >> >> using
>> >> >> hibernate, and i want implement a login and logout, but i dont
>> know
>> >> how,
>> >> >> i
>> >> >> google much, but all the solutions are so complicated. so i have
>> a
>> >> >> example
>> >> >> with a filter, and a put that filter block the pages for non log
>> >> users,
>> >> >> but
>> >> >> i dont know the sufs about sessions and so on... anyone have some
>> >> example
>> >> >> working for i use in my aplication?
>> >> >>
>> >> >> I just want a simple login logout example, using a filter for
>> >> sessions.
>> >> >>
>> >> >>
>> >> >> Tks for all the help...
>> >> >> --
>> >> >> View this message in context:
>> >> >> http://www.nabble.com/JSF-Authentication-tf4235729.html#a12051322
>> >> >> Sent from the MyFaces - Users mailing list archive at Nabble.com.
>> >> >>
>> >> >>
>> >> >
>> >> >
>> >>
>> >> --
>> >> View this message in context:
>> >> http://www.nabble.com/JSF-Authentication-tf4235729.html#a12053317
>> >> Sent from the MyFaces - Users mailing list archive at Nabble.com.
>> >>
>> >>
>> >
>> >
>> > --
>> > Michał Stawicki
>> >
>> > stawicki@gmail.com
>> > http://stawicki.jasliska.pl
>> >
>> >
>> >
>> > NOTICE: This message (including any attachments) from Momentum
>> Systems,
>> > Inc. contains information that is PRIVILEGED and CONFIDENTIAL.  If
>> you are
>> > not an intended recipient, you are hereby notified that any
>> dissemination
>> > of this message is strictly prohibited.  If you have received this
>> message
>> > in error, please do not read, copy or forward this message.  Please
>> > permanently delete all copies and any attachments and notify the
>> sender
>> > immediately by reply email or by calling our Office at 703.740.9300.
>> >
>> >
>> 
>> --
>> View this message in context: http://www.nabble.com/JSF-Authentication-
>> tf4235729.html#a12054402
>> Sent from the MyFaces - Users mailing list archive at Nabble.com.
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/JSF-Authentication-tf4235729.html#a12057863
Sent from the MyFaces - Users mailing list archive at Nabble.com.


RE: JSF Authentication

Posted by "Kito D. Mann" <km...@virtua.com>.
> -----Original Message-----
> From: ignicolist [mailto:ignicolist@gmail.com]
> Sent: Wednesday, August 08, 2007 10:28 AM
> To: users@myfaces.apache.org
> Subject: RE: JSF Authentication
> 
> 
> My way is like in the book: JavaServer Faces JSF in Action Manning i
> think
> its a good solution but i dont know how to put the example in the book
> in my
> aplication.
> 

The book uses the filter approach, but the PhaseListener approach is fine if the only resources you want to authorize are JSF views. You can get a revised version of the book's case study app (that uses Spring and Hibernate) from http://code.google.com/p/projecttrack/. It doesn't include a PhaseListener example, but the code is pretty similar (I can send it to you off-line if you're interested).

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Kito D. Mann - Author, JavaServer Faces in Action
http://www.virtua.com - JSF/Java EE consulting, training, and mentoring
http://www.JSFCentral.com - JavaServer Faces FAQ, news, and info

* Sign up for the JSF Central newsletter! http://oi.vresp.com/?fid=ac048d0e17 *

> 
> 
> hatrang wrote:
> >
> > Is your way like the one in the JSF: the complete reference book? I
> > haven't tried it yet, but I prefer this one than the filter thing.
> >
> > -----Original Message-----
> > From: Michał 'Gandalf' Stawicki [mailto:stawicki@gmail.com]
> > Sent: Wednesday, August 08, 2007 10:01 AM
> > To: MyFaces Discussion
> > Subject: Re: JSF Authentication
> >
> > Write a bean to store login info and use PhaseListener to check if
> > user is logged in if he wants to access pages that need hi to be
> > logged in, and redirect to login page if he is not.
> >
> > there were some good articles describing this approach. unfortunately
> > I can't share my code.
> >
> >
> > On 08/08/07, ignicolist <ig...@gmail.com> wrote:
> >>
> >> is if you could send to me i would apreciate very much.
> >>
> >> TKS
> >>
> >>
> >> Anton Gavazuk wrote:
> >> >
> >> > What you mean  - "filter for sessions"?
> >> > I can send you some pieces of my own app with login\logut funcs
> >> >
> >> > 2007/8/8, ignicolist <ig...@gmail.com>:
> >> >>
> >> >>
> >> >> Hi,  i need some help, i have a aplication in jsf, with a sql
> database
> >> >> using
> >> >> hibernate, and i want implement a login and logout, but i dont
> know
> >> how,
> >> >> i
> >> >> google much, but all the solutions are so complicated. so i have
> a
> >> >> example
> >> >> with a filter, and a put that filter block the pages for non log
> >> users,
> >> >> but
> >> >> i dont know the sufs about sessions and so on... anyone have some
> >> example
> >> >> working for i use in my aplication?
> >> >>
> >> >> I just want a simple login logout example, using a filter for
> >> sessions.
> >> >>
> >> >>
> >> >> Tks for all the help...
> >> >> --
> >> >> View this message in context:
> >> >> http://www.nabble.com/JSF-Authentication-tf4235729.html#a12051322
> >> >> Sent from the MyFaces - Users mailing list archive at Nabble.com.
> >> >>
> >> >>
> >> >
> >> >
> >>
> >> --
> >> View this message in context:
> >> http://www.nabble.com/JSF-Authentication-tf4235729.html#a12053317
> >> Sent from the MyFaces - Users mailing list archive at Nabble.com.
> >>
> >>
> >
> >
> > --
> > Michał Stawicki
> >
> > stawicki@gmail.com
> > http://stawicki.jasliska.pl
> >
> >
> >
> > NOTICE: This message (including any attachments) from Momentum
> Systems,
> > Inc. contains information that is PRIVILEGED and CONFIDENTIAL.  If
> you are
> > not an intended recipient, you are hereby notified that any
> dissemination
> > of this message is strictly prohibited.  If you have received this
> message
> > in error, please do not read, copy or forward this message.  Please
> > permanently delete all copies and any attachments and notify the
> sender
> > immediately by reply email or by calling our Office at 703.740.9300.
> >
> >
> 
> --
> View this message in context: http://www.nabble.com/JSF-Authentication-
> tf4235729.html#a12054402
> Sent from the MyFaces - Users mailing list archive at Nabble.com.


RE: JSF Authentication

Posted by ignicolist <ig...@gmail.com>.
My way is like in the book: JavaServer Faces JSF in Action Manning i think
its a good solution but i dont know how to put the example in the book in my
aplication. 



hatrang wrote:
> 
> Is your way like the one in the JSF: the complete reference book? I
> haven't tried it yet, but I prefer this one than the filter thing.
> 
> -----Original Message-----
> From: Michał 'Gandalf' Stawicki [mailto:stawicki@gmail.com] 
> Sent: Wednesday, August 08, 2007 10:01 AM
> To: MyFaces Discussion
> Subject: Re: JSF Authentication
> 
> Write a bean to store login info and use PhaseListener to check if
> user is logged in if he wants to access pages that need hi to be
> logged in, and redirect to login page if he is not.
> 
> there were some good articles describing this approach. unfortunately
> I can't share my code.
> 
> 
> On 08/08/07, ignicolist <ig...@gmail.com> wrote:
>>
>> is if you could send to me i would apreciate very much.
>>
>> TKS
>>
>>
>> Anton Gavazuk wrote:
>> >
>> > What you mean  - "filter for sessions"?
>> > I can send you some pieces of my own app with login\logut funcs
>> >
>> > 2007/8/8, ignicolist <ig...@gmail.com>:
>> >>
>> >>
>> >> Hi,  i need some help, i have a aplication in jsf, with a sql database
>> >> using
>> >> hibernate, and i want implement a login and logout, but i dont know
>> how,
>> >> i
>> >> google much, but all the solutions are so complicated. so i have a
>> >> example
>> >> with a filter, and a put that filter block the pages for non log
>> users,
>> >> but
>> >> i dont know the sufs about sessions and so on... anyone have some
>> example
>> >> working for i use in my aplication?
>> >>
>> >> I just want a simple login logout example, using a filter for
>> sessions.
>> >>
>> >>
>> >> Tks for all the help...
>> >> --
>> >> View this message in context:
>> >> http://www.nabble.com/JSF-Authentication-tf4235729.html#a12051322
>> >> Sent from the MyFaces - Users mailing list archive at Nabble.com.
>> >>
>> >>
>> >
>> >
>>
>> --
>> View this message in context:
>> http://www.nabble.com/JSF-Authentication-tf4235729.html#a12053317
>> Sent from the MyFaces - Users mailing list archive at Nabble.com.
>>
>>
> 
> 
> -- 
> Michał Stawicki
> 
> stawicki@gmail.com
> http://stawicki.jasliska.pl
> 
> 
> 
> NOTICE: This message (including any attachments) from Momentum Systems,
> Inc. contains information that is PRIVILEGED and CONFIDENTIAL.  If you are
> not an intended recipient, you are hereby notified that any dissemination
> of this message is strictly prohibited.  If you have received this message
> in error, please do not read, copy or forward this message.  Please
> permanently delete all copies and any attachments and notify the sender
> immediately by reply email or by calling our Office at 703.740.9300.
> 
> 

-- 
View this message in context: http://www.nabble.com/JSF-Authentication-tf4235729.html#a12054402
Sent from the MyFaces - Users mailing list archive at Nabble.com.