1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package org.apache.jetspeed.security.impl;
18
19 import java.util.prefs.Preferences;
20
21 import javax.security.auth.Subject;
22
23 import org.apache.jetspeed.security.User;
24
25 /***
26 * <p>A user made of a {@link Subject} and the user {@link Preferences}.</p>
27 * @author <a href="mailto:dlestrat@apache.org">David Le Strat</a>
28 */
29 public class UserImpl implements User
30 {
31 private Subject subject;
32 private Preferences preferences;
33
34 /***
35 * <p>Default constructor.</p>
36 */
37 public UserImpl()
38 {
39 }
40
41 /***
42 * <p>{@link User} constructor given a subject and preferences.</p>
43 * @param subject The subject.
44 * @param preferences The preferences.
45 */
46 public UserImpl(Subject subject, Preferences preferences)
47 {
48 this.subject = subject;
49 this.preferences = preferences;
50 }
51
52 /***
53 * @see org.apache.jetspeed.security.User#getSubject()
54 */
55 public Subject getSubject()
56 {
57 return subject;
58 }
59
60 /***
61 * @see org.apache.jetspeed.security.User#setSubject(javax.security.auth.Subject)
62 */
63 public void setSubject(Subject subject)
64 {
65 this.subject = subject;
66 }
67
68 /***
69 * @see org.apache.jetspeed.security.User#getPreferences()
70 */
71 public Preferences getPreferences()
72 {
73 return preferences;
74 }
75
76 /***
77 * @see org.apache.jetspeed.security.User#setPreferences(java.util.prefs.Preferences)
78 */
79 public void setPreferences(Preferences preferences)
80 {
81 this.preferences = preferences;
82 }
83
84 public Preferences getUserAttributes()
85 {
86 if (preferences != null)
87 {
88 return preferences.node(USER_INFO_PROPERTY_SET);
89 }
90 return null;
91 }
92 }