/** * Any detach logic for session subclasses. This is called on the end of handling a request, * when the RequestCycle is about to be detached from the current thread. */ protected void detach() { if (sessionInvalidated) { invalidateNow(); } }
/** * Any detach logic for session subclasses. This is called on the end of handling a request, * when the RequestCycle is about to be detached from the current thread. */ protected void detach() { refreshId(); if (sessionInvalidated) { invalidateNow(); } }
@SuppressWarnings("unchecked") public LogoutPage(final PageParameters parameters) { final String page = parameters.getString(REDIRECTPAGE_PARAM); Class<? extends Page> pageClass; if (page != null) try { pageClass = (Class<? extends Page>)Class.forName(page); } catch (final ClassNotFoundException e) { throw new RuntimeException(e); } else pageClass = getApplication().getHomePage(); setStatelessHint(true); setResponsePage(pageClass); // this should remove the cookie... final Subject subject = SecurityUtils.getSubject(); LOG.info("logout: " + subject); subject.logout(); Session.get().invalidateNow(); // invalidate the wicket session return; }
/** * Any detach logic for session subclasses. This is called on the end of handling a request, * when the RequestCycle is about to be detached from the current thread. */ public void detach() { detachFeedback(); if (isSessionInvalidated()) { invalidateNow(); } else if (!isTemporary()) { // WICKET-5103 container might have changed id updateId(); } }
/** * Any detach logic for session subclasses. This is called on the end of handling a request, * when the RequestCycle is about to be detached from the current thread. */ public void detach() { detachFeedback(); if (isSessionInvalidated()) { invalidateNow(); } else if (!isTemporary()) { // WICKET-5103 container might have changed id updateId(); } }
/** * Constructor. The page will redirect to the given url after waiting for the given number of * seconds. * * @param url * The url to redirect to * @param waitBeforeRedirectInSeconds * The number of seconds the browser should wait before redirecting */ private void doLogoutAndAddRedirect(final CharSequence url, final int waitBeforeRedirectInSeconds) { setStatelessHint(true); // this should remove the cookie... final Subject subject = SecurityUtils.getSubject(); LOG.info("logout: " + subject); subject.logout(); final WebMarkupContainer redirect = new WebMarkupContainer("redirect"); final String content = waitBeforeRedirectInSeconds + ";URL=" + url; redirect.add(new AttributeModifier("content", new Model<String>(content))); add(redirect); // invalidate the session Session.get().invalidateNow(); // invalidate the wicket session // HYMMMM final Cookie c = new Cookie("rememberMe", "xxx"); c.setMaxAge(0); ((WebResponse)RequestCycle.get().getResponse()).addCookie(c); }
public SignOutPage(final PageParameters params) { PARAM_REQ.Object.requireNotNull(params, "The page parameters parameter must not be null."); final String page = params.getString(REDIRECTPAGE_PARAM); Class<? extends Page> pageClass; if (page != null && !StringUtils.isBlank(page)) { LOGGER.debug("Redirect page not blank: {}", page); try { pageClass = (Class<? extends Page>) Class.forName(page); } catch (ClassNotFoundException ex) { LOGGER.debug("Class not found for redirect page: {}", page); pageClass = getApplication().getHomePage(); } } else { LOGGER.debug("No redirect page, redirecting to application home page."); pageClass = getApplication().getHomePage(); } setStatelessHint(true); getSession().invalidateNow(); getRequestCycle().setRedirect(true); setResponsePage(pageClass); } }
/** * Constructor. The page will redirect to the given url after waiting for the given number of * seconds. * * @param url * The url to redirect to * @param waitBeforeRedirectInSeconds * The number of seconds the browser should wait before redirecting */ private void doLogoutAndAddRedirect(final CharSequence url, final int waitBeforeRedirectInSeconds) { this.setStatelessHint( true ); // this should remove the cookie... SecurityUtils.getSubject().logout(); final WebMarkupContainer redirect = new WebMarkupContainer("redirect"); final String content = waitBeforeRedirectInSeconds + ";URL=" + url; redirect.add(new AttributeModifier("content", new Model<String>(content))); add(redirect); // invalidate the session Session.get().invalidateNow(); // invalidate the wicket session // HYMMMM Cookie c = new Cookie( "rememberMe", "xxx" ); c.setMaxAge(0); ((WebResponse)RequestCycle.get().getResponse()).addCookie( c ); }
public LogoutPage( final PageParameters parameters ) { String page = parameters.getString(REDIRECTPAGE_PARAM); Class<? extends Page> pageClass; if ( page != null ) { try { pageClass = (Class<? extends Page>)Class.forName(page); } catch (ClassNotFoundException e) { throw new RuntimeException(e); } } else { pageClass = getApplication().getHomePage(); } this.setStatelessHint( true ); setResponsePage( pageClass ); // this should remove the cookie... SecurityUtils.getSubject().logout(); Session.get().invalidateNow(); // invalidate the wicket session return; //doLogoutAndAddRedirect( urlFor(pageClass, null ), getDelayTime() ); }