KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > openharmonise > rm > security > authentication > UserAuthenticator


1 /*
2  * The contents of this file are subject to the
3  * Mozilla Public License Version 1.1 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at http://www.mozilla.org/MPL/
6  *
7  * Software distributed under the License is distributed on an "AS IS"
8  * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied.
9  * See the License for the specific language governing rights and
10  * limitations under the License.
11  *
12  * The Initial Developer of the Original Code is Simulacra Media Ltd.
13  * Portions created by Simulacra Media Ltd are Copyright (C) Simulacra Media Ltd, 2004.
14  *
15  * All Rights Reserved.
16  *
17  * Contributor(s):
18  */

19 package org.openharmonise.rm.security.authentication;
20
21 import org.openharmonise.rm.resources.users.*;
22
23 /**
24  * This interface provides a set of methods to be implemented by classes
25  * which can be used to authenticate users and manage passwords within
26  * Harmonise.
27  *
28  * @author Michael Bell
29  * @version $Revision: 1.1 $
30  *
31  */

32 public interface UserAuthenticator {
33
34     public static final int PWD_OK = 0;
35     public static final int AUTHENTICATION_FAIL = -1;
36
37     /**
38      * Authenticate user using given password.
39      *
40      * @param usr User to authenticate
41      * @param pwd Given password for user
42      * @return Returns <code>true</code> if password matches user's password
43      */

44     public boolean authenticate(User usr,String JavaDoc pwd) throws UserAuthenticationException ;
45     
46     /**
47      * Give a new password to pwdUsr.
48      *
49      * @param authUsr User making change
50      * @param pwdUsr User of password to be changed
51      * @param authPwd Password of User requesting the change
52      * @param newPwd New password
53      * @return Returns status code
54      */

55     public int setPassword(User authUsr,User pwdUsr,String JavaDoc authPwd,String JavaDoc newPwd) throws UserAuthenticationException;
56     
57     /**
58      * Returns a user from the user name and password.
59      *
60      * @param sUser
61      * @param sPwd
62      * @return
63      * @throws UserAuthenticationException
64      */

65     public User getUser(String JavaDoc sUser, String JavaDoc sPwd) throws UserAuthenticationException ;
66
67     /**
68      * Returns a user from the user name.
69      *
70      * @param sUser
71      * @param sPwd
72      * @return
73      * @throws UserAuthenticationException
74      */

75     public User getUser(String JavaDoc sUser) throws UserAuthenticationException;
76
77
78     /**
79      * Returns <code>true</code> if the user of the given user name has been locked
80      * out of the system due to to many attempts to log in.
81      *
82      * @param sUserName
83      * @return
84      */

85     public boolean isUserLockedOut(String JavaDoc sUserName) throws UserAuthenticationException;
86
87     public boolean hasPasswordExpired(User usr) throws UserAuthenticationException;
88 }
89
Popular Tags