KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > javax > security > sasl > SaslServerFactory


1 /*
2  * @(#)SaslServerFactory.java 1.14 04/05/05
3  *
4  * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
5  * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
6  */

7
8 package javax.security.sasl;
9
10 import java.util.Map JavaDoc;
11 import javax.security.auth.callback.CallbackHandler JavaDoc;
12
13 /**
14  * An interface for creating instances of <tt>SaslServer</tt>.
15  * A class that implements this interface
16  * must be thread-safe and handle multiple simultaneous
17  * requests. It must also have a public constructor that accepts no
18  * argument.
19  *<p>
20  * This interface is not normally accessed directly by a server, which will use the
21  * <tt>Sasl</tt> static methods
22  * instead. However, a particular environment may provide and install a
23  * new or different <tt>SaslServerFactory</tt>.
24  *
25  * @since 1.5
26  *
27  * @see SaslServer
28  * @see Sasl
29  *
30  * @author Rosanna Lee
31  * @author Rob Weltman
32  */

33 public abstract interface SaslServerFactory {
34     /**
35      * Creates a <tt>SaslServer</tt> using the parameters supplied.
36      * It returns null
37      * if no <tt>SaslServer</tt> can be created using the parameters supplied.
38      * Throws <tt>SaslException</tt> if it cannot create a <tt>SaslServer</tt>
39      * because of an error.
40      *
41      * @param mechanism The non-null
42      * IANA-registered name of a SASL mechanism. (e.g. "GSSAPI", "CRAM-MD5").
43      * @param protocol The non-null string name of the protocol for which
44      * the authentication is being performed (e.g., "ldap").
45      * @param serverName The non-null fully qualified host name of the server
46      * to authenticate to.
47      * @param props The possibly null set of properties used to select the SASL
48      * mechanism and to configure the authentication exchange of the selected
49      * mechanism. See the <tt>Sasl</tt> class for a list of standard properties.
50      * Other, possibly mechanism-specific, properties can be included.
51      * Properties not relevant to the selected mechanism are ignored.
52      *
53      * @param cbh The possibly null callback handler to used by the SASL
54      * mechanisms to get further information from the application/library
55      * to complete the authentication. For example, a SASL mechanism might
56      * require the authentication ID, password and realm from the caller.
57      * The authentication ID is requested by using a <tt>NameCallback</tt>.
58      * The password is requested by using a <tt>PasswordCallback</tt>.
59      * The realm is requested by using a <tt>RealmChoiceCallback</tt> if there is a list
60      * of realms to choose from, and by using a <tt>RealmCallback</tt> if
61      * the realm must be entered.
62      *
63      *@return A possibly null <tt>SaslServer</tt> created using the parameters
64      * supplied. If null, this factory cannot produce a <tt>SaslServer</tt>
65      * using the parameters supplied.
66      *@exception SaslException If cannot create a <tt>SaslServer</tt> because
67      * of an error.
68      */

69     public abstract SaslServer JavaDoc createSaslServer(
70     String JavaDoc mechanism,
71     String JavaDoc protocol,
72     String JavaDoc serverName,
73     Map JavaDoc<String JavaDoc,?> props,
74     CallbackHandler JavaDoc cbh) throws SaslException JavaDoc;
75
76     /**
77      * Returns an array of names of mechanisms that match the specified
78      * mechanism selection policies.
79      * @param props The possibly null set of properties used to specify the
80      * security policy of the SASL mechanisms. For example, if <tt>props</tt>
81      * contains the <tt>Sasl.POLICY_NOPLAINTEXT</tt> property with the value
82      * <tt>"true"</tt>, then the factory must not return any SASL mechanisms
83      * that are susceptible to simple plain passive attacks.
84      * See the <tt>Sasl</tt> class for a complete list of policy properties.
85      * Non-policy related properties, if present in <tt>props</tt>, are ignored.
86      * @return A non-null array containing a IANA-registered SASL mechanism names.
87      */

88     public abstract String JavaDoc[] getMechanismNames(Map JavaDoc<String JavaDoc,?> props);
89 }
90
Popular Tags