/** * A convenience method to return the WebSession. Same as {@link org.apache.wicket.Component#getSession()} . * * @return the current WebSession */ public final WebSession getWebSession() { return WebSession.get(); }
/** * @see org.apache.wicket.Application#newSession(org.apache.wicket.request.Request, * org.apache.wicket.request.Response) */ @Override public Session newSession(Request request, Response response) { return new WebSession(request); }
@Override public String getObject() { return WebSession.get().getMetaData(UPLOAD_DIRECTORY); }
@Override public void setObject(String object) { WebSession.get().setMetaData(UPLOAD_DIRECTORY, object); }
protected ClientProperties newClientInfo() { return WebSession.get().getClientInfo().getProperties(); }
@Override protected void afterSubmit() { getModelObject().setJavaScriptEnabled(true); WebSession.get().setClientInfo(info.getObject()); continueToOriginalDestination(); // switch to home page if no original destination was intercepted setResponsePage(getApplication().getHomePage()); } };
public void onApplicationEvent(ApplicationEvent event) { if (event instanceof AuthenticationSuccessEvent || event instanceof InteractiveAuthenticationSuccessEvent) { if (Session.exists()) { WebSession.get().replaceSession(); } } } }
WebRequestCycle requestCycle = (WebRequestCycle)getRequestCycle(); WebSession session = (WebSession)getSession(); ClientInfo clientInfo = session.getClientInfo(); if (clientInfo == null)
/** * Call signOut() and remove the logon data from whereever they have been persisted (e.g. * Cookies) * * @see org.apache.wicket.Session#invalidate() */ @Override public void invalidate() { if (isSessionInvalidated() == false) { getApplication().getSecuritySettings().getAuthenticationStrategy().remove(); super.invalidate(); } }
/** * Cleans up the WaspAuthorizationStrategy before killing this session. If you override this * method you must call super.invalidateNow(). * * @see WebSession#invalidateNow() */ @Override public void invalidateNow() { securityStrategy.destroy(); super.invalidateNow(); }
public void logout() { PFUserDO user = userContext != null ? userContext.getUser() : null; if (user != null) { log.info("User logged out: " + user.getShortDisplayName()); user = null; } ThreadLocalUserContext.clear(); userContext = null; super.clear(); super.invalidateNow(); }
/** * * @see org.apache.wicket.Session#detach() */ @Override public void detach() { if (isTemporary() && securityStrategy.isUserAuthenticated()) bind(); super.detach(); } }
/** * @return Whether the session was marked invalid during this request (afterwards, we shouldn't * even come here as there is no session) */ private boolean isSessionValid() { if (Session.exists()) { Session session = Session.get(); if (session instanceof WebSession) { return !((WebSession)session).isSessionInvalidated(); } } return true; // we simply don't know, so play safe and rely on // servlet container's code to check availability } }
protected ClientProperties newClientInfo() { return WebSession.get().getClientInfo().getProperties(); }
@Override protected void onStateChange() { HashSet<String> expandedPaths = new HashSet<>(); for (BlobIdent blobIdent: blobPickerState) expandedPaths.add(blobIdent.path); WebSession.get().setMetaData(BLOB_PICKER_STATE, expandedPaths); }
@Override protected void afterSubmit() { getModelObject().setJavaScriptEnabled(true); WebSession.get().setClientInfo(info.getObject()); continueToOriginalDestination(); // switch to home page if no original destination was intercepted setResponsePage(getApplication().getHomePage()); } };
/** * @see org.apache.wicket.markup.html.form.Form#onSubmit() */ protected void onSubmit() { ClientPropertiesBean propertiesBean = (ClientPropertiesBean)getModelObject(); WebRequestCycle requestCycle = (WebRequestCycle)getRequestCycle(); WebSession session = (WebSession)getSession(); ClientInfo clientInfo = session.getClientInfo(); if (clientInfo == null) { clientInfo = new WebClientInfo(requestCycle); getSession().setClientInfo(clientInfo); } if (clientInfo instanceof WebClientInfo) { WebClientInfo info = (WebClientInfo)clientInfo; ClientProperties properties = info.getProperties(); propertiesBean.merge(properties); } else { warnNotUsingWebClientInfo(clientInfo); } afterSubmit(); } };
/** * Call signOut() and remove the logon data from whereever they have been persisted (e.g. * Cookies) * * @see org.apache.wicket.Session#invalidate() */ @Override public void invalidate() { if (isSessionInvalidated() == false) { getApplication().getSecuritySettings().getAuthenticationStrategy().remove(); super.invalidate(); } }
/** * Cleans up the WaspAuthorizationStrategy before killing this session. If you override this * method you must call super.invalidateNow(). * * @see WebSession#invalidateNow() */ @Override public void invalidateNow() { securityStrategy.destroy(); super.invalidateNow(); }
/** {@inheritDoc} */ @Override protected void detach() { if(flowState != null && flowState.getModel() != null){ flowState.getModel().detach(); } super.detach(); } }