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