KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > sun > enterprise > security > auth > login > PasswordLoginModule


1 /*
2  * The contents of this file are subject to the terms
3  * of the Common Development and Distribution License
4  * (the License). You may not use this file except in
5  * compliance with the License.
6  *
7  * You can obtain a copy of the license at
8  * https://glassfish.dev.java.net/public/CDDLv1.0.html or
9  * glassfish/bootstrap/legal/CDDLv1.0.txt.
10  * See the License for the specific language governing
11  * permissions and limitations under the License.
12  *
13  * When distributing Covered Code, include this CDDL
14  * Header Notice in each file and include the License file
15  * at glassfish/bootstrap/legal/CDDLv1.0.txt.
16  * If applicable, add the following below the CDDL Header,
17  * with the fields enclosed by brackets [] replaced by
18  * you own identifying information:
19  * "Portions Copyrighted [year] [name of copyright owner]"
20  *
21  * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
22  */

23
24 package com.sun.enterprise.security.auth.login;
25
26 import com.sun.appserv.security.AppservPasswordLoginModule;
27 import com.sun.enterprise.security.auth.realm.Realm;
28 import javax.security.auth.login.LoginException JavaDoc;
29
30 /**
31  * Abstract base class for password-based login modules.
32  * Newer implementations should extend
33  * com.sun.appserv.security.AbstractLoginModule. This class is provided for
34  * backward compatibility and is a candidate for deprecation.
35  *
36  */

37 public abstract class PasswordLoginModule extends AppservPasswordLoginModule
38 {
39
40     /**
41      * Maintain RI compatibility.
42      *
43      * <P>This is a convenience method which can be used by subclasses
44      * to complete the steps required by RI legacy authentication code.
45      * Most of this should go away if a clean JAAS/Subject based
46      * infrastructure is provided. But for now this must be done.
47      *
48      * <P>Note that this method is called after the authentication
49      * has succeeded. If authentication failed do not call this method.
50      *
51      * <P>A lot of the RI behavior is still present here. Some of the
52      * most notable points to remember:
53      * <ul>
54      * <li>Global instance field succeeded is set to true by this method.
55      *
56      * @param username Name of authenticated user.
57      * @param password Password of this user.
58      * @param theRealm Current Realm object for this authentication.
59      * @param groups String array of group memberships for user (could be
60      * empty).
61      * @returns void
62      *
63      */

64     public final void commitAuthentication(String JavaDoc username,
65                                         String JavaDoc password,
66                                         Realm theRealm,
67                                         String JavaDoc[] groups)
68     {
69         commitUserAuthentication(groups);
70     }
71     /**
72      * Older implementations can implement authenticate. While new implementation
73      * calls authenticateUser
74      * @throws LoginException
75      */

76     protected final void authenticateUser () throws LoginException JavaDoc{
77         authenticate();
78     }
79
80     /**
81      * Perform authentication decision.
82      * Method returns silently on success and returns a LoginException
83      * on failure.
84      * To be implmented by sub-classes
85      * @return void authenticate returns silently on successful authentication.
86      * @throws com.sun.enterprise.security.LoginException on authentication failure.
87      *
88      */

89     abstract protected void authenticate()
90         throws LoginException JavaDoc;
91 }
92
Popular Tags