1 |
|
|
2 |
|
|
3 |
|
|
4 |
|
|
5 |
|
|
6 |
|
|
7 |
|
|
8 |
|
|
9 |
|
|
10 |
|
|
11 |
|
|
12 |
|
|
13 |
|
|
14 |
|
|
15 |
|
|
16 |
|
|
17 |
|
|
18 |
|
|
19 |
|
|
20 |
|
|
21 |
|
|
22 |
|
|
23 |
|
|
24 |
|
|
25 |
|
|
26 |
|
|
27 |
|
|
28 |
|
|
29 |
|
|
30 |
|
|
31 |
|
|
32 |
|
package issrg.pba.repository; |
33 |
|
|
34 |
|
import issrg.pba.rbac.LDAPDNPrincipal; |
35 |
|
import issrg.utils.repository.Entry; |
36 |
|
import issrg.utils.repository.TokenLocator; |
37 |
|
|
38 |
|
|
39 |
|
|
40 |
|
|
41 |
|
|
42 |
|
|
43 |
|
|
44 |
|
|
45 |
|
|
46 |
|
|
47 |
|
|
48 |
|
|
49 |
|
@author |
50 |
|
@version |
51 |
|
|
52 |
|
|
|
|
| 65.9% |
Uncovered Elements: 30 (88) |
Complexity: 17 |
Complexity Density: 0.7 |
|
53 |
|
public class UserEntry implements issrg.pba.rbac.policies.LDAPEntry, TokenLocator { |
54 |
|
private LDAPDNPrincipal subjectDN=null; |
55 |
|
private LDAPDNPrincipal issuerDN=null; |
56 |
|
private java.math.BigInteger sn=null; |
57 |
|
|
58 |
|
protected TokenLocator alternativeDN=null; |
59 |
|
|
60 |
|
|
61 |
|
|
62 |
|
|
63 |
|
|
64 |
|
|
65 |
|
|
66 |
|
|
67 |
|
|
68 |
|
@param |
69 |
|
@param |
70 |
|
@param |
71 |
|
|
72 |
|
@throws |
73 |
|
|
74 |
|
|
75 |
|
|
76 |
|
|
|
|
| 55% |
Uncovered Elements: 9 (20) |
Complexity: 8 |
Complexity Density: 0.67 |
|
77 |
3452
|
protected void _init_(java.security.Principal subject, java.security.Principal issuer,... |
78 |
|
java.math.BigInteger serialNumber){ |
79 |
3452
|
try{ |
80 |
3452
|
if (subject==null && (issuer==null || serialNumber==null)){ |
81 |
0
|
throw new IllegalArgumentException("Cannot instantiate: Subject DN and Issuer data are null"); |
82 |
|
} |
83 |
|
|
84 |
3452
|
if ((issuer==null) ^ (serialNumber==null)){ |
85 |
0
|
throw new IllegalArgumentException("Cannot instantiate: Issuer data incomplete"); |
86 |
|
} |
87 |
|
|
88 |
3452
|
if (subject!=null){ |
89 |
3452
|
subjectDN=new LDAPDNPrincipal(subject.getName()); |
90 |
|
} |
91 |
|
|
92 |
3452
|
sn=serialNumber; |
93 |
|
|
94 |
3452
|
if (issuer!=null){ |
95 |
0
|
issuerDN=new LDAPDNPrincipal(issuer.getName()); |
96 |
0
|
alternativeDN = new EntryLocator(this, new LDAPDNPrincipal( |
97 |
|
issuerSerialToDN(issuerDN.getName(), sn) |
98 |
|
), null, null); |
99 |
|
} |
100 |
|
}catch(issrg.utils.RFC2253ParsingException rpe){ |
101 |
0
|
throw new IllegalArgumentException("Cannot instantiate: Error while parsing DN occured: "+rpe.getMessage()); |
102 |
|
} |
103 |
|
} |
104 |
|
|
105 |
|
|
106 |
|
|
107 |
|
|
108 |
|
|
109 |
|
final public static String SN_ATTRIBUTE_TYPE = "SN"; |
110 |
|
|
111 |
|
|
112 |
|
|
113 |
|
|
114 |
|
|
|
|
| 0% |
Uncovered Elements: 7 (7) |
Complexity: 3 |
Complexity Density: 1 |
|
115 |
0
|
public static String issuerSerialToDN(String issuerDN, java.math.BigInteger serialNumber){... |
116 |
0
|
if (issuerDN==null || serialNumber==null){ |
117 |
|
|
118 |
0
|
return null; |
119 |
|
} |
120 |
0
|
return SN_ATTRIBUTE_TYPE+"="+serialNumber.toString()+((issuerDN.intern()=="")?"":(","+issuerDN)); |
121 |
|
} |
122 |
|
|
123 |
|
|
|
|
| - |
Uncovered Elements: 0 (0) |
Complexity: 1 |
Complexity Density: - |
|
124 |
1779
|
protected UserEntry(){}... |
125 |
|
|
126 |
|
|
127 |
|
|
128 |
|
|
129 |
|
@param |
130 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
131 |
1673
|
public UserEntry(java.security.Principal subject){... |
132 |
1673
|
_init_(subject, null, null); |
133 |
|
} |
134 |
|
|
135 |
|
|
136 |
|
|
137 |
|
|
138 |
|
|
139 |
|
@param |
140 |
|
@param |
141 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
142 |
0
|
public UserEntry(java.security.Principal issuer, java.math.BigInteger serialNumber){... |
143 |
0
|
_init_(null, issuer, serialNumber); |
144 |
|
} |
145 |
|
|
146 |
|
|
147 |
|
|
148 |
|
|
149 |
|
|
150 |
|
@param |
151 |
|
@param |
152 |
|
@param |
153 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
154 |
0
|
public UserEntry(java.security.Principal subject, java.security.Principal issuer,... |
155 |
|
java.math.BigInteger serialNumber){ |
156 |
0
|
_init_(subject, issuer, serialNumber); |
157 |
|
} |
158 |
|
|
159 |
|
|
160 |
|
|
161 |
|
|
162 |
|
|
163 |
|
|
164 |
|
|
165 |
|
|
166 |
|
|
167 |
|
@return |
168 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
169 |
23988
|
public java.security.Principal getSubjectDN(){... |
170 |
23988
|
return subjectDN; |
171 |
|
} |
172 |
|
|
173 |
|
|
174 |
|
|
175 |
|
|
176 |
|
@return |
177 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
178 |
0
|
public java.security.Principal getIssuerDN(){... |
179 |
0
|
return issuerDN; |
180 |
|
} |
181 |
|
|
182 |
|
|
183 |
|
|
184 |
|
|
185 |
|
@return |
186 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
187 |
0
|
public java.math.BigInteger getSerialNumber(){... |
188 |
0
|
return sn; |
189 |
|
} |
190 |
|
|
191 |
|
|
192 |
|
|
193 |
|
|
194 |
|
|
195 |
|
|
196 |
|
|
197 |
|
|
198 |
|
|
199 |
|
@return |
200 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
201 |
23988
|
public java.security.Principal getLocator(){... |
202 |
23988
|
return getSubjectDN(); |
203 |
|
} |
204 |
|
|
205 |
|
|
206 |
|
|
207 |
|
|
208 |
|
|
209 |
|
@return |
210 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
211 |
1353
|
public issrg.utils.repository.AttributeRepository getRepository(){... |
212 |
1353
|
return null; |
213 |
|
} |
214 |
|
|
215 |
|
|
216 |
|
|
217 |
|
|
218 |
|
|
219 |
|
|
220 |
|
@return |
221 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
222 |
23898
|
public TokenLocator getAlternativeLocator(){... |
223 |
23898
|
return alternativeDN; |
224 |
|
} |
225 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
226 |
6470
|
public Entry getEntry(){... |
227 |
6470
|
return this; |
228 |
|
} |
229 |
|
|
230 |
|
|
231 |
|
|
232 |
|
|
233 |
|
|
234 |
|
|
235 |
|
|
236 |
|
|
237 |
|
|
238 |
|
@return |
239 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (8) |
Complexity: 3 |
Complexity Density: 0.5 |
|
240 |
22455
|
public LDAPDNPrincipal getDN(){... |
241 |
22455
|
java.security.Principal s=null; |
242 |
22455
|
TokenLocator t=this; |
243 |
|
|
244 |
44910
|
while (s==null && t!=null){ |
245 |
22455
|
s=t.getLocator(); |
246 |
22455
|
t=t.getAlternativeLocator(); |
247 |
|
} |
248 |
|
|
249 |
22455
|
return (LDAPDNPrincipal)s; |
250 |
|
} |
251 |
|
|
252 |
|
|
253 |
|
|
254 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
255 |
6506
|
public java.security.Principal getEntryName(){... |
256 |
6506
|
return getDN(); |
257 |
|
} |
258 |
|
|
259 |
|
|
260 |
|
|
261 |
|
|
262 |
|
|
263 |
|
@param |
264 |
|
|
265 |
|
@return |
266 |
|
|
267 |
|
@throws |
268 |
|
|
269 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
270 |
0
|
public boolean isObjectClass(String what){... |
271 |
0
|
throw new java.lang.SecurityException("LDAP is not trusted to retrieve objectClass for its entries"); |
272 |
|
} |
273 |
|
|
274 |
|
|
275 |
|
|
276 |
|
|
277 |
|
|
278 |
|
|
|
|
| 87.5% |
Uncovered Elements: 3 (24) |
Complexity: 6 |
Complexity Density: 0.43 |
|
279 |
90
|
public boolean equals(Object o){... |
280 |
90
|
if (o instanceof UserEntry){ |
281 |
90
|
UserEntry u = (UserEntry) o; |
282 |
|
|
283 |
90
|
java.security.Principal l=null; |
284 |
90
|
TokenLocator t; |
285 |
|
|
286 |
135
|
for(t=this; t!=null; t=t.getAlternativeLocator()){ |
287 |
90
|
l=t.getLocator(); |
288 |
|
|
289 |
0
|
if (l==null) continue; |
290 |
|
|
291 |
90
|
TokenLocator u1; |
292 |
135
|
for (u1=u; u1!=null; u1=u1.getAlternativeLocator()){ |
293 |
90
|
java.security.Principal l1=u1.getLocator(); |
294 |
90
|
if (l.equals(l1)) return true; |
295 |
|
} |
296 |
|
} |
297 |
|
} |
298 |
|
|
299 |
45
|
return false; |
300 |
|
} |
301 |
|
} |
302 |
|
|