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(String, String)
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
-
-
Field Summary
-
Fields inherited from class org.jivesoftware.openfire.session.LocalServerSession
inboundAllowed, outboundAllowed, usingServerDialback
-
Fields inherited from class org.jivesoftware.openfire.session.LocalSession
CHARSET, conn, sessionManager, status, 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)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addOutgoingDomainPair(String localDomain, String remoteDomain)
Marks a domain pair as being authenticated.static boolean
authenticateDomain(String localDomain, String remoteDomain)
Authenticates the local domain to the remote domain.boolean
authenticateSubdomain(String localDomain, String remoteDomain)
Authenticates a subdomain of this server with the specified remote server over an exsiting outgoing connection.boolean
checkOutgoingDomainPair(String localDomain, String remoteDomain)
Checks to see if a pair of domains has previously been authenticated.String
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
isUsingServerDialback
-
Methods inherited from class org.jivesoftware.openfire.session.LocalSession
close, decodeVersion, deliverRawText, getAddress, getCipherSuiteName, getConnection, getCreationDate, getHostAddress, getHostName, getLanguage, getLastActiveDate, getNumClientPackets, getNumServerPackets, getPeerCertificates, getServerName, getSessionData, getSoftwareVersion, getStatus, getStreamID, getStreamManager, incrementClientPacketCount, incrementServerPacketCount, isClosed, isDetached, isSecure, isUsingSelfSignedCertificate, process, reattach, removeSessionData, setAddress, setDetached, setSessionData, setSoftwareVersionData, setStatus, 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
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, isClosed, isSecure, process, validate
-
-
-
-
Constructor Detail
-
LocalOutgoingServerSession
public LocalOutgoingServerSession(String localDomain, Connection connection, OutgoingServerSocketReader socketReader, StreamID streamID)
-
-
Method Detail
-
authenticateDomain
public static boolean authenticateDomain(String localDomain, String remoteDomain)
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:
localDomain
- the local domain to authenticate with the remote server.remoteDomain
- the remote server, to which the local domain intends to send data.- Returns:
- True if the domain was authenticated by the remote server.
-
authenticateSubdomain
public boolean authenticateSubdomain(String localDomain, String remoteDomain)
Description copied from interface:OutgoingServerSession
Authenticates a subdomain of this server with the specified remote server over an exsiting 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:
localDomain
- the locally domain to authenticate with the remote server.remoteDomain
- the domain of the remote server.- Returns:
- True if the domain was authenticated by the remote server.
-
getAvailableStreamFeatures
public String 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.- Overrides:
getAvailableStreamFeatures
in classLocalServerSession
- Returns:
- a text with the available stream features or
null
to add nothing.
-
addOutgoingDomainPair
public void addOutgoingDomainPair(String localDomain, String remoteDomain)
Description copied from interface:OutgoingServerSession
Marks a domain pair as being authenticated.- Specified by:
addOutgoingDomainPair
in interfaceOutgoingServerSession
- Parameters:
localDomain
- the locally hosted domain.remoteDomain
- the remote domain.
-
checkOutgoingDomainPair
public boolean checkOutgoingDomainPair(String localDomain, String remoteDomain)
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:
localDomain
- the local domain (previously: authenticated domain)remoteDomain
- the remote domain (previous: hostname)- 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
-
-