001/* 002 * Copyright 2007-2017 UnboundID Corp. 003 * All Rights Reserved. 004 */ 005/* 006 * Copyright (C) 2008-2017 UnboundID Corp. 007 * 008 * This program is free software; you can redistribute it and/or modify 009 * it under the terms of the GNU General Public License (GPLv2 only) 010 * or the terms of the GNU Lesser General Public License (LGPLv2.1 only) 011 * as published by the Free Software Foundation. 012 * 013 * This program is distributed in the hope that it will be useful, 014 * but WITHOUT ANY WARRANTY; without even the implied warranty of 015 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 016 * GNU General Public License for more details. 017 * 018 * You should have received a copy of the GNU General Public License 019 * along with this program; if not, see <http://www.gnu.org/licenses>. 020 */ 021package com.unboundid.ldap.sdk; 022 023 024 025import com.unboundid.util.Extensible; 026import com.unboundid.util.ThreadSafety; 027import com.unboundid.util.ThreadSafetyLevel; 028 029 030 031/** 032 * This interface defines an API that may be used to establish a connection 033 * (and perform authentication if appropriate) to a remote server when following 034 * a referral. 035 * <BR><BR> 036 * Implementations of this interface should be threadsafe to ensure that 037 * multiple connections will be able to safely use the same 038 * {@code ReferralConnector} instance. 039 */ 040@Extensible() 041@ThreadSafety(level=ThreadSafetyLevel.INTERFACE_THREADSAFE) 042public interface ReferralConnector 043{ 044 /** 045 * Retrieves an (optionally authenticated) LDAP connection for use in 046 * following a referral as defined in the provided LDAP URL. The connection 047 * will automatically be closed after the referral has been followed. 048 * 049 * @param referralURL The LDAP URL representing the referral being followed. 050 * @param connection The connection on which the referral was received. 051 * 052 * @return An LDAP connection established and optionally authenticated to the 053 * target system that may be used to attempt to follow a referral. 054 * 055 * @throws LDAPException If a problem occurs while establishing the 056 * connection or performing authentication on it. If 057 * an exception is thrown, then any underlying 058 * connection should be terminated before the 059 * exception is thrown. 060 */ 061 LDAPConnection getReferralConnection(final LDAPURL referralURL, 062 final LDAPConnection connection) 063 throws LDAPException; 064}