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.rbac.xmlpolicy; |
33 |
|
|
34 |
|
import issrg.pba.rbac.policies.*; |
35 |
|
import issrg.pba.rbac.*; |
36 |
|
import issrg.pba.Obligations; |
37 |
|
import issrg.pba.SimpleObligations; |
38 |
|
|
39 |
|
import org.xml.sax.Attributes; |
40 |
|
import javax.xml.parsers.SAXParserFactory; |
41 |
|
|
42 |
|
import issrg.pba.rbac.policies.DITSubtree; |
43 |
|
import issrg.pba.rbac.policies.Subtree; |
44 |
|
|
45 |
|
import issrg.pba.rbac.PolicyParsingException; |
46 |
|
import issrg.pba.rbac.LDAPDNPrincipal; |
47 |
|
import issrg.pba.rbac.BadURLException; |
48 |
|
import issrg.pba.rbac.URLHandler; |
49 |
|
|
50 |
|
|
51 |
|
import java.security.Principal; |
52 |
|
|
53 |
|
import java.util.ArrayList; |
54 |
|
import java.util.Vector; |
55 |
|
import java.util.Map; |
56 |
|
import java.util.Enumeration; |
57 |
|
|
58 |
|
|
59 |
|
|
60 |
|
|
61 |
|
|
62 |
|
|
63 |
|
|
64 |
|
|
65 |
|
|
66 |
|
|
67 |
|
|
68 |
|
|
69 |
|
|
70 |
|
|
71 |
|
|
72 |
|
|
73 |
|
|
74 |
|
|
75 |
|
|
76 |
|
|
77 |
|
|
78 |
|
|
79 |
|
|
80 |
|
|
81 |
|
|
82 |
|
|
83 |
|
|
84 |
|
@author |
85 |
|
@version |
86 |
|
|
87 |
|
|
|
|
| 76.7% |
Uncovered Elements: 42 (180) |
Complexity: 25 |
Complexity Density: 0.52 |
|
88 |
|
public class XMLPolicyParser implements issrg.pba.PolicyParser, |
89 |
|
org.xml.sax.ContentHandler, |
90 |
|
org.xml.sax.ErrorHandler { |
91 |
|
|
92 |
|
|
93 |
|
|
94 |
|
|
95 |
|
|
96 |
|
|
97 |
|
|
98 |
|
|
99 |
|
|
100 |
|
@see |
101 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (18) |
Complexity: 1 |
Complexity Density: 0.06 |
|
102 |
21
|
public static void registerDefaultNodes(){... |
103 |
21
|
issrg.pba.rbac.xmlpolicy.ifstatement.ArgNode.register(); |
104 |
21
|
issrg.pba.rbac.xmlpolicy.ifstatement.ConstantNode.register(); |
105 |
21
|
issrg.pba.rbac.xmlpolicy.ifstatement.EnvironmentNode.register(); |
106 |
|
|
107 |
21
|
issrg.pba.rbac.xmlpolicy.ifstatement.OperatorNode.register(); |
108 |
|
|
109 |
21
|
issrg.pba.rbac.xmlpolicy.ifstatement.PresentNode.register(); |
110 |
21
|
issrg.pba.rbac.xmlpolicy.ifstatement.NotNode.register(); |
111 |
|
|
112 |
21
|
issrg.pba.rbac.xmlpolicy.ifstatement.AndNode.register(); |
113 |
21
|
issrg.pba.rbac.xmlpolicy.ifstatement.OrNode.register(); |
114 |
|
|
115 |
21
|
issrg.pba.rbac.xmlpolicy.ifstatement.EqNode.register(); |
116 |
21
|
issrg.pba.rbac.xmlpolicy.ifstatement.GeNode.register(); |
117 |
21
|
issrg.pba.rbac.xmlpolicy.ifstatement.LeNode.register(); |
118 |
21
|
issrg.pba.rbac.xmlpolicy.ifstatement.GtNode.register(); |
119 |
21
|
issrg.pba.rbac.xmlpolicy.ifstatement.LtNode.register(); |
120 |
21
|
issrg.pba.rbac.xmlpolicy.ifstatement.SubstringsNode.register(); |
121 |
|
|
122 |
21
|
issrg.pba.rbac.xmlpolicy.ifstatement.IntegerInterpreter.register(); |
123 |
21
|
issrg.pba.rbac.xmlpolicy.ifstatement.StringInterpreter.register(); |
124 |
|
|
125 |
21
|
issrg.pba.rbac.Time.register(); |
126 |
21
|
issrg.pba.rbac.TimeInterpreter.register(); |
127 |
|
} |
128 |
|
|
129 |
|
|
130 |
|
|
131 |
|
|
132 |
|
@param |
133 |
|
|
134 |
|
@return |
135 |
|
|
136 |
|
@throws |
137 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
138 |
0
|
public static XMLPolicyParser getXMLPolicyParser(String policy) throws issrg.pba.PbaException{... |
139 |
0
|
return new XMLPolicyParser(policy); |
140 |
|
} |
141 |
|
|
142 |
|
|
143 |
|
|
144 |
|
|
145 |
|
|
146 |
|
|
147 |
|
@param |
148 |
|
|
149 |
|
@return |
150 |
|
|
151 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
152 |
1
|
public static XMLPolicyParser getXMLPolicyParser(java.io.InputStream is) throws issrg.pba.PbaException{... |
153 |
1
|
return new XMLPolicyParser(new org.xml.sax.InputSource(is)); |
154 |
|
} |
155 |
|
|
156 |
|
|
157 |
|
|
158 |
|
|
159 |
|
|
160 |
|
protected final static java.util.Map knownNodes = new java.util.Hashtable(); |
161 |
|
private static Class [] defaultConstr = new Class[]{XMLPolicyParser.class, org.xml.sax.Attributes.class}; |
|
|
| 94.1% |
Uncovered Elements: 1 (17) |
Complexity: 2 |
Complexity Density: 0.12 |
|
162 |
21
|
static{... |
163 |
21
|
try{ |
164 |
21
|
registerXMLNode(XMLTags.ROLE_HIERARCHY_POLICY_NODE, RoleHierarchyPolicyNode.class); |
165 |
21
|
registerXMLNode(XMLTags.ROLE_SPEC_NODE, RoleSpecNode.class); |
166 |
21
|
registerXMLNode(XMLTags.SUP_ROLE_NODE, RoleHierarchyNode.class); |
167 |
21
|
registerXMLNode(XMLTags.SUBJECT_POLICY_NODE, SubjectDomainPolicyNode.class); |
168 |
21
|
registerXMLNode(XMLTags.SUBJECT_DOMAIN_SPEC_NODE, SubjectDomainSpecNode.class); |
169 |
21
|
registerXMLNode(XMLTags.SOA_POLICY_NODE, SOAPolicyNode.class); |
170 |
21
|
registerXMLNode(XMLTags.REPOSITORY_POLICY_NODE, RepositoryPolicyNode.class); |
171 |
21
|
registerXMLNode(XMLTags.TARGET_ACCESS_POLICY_NODE, TargetAccessPolicyNode.class); |
172 |
21
|
registerXMLNode(XMLTags.TARGET_POLICY_NODE, TargetDomainPolicyNode.class); |
173 |
21
|
registerXMLNode(XMLTags.TARGET_DOMAIN_SPEC_NODE, TargetDomainSpecNode.class); |
174 |
21
|
registerXMLNode(XMLTags.ACTION_POLICY_NODE, ActionPolicyNode.class); |
175 |
21
|
registerXMLNode(XMLTags.ROLE_ASSIGNMENT_POLICY_NODE, RoleAssignmentPolicyNode.class); |
176 |
21
|
registerXMLNode(XMLTags.ROLE_LIST_NODE, RoleListNode.class); |
177 |
21
|
registerXMLNode(XMLTags.X_509_PMI_RBAC_POLICY_NODE, PMIXMLPolicyNode.class); |
178 |
|
|
179 |
21
|
registerXMLNode(XMLTags.MSoD_POLICY_SET_NODE, MSoDPolicySetNode.class); |
180 |
|
|
181 |
|
}catch (NoSuchMethodException nsme){ |
182 |
0
|
nsme.printStackTrace(); |
183 |
|
} |
184 |
|
} |
185 |
|
|
186 |
|
|
187 |
|
|
188 |
|
|
189 |
|
|
|
|
| 0% |
Uncovered Elements: 7 (7) |
Complexity: 2 |
Complexity Density: 0.4 |
|
190 |
0
|
public static void printNodes(){... |
191 |
0
|
System.out.println("The nodes registered with the XML Policy parser:"); |
192 |
0
|
Object [] keys = knownNodes.keySet().toArray(); |
193 |
|
|
194 |
0
|
for (int i=0; i<keys.length; i++){ |
195 |
0
|
System.out.println(keys[i]); |
196 |
|
} |
197 |
0
|
System.out.println(); |
198 |
|
} |
199 |
|
|
200 |
|
|
201 |
|
|
202 |
|
|
203 |
|
|
204 |
|
|
205 |
|
@param |
206 |
|
|
207 |
|
@param |
208 |
|
|
209 |
|
|
210 |
|
|
211 |
|
|
212 |
|
|
213 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
214 |
609
|
public static void registerXMLNode(String nodeName, Class nodeClass) throws NoSuchMethodException {... |
215 |
609
|
knownNodes.put(nodeName, nodeClass.getConstructor(defaultConstr)); |
216 |
|
} |
217 |
|
|
218 |
|
|
219 |
|
|
220 |
|
|
221 |
|
protected PMIXMLPolicyNode pmiXMLPolicy; |
222 |
|
|
223 |
|
|
224 |
|
|
225 |
|
|
226 |
|
|
227 |
|
|
228 |
|
protected java.util.Vector nodeStack; |
229 |
|
|
230 |
|
|
231 |
|
|
232 |
|
|
233 |
|
|
234 |
|
protected RoleHierarchyPolicyNode roleHierarchyPolicy; |
235 |
|
|
236 |
|
|
237 |
|
|
238 |
|
|
239 |
|
|
240 |
|
|
241 |
|
|
242 |
|
|
243 |
|
|
244 |
|
protected issrg.pba.rbac.ValidityPeriod validityForRoleList; |
245 |
|
|
246 |
|
|
247 |
|
|
248 |
|
|
249 |
|
|
250 |
|
|
251 |
|
private java.util.Map rolespec; |
252 |
|
|
253 |
|
|
254 |
|
|
255 |
|
|
256 |
|
|
257 |
|
|
258 |
|
private DomainPolicyNode subjectPolicy; |
259 |
|
|
260 |
|
|
261 |
|
|
262 |
|
|
263 |
|
|
264 |
|
private SOAPolicyNode soaPolicy; |
265 |
|
|
266 |
|
|
267 |
|
|
268 |
|
|
269 |
|
private DomainPolicyNode targetPolicy; |
270 |
|
|
271 |
|
|
272 |
|
|
273 |
|
|
274 |
|
|
275 |
|
|
276 |
|
private ActionPolicyNode actionPolicy; |
277 |
|
|
278 |
|
|
279 |
|
|
280 |
|
|
281 |
|
private TargetAccessPolicyNode targetAccessPolicy; |
282 |
|
|
283 |
|
|
284 |
|
|
285 |
|
|
286 |
|
private MSoDPolicySetNode msodPolicySetNode; |
287 |
|
|
288 |
|
|
289 |
|
|
290 |
|
|
291 |
|
private RepositoryPolicyNode repositoryPolicy; |
292 |
|
|
293 |
|
|
294 |
|
|
295 |
|
|
296 |
|
|
297 |
|
protected org.xml.sax.Locator locator; |
298 |
|
|
299 |
|
|
300 |
|
|
301 |
|
|
302 |
|
|
303 |
|
protected RoleAssignmentPolicyNode delegationPolicy; |
304 |
|
|
305 |
|
|
306 |
|
|
307 |
|
|
308 |
|
protected org.xml.sax.Attributes attrs; |
309 |
|
|
310 |
|
|
|
|
| - |
Uncovered Elements: 0 (0) |
Complexity: 1 |
Complexity Density: - |
|
311 |
0
|
protected XMLPolicyParser(){}... |
312 |
|
|
313 |
|
|
314 |
|
|
315 |
|
|
316 |
|
|
317 |
|
@param |
318 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
319 |
1
|
public XMLPolicyParser(org.xml.sax.InputSource xmlSource) throws issrg.pba.PbaException{... |
320 |
1
|
_init_(xmlSource); |
321 |
|
} |
322 |
|
|
323 |
|
|
324 |
|
|
325 |
|
|
326 |
|
|
327 |
|
@param |
328 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
329 |
24
|
public XMLPolicyParser(String xml) throws issrg.pba.PbaException {... |
330 |
24
|
org.xml.sax.InputSource xmlSource = new org.xml.sax.InputSource(new java.io.StringReader(xml)); |
331 |
24
|
_init_(xmlSource); |
332 |
|
} |
333 |
|
|
334 |
|
|
335 |
|
|
336 |
|
|
337 |
|
|
338 |
|
|
339 |
|
@param |
340 |
|
|
|
|
| 46.7% |
Uncovered Elements: 8 (15) |
Complexity: 6 |
Complexity Density: 0.46 |
|
341 |
25
|
private void _init_(org.xml.sax.InputSource xmlSource) throws issrg.pba.PbaException {... |
342 |
25
|
SAXParserFactory sf = SAXParserFactory.newInstance(); |
343 |
|
|
344 |
25
|
sf.setValidating(false); |
345 |
25
|
sf.setNamespaceAware(false); |
346 |
|
|
347 |
25
|
try{ |
348 |
25
|
org.xml.sax.XMLReader parser = sf.newSAXParser().getXMLReader(); |
349 |
|
|
350 |
|
|
351 |
|
|
352 |
|
|
353 |
|
|
354 |
|
|
355 |
|
|
356 |
|
|
357 |
|
|
358 |
|
|
359 |
|
|
360 |
|
|
361 |
25
|
parser.setContentHandler(this); |
362 |
25
|
parser.parse(xmlSource); |
363 |
|
|
364 |
|
}catch (org.xml.sax.SAXParseException se){ |
365 |
0
|
if (se.getException()!=null){ |
366 |
|
|
367 |
0
|
throw new issrg.pba.PbaException("Could not initialise; parse error @ line "+se.getLineNumber(), se.getException()); |
368 |
|
|
369 |
|
}else{ |
370 |
|
|
371 |
0
|
throw new issrg.pba.PbaException("Could not initialise; parse error @ line "+se.getLineNumber(), se); |
372 |
|
|
373 |
|
} |
374 |
|
}catch (org.xml.sax.SAXException sae){ |
375 |
0
|
throw new issrg.pba.PbaException("Policy parse failed: "+sae.getMessage(), sae); |
376 |
|
}catch (javax.xml.parsers.ParserConfigurationException pce){ |
377 |
0
|
throw new issrg.pba.PbaException("Policy parse failed: "+pce.getMessage(), pce); |
378 |
|
}catch (java.io.IOException io){ |
379 |
0
|
throw new issrg.pba.PbaException("IO failure: "+io.getMessage(), io); |
380 |
|
} |
381 |
|
} |
382 |
|
|
383 |
|
|
384 |
|
|
385 |
|
|
|
|
| - |
Uncovered Elements: 0 (0) |
Complexity: 1 |
Complexity Density: - |
|
386 |
0
|
public void skippedEntity(String what){... |
387 |
|
} |
388 |
|
|
389 |
|
|
390 |
|
|
391 |
|
|
|
|
| - |
Uncovered Elements: 0 (0) |
Complexity: 1 |
Complexity Density: - |
|
392 |
0
|
public void processingInstruction(String target, String data){... |
393 |
|
} |
394 |
|
|
395 |
|
|
396 |
|
|
397 |
|
|
|
|
| - |
Uncovered Elements: 0 (0) |
Complexity: 1 |
Complexity Density: - |
|
398 |
0
|
public void ignorableWhitespace(char [] arr, int start, int len){... |
399 |
|
} |
400 |
|
|
401 |
|
|
402 |
|
|
403 |
|
|
404 |
|
|
405 |
|
|
406 |
|
|
407 |
|
|
408 |
|
|
409 |
|
|
410 |
|
|
411 |
|
|
412 |
|
|
413 |
|
|
414 |
|
|
415 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (4) |
Complexity: 3 |
Complexity Density: 1.5 |
|
416 |
10141
|
public void characters(char [] arr, int start, int len){... |
417 |
10141
|
if (len>0 && nodeStack.size()>0) |
418 |
7094
|
((PolicyXMLNode)nodeStack.get(0)).addString(new String(arr, start, len).trim()); |
419 |
|
} |
420 |
|
|
421 |
|
|
422 |
|
|
423 |
|
|
424 |
|
|
425 |
|
|
426 |
|
|
427 |
|
|
428 |
|
|
429 |
|
|
430 |
|
@see |
431 |
|
|
|
|
| 83.3% |
Uncovered Elements: 3 (18) |
Complexity: 5 |
Complexity Density: 0.42 |
|
432 |
2668
|
public void startElement(String URI, String localName, String qName, org.xml.sax.Attributes attrs) throws org.xml.sax.SAXParseException{... |
433 |
|
|
434 |
|
|
435 |
|
|
436 |
|
|
437 |
|
|
438 |
|
|
439 |
|
|
440 |
|
|
441 |
|
|
442 |
2668
|
if (localName.intern()==""){ |
443 |
0
|
localName=qName; |
444 |
|
} |
445 |
|
|
446 |
|
|
447 |
|
|
448 |
2668
|
this.attrs=attrs; |
449 |
|
|
450 |
2668
|
PolicyXMLNode node=null; |
451 |
2668
|
try{ |
452 |
2668
|
java.lang.reflect.Constructor co = (java.lang.reflect.Constructor)knownNodes.get(localName); |
453 |
2668
|
if (co!=null){ |
454 |
926
|
node=(PolicyXMLNode)(co.newInstance(new Object[]{this, this.attrs})); |
455 |
|
} |
456 |
|
}catch(Exception iae){ |
457 |
0
|
throw new org.xml.sax.SAXParseException(iae.getMessage(), locator, iae); |
458 |
|
|
459 |
|
|
460 |
|
} |
461 |
|
|
462 |
|
|
463 |
|
|
464 |
|
|
465 |
|
|
466 |
|
|
467 |
2668
|
if (node==null){ |
468 |
1742
|
node = new PolicyXMLNode(localName, attrs); |
469 |
|
} |
470 |
2668
|
nodeStack.insertElementAt(node, 0); |
471 |
|
|
472 |
|
|
473 |
|
} |
474 |
|
|
475 |
|
|
476 |
|
|
477 |
|
|
478 |
|
|
479 |
|
|
480 |
|
@link |
481 |
|
|
482 |
|
|
|
|
| 80% |
Uncovered Elements: 2 (10) |
Complexity: 4 |
Complexity Density: 0.5 |
|
483 |
2668
|
public void endElement(String URI, String localName, String qName) throws org.xml.sax.SAXException {... |
484 |
|
|
485 |
|
|
486 |
2668
|
try{ |
487 |
2668
|
PolicyXMLNode node = (PolicyXMLNode)nodeStack.remove(0); |
488 |
|
|
489 |
2668
|
if (nodeStack.size()==0){ |
490 |
25
|
pmiXMLPolicy=(PMIXMLPolicyNode)node; |
491 |
|
}else{ |
492 |
2643
|
((PolicyXMLNode)nodeStack.get(0)).addChild(node); |
493 |
|
} |
494 |
|
|
495 |
|
|
496 |
|
|
497 |
2668
|
node.construct(); |
498 |
|
|
499 |
|
}catch (Exception e){ |
500 |
0
|
throw new org.xml.sax.SAXParseException(e.getMessage(), locator, e); |
501 |
|
}catch (Throwable th){ |
502 |
0
|
throw new org.xml.sax.SAXParseException(th.getMessage(), locator); |
503 |
|
} |
504 |
|
} |
505 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (3) |
Complexity: 1 |
Complexity Density: 0.33 |
|
506 |
25
|
public void startDocument(){... |
507 |
25
|
pmiXMLPolicy = null; |
508 |
25
|
roleHierarchyPolicy = null; |
509 |
25
|
nodeStack = new java.util.Vector(); |
510 |
|
} |
511 |
|
|
512 |
|
|
513 |
|
|
514 |
|
|
|
|
| - |
Uncovered Elements: 0 (0) |
Complexity: 1 |
Complexity Density: - |
|
515 |
25
|
public void endDocument(){... |
516 |
|
} |
517 |
|
|
518 |
|
|
519 |
|
|
520 |
|
|
521 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
522 |
25
|
public void setDocumentLocator(org.xml.sax.Locator l){... |
523 |
25
|
this.locator=l; |
524 |
|
} |
525 |
|
|
526 |
|
|
527 |
|
|
528 |
|
|
|
|
| - |
Uncovered Elements: 0 (0) |
Complexity: 1 |
Complexity Density: - |
|
529 |
0
|
public void startPrefixMapping(String prefix, String URI){... |
530 |
|
} |
531 |
|
|
532 |
|
|
533 |
|
|
534 |
|
|
|
|
| - |
Uncovered Elements: 0 (0) |
Complexity: 1 |
Complexity Density: - |
|
535 |
0
|
public void endPrefixMapping(String prefix){... |
536 |
|
} |
537 |
|
|
538 |
|
|
539 |
|
|
540 |
|
|
541 |
|
|
542 |
|
|
543 |
|
|
544 |
|
|
545 |
|
|
|
|
| - |
Uncovered Elements: 0 (0) |
Complexity: 1 |
Complexity Density: - |
|
546 |
0
|
public void warning(org.xml.sax.SAXParseException spe){... |
547 |
|
} |
548 |
|
|
|
|
| - |
Uncovered Elements: 0 (0) |
Complexity: 1 |
Complexity Density: - |
|
549 |
0
|
public void fatalError(org.xml.sax.SAXParseException spe){... |
550 |
|
} |
551 |
|
|
|
|
| - |
Uncovered Elements: 0 (0) |
Complexity: 1 |
Complexity Density: - |
|
552 |
0
|
public void error(org.xml.sax.SAXParseException spe){... |
553 |
|
} |
554 |
|
|
555 |
|
|
556 |
|
|
557 |
|
|
558 |
|
@see |
559 |
|
|
560 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
561 |
770
|
private static PolicyXMLNode expect(java.util.Vector where, int pos, String what) throws PolicyParsingException{... |
562 |
770
|
return expect(where, pos, what, false); |
563 |
|
} |
564 |
|
|
565 |
|
|
566 |
|
|
567 |
|
|
568 |
|
|
569 |
|
|
570 |
|
|
571 |
|
|
572 |
|
|
573 |
|
|
574 |
|
@param |
575 |
|
@param |
576 |
|
|
577 |
|
@param |
578 |
|
@param |
579 |
|
|
580 |
|
|
581 |
|
|
582 |
|
|
583 |
|
|
584 |
|
@return |
585 |
|
|
586 |
|
@throws |
587 |
|
|
588 |
|
|
589 |
|
|
590 |
|
|
|
|
| 71.4% |
Uncovered Elements: 6 (21) |
Complexity: 7 |
Complexity Density: 0.54 |
|
591 |
1439
|
private static PolicyXMLNode expect(java.util.Vector where, int pos, String what, boolean optional) throws PolicyParsingException{... |
592 |
1439
|
try{ |
593 |
1439
|
if (where.size()<=pos){ |
594 |
0
|
if (!optional) throw new PolicyParsingException("Cannot access an expected child node: "+what); |
595 |
416
|
return null; |
596 |
|
} |
597 |
1023
|
PolicyXMLNode c2 = (PolicyXMLNode)where.get(pos); |
598 |
1023
|
if (c2.getName().intern()!=what.intern()){ |
599 |
0
|
if (!optional) throw new PolicyParsingException(what+" node has been exected, but "+c2.getName()+" was found"); |
600 |
11
|
c2=null; |
601 |
|
} |
602 |
|
|
603 |
1023
|
return c2; |
604 |
|
}catch (PolicyParsingException ppe){ |
605 |
0
|
throw ppe; |
606 |
|
}catch (Throwable th){ |
607 |
|
|
608 |
0
|
throw new PolicyParsingException("Parse error", th); |
609 |
|
} |
610 |
|
} |
611 |
|
|
612 |
|
|
613 |
|
|
614 |
|
|
615 |
|
|
616 |
|
|
617 |
|
|
618 |
|
|
619 |
|
|
620 |
|
@param |
621 |
|
|
622 |
|
|
623 |
|
@param |
624 |
|
|
625 |
|
|
626 |
|
@return |
627 |
|
|
628 |
|
|
629 |
|
|
|
|
| 75% |
Uncovered Elements: 1 (4) |
Complexity: 1 |
Complexity Density: 0.5 |
|
630 |
89
|
public RoleHierarchyNode getRole(String roleType, String roleValue){... |
631 |
89
|
RoleSpecNode rsn = roleHierarchyPolicy.getByType(roleType); |
632 |
89
|
return rsn==null?null:rsn.getRole(roleValue); |
633 |
|
} |
634 |
|
|
635 |
|
|
636 |
|
|
637 |
|
|
638 |
|
|
639 |
|
|
640 |
|
|
641 |
|
@return |
642 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
643 |
24
|
public java.util.Map getAccessRules(){... |
644 |
|
|
645 |
24
|
return targetAccessPolicy.getRules(); |
646 |
|
} |
647 |
|
|
648 |
|
|
649 |
|
|
650 |
|
|
651 |
|
|
652 |
|
@see |
653 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
654 |
25
|
public java.util.Map getAssignmentRules(){... |
655 |
25
|
return delegationPolicy.getRules(); |
656 |
|
} |
657 |
|
|
658 |
|
|
659 |
|
|
660 |
|
|
661 |
|
|
662 |
|
|
663 |
|
|
664 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (3) |
Complexity: 1 |
Complexity Density: 0.33 |
|
665 |
28
|
public java.util.Map getAuthTokenParsingRules(){... |
666 |
28
|
java.util.Map h = new java.util.Hashtable(); |
667 |
28
|
h.put(issrg.pba.rbac.RoleHierarchyPolicy.class, roleHierarchyPolicy); |
668 |
28
|
return h; |
669 |
|
} |
670 |
|
|
671 |
|
|
672 |
|
|
673 |
|
|
674 |
|
@return |
675 |
|
|
676 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
677 |
14
|
public String getPolicyID(){... |
678 |
14
|
return pmiXMLPolicy.getOID(); |
679 |
|
} |
680 |
|
|
681 |
|
|
682 |
|
|
683 |
|
|
684 |
|
|
685 |
|
@return |
686 |
|
|
687 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (5) |
Complexity: 2 |
Complexity Density: 0.67 |
|
688 |
25
|
public String [] getRepositoryURLs(){... |
689 |
25
|
if (repositoryPolicy==null) return null; |
690 |
|
|
691 |
2
|
return repositoryPolicy.getURLs(); |
692 |
|
} |
693 |
|
|
694 |
|
|
695 |
|
|
696 |
|
|
697 |
|
|
698 |
|
@return |
699 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
700 |
0
|
public Subtree getSubjectDomains() {... |
701 |
0
|
return subjectPolicy.getCoverageDomain(); |
702 |
|
} |
703 |
|
|
704 |
|
|
705 |
|
|
706 |
|
@return |
707 |
|
|
708 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
709 |
1
|
public java.util.Map getSOAs() {... |
710 |
1
|
return soaPolicy.getSOAs(); |
711 |
|
} |
712 |
|
|
713 |
|
|
714 |
|
|
715 |
|
|
716 |
|
|
717 |
|
|
718 |
|
|
719 |
|
|
720 |
|
|
721 |
|
|
722 |
|
|
723 |
|
|
724 |
|
|
725 |
|
@see |
726 |
|
@author |
727 |
|
@version |
728 |
|
|
729 |
|
|
|
|
| 96% |
Uncovered Elements: 2 (50) |
Complexity: 8 |
Complexity Density: 0.39 |
|
730 |
|
public class ActionPolicyNode extends PolicyXMLNode{ |
731 |
|
|
732 |
|
|
733 |
|
|
734 |
|
|
735 |
|
public final static String ARGS_SEPARATORS = ","; |
736 |
|
|
737 |
|
|
738 |
|
|
739 |
|
|
740 |
|
private java.util.Map actions = new java.util.Hashtable(); |
741 |
|
|
742 |
|
|
743 |
|
|
744 |
|
|
745 |
|
private java.util.Map targets = new java.util.Hashtable(); |
746 |
|
|
747 |
|
|
748 |
|
|
749 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
750 |
25
|
public ActionPolicyNode(Attributes attrs) {... |
751 |
25
|
super(XMLTags.ACTION_POLICY_NODE, attrs); |
752 |
|
|
753 |
25
|
actionPolicy = this; |
754 |
|
} |
755 |
|
|
756 |
|
|
757 |
|
|
758 |
|
|
759 |
|
@link |
760 |
|
|
761 |
|
|
|
|
| 96.8% |
Uncovered Elements: 1 (31) |
Complexity: 6 |
Complexity Density: 0.29 |
|
762 |
25
|
public void construct(){... |
763 |
|
|
764 |
|
|
765 |
|
|
766 |
134
|
for (int i=children.size(); i-->0;){ |
767 |
109
|
PolicyXMLNode c = (PolicyXMLNode)children.get(i); |
768 |
109
|
if (c.getName().intern()!=XMLTags.ACTION_NODE){ |
769 |
|
|
770 |
|
|
771 |
|
|
772 |
|
} |
773 |
|
|
774 |
109
|
java.util.Map m = c.getAttributes(); |
775 |
109
|
String n = (String)m.get(XMLTags.NAME_ATTRIBUTE); |
776 |
109
|
String ret = (String)m.get(XMLTags.RETURN_TYPE_ATTRIBUTE); |
777 |
|
|
778 |
109
|
String args = (String)m.get(XMLTags.ARGS_ATTRIBUTE); |
779 |
109
|
String [] def = new String [] {ret}; |
780 |
109
|
if (args!=null){ |
781 |
68
|
java.util.Vector v = split(args); |
782 |
68
|
def = new String[1+v.size()]; |
783 |
68
|
def[0]=ret; |
784 |
|
|
785 |
68
|
if (def.length>1){ |
786 |
13
|
System.arraycopy(v.toArray(), 0, def, 1, def.length-1); |
787 |
|
} |
788 |
|
} |
789 |
|
|
790 |
109
|
actions.put(n, def); |
791 |
|
|
792 |
109
|
String targetAttribute = (String)m.get(XMLTags.TARGET_ATTRIBUTE); |
793 |
109
|
if(targetAttribute != null) |
794 |
|
{ |
795 |
1
|
java.util.Vector targetVector = split(targetAttribute); |
796 |
1
|
String[] tars = new String[targetVector.size()]; |
797 |
1
|
System.arraycopy(targetVector.toArray(), 0, tars, 0, targetVector.size()); |
798 |
1
|
targets.put(n, tars); |
799 |
|
} |
800 |
|
} |
801 |
|
} |
802 |
|
|
803 |
|
|
804 |
|
|
805 |
|
|
806 |
|
|
807 |
|
|
808 |
|
|
809 |
|
|
810 |
|
|
811 |
|
|
812 |
|
|
813 |
|
|
814 |
|
|
815 |
|
|
816 |
|
@param |
817 |
|
|
818 |
|
@return |
819 |
|
|
820 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
821 |
1250
|
public String [] getActionDefinition(String name){... |
822 |
1250
|
return (String [])actions.get(name); |
823 |
|
} |
824 |
|
|
825 |
|
|
826 |
|
|
827 |
|
|
828 |
|
@param |
829 |
|
|
830 |
|
@return |
831 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
832 |
197
|
public String[] getApplyToTargets(String name)... |
833 |
|
{ |
834 |
197
|
return (String [])targets.get(name); |
835 |
|
} |
836 |
|
|
837 |
|
|
838 |
|
|
839 |
|
|
840 |
|
@param |
841 |
|
|
842 |
|
@return |
843 |
|
|
|
|
| 90% |
Uncovered Elements: 1 (10) |
Complexity: 3 |
Complexity Density: 0.5 |
|
844 |
69
|
private java.util.Vector split(String args){... |
845 |
69
|
java.util.Vector v = new java.util.Vector(); |
846 |
|
|
847 |
69
|
if (args!=null){ |
848 |
69
|
java.util.Enumeration st = new java.util.StringTokenizer(args, ARGS_SEPARATORS); |
849 |
|
|
850 |
85
|
while (st.hasMoreElements()){ |
851 |
16
|
v.add(st.nextElement()); |
852 |
|
} |
853 |
|
} |
854 |
|
|
855 |
69
|
return v; |
856 |
|
} |
857 |
|
} |
858 |
|
|
859 |
|
|
860 |
|
|
861 |
|
|
862 |
|
|
863 |
|
|
864 |
|
|
865 |
|
|
866 |
|
|
867 |
|
@author |
868 |
|
@version |
869 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (17) |
Complexity: 2 |
Complexity Density: 0.45 |
|
870 |
|
public class DomainPolicyNode extends PolicyXMLNode{ |
871 |
|
|
872 |
|
|
873 |
|
|
874 |
|
|
875 |
|
public final static String NODE_NAME = "Policy"; |
876 |
|
|
877 |
|
protected java.util.Map domains; |
878 |
|
protected issrg.pba.rbac.policies.Subtree coverageDomain; |
879 |
|
|
880 |
|
|
881 |
|
|
882 |
|
|
883 |
|
|
884 |
|
@param |
885 |
|
|
886 |
|
@param |
887 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
888 |
50
|
public DomainPolicyNode(String prefix, Attributes attrs) {... |
889 |
50
|
super(prefix+NODE_NAME, attrs); |
890 |
|
} |
891 |
|
|
892 |
|
|
893 |
|
|
894 |
|
|
895 |
|
|
896 |
|
|
897 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (10) |
Complexity: 2 |
Complexity Density: 0.25 |
|
898 |
50
|
public void construct(){... |
899 |
|
|
900 |
|
|
901 |
|
|
902 |
|
|
903 |
50
|
DomainSpecNode [] s = new DomainSpecNode[children.size()]; |
904 |
50
|
System.arraycopy(children.toArray(), 0, s, 0, s.length); |
905 |
|
|
906 |
50
|
domains = new java.util.Hashtable(); |
907 |
50
|
java.util.Vector coverage = new java.util.Vector(); |
908 |
|
|
909 |
|
|
910 |
166
|
for (int i=0; i<s.length; i++){ |
911 |
|
|
912 |
116
|
domains.put(s[i].getID(), s[i].getSubtree()); |
913 |
116
|
coverage.add(s[i].getSubtree()); |
914 |
|
} |
915 |
|
|
916 |
50
|
coverageDomain = new issrg.pba.rbac.policies.ComplexSubtree(coverage, null); |
917 |
|
|
918 |
|
|
919 |
|
} |
920 |
|
|
921 |
|
|
922 |
|
|
923 |
|
|
924 |
|
|
925 |
|
@param |
926 |
|
|
927 |
|
@return |
928 |
|
|
929 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
930 |
233
|
public issrg.pba.rbac.policies.Subtree getDomain(String id){... |
931 |
|
|
932 |
233
|
return (issrg.pba.rbac.policies.Subtree)domains.get(id); |
933 |
|
} |
934 |
|
|
935 |
|
|
936 |
|
|
937 |
|
|
938 |
|
|
939 |
|
|
940 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
941 |
1384
|
public issrg.pba.rbac.policies.Subtree getCoverageDomain(){... |
942 |
1384
|
return coverageDomain; |
943 |
|
} |
944 |
|
|
945 |
|
} |
946 |
|
|
947 |
|
|
948 |
|
|
949 |
|
|
950 |
|
|
951 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (3) |
Complexity: 1 |
Complexity Density: 0.5 |
|
952 |
|
public class SubjectDomainPolicyNode extends DomainPolicyNode{ |
|
|
| 100% |
Uncovered Elements: 0 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
953 |
25
|
public SubjectDomainPolicyNode(Attributes attrs){... |
954 |
25
|
super(XMLTags.SUBJECT_PREFIX, attrs); |
955 |
25
|
subjectPolicy = this; |
956 |
|
} |
957 |
|
} |
958 |
|
|
959 |
|
|
960 |
|
|
961 |
|
|
962 |
|
|
963 |
|
|
964 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (3) |
Complexity: 1 |
Complexity Density: 0.5 |
|
965 |
|
public class TargetDomainPolicyNode extends DomainPolicyNode{ |
|
|
| 100% |
Uncovered Elements: 0 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
966 |
25
|
public TargetDomainPolicyNode(Attributes attrs){... |
967 |
25
|
super(XMLTags.TARGET_PREFIX, attrs); |
968 |
25
|
targetPolicy = this; |
969 |
|
} |
970 |
|
} |
971 |
|
|
972 |
|
|
973 |
|
|
974 |
|
|
975 |
|
|
976 |
|
|
977 |
|
@author |
978 |
|
@version |
979 |
|
|
|
|
| 82% |
Uncovered Elements: 18 (100) |
Complexity: 20 |
Complexity Density: 0.41 |
|
980 |
|
public class DomainSpecNode extends PolicyXMLNode { |
981 |
|
|
982 |
|
|
983 |
|
|
984 |
|
|
985 |
|
public static final String NODE_NAME = "DomainSpec"; |
986 |
|
|
987 |
|
private String domainID; |
988 |
|
|
989 |
|
private issrg.pba.rbac.policies.Subtree subTree; |
990 |
|
|
991 |
|
|
992 |
|
|
993 |
|
|
994 |
|
|
995 |
|
private boolean expectObjClasses; |
996 |
|
|
997 |
|
|
998 |
|
|
999 |
|
|
1000 |
|
|
1001 |
|
|
1002 |
|
@param |
1003 |
|
|
1004 |
|
|
1005 |
|
@param |
1006 |
|
|
1007 |
|
|
1008 |
|
|
1009 |
|
@param |
1010 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
1011 |
116
|
public DomainSpecNode(String prefix, boolean objClass, Attributes attrs) {... |
1012 |
116
|
super(prefix+NODE_NAME, attrs); |
1013 |
|
|
1014 |
116
|
expectObjClasses = objClass; |
1015 |
|
} |
1016 |
|
|
1017 |
|
|
1018 |
|
|
1019 |
|
|
1020 |
|
|
|
|
| 50% |
Uncovered Elements: 3 (6) |
Complexity: 4 |
Complexity Density: 0.67 |
|
1021 |
116
|
public void construct() throws PolicyParsingException{... |
1022 |
116
|
try{ |
1023 |
116
|
subTree = new issrg.pba.rbac.policies.ComplexSubtree(gatherSubtrees(children, true), null); |
1024 |
116
|
domainID = (String)this.attributes.get(XMLTags.ID_ATTRIBUTE); |
1025 |
|
|
1026 |
|
|
1027 |
|
}catch(issrg.utils.RFC2253ParsingException rpe){ |
1028 |
0
|
throw new PolicyParsingException(rpe.getMessage(), rpe); |
1029 |
|
}catch(BadURLException bue){ |
1030 |
0
|
throw new PolicyParsingException(bue.getMessage(), bue); |
1031 |
|
}catch(java.lang.NumberFormatException nfe){ |
1032 |
0
|
throw new PolicyParsingException("Error parsing integer", nfe); |
1033 |
|
} |
1034 |
|
} |
1035 |
|
|
1036 |
|
|
1037 |
|
|
1038 |
|
|
1039 |
|
|
1040 |
|
|
1041 |
|
|
1042 |
|
|
1043 |
|
|
1044 |
|
|
1045 |
|
|
1046 |
|
@param |
1047 |
|
@param |
1048 |
|
|
1049 |
|
|
1050 |
|
|
1051 |
|
|
1052 |
|
|
|
|
| 82.4% |
Uncovered Elements: 15 (85) |
Complexity: 17 |
Complexity Density: 0.35 |
|
1053 |
118
|
protected java.util.Vector gatherSubtrees(java.util.Vector children, boolean includes) throws PolicyParsingException, issrg.utils.RFC2253ParsingException, BadURLException {... |
1054 |
118
|
java.util.Vector subtrees = new java.util.Vector(); |
1055 |
|
|
1056 |
118
|
java.util.Vector excl = includes?new java.util.Vector():subtrees; |
1057 |
118
|
java.util.Vector classes = null; |
1058 |
118
|
int i=children.size(); |
1059 |
118
|
boolean objClasses = includes && expectObjClasses; |
1060 |
|
|
1061 |
|
|
1062 |
303
|
while(i-->0){ |
1063 |
185
|
PolicyXMLNode child = (PolicyXMLNode)children.get(i); |
1064 |
185
|
String s = child.getName().intern(); |
1065 |
|
|
1066 |
|
|
1067 |
185
|
String minmax = (String)child.getAttributes().get(XMLTags.MIN_ATTRIBUTE); |
1068 |
185
|
int min=minmax==null?0:Integer.parseInt(minmax); |
1069 |
|
|
1070 |
185
|
minmax = (String)child.getAttributes().get(XMLTags.MAX_ATTRIBUTE); |
1071 |
185
|
int max=minmax==null?-1:Integer.parseInt(minmax); |
1072 |
|
|
1073 |
|
|
1074 |
|
|
1075 |
185
|
String dn = (String)child.getAttributes().get(XMLTags.LDAPDN_ATTRIBUTE); |
1076 |
185
|
String url = (String)child.getAttributes().get(XMLTags.URL_ATTRIBUTE); |
1077 |
|
|
1078 |
185
|
if (dn!=null && url!=null){ |
1079 |
0
|
throw new PolicyParsingException("Invalid subtree specification: cannot have "+XMLTags.LDAPDN_ATTRIBUTE+" and "+XMLTags.URL_ATTRIBUTE+" attributes at the same time."); |
1080 |
|
} |
1081 |
|
|
1082 |
185
|
if (dn==null && url==null){ |
1083 |
1
|
dn=""; |
1084 |
|
} |
1085 |
|
|
1086 |
185
|
Subtree sub=null; |
1087 |
|
|
1088 |
185
|
objClasses &= s==XMLTags.OBJECT_CLASS_NODE; |
1089 |
|
|
1090 |
185
|
if (s==XMLTags.INCLUDE_NODE){ |
1091 |
0
|
if (!includes) throw new PolicyParsingException(s+" nodes cannot be nested"); |
1092 |
|
|
1093 |
|
|
1094 |
172
|
if (child.getChildren().size()!=0){ |
1095 |
2
|
excl.addAll(0, gatherSubtrees(child.getChildren(), false)); |
1096 |
|
} |
1097 |
|
|
1098 |
172
|
Subtree [] exclude = (Subtree[])excl.toArray(new Subtree[0]); |
1099 |
172
|
excl = new java.util.Vector(); |
1100 |
|
|
1101 |
172
|
if (dn==null){ |
1102 |
|
|
1103 |
42
|
sub=issrg.pba.rbac.URLHandler.getSubtreeByURL(url, min, max, exclude); |
1104 |
|
}else{ |
1105 |
130
|
sub=new DITSubtree(new LDAPDNPrincipal(dn), min, max, classes==null?null:(String[])classes.toArray(new String[0]), exclude); |
1106 |
|
} |
1107 |
|
|
1108 |
|
|
1109 |
|
|
1110 |
0
|
if (sub==null) throw new PolicyParsingException("Invalid subtree specification: DN="+dn+", URL="+url); |
1111 |
|
|
1112 |
|
|
1113 |
|
|
1114 |
|
|
1115 |
172
|
subtrees.add(0, sub); |
1116 |
13
|
}else if (s==XMLTags.EXCLUDE_NODE){ |
1117 |
12
|
if (dn==null){ |
1118 |
2
|
sub=issrg.pba.rbac.URLHandler.getSubtreeByURL(url, min, max, null); |
1119 |
|
}else{ |
1120 |
10
|
sub=new DITSubtree(new LDAPDNPrincipal(dn), min, max, null, null); |
1121 |
|
} |
1122 |
|
|
1123 |
|
|
1124 |
0
|
if (sub==null) throw new PolicyParsingException("Invalid subtree specification: DN="+dn+", URL="+url); |
1125 |
|
|
1126 |
12
|
excl.add(0, sub); |
1127 |
1
|
}else if (objClasses){ |
1128 |
1
|
if (classes==null){ |
1129 |
1
|
classes = new java.util.Vector(); |
1130 |
|
} |
1131 |
|
|
1132 |
1
|
s=(String)child.getAttributes().get(XMLTags.NAME_ATTRIBUTE); |
1133 |
1
|
if (s==null){ |
1134 |
0
|
throw new PolicyParsingException(XMLTags.NAME_ATTRIBUTE+" is required, but not found"); |
1135 |
|
} |
1136 |
1
|
classes.add(s); |
1137 |
|
}else{ |
1138 |
0
|
throw new PolicyParsingException(s+" node was found, but was not expected"); |
1139 |
|
} |
1140 |
|
} |
1141 |
|
|
1142 |
|
|
1143 |
|
|
1144 |
118
|
return subtrees; |
1145 |
|
} |
1146 |
|
|
1147 |
|
|
1148 |
|
|
1149 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
1150 |
116
|
public String getID(){... |
1151 |
116
|
return domainID; |
1152 |
|
} |
1153 |
|
|
1154 |
|
|
1155 |
|
|
1156 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
1157 |
232
|
public Subtree getSubtree(){... |
1158 |
232
|
return subTree; |
1159 |
|
} |
1160 |
|
|
1161 |
|
} |
1162 |
|
|
1163 |
|
|
1164 |
|
|
1165 |
|
|
1166 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (2) |
Complexity: 1 |
Complexity Density: 1 |
|
1167 |
|
public class SubjectDomainSpecNode extends DomainSpecNode{ |
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
1168 |
50
|
public SubjectDomainSpecNode(Attributes attrs){... |
1169 |
50
|
super(XMLTags.SUBJECT_PREFIX, false, attrs); |
1170 |
|
} |
1171 |
|
} |
1172 |
|
|
1173 |
|
|
1174 |
|
|
1175 |
|
|
1176 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (2) |
Complexity: 1 |
Complexity Density: 1 |
|
1177 |
|
public class TargetDomainSpecNode extends DomainSpecNode{ |
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
1178 |
66
|
public TargetDomainSpecNode(Attributes attrs){... |
1179 |
66
|
super(XMLTags.TARGET_PREFIX, true, attrs); |
1180 |
|
} |
1181 |
|
} |
1182 |
|
|
1183 |
|
|
1184 |
|
|
1185 |
|
|
1186 |
|
|
1187 |
|
|
1188 |
|
@author |
1189 |
|
@version |
1190 |
|
|
|
|
| 86.3% |
Uncovered Elements: 17 (124) |
Complexity: 22 |
Complexity Density: 0.31 |
|
1191 |
|
public class RoleAssignmentPolicyNode extends PolicyXMLNode{ |
1192 |
|
|
1193 |
|
|
1194 |
|
|
1195 |
|
public static final int SUBJECT_DOMAIN_NODE_SEQUENCE = 0; |
1196 |
|
public static final int ROLE_LIST_NODE_SEQUENCE = 1; |
1197 |
|
public static final int DELEGATE_NODE_SEQUENCE = 2; |
1198 |
|
public static final int SOA_NODE_SEQUENCE = 3; |
1199 |
|
public static final int VALIDITY_NODE_SEQUENCE = 4; |
1200 |
|
|
1201 |
|
public static final int ABSOLUTE_VALIDITY_NODE_SEQUENCE = 0; |
1202 |
|
public static final int AGE_VALIDITY_NODE_SEQUENCE = 1; |
1203 |
|
public static final int MAXIMUM_VALIDITY_NODE_SEQUENCE = 2; |
1204 |
|
public static final int MINIMUM_VALIDITY_NODE_SEQUENCE = 3; |
1205 |
|
|
1206 |
|
|
1207 |
|
|
1208 |
|
|
1209 |
|
private DomainPolicyNode subjectPol; |
1210 |
|
private SOAPolicyNode soas; |
1211 |
|
|
1212 |
|
|
1213 |
|
|
1214 |
|
|
1215 |
|
protected java.util.Map rules; |
1216 |
|
|
1217 |
|
|
1218 |
|
|
1219 |
|
|
1220 |
|
|
1221 |
|
|
1222 |
|
|
1223 |
|
@param |
1224 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
1225 |
25
|
public RoleAssignmentPolicyNode(Attributes attrs){... |
1226 |
25
|
this(subjectPolicy, soaPolicy, attrs); |
1227 |
|
} |
1228 |
|
|
1229 |
|
|
1230 |
|
|
1231 |
|
|
1232 |
|
|
1233 |
|
@param |
1234 |
|
@param |
1235 |
|
@param |
1236 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (4) |
Complexity: 1 |
Complexity Density: 0.25 |
|
1237 |
25
|
public RoleAssignmentPolicyNode(DomainPolicyNode subjectPolicy,... |
1238 |
|
SOAPolicyNode soaPolicy, Attributes attrs) { |
1239 |
25
|
super(XMLTags.ROLE_ASSIGNMENT_POLICY_NODE, attrs); |
1240 |
|
|
1241 |
25
|
this.subjectPol = subjectPolicy; |
1242 |
25
|
soas = soaPolicy; |
1243 |
25
|
delegationPolicy = this; |
1244 |
|
} |
1245 |
|
|
1246 |
|
|
1247 |
|
|
1248 |
|
|
1249 |
|
|
1250 |
|
|
1251 |
|
|
1252 |
|
|
|
|
| 84.7% |
Uncovered Elements: 17 (111) |
Complexity: 22 |
Complexity Density: 0.29 |
|
1253 |
25
|
public void construct() throws PolicyParsingException{... |
1254 |
25
|
rules = new java.util.Hashtable(); |
1255 |
|
|
1256 |
25
|
rules.put(issrg.pba.rbac.policies.Subtree.class, subjectPol.getCoverageDomain()); |
1257 |
|
|
1258 |
|
|
1259 |
77
|
for (int i=children.size(); i-->0; ){ |
1260 |
52
|
PolicyXMLNode c = (PolicyXMLNode)children.get(i); |
1261 |
52
|
String s = c.getName().intern(); |
1262 |
52
|
if (s!=XMLTags.ROLE_ASSIGNMENT_NODE){ |
1263 |
0
|
throw new PolicyParsingException("Only "+XMLTags.ROLE_ASSIGNMENT_NODE+" nodes are allowed under this node"); |
1264 |
|
} |
1265 |
|
|
1266 |
52
|
java.util.Vector v = c.getChildren(); |
1267 |
|
|
1268 |
|
|
1269 |
52
|
String subjId = (String)expect(v, SUBJECT_DOMAIN_NODE_SEQUENCE, XMLTags.SUBJECT_DOMAIN_NODE).getAttributes().get(XMLTags.ID_ATTRIBUTE); |
1270 |
|
|
1271 |
|
|
1272 |
52
|
RoleListNode roleList = (RoleListNode)expect(v, ROLE_LIST_NODE_SEQUENCE, XMLTags.ROLE_LIST_NODE); |
1273 |
|
|
1274 |
52
|
String delegationDepth = (String)expect(v, DELEGATE_NODE_SEQUENCE, XMLTags.DELEGATE_NODE).getAttributes().get(XMLTags.DEPTH_ATTRIBUTE); |
1275 |
|
|
1276 |
52
|
int delegation; |
1277 |
|
|
1278 |
52
|
try{ |
1279 |
52
|
delegation=delegationDepth==null? -1 : Integer.parseInt(delegationDepth); |
1280 |
0
|
if (delegation<-1) throw new NumberFormatException(); |
1281 |
|
}catch(java.lang.NumberFormatException ex){ |
1282 |
0
|
throw new PolicyParsingException("Delegation Depth should be a valid non-negative integer number, or be missing", ex); |
1283 |
|
} |
1284 |
|
|
1285 |
|
|
1286 |
52
|
String soaId = (String)expect(v, SOA_NODE_SEQUENCE, XMLTags.SOA_NODE).getAttributes().get(XMLTags.ID_ATTRIBUTE); |
1287 |
|
|
1288 |
|
|
1289 |
52
|
Vector validity = expect(v, VALIDITY_NODE_SEQUENCE, XMLTags.VALIDITY_NODE).getChildren(); |
1290 |
|
|
1291 |
52
|
validityForRoleList = new issrg.pba.rbac.AnyTimeValidityPeriod(); |
1292 |
52
|
int missingnodes=0; |
1293 |
52
|
PolicyXMLNode val_node = expect(validity, ABSOLUTE_VALIDITY_NODE_SEQUENCE, XMLTags.ABSOLUTE_NODE, true); |
1294 |
52
|
issrg.pba.rbac.RelativeDate rd; |
1295 |
|
|
1296 |
52
|
if (val_node==null){ |
1297 |
33
|
missingnodes++; |
1298 |
|
}else{ |
1299 |
19
|
java.util.Date nb = null; |
1300 |
19
|
java.util.Date na = null; |
1301 |
19
|
s = (String)val_node.getAttributes().get(XMLTags.START_ATTRIBUTE); |
1302 |
19
|
if (s!=null && s.intern()!=""){ |
1303 |
19
|
rd = parseDateTime(s); |
1304 |
19
|
rd.months--; |
1305 |
19
|
nb = rd.getDate(); |
1306 |
|
} |
1307 |
|
|
1308 |
19
|
s = (String)val_node.getAttributes().get(XMLTags.END_ATTRIBUTE); |
1309 |
19
|
if (s!=null && s.intern()!=""){ |
1310 |
19
|
rd = parseDateTime(s); |
1311 |
19
|
rd.months--; |
1312 |
19
|
na = rd.getDate(); |
1313 |
|
} |
1314 |
|
|
1315 |
19
|
validityForRoleList=new issrg.pba.rbac.AbsoluteValidityPeriod(nb, na); |
1316 |
|
} |
1317 |
|
|
1318 |
52
|
issrg.pba.rbac.RelativeDate age=null; |
1319 |
52
|
issrg.pba.rbac.RelativeDate min=null; |
1320 |
52
|
issrg.pba.rbac.RelativeDate max=null; |
1321 |
|
|
1322 |
52
|
val_node = expect(validity, AGE_VALIDITY_NODE_SEQUENCE-missingnodes, XMLTags.AGE_NODE, true); |
1323 |
52
|
if (val_node==null){ |
1324 |
50
|
missingnodes++; |
1325 |
|
}else{ |
1326 |
2
|
s = (String)val_node.getAttributes().get(XMLTags.TIME_ATTRIBUTE); |
1327 |
2
|
if (s==null){ |
1328 |
0
|
throw new PolicyParsingException(XMLTags.TIME_ATTRIBUTE+" attribute is missing in "+XMLTags.AGE_NODE); |
1329 |
|
} |
1330 |
|
|
1331 |
2
|
age=parseDateTime(s); |
1332 |
|
} |
1333 |
|
|
1334 |
52
|
val_node = expect(validity, MAXIMUM_VALIDITY_NODE_SEQUENCE-missingnodes, XMLTags.MAXIMUM_NODE, true); |
1335 |
52
|
if (val_node==null){ |
1336 |
50
|
missingnodes++; |
1337 |
|
}else{ |
1338 |
2
|
s = (String)val_node.getAttributes().get(XMLTags.TIME_ATTRIBUTE); |
1339 |
2
|
if (s==null){ |
1340 |
0
|
throw new PolicyParsingException(XMLTags.TIME_ATTRIBUTE+" attribute is missing in "+XMLTags.MAXIMUM_NODE); |
1341 |
|
} |
1342 |
|
|
1343 |
2
|
max=parseDateTime(s); |
1344 |
|
} |
1345 |
|
|
1346 |
52
|
val_node = expect(validity, MINIMUM_VALIDITY_NODE_SEQUENCE-missingnodes, XMLTags.MINIMUM_NODE, true); |
1347 |
52
|
if (val_node==null){ |
1348 |
51
|
missingnodes++; |
1349 |
|
}else{ |
1350 |
1
|
s = (String)val_node.getAttributes().get(XMLTags.TIME_ATTRIBUTE); |
1351 |
1
|
if (s==null){ |
1352 |
0
|
throw new PolicyParsingException(XMLTags.TIME_ATTRIBUTE+" attribute is missing in "+XMLTags.MINIMUM_NODE); |
1353 |
|
} |
1354 |
|
|
1355 |
1
|
min=parseDateTime(s); |
1356 |
|
} |
1357 |
|
|
1358 |
52
|
if (age!=null || min!=null || max!=null){ |
1359 |
5
|
validityForRoleList = new issrg.pba.rbac.AdjustedPeriodCollection( |
1360 |
|
validityForRoleList, |
1361 |
|
new issrg.pba.rbac.AdjustedValidityPeriod(age, min, max) |
1362 |
|
); |
1363 |
|
} |
1364 |
|
|
1365 |
52
|
roleList.construct(); |
1366 |
|
|
1367 |
|
|
1368 |
52
|
issrg.pba.Credentials soaCreds = roleList.getCredential(); |
1369 |
|
|
1370 |
|
|
1371 |
52
|
java.security.Principal soa = soas.getSOA(soaId); |
1372 |
|
|
1373 |
52
|
if (soa==null){ |
1374 |
0
|
throw new PolicyParsingException("No SOA with "+soaId+" has been defined"); |
1375 |
|
} |
1376 |
|
|
1377 |
|
|
1378 |
52
|
Subtree subj = subjectPol.getDomain(subjId); |
1379 |
|
|
1380 |
52
|
if (subj==null){ |
1381 |
0
|
throw new PolicyParsingException("No Subject Domain with "+subjId+" has been defined"); |
1382 |
|
} |
1383 |
|
|
1384 |
52
|
java.util.Vector v2 = (java.util.Vector)rules.get(soa.getName()); |
1385 |
52
|
if (v2==null){ |
1386 |
40
|
v2 = new java.util.Vector(); |
1387 |
40
|
rules.put(soa.getName(), v2); |
1388 |
|
} |
1389 |
|
|
1390 |
|
|
1391 |
52
|
v2.add(new issrg.pba.rbac.policies.AssignmentRule(subj, delegation, soaCreds)); |
1392 |
|
|
1393 |
|
} |
1394 |
|
} |
1395 |
|
|
1396 |
|
|
1397 |
|
|
1398 |
|
|
1399 |
|
|
1400 |
|
|
1401 |
|
|
1402 |
|
|
1403 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
1404 |
25
|
public java.util.Map getRules(){... |
1405 |
25
|
return rules; |
1406 |
|
} |
1407 |
|
|
1408 |
|
|
1409 |
|
|
1410 |
|
|
1411 |
|
|
1412 |
|
|
1413 |
|
|
1414 |
|
|
1415 |
|
|
1416 |
|
|
1417 |
|
|
1418 |
|
|
1419 |
|
|
1420 |
|
|
1421 |
|
|
1422 |
|
|
1423 |
|
|
1424 |
|
|
1425 |
|
|
1426 |
|
@param |
1427 |
|
|
1428 |
|
@return |
1429 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
1430 |
43
|
protected issrg.pba.rbac.RelativeDate parseDateTime(String s){... |
1431 |
43
|
int [] d = new issrg.pba.rbac.Time(s).getEvaluationTime(); |
1432 |
|
|
1433 |
43
|
return new issrg.pba.rbac.RelativeDate(d[0], d[1], d[2], d[3], d[4], d[5]); |
1434 |
|
} |
1435 |
|
} |
1436 |
|
|
1437 |
|
|
1438 |
|
|
1439 |
|
|
1440 |
|
|
1441 |
|
|
1442 |
|
|
1443 |
|
|
1444 |
|
|
1445 |
|
|
1446 |
|
@author |
1447 |
|
@version |
1448 |
|
|
|
|
| 82.7% |
Uncovered Elements: 14 (81) |
Complexity: 18 |
Complexity Density: 0.64 |
|
1449 |
|
public class RoleHierarchyNode extends PolicyXMLNode implements issrg.pba.rbac.RoleHierarchyNode { |
1450 |
|
|
1451 |
|
|
1452 |
|
|
1453 |
|
|
1454 |
|
|
1455 |
|
|
1456 |
|
|
1457 |
|
|
1458 |
|
|
1459 |
|
|
1460 |
|
|
1461 |
|
|
1462 |
|
protected int hierarchyLevel = -1; |
1463 |
|
|
1464 |
|
protected String type; |
1465 |
|
protected String value; |
1466 |
|
|
1467 |
|
protected RoleHierarchyNode [] subordinates=null; |
1468 |
|
|
1469 |
|
|
1470 |
|
|
1471 |
|
|
1472 |
|
|
1473 |
|
|
1474 |
|
private int loops = 0; |
1475 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
1476 |
101
|
public RoleHierarchyNode(org.xml.sax.Attributes attrs) {... |
1477 |
101
|
super(XMLTags.SUP_ROLE_NODE, attrs); |
1478 |
|
|
1479 |
101
|
_init_(); |
1480 |
|
} |
1481 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
1482 |
101
|
private void _init_(){... |
1483 |
101
|
value = attrs.getValue(XMLTags.VALUE_ATTRIBUTE); |
1484 |
|
} |
1485 |
|
|
1486 |
|
|
1487 |
|
|
1488 |
|
|
1489 |
|
|
1490 |
|
|
1491 |
|
|
1492 |
|
|
1493 |
|
|
1494 |
|
@param |
1495 |
|
|
1496 |
|
|
|
|
| 69.6% |
Uncovered Elements: 7 (23) |
Complexity: 6 |
Complexity Density: 0.4 |
|
1497 |
101
|
public void optimise(java.util.Map roleHierarchy) throws PolicyParsingException{... |
1498 |
101
|
try{ |
1499 |
101
|
if (subordinates!=null){ |
1500 |
0
|
return; |
1501 |
|
} |
1502 |
|
|
1503 |
101
|
Object [] childs = children.toArray(); |
1504 |
101
|
subordinates = new RoleHierarchyNode[childs.length]; |
1505 |
|
|
1506 |
149
|
for (int i=0; i<childs.length; i++){ |
1507 |
48
|
String s = (String)(((PolicyXMLNode)childs[i]).getAttributes().get(XMLTags.VALUE_ATTRIBUTE)); |
1508 |
|
|
1509 |
48
|
RoleHierarchyNode sub = (RoleHierarchyNode)roleHierarchy.get(s); |
1510 |
|
|
1511 |
48
|
if (sub==null){ |
1512 |
0
|
throw new PolicyParsingException("Could not find Role "+s+" in this hierarchy"); |
1513 |
|
} |
1514 |
|
|
1515 |
48
|
subordinates[i]=sub; |
1516 |
48
|
sub.setLevel(getLevel()+1); |
1517 |
|
|
1518 |
|
} |
1519 |
|
}catch(Throwable th){ |
1520 |
0
|
throw new PolicyParsingException(th.getMessage()); |
1521 |
|
} |
1522 |
|
|
1523 |
101
|
if (loops!=0){ |
1524 |
0
|
throw new PolicyParsingException("Role Hierarchy directed graph contains loops"); |
1525 |
|
} |
1526 |
|
} |
1527 |
|
|
1528 |
|
|
1529 |
|
|
1530 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
1531 |
24231
|
public int getLevel(){... |
1532 |
24231
|
return hierarchyLevel; |
1533 |
|
} |
1534 |
|
|
1535 |
|
|
1536 |
|
|
1537 |
|
|
1538 |
|
|
1539 |
|
|
1540 |
|
|
1541 |
|
|
1542 |
|
|
1543 |
|
|
1544 |
|
|
1545 |
|
@param |
1546 |
|
|
1547 |
|
|
1548 |
|
|
|
|
| 82.4% |
Uncovered Elements: 3 (17) |
Complexity: 5 |
Complexity Density: 0.56 |
|
1549 |
113
|
public void setLevel(int level){... |
1550 |
113
|
loops++; |
1551 |
113
|
if (loops!=1){ |
1552 |
0
|
return; |
1553 |
|
} |
1554 |
|
|
1555 |
113
|
if (level>=getLevel()){ |
1556 |
|
|
1557 |
108
|
hierarchyLevel = level; |
1558 |
108
|
if (subordinates!=null) |
1559 |
173
|
for(int i=0; i<subordinates.length; i++){ |
1560 |
65
|
subordinates[i].setLevel(level+1); |
1561 |
|
} |
1562 |
|
} |
1563 |
113
|
loops--; |
1564 |
|
} |
1565 |
|
|
1566 |
|
|
1567 |
|
|
1568 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
1569 |
45595
|
public String getValue(){... |
1570 |
45595
|
return value; |
1571 |
|
} |
1572 |
|
|
1573 |
|
|
1574 |
|
|
1575 |
|
|
1576 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
1577 |
17244
|
public Object getRoleValue(){... |
1578 |
17244
|
return getValue(); |
1579 |
|
} |
1580 |
|
|
1581 |
|
|
1582 |
|
|
1583 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
1584 |
2711
|
public String getRoleType(){... |
1585 |
2711
|
return type; |
1586 |
|
} |
1587 |
|
|
1588 |
|
|
1589 |
|
|
1590 |
|
|
1591 |
|
|
1592 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
1593 |
101
|
protected void setRoleType(String t){... |
1594 |
101
|
type=t; |
1595 |
|
} |
1596 |
|
|
1597 |
|
|
1598 |
|
|
1599 |
|
|
1600 |
|
|
1601 |
|
|
1602 |
|
|
1603 |
|
|
1604 |
|
|
1605 |
|
|
1606 |
|
@return |
1607 |
|
|
|
|
| 90.5% |
Uncovered Elements: 2 (21) |
Complexity: 9 |
Complexity Density: 0.82 |
|
1608 |
17641
|
public boolean isSuperiorTo(issrg.pba.rbac.RoleHierarchyNode rhn){... |
1609 |
|
|
1610 |
|
|
1611 |
17641
|
if (rhn==null || !(rhn instanceof RoleHierarchyNode)){ |
1612 |
|
|
1613 |
0
|
return false; |
1614 |
|
} |
1615 |
|
|
1616 |
17641
|
RoleHierarchyNode rhn1 = (RoleHierarchyNode)rhn; |
1617 |
|
|
1618 |
17641
|
if (rhn1==this || rhn1.getValue().intern()==getValue().intern()){ |
1619 |
|
|
1620 |
5606
|
return true; |
1621 |
|
} |
1622 |
|
|
1623 |
|
|
1624 |
|
|
1625 |
12035
|
if (rhn1.getLevel()<=getLevel() || subordinates==null){ |
1626 |
|
|
1627 |
6715
|
return false; |
1628 |
|
} |
1629 |
|
|
1630 |
6029
|
for (int i=0; i<subordinates.length; i++){ |
1631 |
|
|
1632 |
5963
|
if (subordinates[i].isSuperiorTo(rhn)){ |
1633 |
|
|
1634 |
5254
|
return true; |
1635 |
|
} |
1636 |
|
|
1637 |
|
} |
1638 |
|
|
1639 |
|
|
1640 |
66
|
return false; |
1641 |
|
} |
1642 |
|
|
1643 |
|
|
1644 |
|
|
1645 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
1646 |
0
|
public String toString(){... |
1647 |
0
|
return getValue(); |
1648 |
|
} |
1649 |
|
} |
1650 |
|
|
1651 |
|
|
1652 |
|
|
1653 |
|
|
1654 |
|
|
1655 |
|
|
1656 |
|
@author |
1657 |
|
@version |
1658 |
|
|
|
|
| 85.7% |
Uncovered Elements: 6 (42) |
Complexity: 4 |
Complexity Density: 0.48 |
|
1659 |
|
public class RoleHierarchyPolicyNode extends PolicyXMLNode implements issrg.pba.rbac.RoleHierarchyPolicy { |
1660 |
|
|
1661 |
|
|
1662 |
|
|
1663 |
|
protected java.util.Map byType = new java.util.Hashtable(); |
1664 |
|
|
1665 |
|
|
1666 |
|
|
1667 |
|
|
1668 |
|
protected java.util.Map byOID = new java.util.Hashtable(); |
1669 |
|
protected java.util.Map typeOid = new java.util.Hashtable(); |
1670 |
|
|
1671 |
|
|
1672 |
|
|
1673 |
|
|
1674 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
1675 |
25
|
public RoleHierarchyPolicyNode(Attributes attrs) {... |
1676 |
25
|
super(XMLTags.ROLE_HIERARCHY_POLICY_NODE, attrs); |
1677 |
|
|
1678 |
25
|
roleHierarchyPolicy = this; |
1679 |
|
} |
1680 |
|
|
1681 |
|
|
1682 |
|
|
1683 |
|
|
1684 |
|
|
1685 |
|
|
1686 |
|
@throws |
1687 |
|
|
1688 |
|
|
1689 |
|
|
|
|
| 77.8% |
Uncovered Elements: 4 (18) |
Complexity: 4 |
Complexity Density: 0.33 |
|
1690 |
25
|
public void construct() throws PolicyParsingException{... |
1691 |
25
|
Object [] childs = children.toArray(); |
1692 |
|
|
1693 |
55
|
for (int i=0; i<childs.length; i++){ |
1694 |
30
|
RoleSpecNode rsn = (RoleSpecNode)childs[i]; |
1695 |
|
|
1696 |
30
|
String s = rsn.getType(); |
1697 |
30
|
String oid = rsn.getOID(); |
1698 |
30
|
if (byType.get(s)!=null){ |
1699 |
0
|
throw new PolicyParsingException("Role Type "+s+" defined more than once"); |
1700 |
|
} |
1701 |
|
|
1702 |
30
|
if (byOID.get(oid)!=null){ |
1703 |
0
|
throw new PolicyParsingException("Role OID "+oid+" defined more than once"); |
1704 |
|
} |
1705 |
|
|
1706 |
30
|
byType.put(s, rsn); |
1707 |
30
|
byOID.put(oid, rsn); |
1708 |
30
|
typeOid.put(s,oid); |
1709 |
|
} |
1710 |
|
} |
1711 |
|
|
1712 |
|
|
1713 |
|
|
1714 |
|
|
1715 |
|
|
1716 |
|
@param |
1717 |
|
|
1718 |
|
@return |
1719 |
|
|
1720 |
|
|
1721 |
|
|
|
|
| 66.7% |
Uncovered Elements: 1 (3) |
Complexity: 1 |
Complexity Density: 1 |
|
1722 |
2919
|
public RoleSpecNode getByType(String roleType){... |
1723 |
2919
|
return roleType==null ? null : (RoleSpecNode)byType.get(roleType); |
1724 |
|
} |
1725 |
|
|
1726 |
|
|
1727 |
|
|
1728 |
|
|
1729 |
|
|
1730 |
|
|
1731 |
|
@param |
1732 |
|
|
1733 |
|
|
1734 |
|
@return |
1735 |
|
|
1736 |
|
|
1737 |
|
|
|
|
| 66.7% |
Uncovered Elements: 1 (3) |
Complexity: 1 |
Complexity Density: 1 |
|
1738 |
1803
|
public RoleSpecNode getByOID(String roleOID){... |
1739 |
1803
|
return roleOID==null ? null : (RoleSpecNode)byOID.get(roleOID); |
1740 |
|
} |
1741 |
|
|
1742 |
|
|
1743 |
|
|
1744 |
|
|
1745 |
|
@param |
1746 |
|
|
1747 |
|
@return |
1748 |
|
|
1749 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (4) |
Complexity: 1 |
Complexity Density: 0.5 |
|
1750 |
1803
|
public String getTypeByOID(String roleOID){... |
1751 |
1803
|
RoleSpecNode rsn = getByOID(roleOID); |
1752 |
|
|
1753 |
1803
|
return rsn==null ? null : rsn.getType(); |
1754 |
|
} |
1755 |
|
|
1756 |
|
|
1757 |
|
|
1758 |
|
|
1759 |
|
|
1760 |
|
@param |
1761 |
|
@param |
1762 |
|
|
1763 |
|
@return |
1764 |
|
|
1765 |
|
|
1766 |
|
|
1767 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (4) |
Complexity: 1 |
Complexity Density: 0.5 |
|
1768 |
2589
|
public issrg.pba.rbac.RoleHierarchyNode getRole(String type, String value){... |
1769 |
2589
|
RoleSpecNode rsn = getByType(type); |
1770 |
2589
|
return rsn==null ? null : rsn.getRole(value); |
1771 |
|
} |
1772 |
|
|
1773 |
|
|
1774 |
|
|
1775 |
|
|
1776 |
|
|
1777 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
1778 |
1
|
public Map getTypeOid() {... |
1779 |
1
|
return typeOid; |
1780 |
|
} |
1781 |
|
} |
1782 |
|
|
1783 |
|
|
1784 |
|
|
1785 |
|
|
1786 |
|
|
1787 |
|
|
1788 |
|
|
1789 |
|
|
1790 |
|
|
1791 |
|
@author |
1792 |
|
@version |
1793 |
|
|
|
|
| 82% |
Uncovered Elements: 9 (50) |
Complexity: 8 |
Complexity Density: 0.39 |
|
1794 |
|
public class RoleListNode extends PolicyXMLNode { |
1795 |
|
|
1796 |
|
|
1797 |
|
|
1798 |
|
protected RoleHierarchyPolicyNode policy; |
1799 |
|
|
1800 |
|
|
1801 |
|
|
1802 |
|
|
1803 |
|
protected issrg.pba.Credentials credential; |
1804 |
|
|
1805 |
|
|
1806 |
|
|
1807 |
|
|
1808 |
|
|
1809 |
|
|
1810 |
|
|
1811 |
|
|
1812 |
|
@param |
1813 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
1814 |
151
|
public RoleListNode(Attributes attrs){... |
1815 |
151
|
this(null, attrs); |
1816 |
|
} |
1817 |
|
|
1818 |
|
|
1819 |
|
|
1820 |
|
|
1821 |
|
|
1822 |
|
@param |
1823 |
|
|
1824 |
|
|
1825 |
|
@param |
1826 |
|
|
|
|
| 75% |
Uncovered Elements: 1 (4) |
Complexity: 1 |
Complexity Density: 0.5 |
|
1827 |
151
|
public RoleListNode(RoleHierarchyPolicyNode rhpn, Attributes attrs){... |
1828 |
151
|
super(XMLTags.ROLE_LIST_NODE, attrs); |
1829 |
|
|
1830 |
151
|
policy = rhpn==null?roleHierarchyPolicy:rhpn; |
|