Wicket 1.4 Remember Login WIth Cookie
Hi. I have a wicket 1.4 application with a AuthenticatedWebSession with authenticate(String username, String password) method. I use annotations to allow for seeing some components : @AuthorizeAction(action = Action.RENDER, roles = Roles.ADMIN) for example. I want when user logs in to save a cookie and use that cookie to keep user logged in for ever until he logs out. I have my custom LoginPanel with user, password and remember checkbox. In LoginPanel I use a LoginValidator like: @Override protected void onInitialize() { super.onInitialize(); getForm().add(new LoginValidator(username, password, remember)); } and in my LoginValidator, after a successful login, I do the following: if (remember.getConvertedInput()) { HttpServletResponse servletResponse = ((BufferedWebResponse) RequestCycle.get().getResponse()).getHttpServletResponse(); Cookie c = new Cookie(userid, username); servletResponse.addCookie(c); } My cookie is created. But I do not know WHERE to read from HttpServletRequest to see that a cookie exists and automatically login the user if session expired. Any clues? -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/Wicket-1-4-Remember-Login-WIth-Cookie-tp4650029.html Sent from the Users forum mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Wicket 1.4 Remember Login WIth Cookie
Have a look at org.apache.wicket.util.cookies.CookieUtils#load(final String key). Cheers, -Tom - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Wicket 1.4 Remember Login WIth Cookie
CookieUtils (1.5+) is the new name of CookieValuePersister (until 1.4.x) On Mon, Jun 18, 2012 at 5:09 PM, Thomas Götz t...@decoded.de wrote: Have a look at org.apache.wicket.util.cookies.CookieUtils#load(final String key). Cheers, -Tom - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org -- Martin Grigorov jWeekend Training, Consulting, Development http://jWeekend.com - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Wicket 1.4 Remember Login WIth Cookie
Hi. My problem is not how to read the cookie. I do not know WHERE to read it, because my authentication is done from LoginPanel / LoginValidator, and I do not want my LoginPanel to be shown anymore. -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/Wicket-1-4-Remember-Login-WIth-Cookie-tp4650029p4650032.html Sent from the Users forum mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Wicket 1.4 Remember Login WIth Cookie
See wicket-examples project. It has an example with rememberMe functionality. On Mon, Jun 18, 2012 at 5:16 PM, dpmihai dpmi...@yahoo.com wrote: Hi. My problem is not how to read the cookie. I do not know WHERE to read it, because my authentication is done from LoginPanel / LoginValidator, and I do not want my LoginPanel to be shown anymore. -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/Wicket-1-4-Remember-Login-WIth-Cookie-tp4650029p4650032.html Sent from the Users forum mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org -- Martin Grigorov jWeekend Training, Consulting, Development http://jWeekend.com - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Wicket 1.4 Remember Login WIth Cookie
I made it by reading cookies in my AuthenticatedWebApplication in @Override public Session newSession(Request request, Response response) { Session session = super.newSession(request, response); HttpServletRequest servletRequest = ((ServletWebRequest) request).getHttpServletRequest(); Cookie[] cookies = servletRequest.getCookies(); . } and in the case a remember is needed i call sign-in. PS. I know about SignInPanel, but I wanted a custom solution. -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/Wicket-1-4-Remember-Login-WIth-Cookie-tp4650029p4650038.html Sent from the Users forum mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org