// Do nothing if the target domain is empty, null or contains whitespaces
// Check if the remote domain is in the blacklist
log.warn("Unable to authenticate: remote domain is invalid.");
if(!RemoteServerManager.canAccess(remoteDomain)){
returnfalse;
log.info("Unable to authenticate: Remote domain is not accessible according to our configuration (typical causes: server federation is disabled, or domain is blacklisted).");
}
returnfalse;
try{
}
// Check if the remote domain is in the blacklist
if(!RemoteServerManager.canAccess(remoteDomain)){
log.debug("Searching for pre-existing outgoing sessions to the remote domain (if one exists, it will be re-used) ...");
log.info("Unable to authenticate: Remote domain is not accessible according to our configuration (typical causes: server federation is disabled, or domain is blacklisted).");
// Server is shutting down while we are trying to create a new s2s connection
log.debug("Searching for pre-existing outgoing sessions to the remote domain (if one exists, it will be re-used) ...");
log.warn("Unable to authenticate: a SessionManager instance is not available. This should not occur unless Openfire is starting up or shutting down.");
// Server is shutting down while we are trying to create a new s2s connection
log.warn("Unable to authenticate: a SessionManager instance is not available. This should not occur unless Openfire is starting up or shutting down.");
if(session==null)
returnfalse;
{
}
log.debug("There are no pre-existing outgoing sessions to the remote domain itself. Searching for pre-existing outgoing sessions to super- or subdomains of the remote domain (if one exists, it might be re-usable) ...");
// These are the remote domains that are allowed to send data to the local domain - expected to be sub- or superdomains of remoteDomain
log.debug("There are no pre-existing outgoing sessions to the remote domain itself. Searching for pre-existing outgoing sessions to super- or subdomains of the remote domain (if one exists, it might be re-usable) ...");
// As this sub/superdomain is different from the original remote domain, we need to check if it supports dialback.
if(session!=null)
if(session.isUsingServerDialback())
{
{
log.debug("An outgoing session to a different domain ('{}') hosted on the remote domain was found.",otherRemoteDomain);
log.debug("Dialback was used for '{}'. This session can be re-used.",otherRemoteDomain);
break;
// As this sub/superdomain is different from the original remote domain, we need to check if it supports dialback.
}
if(session.isUsingServerDialback())
else
{
{
log.debug("Dialback was used for '{}'. This session can be re-used.",otherRemoteDomain);
log.debug("Dialback was not used for '{}'. This session cannot be re-used.",otherRemoteDomain);
break;
session=null;
}
}
else
}
{
}
log.debug("Dialback was not used for '{}'. This session cannot be re-used.",otherRemoteDomain);
}
session=null;
}
if(session==null){
}
log.debug("There are no pre-existing session to other domains hosted on the remote domain.");
}
}
}
}
if(session==null){
if(session!=null)
log.debug("There are no pre-existing session to other domains hosted on the remote domain.");
{
}
log.debug("A pre-existing session can be re-used. The session was established using server dialback so it is possible to do piggybacking to authenticate more domains.");
// Do nothing since the domain has already been authenticated.
{
log.debug("Authentication successful (domain was already authenticated in the pre-existing session).");
log.debug("A pre-existing session can be re-used. The session was established using server dialback so it is possible to do piggybacking to authenticate more domains.");
if(outgoingSession!=null){// TODO this success handler behaves differently from a similar success handler above. Shouldn't those be the same?
{
log.debug("Successfully created new session (using dialback as a fallback)!");
log.warn("Unable to create a new session: exhausted all options (not trying dialback as a fallback, as server dialback is disabled by configuration.");
returnoutgoingSession;
returnnull;
}else{
}
log.warn("Unable to create a new session: Dialback (as a fallback) failed.");
finalLoggerlog=LoggerFactory.getLogger(Log.getName()+"[Secure/Authenticate connection for: "+localDomain+" to: "+remoteDomain+"]");
else
Elementfeatures;
{
log.warn("Unable to create a new session: exhausted all options (not trying dialback as a fallback, as server dialback is disabled by configuration.");
log.debug("Securing and authenticating connection ...");
returnnull;
}
log.debug("Indicating we want TLS and wait for response.");