001    /*
002     *  Licensed to the Apache Software Foundation (ASF) under one
003     *  or more contributor license agreements.  See the NOTICE file
004     *  distributed with this work for additional information
005     *  regarding copyright ownership.  The ASF licenses this file
006     *  to you under the Apache License, Version 2.0 (the
007     *  "License"); you may not use this file except in compliance
008     *  with the License.  You may obtain a copy of the License at
009     *
010     *    http://www.apache.org/licenses/LICENSE-2.0
011     *
012     *  Unless required by applicable law or agreed to in writing,
013     *  software distributed under the License is distributed on an
014     *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
015     *  KIND, either express or implied.  See the License for the
016     *  specific language governing permissions and limitations
017     *  under the License.
018     *
019     */
020    package org.apache.directory.server.annotations;
021    
022    import java.lang.annotation.Documented;
023    import java.lang.annotation.ElementType;
024    import java.lang.annotation.Inherited;
025    import java.lang.annotation.Retention;
026    import java.lang.annotation.RetentionPolicy;
027    import java.lang.annotation.Target;
028    
029    import org.apache.directory.server.ldap.handlers.bind.SimpleMechanismHandler;
030    import org.apache.directory.server.ldap.handlers.bind.cramMD5.CramMd5MechanismHandler;
031    import org.apache.directory.server.ldap.handlers.bind.digestMD5.DigestMd5MechanismHandler;
032    import org.apache.directory.server.ldap.handlers.bind.gssapi.GssapiMechanismHandler;
033    import org.apache.directory.server.ldap.handlers.bind.ntlm.NtlmMechanismHandler;
034    
035    
036    /**
037     * A annotation used to define the SASL configuration. Many elements can be configured :
038     * <ul>
039     * <li> The host</li>
040     * <li> The principal</li>
041     * <li> The SASL Qop</li>
042     * <li> The SASL Realms</li>
043     * <li> The SASL mechanisms</li>
044     * </ul>
045     * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
046     * @version $Rev$, $Date$
047     */
048    @Documented
049    @Inherited
050    @Retention ( RetentionPolicy.RUNTIME )
051    @Target ( { ElementType.METHOD, ElementType.TYPE } )
052    public @interface Sasl
053    {
054        /** The SASL host, default to localhost */
055        String host() default "localhost";
056        
057        /** The principal */
058        String principal();
059        
060        /** The SASL QOP list */
061        String[] qop() default { "auth", "auth-int", "auth-conf" };
062        
063        /** The SASL realms */
064        String[] realms() default {};
065        
066        /** The mechanism handlers.*/
067        Class<?>[] mechanismHandler() default 
068            { 
069                SimpleMechanismHandler.class,
070                CramMd5MechanismHandler.class,
071                DigestMd5MechanismHandler.class,
072                GssapiMechanismHandler.class,
073                NtlmMechanismHandler.class
074            };
075    }