1/*2 * Licensed to the Apache Software Foundation (ASF) under one or more3 * contributor license agreements. See the NOTICE file distributed with4 * this work for additional information regarding copyright ownership.5 * The ASF licenses this file to You under the Apache License, Version 2.06 * (the "License"); you may not use this file except in compliance with7 * the License. You may obtain a copy of the License at8 *9 * http://www.apache.org/licenses/LICENSE-2.010 *11 * Unless required by applicable law or agreed to in writing, software12 * 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 and15 * limitations under the License.16 */17packageorg.apache.jetspeed.security.impl;
1819import java.util.prefs.Preferences;
2021import javax.security.auth.Subject;
2223import org.apache.jetspeed.security.User;
2425/***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 */29publicclassUserImpl implements User
30 {
31private Subject subject;
32private Preferences preferences;
3334/***35 * <p>Default constructor.</p>36 */37publicUserImpl()
38 {
39 }
4041/***42 * <p>{@link User} constructor given a subject and preferences.</p>43 * @param subject The subject.44 * @param preferences The preferences.45 */46publicUserImpl(Subject subject, Preferences preferences)
47 {
48this.subject = subject;
49this.preferences = preferences;
50 }
5152/***53 * @see org.apache.jetspeed.security.User#getSubject()54 */55public Subject getSubject()
56 {
57return subject;
58 }
5960/***61 * @see org.apache.jetspeed.security.User#setSubject(javax.security.auth.Subject)62 */63publicvoid setSubject(Subject subject)
64 {
65this.subject = subject;
66 }
6768/***69 * @see org.apache.jetspeed.security.User#getPreferences()70 */71public Preferences getPreferences()
72 {
73return preferences;
74 }
7576/***77 * @see org.apache.jetspeed.security.User#setPreferences(java.util.prefs.Preferences)78 */79publicvoid setPreferences(Preferences preferences)
80 {
81this.preferences = preferences;
82 }
8384public Preferences getUserAttributes()
85 {
86if (preferences != null)
87 {
88return preferences.node(USER_INFO_PROPERTY_SET);
89 }
90returnnull;
91 }
92 }