1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23 package org.talika.tarsis.security.memory;
24
25 import java.io.Serializable;
26 import java.util.Set;
27
28 import org.talika.tarsis.security.UserImpl;
29
30 /**
31 * XML/Memory implementation of <code>User</code> interface.
32 *
33 * @author Jose M. Palomar
34 * @version $Revision: 125 $
35 *
36 * @todo Make password field transient or remove it. Add a empty parameters default
37 * constructor.
38 */
39 public final class MemoryUserImpl extends UserImpl implements Serializable {
40
41
42
43
44 /**
45 * Password of user.
46 */
47 private final String password;
48
49
50 /**
51 * Creates a new <code>MemoryUserImpl</code> using given parameters.
52 *
53 * @param login String login name of user.
54 * @param name String real name of user.
55 * @param password String password of user.
56 * @param roles Set roles of user.
57 */
58 public MemoryUserImpl(String login, String name, String password, Set roles) {
59 super(login, name, roles);
60 this.password = password;
61 }
62
63
64 /**
65 * Returns <code>true</code> if password is valid.
66 *
67 * @param password String password to check.
68 * @return boolean <code>true</code> if password is valid.
69 */
70 public boolean isPasswordValid(String password) {
71 return this.password.equals(password);
72 }
73
74 }