KickJava   Java API By Example, From Geeks To Geeks.

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


1 /*
2  * @(#)SaslClientFactory.java 1.15 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>SaslClient</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 client, 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>SaslClientFactory</tt>.
24  *
25  * @since 1.5
26  *
27  * @see SaslClient
28  * @see Sasl
29  *
30  * @author Rosanna Lee
31  * @author Rob Weltman
32  */

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

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

91     public abstract String JavaDoc[] getMechanismNames(Map JavaDoc<String JavaDoc,?> props);
92 }
93
Popular Tags