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 */
020package org.apache.directory.server.annotations;
021
022
023import java.lang.annotation.Documented;
024import java.lang.annotation.ElementType;
025import java.lang.annotation.Inherited;
026import java.lang.annotation.Retention;
027import java.lang.annotation.RetentionPolicy;
028import java.lang.annotation.Target;
029
030import org.apache.directory.server.ldap.handlers.sasl.SimpleMechanismHandler;
031import org.apache.directory.server.ldap.handlers.sasl.cramMD5.CramMd5MechanismHandler;
032import org.apache.directory.server.ldap.handlers.sasl.digestMD5.DigestMd5MechanismHandler;
033import org.apache.directory.server.ldap.handlers.sasl.external.certificate.CertificateMechanismHandler;
034import org.apache.directory.server.ldap.handlers.sasl.gssapi.GssapiMechanismHandler;
035import org.apache.directory.server.ldap.handlers.sasl.ntlm.NtlmMechanismHandler;
036
037
038/**
039 * A annotation used to define the SASL configuration. Many elements can be configured :
040 * <ul>
041 * <li> The host</li>
042 * <li> The principal</li>
043 * <li> The SASL Qop</li>
044 * <li> The SASL Realms</li>
045 * <li> The SASL mechanisms</li>
046 * </ul>
047 * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
048 */
049@Documented
050@Inherited
051@Retention(RetentionPolicy.RUNTIME)
052@Target(
053    { ElementType.METHOD, ElementType.TYPE })
054public @interface Sasl
055{
056    /** @return The SASL host, default to "" */
057    String host() default "";
058
059
060    /** @return The principal */
061    String principal();
062
063
064    /** @return The SASL QOP list */
065    String[] qop() default
066        { "auth", "auth-int", "auth-conf" };
067
068
069    /** @return The SASL realms */
070    String[] realms() default
071        {};
072
073
074    /** @return The mechanism handlers.*/
075    Class<?>[] mechanismHandler() default
076        {
077            SimpleMechanismHandler.class,
078            CramMd5MechanismHandler.class,
079            DigestMd5MechanismHandler.class,
080            GssapiMechanismHandler.class,
081            NtlmMechanismHandler.class,
082            CertificateMechanismHandler.class
083    };
084}