public class LocalClientSession extends LocalSession implements ClientSession
Modifier and Type | Field and Description |
---|---|
protected AuthToken |
authToken
The authentication token for this session.
|
CHARSET, conn, sessionManager, status
MAJOR_VERSION, MINOR_VERSION, STATUS_AUTHENTICATED, STATUS_CLOSED, STATUS_CONNECTED
Constructor and Description |
---|
LocalClientSession(String serverName,
Connection connection,
StreamID streamID)
Creates a session with an underlying connection and permission protection.
|
Modifier and Type | Method and Description |
---|---|
boolean |
canFloodOfflineMessages()
Returns true if the offline messages of the user should be sent to the user when
the user becomes online.
|
boolean |
canProcess(org.xmpp.packet.Packet packet)
Returns true if the specified packet must not be blocked based on the active or default
privacy list rules.
|
static LocalClientSession |
createSession(String serverName,
org.xmlpull.v1.XmlPullParser xpp,
Connection connection)
Returns a newly created session between the server and a client.
|
void |
deliver(org.xmpp.packet.Packet packet) |
PrivacyList |
getActiveList()
Returns the Privacy list that overrides the default privacy list.
|
static Map<String,String> |
getAllowedAnonymIPs()
Returns the list of IP address that are allowed to connect to the server for anonymous
users.
|
static Map<String,String> |
getAllowedIPs()
Returns the list of IP address that are allowed to connect to the server.
|
AuthToken |
getAuthToken()
Returns the authentication token associated with this session.
|
String |
getAvailableStreamFeatures()
Returns a text with the available stream features.
|
static Connection.CompressionPolicy |
getCompressionPolicy()
Returns whether compression is optional or is disabled for clients.
|
PrivacyList |
getDefaultList()
Returns the default Privacy list used for the session's user.
|
org.xmpp.packet.Presence |
getPresence()
Obtain the presence of this session.
|
static Connection.TLSPolicy |
getTLSPolicy()
Returns whether TLS is mandatory, optional or is disabled for clients.
|
String |
getUsername()
Returns the username associated with this session.
|
int |
incrementConflictCount()
Increments the conflict by one.
|
static boolean |
isAllowed(Connection connection) |
boolean |
isAnonymousUser()
Returns true if the authetnicated user is an anonymous user or if
the use has not authenticated yet.
|
boolean |
isInitialized()
Flag indicating if this session has been initialized once coming
online.
|
boolean |
isMessageCarbonsEnabled()
Indicates, whether message carbons are enabled.
|
boolean |
isOfflineFloodStopped()
Returns true if the user requested to not receive offline messages when sending
an available presence.
|
void |
setActiveList(PrivacyList activeList)
Sets the Privacy list that overrides the default privacy list.
|
static void |
setAllowedAnonymIPs(Map<String,String> allowed)
Sets the list of IP address that are allowed to connect to the server for anonymous
users.
|
static void |
setAllowedIPs(Map<String,String> allowed)
Sets the list of IP address that are allowed to connect to the server.
|
void |
setAnonymousAuth()
Initialize the session as an anonymous login.
|
void |
setAuthToken(AuthToken auth)
Sets the new Authorization Token for this session.
|
void |
setAuthToken(AuthToken auth,
String resource)
Initialize the session with a valid authentication token and
resource name.
|
static void |
setCompressionPolicy(Connection.CompressionPolicy policy)
Sets whether compression is optional or is disabled for clients.
|
void |
setDefaultList(PrivacyList defaultList)
Sets the default Privacy list used for the session's user.
|
void |
setInitialized(boolean isInit)
Sets the initialization state of the session.
|
void |
setMessageCarbonsEnabled(boolean enabled)
Enables or disables XEP-0280: Message Carbons for this session.
|
void |
setOfflineFloodStopped(boolean offlineFloodStopped)
Sets if the user requested to not receive offline messages when sending
an available presence.
|
void |
setPresence(org.xmpp.packet.Presence presence)
Set the presence of this session
|
static void |
setTLSPolicy(Connection.TLSPolicy policy)
Sets whether TLS is mandatory, optional or is disabled for clients.
|
String |
toString() |
boolean |
wasAvailable()
Returns true if the session was available ever.
|
close, decodeVersion, deliverRawText, getAddress, getCipherSuiteName, getConnection, getCreationDate, getHostAddress, getHostName, getLastActiveDate, getNumClientPackets, getNumServerPackets, getServerName, getSessionData, getStatus, getStreamID, incrementClientPacketCount, incrementServerPacketCount, isClosed, isSecure, isUsingSelfSignedCertificate, process, removeSessionData, setAddress, setSessionData, setStatus, validate
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
close, deliverRawText, getAddress, getCipherSuiteName, getCreationDate, getHostAddress, getHostName, getLastActiveDate, getNumClientPackets, getNumServerPackets, getServerName, getStatus, getStreamID, isClosed, isSecure, process, validate
protected AuthToken authToken
public LocalClientSession(String serverName, Connection connection, StreamID streamID)
serverName
- name of the server.connection
- The connection we are proxying.streamID
- unique identifier of this session.public static Map<String,String> getAllowedIPs()
getAllowedAnonymIPs()
. This list is used for both anonymous and
non-anonymous users.public static Map<String,String> getAllowedAnonymIPs()
getAllowedIPs()
.public static LocalClientSession createSession(String serverName, org.xmlpull.v1.XmlPullParser xpp, Connection connection) throws org.xmlpull.v1.XmlPullParserException
serverName
- the name of the server where the session is connecting to.xpp
- the parser that is reading the provided XML through the connection.connection
- the connection with the client.org.xmlpull.v1.XmlPullParserException
- if an error occurs while parsing incoming data.public static boolean isAllowed(Connection connection)
public static void setAllowedIPs(Map<String,String> allowed)
getAllowedAnonymIPs()
. This list is used for both anonymous and
non-anonymous users.allowed
- the list of IP address that are allowed to connect to the server.public static void setAllowedAnonymIPs(Map<String,String> allowed)
getAllowedIPs()
.allowed
- the list of IP address that are allowed to connect to the server.public static Connection.TLSPolicy getTLSPolicy()
public static void setTLSPolicy(Connection.TLSPolicy policy)
policy
- whether TLS is mandatory, optional or is disabled.public static Connection.CompressionPolicy getCompressionPolicy()
public static void setCompressionPolicy(Connection.CompressionPolicy policy)
policy
- whether compression is optional or is disabled.public PrivacyList getActiveList()
getActiveList
in interface ClientSession
public void setActiveList(PrivacyList activeList)
setActiveList
in interface ClientSession
activeList
- the Privacy list that overrides the default privacy list.public PrivacyList getDefaultList()
getDefaultList
in interface ClientSession
public void setDefaultList(PrivacyList defaultList)
setDefaultList
in interface ClientSession
defaultList
- the default Privacy list used for the session's user.public String getUsername() throws UserNotFoundException
getUsername
in interface ClientSession
UserNotFoundException
- if a user is not associated with a session
(the session has not authenticated yet)public void setAuthToken(AuthToken auth)
auth
- the authentication token obtained from SASL authentication.public void setAuthToken(AuthToken auth, String resource)
auth
- the authentication token obtained from the AuthFactory.resource
- the resource this session authenticated under.public void setAnonymousAuth()
public AuthToken getAuthToken()
public boolean isAnonymousUser()
ClientSession
isAnonymousUser
in interface ClientSession
public boolean isInitialized()
isInitialized
in interface ClientSession
public void setInitialized(boolean isInit)
setInitialized
in interface ClientSession
isInit
- True if the session has been initializedisInitialized()
public boolean wasAvailable()
public boolean canFloodOfflineMessages()
canFloodOfflineMessages
in interface ClientSession
public boolean isOfflineFloodStopped()
isOfflineFloodStopped
in interface ClientSession
public void setOfflineFloodStopped(boolean offlineFloodStopped)
offlineFloodStopped
- if the user requested to not receive offline messages when
sending an available presence.public org.xmpp.packet.Presence getPresence()
getPresence
in interface ClientSession
public void setPresence(org.xmpp.packet.Presence presence)
setPresence
in interface ClientSession
presence
- The presence for the sessionpublic String getAvailableStreamFeatures()
LocalSession
getAvailableStreamFeatures
in class LocalSession
public int incrementConflictCount()
incrementConflictCount
in interface ClientSession
public boolean isMessageCarbonsEnabled()
ClientSession
isMessageCarbonsEnabled
in interface ClientSession
public void setMessageCarbonsEnabled(boolean enabled)
ClientSession
setMessageCarbonsEnabled
in interface ClientSession
enabled
- True, if message carbons are enabled.public boolean canProcess(org.xmpp.packet.Packet packet)
packet
- the packet to analyze if it must be blocked.public void deliver(org.xmpp.packet.Packet packet) throws UnauthorizedException
UnauthorizedException
public String toString()
toString
in class LocalSession
Copyright © 2003-2008 Jive Software.