“remember me” functionality with jsf 2.0

后端 未结 2 773
别跟我提以往
别跟我提以往 2021-01-25 06:39

I am trying to implement \"remember me\"/\"autologin\" functionality. I have stored a cookie at the client but when should I read it? If I try to do that in a filter, for exampl

2条回答
  •  臣服心动
    2021-01-25 07:38

    Session scope will keep content for as long as a session is active, combine it with a state persistence either in DB or via a cookie.

    Non of the scopes will really "remember" your state by itself, the best you can do is persist the state to the DB and when the user returns, restore it as best as possible and push the data into a sessionscoped bean.

    Otherwise extend the sessionscope's session via a cookie

    FacesContext.getCurrentInstance().getExternalContext.addResponseCookie(..)
    

提交回复
热议问题