01: /*
02: * The contents of this file are subject to the
03: * Mozilla Public License Version 1.1 (the "License");
04: * you may not use this file except in compliance with the License.
05: * You may obtain a copy of the License at http://www.mozilla.org/MPL/
06: *
07: * Software distributed under the License is distributed on an "AS IS"
08: * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied.
09: * 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 pwd)
45: throws UserAuthenticationException;
46:
47: /**
48: * Give a new password to pwdUsr.
49: *
50: * @param authUsr User making change
51: * @param pwdUsr User of password to be changed
52: * @param authPwd Password of User requesting the change
53: * @param newPwd New password
54: * @return Returns status code
55: */
56: public int setPassword(User authUsr, User pwdUsr, String authPwd,
57: String newPwd) throws UserAuthenticationException;
58:
59: /**
60: * Returns a user from the user name and password.
61: *
62: * @param sUser
63: * @param sPwd
64: * @return
65: * @throws UserAuthenticationException
66: */
67: public User getUser(String sUser, String sPwd)
68: throws UserAuthenticationException;
69:
70: /**
71: * Returns a user from the user name.
72: *
73: * @param sUser
74: * @param sPwd
75: * @return
76: * @throws UserAuthenticationException
77: */
78: public User getUser(String sUser)
79: throws UserAuthenticationException;
80:
81: /**
82: * Returns <code>true</code> if the user of the given user name has been locked
83: * out of the system due to to many attempts to log in.
84: *
85: * @param sUserName
86: * @return
87: */
88: public boolean isUserLockedOut(String sUserName)
89: throws UserAuthenticationException;
90:
91: public boolean hasPasswordExpired(User usr)
92: throws UserAuthenticationException;
93: }
|