Class LocalOutgoingServerSession
- java.lang.Object
-
- org.jivesoftware.openfire.session.LocalSession
-
- org.jivesoftware.openfire.session.LocalServerSession
-
- org.jivesoftware.openfire.session.LocalOutgoingServerSession
-
- All Implemented Interfaces:
ChannelHandler<org.xmpp.packet.Packet>
,RoutableChannelHandler
,OutgoingServerSession
,ServerSession
,Session
public class LocalOutgoingServerSession extends LocalServerSession implements OutgoingServerSession
Server-to-server communication is done using two TCP connections between the servers. One connection is used for sending packets while the other connection is used for receiving packets. TheOutgoingServerSession
represents the connection to a remote server that will only be used for sending packets.Currently only the Server Dialback method is being used for authenticating with the remote server. Use
authenticateDomain(DomainPair)
to create a new connection to a remote server that will be used for sending packets to the remote server from the specified domain. Only the authenticated domains with the remote server will be able to effectively send packets to the remote server. The remote server will reject and close the connection if a non-authenticated domain tries to send a packet through this connection.Once the connection has been established with the remote server and at least a domain has been authenticated then a new route will be added to the routing table for this connection. For optimization reasons the same outgoing connection will be used even if the remote server has several hostnames. However, different routes will be created in the routing table for each hostname of the remote server.
- Author:
- Gaston Dombiak
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.jivesoftware.openfire.session.ServerSession
ServerSession.AuthenticationMethod
-
Nested classes/interfaces inherited from interface org.jivesoftware.openfire.session.Session
Session.Status
-
-
Field Summary
Fields Modifier and Type Field Description static SystemProperty<Duration>
INITIALISE_TIMEOUT_SECONDS
Controls the S2S outgoing session initialise timeout time in seconds-
Fields inherited from class org.jivesoftware.openfire.session.LocalServerSession
authenticationMethod
-
Fields inherited from class org.jivesoftware.openfire.session.LocalSession
address, conn, serverName, sessionManager, startDate, status, streamID, streamManager
-
Fields inherited from interface org.jivesoftware.openfire.session.Session
MAJOR_VERSION, MINOR_VERSION, STATUS_AUTHENTICATED, STATUS_CLOSED, STATUS_CONNECTED
-
-
Constructor Summary
Constructors Constructor Description LocalOutgoingServerSession(String localDomain, Connection connection, OutgoingServerSocketReader socketReader, StreamID streamID)
LocalOutgoingServerSession(String localDomain, Connection connection, StreamID streamID)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addOutgoingDomainPair(DomainPair domainPair)
Marks a domain pair as being authenticated.static boolean
authenticateDomain(DomainPair domainPair)
Authenticates the local domain to the remote domain.boolean
authenticateSubdomain(DomainPair domainPair)
Authenticates a subdomain of this server with the specified remote server over an existing outgoing connection.boolean
checkOutgoingDomainPair(DomainPair domainPair)
Checks to see if a pair of domains has previously been authenticated.List<org.dom4j.Element>
getAvailableStreamFeatures()
Returns a text with the available stream features.Collection<DomainPair>
getOutgoingDomainPairs()
Obtains all authenticated domain pairs.String
toString()
-
Methods inherited from class org.jivesoftware.openfire.session.LocalServerSession
getAuthenticationMethod, getConnection, reattach, setAuthenticationMethod, setDetached, setStatus
-
Methods inherited from class org.jivesoftware.openfire.session.LocalSession
close, decodeVersion, deliverRawText, getAddress, getCipherSuiteName, getCreationDate, getHostAddress, getHostName, getLanguage, getLastActiveDate, getNumClientPackets, getNumServerPackets, getPeerCertificates, getServerName, getSessionData, getSoftwareVersion, getStatus, getStreamID, getStreamManager, getTLSProtocolName, incrementClientPacketCount, incrementServerPacketCount, isClosed, isDetached, isEncrypted, isSecure, isUsingSelfSignedCertificate, process, removeSessionData, setAddress, setSessionData, setSoftwareVersionData, validate
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.jivesoftware.openfire.session.ServerSession
getAuthenticationMethod, isUsingSaslExternal, isUsingServerDialback
-
Methods inherited from interface org.jivesoftware.openfire.session.Session
close, deliverRawText, getAddress, getCipherSuiteName, getCreationDate, getHostAddress, getHostName, getLanguage, getLastActiveDate, getNumClientPackets, getNumServerPackets, getPeerCertificates, getServerName, getSoftwareVersion, getStatus, getStreamID, getTLSProtocolName, isAuthenticated, isClosed, isEncrypted, isSecure, process, validate
-
-
-
-
Field Detail
-
INITIALISE_TIMEOUT_SECONDS
public static final SystemProperty<Duration> INITIALISE_TIMEOUT_SECONDS
Controls the S2S outgoing session initialise timeout time in seconds
-
-
Constructor Detail
-
LocalOutgoingServerSession
public LocalOutgoingServerSession(String localDomain, Connection connection, OutgoingServerSocketReader socketReader, StreamID streamID)
-
LocalOutgoingServerSession
public LocalOutgoingServerSession(String localDomain, Connection connection, StreamID streamID)
-
-
Method Detail
-
authenticateDomain
public static boolean authenticateDomain(DomainPair domainPair)
Authenticates the local domain to the remote domain. Once authenticated the remote domain can be expected to start accepting data from the local domain. This implementation will attempt to re-use an existing connection. An connection is deemed re-usable when it is either:- authenticated to the remote domain itself, or:
- authenticated to a sub- or superdomain of the remote domain AND offers dialback.
- Parameters:
domainPair
- the local and remote domain for which authentication is to be established.- Returns:
- True if the domain was authenticated by the remote server.
-
authenticateSubdomain
public boolean authenticateSubdomain(@Nonnull DomainPair domainPair)
Description copied from interface:OutgoingServerSession
Authenticates a subdomain of this server with the specified remote server over an existing outgoing connection. If the existing session was using server dialback then a new db:result is going to be sent to the remote server. But if the existing session was TLS+SASL based then just assume that the subdomain was authenticated by the remote server.- Specified by:
authenticateSubdomain
in interfaceOutgoingServerSession
- Parameters:
domainPair
- the local (sub) and remote domain for which authentication is to be established.- Returns:
- True if the domain was authenticated by the remote server.
-
getAvailableStreamFeatures
public List<org.dom4j.Element> getAvailableStreamFeatures()
Description copied from class:LocalSession
Returns a text with the available stream features. Each subclass may return different values depending whether the session has been authenticated or not.- Specified by:
getAvailableStreamFeatures
in classLocalSession
- Returns:
- a text with the available stream features or
null
to add nothing.
-
addOutgoingDomainPair
public void addOutgoingDomainPair(@Nonnull DomainPair domainPair)
Description copied from interface:OutgoingServerSession
Marks a domain pair as being authenticated.- Specified by:
addOutgoingDomainPair
in interfaceOutgoingServerSession
- Parameters:
domainPair
- the local and remote domain for which authentication has been established.
-
checkOutgoingDomainPair
public boolean checkOutgoingDomainPair(@Nonnull DomainPair domainPair)
Description copied from interface:OutgoingServerSession
Checks to see if a pair of domains has previously been authenticated. Since domains are authenticated as pairs, authenticating A->B does not imply anything about A-->C or D->B.- Specified by:
checkOutgoingDomainPair
in interfaceOutgoingServerSession
- Parameters:
domainPair
- the local and remote domain for which the check is executed.- Returns:
- True if the pair of domains has been authenticated.
-
getOutgoingDomainPairs
public Collection<DomainPair> getOutgoingDomainPairs()
Description copied from interface:OutgoingServerSession
Obtains all authenticated domain pairs. Most callers should avoid accessing this and use a simple check as above.- Specified by:
getOutgoingDomainPairs
in interfaceOutgoingServerSession
- Returns:
- collection of authenticated DomainPairs
-
toString
public String toString()
- Overrides:
toString
in classLocalServerSession
-
-