001/* 002 * (C) Copyright 2010 Nuxeo SA (http://nuxeo.com/) and others. 003 * 004 * Licensed under the Apache License, Version 2.0 (the "License"); 005 * you may not use this file except in compliance with the License. 006 * You may obtain a copy of the License at 007 * 008 * http://www.apache.org/licenses/LICENSE-2.0 009 * 010 * Unless required by applicable law or agreed to in writing, software 011 * distributed under the License is distributed on an "AS IS" BASIS, 012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 013 * See the License for the specific language governing permissions and 014 * limitations under the License. 015 * 016 * Contributors: 017 * Robert Browning - initial implementation 018 * Nuxeo - code review and integration 019 */ 020package org.nuxeo.ecm.directory.ldap.dns; 021 022import java.util.List; 023 024import javax.naming.NamingException; 025 026/** 027 * Utility to fetch SRV records from a DNS server to get the list of available ldap servers from the DN representation 028 * of the domain. 029 * <p> 030 * See: http://en.wikipedia.org/wiki/SRV_record 031 * 032 * @author Robert Browning 033 */ 034public interface DNSServiceResolver { 035 036 /** 037 * DNS Cache Expiry property 038 */ 039 String DNS_CACHE_EXPIRY = "org.nuxeo.ecm.directory.ldap.dns.cache.expiry"; 040 041 /** 042 * Prefix to locate LDAP service on DNS Server. 043 * <p> 044 * <b>service</b>: _ldap<br/> 045 * <b>protocol</b>: _tcp 046 */ 047 String LDAP_SERVICE_PREFIX = "_ldap._tcp"; 048 049 /** 050 * Returns a list of LDAP servers for the specified domain by performing an SRV DNS lookup on _ldap._tcp.${domain}. 051 * 052 * @param domain 053 * @return the list of SRV dns entries 054 * @throws NamingException 055 */ 056 List<DNSServiceEntry> resolveLDAPDomainServers(final String domain) throws NamingException; 057 058 /** 059 * Returns a list of LDAP servers for the specified domain by performing an SRV DNS lookup using a custom DNS 060 * service prefix. 061 * 062 * @param domain 063 * @param prefix custom SRV prefix such as "_gc._tcp" 064 * @return the list of SRV dns entries 065 * @throws NamingException 066 */ 067 List<DNSServiceEntry> resolveLDAPDomainServers(final String domain, final String prefix) throws NamingException; 068 069}