001    package org.esupportail.cas.server.handlers.ldap;
002    
003    import org.dom4j.Element;
004    import org.esupportail.cas.server.util.RedundantHandler;
005    
006    /**
007     * This abstract class implements an LDAP handler class, inherited by
008     * FastBindLdapHandler and BindLdapHandler.
009     *
010     * @author Pascal Aubry <pascal.aubry at univ-rennes1.fr>
011     */
012    abstract class LdapHandler extends RedundantHandler {
013            /**
014             * The filter for the usernames provided by the users.
015             */
016            private String filter;
017            
018            /**
019             * Constructor.
020             *
021             * @param handlerElement the XML element that declares the handler 
022             * in the configuration file
023             * @param configDebug debugging mode of the global configuration
024             * @throws Exception Exception
025             */
026            protected LdapHandler(
027                            final Element handlerElement, 
028                            final Boolean configDebug) throws Exception {
029                    super(handlerElement, configDebug);
030                    traceBegin();
031    
032                    // check that a config element is present
033                    checkConfigElement(true);
034    
035                    filter = getConfigSubElementContent("filter", true/*needed*/);
036                    trace("filter = " + filter);
037    
038                    traceEnd();
039            }
040    
041            /**
042             * Retrieve the filter of the usernames.
043             *
044             * @return a String Object.
045             */
046            final String getFilter() {
047                    return filter;
048            }
049            
050    }
051