KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > java > security > AuthProvider


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

7
8 package java.security;
9
10 import javax.security.auth.Subject JavaDoc;
11 import javax.security.auth.login.LoginException JavaDoc;
12 import javax.security.auth.callback.CallbackHandler JavaDoc;
13
14 /**
15  * This class defines login and logout methods for a provider.
16  *
17  * <p> While callers may invoke <code>login</code> directly,
18  * the provider may also invoke <code>login</code> on behalf of callers
19  * if it determines that a login must be performed
20  * prior to certain operations.
21  *
22  * @version 1.3, 02/03/04
23  * @since 1.5
24  */

25 public abstract class AuthProvider extends Provider JavaDoc {
26
27     /**
28      * Constructs a provider with the specified name, version number,
29      * and information.
30      *
31      * @param name the provider name.
32      * @param version the provider version number.
33      * @param info a description of the provider and its services.
34      */

35     protected AuthProvider(String JavaDoc name, double version, String JavaDoc info) {
36     super(name, version, info);
37     }
38
39     /**
40      * Log in to this provider.
41      *
42      * <p> The provider relies on a <code>CallbackHandler</code>
43      * to obtain authentication information from the caller
44      * (a PIN, for example). If the caller passes a <code>null</code>
45      * handler to this method, the provider uses the handler set in the
46      * <code>setCallbackHandler</code> method.
47      * If no handler was set in that method, the provider queries the
48      * <i>auth.login.defaultCallbackHandler</i> security property
49      * for the fully qualified class name of a default handler implementation.
50      * If the security property is not set,
51      * the provider is assumed to have alternative means
52      * for obtaining authentication information.
53      *
54      * @param subject the <code>Subject</code> which may contain
55      * principals/credentials used for authentication,
56      * or may be populated with additional principals/credentials
57      * after successful authentication has completed.
58      * This parameter may be <code>null</code>.
59      * @param handler the <code>CallbackHandler</code> used by
60      * this provider to obtain authentication information
61      * from the caller, which may be <code>null</code>
62      *
63      * @exception LoginException if the login operation fails
64      * @exception SecurityException if the caller does not pass a
65      * security check for
66      * <code>SecurityPermission("authProvider.<i>name</i>")</code>,
67      * where <i>name</i> is the value returned by
68      * this provider's <code>getName</code> method
69      */

70     public abstract void login(Subject JavaDoc subject, CallbackHandler JavaDoc handler)
71     throws LoginException JavaDoc;
72
73     /**
74      * Log out from this provider.
75      *
76      * @exception LoginException if the logout operation fails
77      * @exception SecurityException if the caller does not pass a
78      * security check for
79      * <code>SecurityPermission("authProvider.<i>name</i>")</code>,
80      * where <i>name</i> is the value returned by
81      * this provider's <code>getName</code> method
82      */

83     public abstract void logout() throws LoginException JavaDoc;
84
85     /**
86      * Set a <code>CallbackHandler</code>.
87      *
88      * <p> The provider uses this handler if one is not passed to the
89      * <code>login</code> method. The provider also uses this handler
90      * if it invokes <code>login</code> on behalf of callers.
91      * In either case if a handler is not set via this method,
92      * the provider queries the
93      * <i>auth.login.defaultCallbackHandler</i> security property
94      * for the fully qualified class name of a default handler implementation.
95      * If the security property is not set,
96      * the provider is assumed to have alternative means
97      * for obtaining authentication information.
98      *
99      * @param handler a <code>CallbackHandler</code> for obtaining
100      * authentication information, which may be <code>null</code>
101      *
102      * @exception SecurityException if the caller does not pass a
103      * security check for
104      * <code>SecurityPermission("authProvider.<i>name</i>")</code>,
105      * where <i>name</i> is the value returned by
106      * this provider's <code>getName</code> method
107      */

108     public abstract void setCallbackHandler(CallbackHandler JavaDoc handler);
109 }
110
Popular Tags