01: package com.jat.business.authentication;
02:
03: import com.jat.business.BusinessException;
04: import com.jat.business.BusinessObjectProperties;
05: import com.jat.business.JatUser;
06:
07: /**
08: * <p>Title: JAT</p>
09: * <p>Description: </p>
10: * <p>Copyright: Copyright (c) 2004 -2005 Stefano Fratini (stefano.fratini@gmail.com)</p>
11: * <p>Distributed under the terms of the GNU Lesser General Public License, v2.1 or later</p>
12: * @author stf
13: * @version 1.2
14: * @since 1.0
15: */
16:
17: public class DummyAuthenticator implements Authenticator {
18:
19: public JatUser authenticate(String username, String password)
20: throws AuthenticationException {
21: DefaultUser user = null;
22: try {
23: user = new DefaultUser("DUMMY", username, password);
24: } catch (BusinessException ex) {
25: throw new AuthenticationException(ex.getMessage());
26: }
27: //if (username.indexOf("st")<0) throw new AuthenticationException("User does not exist");
28: if (password.length() < 3)
29: throw new AuthenticationException(
30: "Wrong username and/or password");
31: user.putField(JatUser.LAST_NAME, "Satriani");
32: user.putField(JatUser.FIRST_NAME, "Joe");
33: user.putField(JatUser.PROFILE, "DUMMY");
34: return user;
35: }
36:
37: /** @link dependency
38: * @stereotype instantiate*/
39: /*# DefaultUser lnkDefaultUser; */
40: }
|