%line | %branch | |||||||||
---|---|---|---|---|---|---|---|---|---|---|
org.apache.jetspeed.security.impl.UserImpl |
|
|
1 | /* |
|
2 | * Licensed to the Apache Software Foundation (ASF) under one or more |
|
3 | * contributor license agreements. See the NOTICE file distributed with |
|
4 | * this work for additional information regarding copyright ownership. |
|
5 | * The ASF licenses this file to You under the Apache License, Version 2.0 |
|
6 | * (the "License"); you may not use this file except in compliance with |
|
7 | * the License. You may obtain a copy of the License at |
|
8 | * |
|
9 | * http://www.apache.org/licenses/LICENSE-2.0 |
|
10 | * |
|
11 | * Unless required by applicable law or agreed to in writing, software |
|
12 | * distributed under the License is distributed on an "AS IS" BASIS, |
|
13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
|
14 | * See the License for the specific language governing permissions and |
|
15 | * limitations under the License. |
|
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 | 0 | { |
39 | 0 | } |
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 | 0 | { |
48 | 0 | this.subject = subject; |
49 | 0 | this.preferences = preferences; |
50 | 0 | } |
51 | ||
52 | /** |
|
53 | * @see org.apache.jetspeed.security.User#getSubject() |
|
54 | */ |
|
55 | public Subject getSubject() |
|
56 | { |
|
57 | 0 | 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 | 0 | this.subject = subject; |
66 | 0 | } |
67 | ||
68 | /** |
|
69 | * @see org.apache.jetspeed.security.User#getPreferences() |
|
70 | */ |
|
71 | public Preferences getPreferences() |
|
72 | { |
|
73 | 0 | 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 | 0 | this.preferences = preferences; |
82 | 0 | } |
83 | ||
84 | public Preferences getUserAttributes() |
|
85 | { |
|
86 | 0 | if (preferences != null) |
87 | { |
|
88 | 0 | return preferences.node(USER_INFO_PROPERTY_SET); |
89 | } |
|
90 | 0 | return null; |
91 | } |
|
92 | } |
This report is generated by jcoverage, Maven and Maven JCoverage Plugin. |