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, streamManager
MAJOR_VERSION, MINOR_VERSION, STATUS_AUTHENTICATED, STATUS_CLOSED, STATUS_CONNECTED
Constructor and Description |
---|
LocalClientSession(String serverName,
Connection connection,
StreamID streamID,
Locale language)
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()
Deprecated.
Use #getWhitelistedAnonymousIPs instead.
|
static Map<String,String> |
getAllowedIPs()
Deprecated.
Use #getWhitelistedIPs instead.
|
AuthToken |
getAuthToken()
Returns the authentication token associated with this session.
|
String |
getAvailableStreamFeatures()
Returns a text with the available stream features.
|
static Set<String> |
getBlacklistedIPs()
Returns the list of IP address that are disallowed to connect to the server.
|
PrivacyList |
getDefaultList()
Returns the default Privacy list used for the session's user.
|
org.xmpp.packet.Presence |
getPresence()
Obtain the presence of this session.
|
String |
getUsername()
Returns the username associated with this session.
|
static Set<String> |
getWhitelistedAnonymousIPs()
Returns the list of IP address that are allowed to connect to the server for anonymous users.
|
static Set<String> |
getWhitelistedIPs()
Returns the list of IP address that are allowed to connect to the server.
|
int |
incrementConflictCount()
Increments the conflict by one.
|
static boolean |
isAddressInRange(byte[] address,
Set<String> ranges) |
static boolean |
isAllowed(Connection connection) |
static boolean |
isAllowedAnonymous(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)
Deprecated.
use #setWhitelistedAnonymousIPs instead.
|
static void |
setAllowedIPs(Map<String,String> allowed)
Deprecated.
Use setWhitelistedIPs instead.
|
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 |
setBlacklistedIPs(Set<String> blocked)
Sets the list of IP address that are not allowed to connect to the server.
|
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 |
setWhitelistedAnonymousIPs(Set<String> allowed)
Sets the list of IP address that are allowed to connect to the server for anonymous users.
|
static void |
setWhitelistedIPs(Set<String> allowed)
Sets the list of IP address that are allowed to connect to the server.
|
String |
toString() |
boolean |
wasAvailable()
Returns true if the session was available ever.
|
close, decodeVersion, deliverRawText, getAddress, getCipherSuiteName, getConnection, getCreationDate, getHostAddress, getHostName, getLanguage, getLastActiveDate, getNumClientPackets, getNumServerPackets, getPeerCertificates, getServerName, getSessionData, getStatus, getStreamID, getStreamManager, 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, getLanguage, getLastActiveDate, getNumClientPackets, getNumServerPackets, getPeerCertificates, getServerName, getStatus, getStreamID, isClosed, isSecure, process, validate
protected AuthToken authToken
public LocalClientSession(String serverName, Connection connection, StreamID streamID, Locale language)
serverName
- name of the server.connection
- The connection we are proxying.streamID
- unique identifier of this session.@Deprecated public static Map<String,String> getAllowedIPs()
getAllowedAnonymIPs()
. This list is used for both anonymous and
non-anonymous users.
Note that the blacklist in getBlacklistedIPs()
should take precedence!public static Set<String> getWhitelistedIPs()
getWhitelistedAnonymousIPs()
. This list is used for both anonymous and non-anonymous users.
Note that the blacklist in getBlacklistedIPs()
should take precedence!public static Map<String,String> getAllowedAnonymIPs()
getAllowedIPs()
.
Note that the blacklist in getBlacklistedIPs()
should take precedence!public static Set<String> getWhitelistedAnonymousIPs()
getWhitelistedIPs()
.
Note that the blacklist in getBlacklistedIPs()
should take precedence!public static Set<String> getBlacklistedIPs()
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 boolean isAllowedAnonymous(Connection connection)
@Deprecated 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 setWhitelistedIPs(Set<String> allowed)
getBlacklistedIPs()
is allowed to connect to the server except for anonymous users that are subject to
getWhitelistedAnonymousIPs()
. This list is used for both anonymous and non-anonymous users.
Note that blacklisting takes precedence over whitelisting: if an address is matched by both, access is denied.allowed
- the list of IP address that are allowed to connect to the server. Can be empty, but not null.@Deprecated 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 void setWhitelistedAnonymousIPs(Set<String> allowed)
getBlacklistedIPs()
and getWhitelistedIPs()
.allowed
- the list of IP address that are allowed to connect to the server. Can be empty, but not null.public static void setBlacklistedIPs(Set<String> blocked)
blocked
- the list of IP address that are not allowed to connect to the server. Can be empty, but not null.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.