public class BasicSession<U extends User,S extends WebUserShell<U,org.apache.wicket.protocol.http.WebSession>> extends org.apache.wicket.protocol.http.WebSession implements IBasicSession<U,S>
Constructor and Description |
---|
BasicSession(org.apache.wicket.Request request) |
Modifier and Type | Method and Description |
---|---|
protected String |
deriveUserId()
Override to derive custom
User field for id. |
void |
extendShell(BasicSession environment)
Extend the current Shell, with a new child shell.
|
static BasicSession |
get()
Use Java 5 covariance
|
AuthenticationToken |
getAuthToken() |
S |
getShell()
Some sessions may want to discourage access to the shell itself
As a best practice avoid working with the shell directly, and create methods that internally call the shell from your session. |
U |
getUser() |
String |
getUserId()
Get the userId for the Session.
|
void |
setAuthToken(AuthenticationToken authToken) |
void |
setUser(U user) |
cleanupComponentFeedbackMessages, cleanupFeedbackMessages, isCurrentRequestValid
attach, bind, clear, createAutoPageMap, createAutoPageMapName, currentCreateAutoPageMapCounter, detach, dirty, error, exists, findOrCreate, findOrCreate, getApplication, getAttribute, getAttributeNames, getAuthorizationStrategy, getAutoPageMapNamePrefix, getAutoPageMapNameSuffix, getClassResolver, getClientInfo, getDefaultPageMap, getFeedbackMessages, getId, getLocale, getMetaData, getPage, getPage, getPageFactory, getPageMaps, getSessionStore, getSizeInBytes, getStyle, incrementCreateAutoPageMapCounter, info, invalidate, invalidateNow, isSessionInvalidated, isTemporary, newPageMap, nextPageId, nextSequenceValue, pageMapForName, removeAttribute, removePageMap, replaceSession, set, setApplication, setAttribute, setClientInfo, setLocale, setMetaData, setStyle, touch, unset, untouch, update, visitPageMaps, warn
protected S extends WebUserShell<U,org.apache.wicket.protocol.http.WebSession> shell
public static BasicSession get()
public AuthenticationToken getAuthToken()
getAuthToken
in interface IBasicSession<U extends User,S extends WebUserShell<U,org.apache.wicket.protocol.http.WebSession>>
public void setAuthToken(AuthenticationToken authToken)
setAuthToken
in interface IBasicSession<U extends User,S extends WebUserShell<U,org.apache.wicket.protocol.http.WebSession>>
public U getUser()
getUser
in interface IBasicSession<U extends User,S extends WebUserShell<U,org.apache.wicket.protocol.http.WebSession>>
public void setUser(U user)
setUser
in interface IBasicSession<U extends User,S extends WebUserShell<U,org.apache.wicket.protocol.http.WebSession>>
protected String deriveUserId()
User
field for id. The user object is guaranteed to be not null by getUserId()
public String getUserId()
BasicSession
type can use any user object or attribute to represent that as the id
for the session. This could be the same as HttpSession.getId()
or something custom like email, name etc.
getUser()
exists and this maybe derived from it, getUser()
does not guarantee any convention on which
attribute identifies the id we want for a session.getUserId
in interface IBasicSession<U extends User,S extends WebUserShell<U,org.apache.wicket.protocol.http.WebSession>>
deriveUserId()
#getUser()#getId()
and if not user defined then gets the sessionId
TODO: Add unit test case for user null, user not null but id null etc.public void extendShell(BasicSession environment)
environment
- @nullable true; if null will assume current BasicSession
public S getShell() throws AuthorizationException
getShell
in interface IBasicSession<U extends User,S extends WebUserShell<U,org.apache.wicket.protocol.http.WebSession>>
AuthorizationException
Copyright © 2018. All rights reserved.