01: package com.technoetic.xplanner.security;
02:
03: import java.io.Serializable;
04: import java.util.Map;
05: import javax.security.auth.Subject;
06: import javax.servlet.http.HttpServletRequest;
07:
08: public interface LoginModule extends Serializable {
09: String MESSAGE_NULL_PASSWORD_KEY = "authentication.module.message.passwordNotSet";
10: String MESSAGE_SERVER_ERROR_KEY = "authentication.module.message.serverError";
11: String MESSAGE_AUTHENTICATION_FAILED_KEY = "authentication.module.message.authenticationFailed";
12: String MESSAGE_USER_NOT_FOUND_KEY = "authentication.module.message.userNotFound";
13: String MESSAGE_COMMUNICATION_ERROR_KEY = "authentication.module.message.communicationError";
14: String MESSAGE_SERVER_NOT_FOUND_KEY = "authentication.module.message.serverNotFound";
15: String MESSAGE_CONFIGURATION_ERROR_KEY = "authentication.module.message.serverConfigurationError";
16: String MESSAGE_NO_MODULE_NAME_SPECIFIED_ERROR_KEY = "authentication.module.message.serverConfigurationError.noModuleName";
17: String ATTEMPTING_TO_AUTHENTICATE = "Attempting to authenticate with login module: ";
18: String AUTHENTICATION_SUCCESFULL = "Authentication successful with login module: ";
19:
20: /**
21: * Authenticates a user through some specific mechansism.
22: * @param userId
23: * @param password
24: * @return A Subject containing at least a Person principal and one or more Role principals.
25: * @throws AuthenticationException
26: */
27: Subject authenticate(String userId, String password)
28: throws AuthenticationException;
29:
30: /**
31: * Predicate that indicates whether this module can modify passwords.
32: * @return True if password can be changed, false otherwise.
33: */
34: boolean isCapableOfChangingPasswords();
35:
36: /**
37: * Changes a user's password.
38: * @param userId
39: * @param password
40: * @throws AuthenticationException if password cannot be changed.
41: */
42: void changePassword(String userId, String password)
43: throws AuthenticationException;
44:
45: /**
46: * Log out a user. At a minimum this method should invalidate the user's session.
47: * @throws AuthenticationException
48: */
49: void logout(HttpServletRequest request)
50: throws AuthenticationException;
51:
52: String getName();
53:
54: void setName(String name);
55:
56: void setOptions(Map options);
57: }
|