|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.ecyrd.jspwiki.WikiSession
public class WikiSession
Represents a long-running wiki session, with an associated user Principal,
user Subject, and authentication status. This class is initialized with
minimal, default-deny values: authentication is set to false
,
and the user principal is set to null
.
Field Summary | |
---|---|
protected static String |
ALL
|
static String |
ANONYMOUS
|
static String |
ASSERTED
|
static String |
AUTHENTICATED
|
protected static int |
DOT
|
protected static org.apache.log4j.Logger |
log
|
protected String |
m_cachedCookieIdentity
|
protected String |
m_cachedRemoteUser
|
protected Principal |
m_cachedUserPrincipal
|
protected static int |
NINE
|
protected static int |
ONE
|
Method Summary | |
---|---|
void |
actionPerformed(WikiEvent event)
Listens for WikiEvents generated by source objects such as the GroupManager. |
void |
addMessage(String message)
Adds a message to the generic list of messages associated with the session. |
void |
addMessage(String topic,
String message)
Adds a message to the specific set of messages associated with the session. |
void |
clearMessages()
Clears all messages associated with this session. |
void |
clearMessages(String topic)
Clears all messages associated with a session topic. |
Principal |
getLoginPrincipal()
Returns the Principal used to log in to an authenticated session. |
String[] |
getMessages()
Returns all generic messages associated with this session. |
String[] |
getMessages(String topic)
Returns all messages associated with a session topic. |
Principal[] |
getPrincipals()
Returns all user Principals associated with this session. |
String |
getStatus()
Returns the status of the session as a text string. |
Subject |
getSubject()
Returns the Subject representing the user. |
Principal |
getUserPrincipal()
Returns the primary user Principal associated with this session. |
static WikiSession |
getWikiSession(WikiEngine engine,
javax.servlet.http.HttpServletRequest request)
Static factory method that returns the WikiSession object associated with the current HTTP request. |
static WikiSession |
guestSession()
Factory method that creates a new "guest" session containing a single user Principal, |
void |
invalidate()
Invalidates the WikiSession and resets its Subject's Principal set to the equivalent of a "guest session". |
boolean |
isAnonymous()
Determines whether the current session is anonymous. |
boolean |
isAuthenticated()
Returns the authentication status of the user's session. |
protected boolean |
isContainerStatusChanged(javax.servlet.http.HttpServletRequest request)
Returns whether the Http servlet container's authentication status has changed. |
protected boolean |
isInGroup(Group group)
Returns true if one of this WikiSession's user Principals
can be shown to belong to a particular wiki group. |
protected static boolean |
isIPV4Address(String name)
Verifies whether a String represents an IP address. |
protected boolean |
isNew()
Returns true if the wiki session is newly initialized. |
static void |
removeWikiSession(WikiEngine engine,
javax.servlet.http.HttpServletRequest request)
Removes the wiki session associated with the user's HTTP request from the cache of wiki sessions, typically as part of a logout process. |
static int |
sessions(WikiEngine engine)
Returns the total number of active wiki sessions. |
protected void |
setNew(boolean isNew)
Sets the status of this wiki session. |
void |
setSubject(Subject subject)
Sets the Subject representing the user. |
static Principal[] |
userPrincipals(WikiEngine engine)
Returns Principals representing the current users known to the wiki. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final String ANONYMOUS
public static final String ASSERTED
public static final String AUTHENTICATED
protected String m_cachedCookieIdentity
protected String m_cachedRemoteUser
protected Principal m_cachedUserPrincipal
protected static int ONE
protected static int NINE
protected static int DOT
protected static org.apache.log4j.Logger log
protected static final String ALL
Method Detail |
---|
protected boolean isInGroup(Group group)
true
if one of this WikiSession's user Principals
can be shown to belong to a particular wiki group.
group
- the group to test
protected boolean isNew()
true
if the wiki session is newly initialized.
protected void setNew(boolean isNew)
isNew
- whether this session should be considered "new".public boolean isAuthenticated()
true
if the user is authenticatedpublic boolean isAnonymous()
Determines whether the current session is anonymous. This will be true if any of these conditions are true:
Role.ANONYMOUS
WikiPrincipal.GUEST
getUserPrincipal()
evaluates
to an IP address.The criteria above are listed in the order in which they are evaluated.
public Principal getLoginPrincipal()
Returns the Principal used to log in to an authenticated session. The
login principal is determined by examining the Subject's Principal set
for PrincipalWrappers or WikiPrincipals with type designator
LOGIN_NAME
; the first one found is the login principal.
If one is not found, this method returns the first principal that isn't
of type Role or GroupPrincipal. If neither of these conditions hold, this method returns
WikiPrincipal.GUEST
.
public Principal getUserPrincipal()
Returns the primary user Principal associated with this session. The primary user principal is determined as follows:
FULL_NAME
or (alternatively)
WIKI_NAME is the primary Principal.
WikiPrincipal.GUEST
.
public void addMessage(String message)
clearMessages()
method is called.
message
- the message to add; if null
it is ignored.public void addMessage(String topic, String message)
clearMessages()
method is called.
topic
- the topic to associate the message to;message
- the message to addpublic void clearMessages()
public void clearMessages(String topic)
topic
- the topic whose messages should be cleared.public String[] getMessages()
clearMessages()
.
public String[] getMessages(String topic)
clearMessages(String)
.
public Principal[] getPrincipals()
public static void removeWikiSession(WikiEngine engine, javax.servlet.http.HttpServletRequest request)
engine
- the current wiki enginerequest
- the users's HTTP requestpublic void setSubject(Subject subject)
subject
- public Subject getSubject()
public void actionPerformed(WikiEvent event)
actionPerformed
in interface WikiEventListener
event
- the eventWikiEventListener.actionPerformed(com.ecyrd.jspwiki.event.WikiEvent)
public void invalidate()
protected boolean isContainerStatusChanged(javax.servlet.http.HttpServletRequest request)
request
- the current servlet request
true
if the status has changed, false
otherwisepublic String getStatus()
Returns the status of the session as a text string. Valid values are:
public static WikiSession getWikiSession(WikiEngine engine, javax.servlet.http.HttpServletRequest request)
null
, a synthetic guestSession()
is returned.
engine
- the current wiki enginerequest
- the current servlet request object
public static WikiSession guestSession()
public static int sessions(WikiEngine engine)
engine
- the current wiki session
public static Principal[] userPrincipals(WikiEngine engine)
getUserPrincipal()
method.
engine
- the wiki engine
protected static boolean isIPV4Address(String name)
name
- the address to test
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |