%line | %branch | |||||||||
---|---|---|---|---|---|---|---|---|---|---|
org.apache.jetspeed.security.om.impl.InternalUserPrincipalImpl |
|
|
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.om.impl; |
|
18 | ||
19 | import java.util.ArrayList; |
|
20 | import java.util.Collection; |
|
21 | ||
22 | import org.apache.jetspeed.security.om.InternalUserPrincipal; |
|
23 | ||
24 | /** |
|
25 | * <p>{@link InternalUserPrincipal} interface implementation.</p> |
|
26 | * |
|
27 | * @author <a href="mailto:dlestrat@apache.org">David Le Strat</a> |
|
28 | */ |
|
29 | public class InternalUserPrincipalImpl extends InternalPrincipalImpl implements InternalUserPrincipal |
|
30 | { |
|
31 | /** The serial version uid. */ |
|
32 | private static final long serialVersionUID = 6713096308414915156L; |
|
33 | ||
34 | /** <p>User principal security class.</p> */ |
|
35 | 0 | static String USER_PRINCIPAL_CLASSNAME = "org.apache.jetspeed.security.InternalUserPrincipalImpl"; |
36 | ||
37 | /** The credentials. */ |
|
38 | private Collection credentials; |
|
39 | ||
40 | /** The role principals. */ |
|
41 | private Collection rolePrincipals; |
|
42 | ||
43 | /** The group principals. */ |
|
44 | private Collection groupPrincipals; |
|
45 | ||
46 | /** |
|
47 | * <p>InternalUserPrincipal implementation default constructor.</p> |
|
48 | */ |
|
49 | public InternalUserPrincipalImpl() |
|
50 | { |
|
51 | 0 | super(); |
52 | 0 | } |
53 | ||
54 | /** |
|
55 | * <p>Constructor to create a new user principal and its credential given |
|
56 | * a username and password.</p> |
|
57 | * @param username The username. |
|
58 | */ |
|
59 | public InternalUserPrincipalImpl(String username) |
|
60 | { |
|
61 | 0 | super(USER_PRINCIPAL_CLASSNAME, username); |
62 | 0 | this.rolePrincipals = new ArrayList(); |
63 | 0 | this.groupPrincipals = new ArrayList(); |
64 | 0 | } |
65 | ||
66 | /** |
|
67 | * @see org.apache.jetspeed.security.om.InternalUserPrincipal#getCredentials() |
|
68 | */ |
|
69 | public Collection getCredentials() |
|
70 | { |
|
71 | 0 | return this.credentials; |
72 | } |
|
73 | ||
74 | /** |
|
75 | * @see org.apache.jetspeed.security.om.InternalUserPrincipal#setCredentials(java.util.Collection) |
|
76 | */ |
|
77 | public void setCredentials(Collection credentials) |
|
78 | { |
|
79 | 0 | this.credentials = credentials; |
80 | 0 | } |
81 | ||
82 | /** |
|
83 | * @see org.apache.jetspeed.security.om.InternalUserPrincipal#getRolePrincipals() |
|
84 | */ |
|
85 | public Collection getRolePrincipals() |
|
86 | { |
|
87 | 0 | return this.rolePrincipals; |
88 | } |
|
89 | ||
90 | /** |
|
91 | * @see org.apache.jetspeed.security.om.InternalUserPrincipal#setRolePrincipals(java.util.Collection) |
|
92 | */ |
|
93 | public void setRolePrincipals(Collection rolePrincipals) |
|
94 | { |
|
95 | 0 | this.rolePrincipals = rolePrincipals; |
96 | 0 | } |
97 | ||
98 | /** |
|
99 | * @see org.apache.jetspeed.security.om.InternalUserPrincipal#getGroupPrincipals() |
|
100 | */ |
|
101 | public Collection getGroupPrincipals() |
|
102 | { |
|
103 | 0 | return this.groupPrincipals; |
104 | } |
|
105 | ||
106 | /** |
|
107 | * @see org.apache.jetspeed.security.om.InternalUserPrincipal#setGroupPrincipals(java.util.Collection) |
|
108 | */ |
|
109 | public void setGroupPrincipals(Collection groupPrincipals) |
|
110 | { |
|
111 | 0 | this.groupPrincipals = groupPrincipals; |
112 | 0 | } |
113 | ||
114 | /** |
|
115 | * <p>Compares this {@link InternalUserPrincipal} to the provided user principal |
|
116 | * and check if they are equal.</p> |
|
117 | * return Whether the {@link InternalUserPrincipal} are equal. |
|
118 | */ |
|
119 | public boolean equals(Object object) |
|
120 | { |
|
121 | 0 | if (!(object instanceof InternalUserPrincipal)) |
122 | 0 | return false; |
123 | ||
124 | 0 | InternalUserPrincipal r = (InternalUserPrincipal) object; |
125 | 0 | boolean isEqual = (r.getFullPath().equals(this.getFullPath())); |
126 | 0 | return isEqual; |
127 | } |
|
128 | ||
129 | } |
This report is generated by jcoverage, Maven and Maven JCoverage Plugin. |