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 |
|
|
33 |
|
|
34 |
|
|
35 |
|
|
36 |
|
|
37 |
|
|
38 |
|
|
39 |
|
|
40 |
|
|
41 |
|
|
42 |
|
|
43 |
|
|
44 |
|
|
45 |
|
|
46 |
|
|
47 |
|
|
48 |
|
|
49 |
|
|
50 |
|
|
51 |
|
|
52 |
|
package issrg.pba.rbac; |
53 |
|
|
54 |
|
import issrg.pba.PbaException; |
55 |
|
import issrg.pba.rbac.SAWSLogLevelConstant; |
56 |
|
import iaik.asn1.*; |
57 |
|
import iaik.asn1.structures.AlgorithmID; |
58 |
|
import iaik.utils.Util; |
59 |
|
import java.util.Iterator; |
60 |
|
import java.util.Set; |
61 |
|
|
62 |
|
|
63 |
|
|
64 |
|
@author |
65 |
|
|
66 |
|
|
67 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (5) |
Complexity: 1 |
Complexity Density: 0.25 |
|
68 |
|
public abstract class Record { |
69 |
|
|
70 |
|
|
71 |
|
String type; |
72 |
|
public abstract byte[] toBytes(); |
73 |
|
|
74 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (4) |
Complexity: 1 |
Complexity Density: 0.25 |
|
75 |
47
|
protected byte[] toBytes(String result){... |
76 |
47
|
SEQUENCE ASN1Seq = new SEQUENCE(); |
77 |
47
|
ASN1Seq.addComponent(new IA5String(result)); |
78 |
47
|
byte[] arrayASN = DerCoder.encode(ASN1Seq); |
79 |
47
|
return arrayASN; |
80 |
|
} |
81 |
|
|
82 |
|
} |
83 |
|
|
84 |
|
|
85 |
|
|
|
|
| 80% |
Uncovered Elements: 4 (20) |
Complexity: 4 |
Complexity Density: 0.42 |
|
86 |
|
class StartupRecord extends Record { |
87 |
|
String soa; |
88 |
|
String policyOID; |
89 |
|
String filePath; |
90 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (4) |
Complexity: 1 |
Complexity Density: 0.25 |
|
91 |
4
|
public StartupRecord(String soa, String policyOID, String filePath) {... |
92 |
4
|
type=SAWSLogLevelConstant.PermisStartingType; |
93 |
4
|
this.soa=soa; |
94 |
4
|
this.policyOID=policyOID; |
95 |
4
|
this.filePath=filePath; |
96 |
|
} |
97 |
|
|
98 |
|
|
99 |
|
|
|
|
| 71.4% |
Uncovered Elements: 4 (14) |
Complexity: 4 |
Complexity Density: 0.5 |
|
100 |
4
|
public byte[] toBytes() {... |
101 |
4
|
String result="Type: "+type+ "\n"; |
102 |
4
|
if(soa!=null) |
103 |
4
|
result=result + "SOA: "+soa + "\n"; |
104 |
4
|
if(policyOID!=null) |
105 |
4
|
result=result+"policyOID: "+policyOID; |
106 |
4
|
if(filePath!=null) |
107 |
0
|
result=result+ "filePath: "+filePath; |
108 |
|
|
109 |
4
|
return toBytes(result); |
110 |
|
} |
111 |
|
} |
112 |
|
|
113 |
|
|
114 |
|
|
115 |
|
|
116 |
|
|
117 |
|
|
|
|
| 0% |
Uncovered Elements: 5 (5) |
Complexity: 1 |
Complexity Density: 0.67 |
|
118 |
|
class ShutDownRecord extends Record { |
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
119 |
0
|
public ShutDownRecord(){... |
120 |
0
|
type=SAWSLogLevelConstant.PermisShutDownType; |
121 |
|
} |
122 |
|
|
123 |
|
|
124 |
|
|
|
|
| 0% |
Uncovered Elements: 2 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
125 |
0
|
public byte[] toBytes(){... |
126 |
0
|
String result="Type: "+type; |
127 |
0
|
return toBytes(result); |
128 |
|
} |
129 |
|
} |
130 |
|
|
131 |
|
|
132 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (27) |
Complexity: 4 |
Complexity Density: 0.26 |
|
133 |
|
class AccessGrantRecord extends Record { |
134 |
|
issrg.pba.Subject S; |
135 |
|
issrg.pba.Action A; |
136 |
|
issrg.pba.Target T; |
137 |
|
java.util.Map Application_Context; |
138 |
|
String creds; |
139 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (6) |
Complexity: 1 |
Complexity Density: 0.17 |
|
140 |
18
|
public AccessGrantRecord(issrg.pba.Subject S, issrg.pba.Action A, issrg.pba.Target T,java.util.Map Application_Context){... |
141 |
18
|
type=SAWSLogLevelConstant.PermisAccessGrantType; |
142 |
18
|
this.S=S; |
143 |
18
|
this.A=A; |
144 |
18
|
this.T=T; |
145 |
18
|
this.Application_Context=Application_Context; |
146 |
18
|
this.creds= ((issrg.pba.Credentials)S.exportCreds()).toString(); |
147 |
|
} |
148 |
|
|
149 |
|
|
150 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (19) |
Complexity: 4 |
Complexity Density: 0.31 |
|
151 |
18
|
public byte[] toBytes(){... |
152 |
|
|
153 |
|
|
154 |
18
|
String result="Type: "+type+ "\n"; |
155 |
18
|
result=result+ S.getHolder().getName()+"\n"+A.getActionName()+"\n"+((PermisTarget) T).getName()+"\n" + creds+ "\n"; |
156 |
|
|
157 |
|
|
158 |
18
|
Set keys = Application_Context.keySet(); |
159 |
18
|
Iterator keyIter = keys.iterator(); |
160 |
|
|
161 |
72
|
while (keyIter.hasNext()) { |
162 |
54
|
Object key = keyIter.next(); |
163 |
54
|
Object value = Application_Context.get(key); |
164 |
|
|
165 |
54
|
if(key=="Subject") |
166 |
18
|
result=result+"Environment parameters: Subject= "+((issrg.pba.Subject)value).getHolder().getName()+"\n"; |
167 |
|
|
168 |
36
|
else if(key=="ContextInstance") |
169 |
18
|
result=result+"Environment parameters: ContextInstance= "+value+ " "; |
170 |
|
else |
171 |
18
|
result=result+"Environment parameters:" + key+ ": " +value+ " "; |
172 |
|
|
173 |
|
|
174 |
|
|
175 |
|
|
176 |
|
} |
177 |
|
|
178 |
|
|
179 |
|
|
180 |
18
|
return toBytes(result); |
181 |
|
} |
182 |
|
} |
183 |
|
|
184 |
|
|
185 |
|
|
186 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (27) |
Complexity: 4 |
Complexity Density: 0.26 |
|
187 |
|
class AccessDenyRecord extends Record { |
188 |
|
issrg.pba.Subject S; |
189 |
|
issrg.pba.Action A; |
190 |
|
issrg.pba.Target T; |
191 |
|
java.util.Map Application_Context; |
192 |
|
String creds; |
193 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (6) |
Complexity: 1 |
Complexity Density: 0.17 |
|
194 |
17
|
public AccessDenyRecord(issrg.pba.Subject S, issrg.pba.Action A, issrg.pba.Target T,java.util.Map Application_Context){... |
195 |
17
|
this.S=S; |
196 |
17
|
this.A=A; |
197 |
17
|
this.T=T; |
198 |
17
|
this.Application_Context=Application_Context; |
199 |
17
|
type=SAWSLogLevelConstant.PermisAccessDenyType; |
200 |
17
|
this.creds= ((issrg.pba.Credentials)S.exportCreds()).toString(); |
201 |
|
} |
202 |
|
|
203 |
|
|
204 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (19) |
Complexity: 4 |
Complexity Density: 0.31 |
|
205 |
17
|
public byte[] toBytes(){... |
206 |
|
|
207 |
|
|
208 |
17
|
String result="Type: "+type+ "\n"; |
209 |
17
|
result=result+S.getHolder().getName()+"\n"+A.getActionName()+"\n"+((PermisTarget) T).getName()+"\n" + creds+"\n"; |
210 |
|
|
211 |
|
|
212 |
|
|
213 |
|
|
214 |
|
|
215 |
17
|
Set keys = Application_Context.keySet(); |
216 |
17
|
Iterator keyIter = keys.iterator(); |
217 |
|
|
218 |
68
|
while (keyIter.hasNext()) { |
219 |
51
|
Object key = keyIter.next(); |
220 |
51
|
Object value = Application_Context.get(key); |
221 |
|
|
222 |
51
|
if(key=="Subject") |
223 |
17
|
result=result+"Environment parameters: Subject= "+((issrg.pba.Subject)value).getHolder().getName()+"\n"; |
224 |
|
|
225 |
34
|
else if(key=="ContextInstance") |
226 |
17
|
result=result+"Environment parameters: ContextInstance= "+value+ " "; |
227 |
|
else |
228 |
17
|
result=result+"Environment parameters:" + key+ ": " +value+ " "; |
229 |
|
|
230 |
|
} |
231 |
|
|
232 |
|
|
233 |
17
|
return toBytes(result); |
234 |
|
} |
235 |
|
} |
236 |
|
|
237 |
|
|
238 |
|
|