001 /* 002 * Copyright 2007-2015 UnboundID Corp. 003 * All Rights Reserved. 004 */ 005 /* 006 * Copyright (C) 2008-2015 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 */ 021 package com.unboundid.ldap.sdk; 022 023 024 025 026 027 028 /** 029 * This interface defines an API that may be used to establish a connection 030 * (and perform authentication if appropriate) to a remote server when following 031 * a referral. 032 * <BR><BR> 033 * Implementations of this interface should be threadsafe to ensure that 034 * multiple connections will be able to safely use the same 035 * {@code ReferralConnector} instance. 036 */ 037 public interface ReferralConnector 038 { 039 /** 040 * Retrieves an (optionally authenticated) LDAP connection for use in 041 * following a referral as defined in the provided LDAP URL. The connection 042 * will automatically be closed after the referral has been followed. 043 * 044 * @param referralURL The LDAP URL representing the referral being followed. 045 * @param connection The connection on which the referral was received. 046 * 047 * @return An LDAP connection established and optionally authenticated to the 048 * target system that may be used to attempt to follow a referral. 049 * 050 * @throws LDAPException If a problem occurs while establishing the 051 * connection or performing authentication on it. If 052 * an exception is thrown, then any underlying 053 * connection should be terminated before the 054 * exception is thrown. 055 */ 056 LDAPConnection getReferralConnection(final LDAPURL referralURL, 057 final LDAPConnection connection) 058 throws LDAPException; 059 }