1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 package org.caleigo.security;
20
21 /*** Handles the retreival of user login information. Typically an IUserLoginHandler
22 * asks the user for a user name and a password.
23 *
24 * @author Mattias Hagstrand
25 * @version 1.00
26 *
27 *//*
28 *
29 * WHEN WHO WHY & WHAT
30 * -----------------------------------------------------------------------------
31 * 2002-10-16 Mattias Hagstrand Creation
32 */
33 public interface ILoginInfoProvider
34 {
35 /*** Returns an Object that represents user login information. If the login
36 * is canceled <code>null</code> is returned.
37 */
38 public Object getUserLoginInformation() throws SecurityException;
39
40 /*** Invoked when an error occured while logging in with the user login information
41 * returned by this IUserLoginHandler.
42 */
43 public void handleError(String message);
44
45 /*** Returns the maximum number of times a user is allowed to try to login
46 * before the application exits.
47 */
48 public int getMaximumNumberOfLoginTries();
49
50
51 public static class GuestUserLoginHandler implements java.io.Serializable, ILoginInfoProvider
52 {
53
54 public static final int MAX_LOGIN_TRIES = 3;
55
56
57 private static final Object LOGIN_INFO = new ILoginService.UserLoginInfo("guest", "");
58
59
60
61 /*** Returns an Object that represents user login information.
62 */
63 public Object getUserLoginInformation() throws SecurityException
64 {
65 return LOGIN_INFO;
66 }
67
68 /*** Invoked when an error occured while logging in with the user login information
69 * returned by this IUserLoginHandler.
70 */
71 public void handleError(String message)
72 {
73 }
74
75 /*** Returns the maximum number of times a user is allowed to try to login
76 * before the application exits.
77 */
78 public int getMaximumNumberOfLoginTries()
79 {
80 return MAX_LOGIN_TRIES;
81 }
82 }
83 }