0N/A/*
2362N/A * Copyright (c) 2000, 2006, Oracle and/or its affiliates. All rights reserved.
0N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
0N/A *
0N/A * This code is free software; you can redistribute it and/or modify it
0N/A * under the terms of the GNU General Public License version 2 only, as
2362N/A * published by the Free Software Foundation. Oracle designates this
0N/A * particular file as subject to the "Classpath" exception as provided
2362N/A * by Oracle in the LICENSE file that accompanied this code.
0N/A *
0N/A * This code is distributed in the hope that it will be useful, but WITHOUT
0N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
0N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
0N/A * version 2 for more details (a copy is included in the LICENSE file that
0N/A * accompanied this code).
0N/A *
0N/A * You should have received a copy of the GNU General Public License version
0N/A * 2 along with this work; if not, write to the Free Software Foundation,
0N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
0N/A *
2362N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
2362N/A * or visit www.oracle.com if you need additional information or have any
2362N/A * questions.
0N/A */
0N/A
0N/Apackage javax.security.sasl;
0N/A
0N/Aimport java.util.Map;
0N/Aimport javax.security.auth.callback.CallbackHandler;
0N/A
0N/A/**
0N/A * An interface for creating instances of <tt>SaslServer</tt>.
0N/A * A class that implements this interface
0N/A * must be thread-safe and handle multiple simultaneous
0N/A * requests. It must also have a public constructor that accepts no
0N/A * argument.
0N/A *<p>
0N/A * This interface is not normally accessed directly by a server, which will use the
0N/A * <tt>Sasl</tt> static methods
0N/A * instead. However, a particular environment may provide and install a
0N/A * new or different <tt>SaslServerFactory</tt>.
0N/A *
0N/A * @since 1.5
0N/A *
0N/A * @see SaslServer
0N/A * @see Sasl
0N/A *
0N/A * @author Rosanna Lee
0N/A * @author Rob Weltman
0N/A */
0N/Apublic abstract interface SaslServerFactory {
0N/A /**
0N/A * Creates a <tt>SaslServer</tt> using the parameters supplied.
0N/A * It returns null
0N/A * if no <tt>SaslServer</tt> can be created using the parameters supplied.
0N/A * Throws <tt>SaslException</tt> if it cannot create a <tt>SaslServer</tt>
0N/A * because of an error.
0N/A *
0N/A * @param mechanism The non-null
0N/A * IANA-registered name of a SASL mechanism. (e.g. "GSSAPI", "CRAM-MD5").
0N/A * @param protocol The non-null string name of the protocol for which
0N/A * the authentication is being performed (e.g., "ldap").
0N/A * @param serverName The non-null fully qualified host name of the server
0N/A * to authenticate to.
0N/A * @param props The possibly null set of properties used to select the SASL
0N/A * mechanism and to configure the authentication exchange of the selected
0N/A * mechanism. See the <tt>Sasl</tt> class for a list of standard properties.
0N/A * Other, possibly mechanism-specific, properties can be included.
0N/A * Properties not relevant to the selected mechanism are ignored,
0N/A * including any map entries with non-String keys.
0N/A *
0N/A * @param cbh The possibly null callback handler to used by the SASL
0N/A * mechanisms to get further information from the application/library
0N/A * to complete the authentication. For example, a SASL mechanism might
0N/A * require the authentication ID, password and realm from the caller.
0N/A * The authentication ID is requested by using a <tt>NameCallback</tt>.
0N/A * The password is requested by using a <tt>PasswordCallback</tt>.
0N/A * The realm is requested by using a <tt>RealmChoiceCallback</tt> if there is a list
0N/A * of realms to choose from, and by using a <tt>RealmCallback</tt> if
0N/A * the realm must be entered.
0N/A *
0N/A *@return A possibly null <tt>SaslServer</tt> created using the parameters
0N/A * supplied. If null, this factory cannot produce a <tt>SaslServer</tt>
0N/A * using the parameters supplied.
0N/A *@exception SaslException If cannot create a <tt>SaslServer</tt> because
0N/A * of an error.
0N/A */
0N/A public abstract SaslServer createSaslServer(
0N/A String mechanism,
0N/A String protocol,
0N/A String serverName,
0N/A Map<String,?> props,
0N/A CallbackHandler cbh) throws SaslException;
0N/A
0N/A /**
0N/A * Returns an array of names of mechanisms that match the specified
0N/A * mechanism selection policies.
0N/A * @param props The possibly null set of properties used to specify the
0N/A * security policy of the SASL mechanisms. For example, if <tt>props</tt>
0N/A * contains the <tt>Sasl.POLICY_NOPLAINTEXT</tt> property with the value
0N/A * <tt>"true"</tt>, then the factory must not return any SASL mechanisms
0N/A * that are susceptible to simple plain passive attacks.
0N/A * See the <tt>Sasl</tt> class for a complete list of policy properties.
0N/A * Non-policy related properties, if present in <tt>props</tt>, are ignored,
0N/A * including any map entries with non-String keys.
0N/A * @return A non-null array containing a IANA-registered SASL mechanism names.
0N/A */
0N/A public abstract String[] getMechanismNames(Map<String,?> props);
0N/A}