1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package edu.internet2.middleware.shibboleth.common.log;
18
19 import java.util.ArrayList;
20 import java.util.List;
21
22 import org.joda.time.DateTime;
23 import org.joda.time.DateTimeZone;
24 import org.joda.time.format.DateTimeFormatter;
25 import org.joda.time.format.ISODateTimeFormat;
26
27
28
29
30 public class AuditLogEntry {
31
32
33 public static final String AUDIT_LOGGER_NAME = "Shibboleth-Audit";
34
35
36 private static DateTimeFormatter dateFormatter = ISODateTimeFormat.basicDateTimeNoMillis();
37
38
39 private DateTime auditEventTime;
40
41
42 private String assertingPartyId;
43
44
45 private String relyingPartyId;
46
47
48 private String requestBinding;
49
50
51 private String responseBinding;
52
53
54 private String messageProfile;
55
56
57 private String requestId;
58
59
60 private String responseId;
61
62
63 private String principalName;
64
65
66 private String principalAuthenticationMethod;
67
68
69 private List<String> releasedAttributes;
70
71
72 private String nameIdValue;
73
74
75 public AuditLogEntry() {
76 auditEventTime = new DateTime();
77 releasedAttributes = new ArrayList<String>();
78 }
79
80
81
82
83
84
85 public String getAssertingPartyId() {
86 return assertingPartyId;
87 }
88
89
90
91
92
93
94 public DateTime getAuditEventTime() {
95 return auditEventTime;
96 }
97
98
99
100
101
102
103 public String getMessageProfile() {
104 return messageProfile;
105 }
106
107
108
109
110
111 public String getNameIdValue() {
112 return nameIdValue;
113 }
114
115
116
117
118
119
120 public String getPrincipalAuthenticationMethod() {
121 return principalAuthenticationMethod;
122 }
123
124
125
126
127
128
129 public String getPrincipalName() {
130 return principalName;
131 }
132
133
134
135
136
137
138 public List<String> getReleasedAttributes() {
139 return releasedAttributes;
140 }
141
142
143
144
145
146
147 public String getRelyingPartyId() {
148 return relyingPartyId;
149 }
150
151
152
153
154
155
156 public String getRequestBinding() {
157 return requestBinding;
158 }
159
160
161
162
163
164
165 public String getRequestId() {
166 return requestId;
167 }
168
169
170
171
172
173
174 public String getResponseBinding() {
175 return responseBinding;
176 }
177
178
179
180
181
182
183 public String getResponseId() {
184 return responseId;
185 }
186
187
188
189
190
191
192 public void setAssertingPartyId(String id) {
193 assertingPartyId = id;
194 }
195
196
197
198
199
200
201 public void setMessageProfile(String profileURI) {
202 messageProfile = profileURI;
203 }
204
205
206
207
208
209
210 public void setNameIdValue(String value) {
211 nameIdValue = value;
212 }
213
214
215
216
217
218
219 public void setPrincipalAuthenticationMethod(String method) {
220 principalAuthenticationMethod = method;
221 }
222
223
224
225
226
227
228 public void setPrincipalName(String id) {
229 principalName = id;
230 }
231
232
233
234
235
236
237 public void setRelyingPartyId(String entityId) {
238 relyingPartyId = entityId;
239 }
240
241
242
243
244
245
246 public void setRequestBinding(String bindingURI) {
247 requestBinding = bindingURI;
248 }
249
250
251
252
253
254
255 public void setRequestId(String id) {
256 requestId = id;
257 }
258
259
260
261
262
263
264 public void setResponseBinding(String bindingURI) {
265 responseBinding = bindingURI;
266 }
267
268
269
270
271
272
273 public void setResponseId(String id) {
274 responseId = id;
275 }
276
277
278 public String toString() {
279 StringBuilder entryString = new StringBuilder();
280
281 entryString.append(getAuditEventTime().toString(dateFormatter.withZone(DateTimeZone.UTC)));
282 entryString.append("|");
283
284 if (getRequestBinding() != null) {
285 entryString.append(getRequestBinding());
286 }
287 entryString.append("|");
288
289 if (getRequestId() != null) {
290 entryString.append(getRequestId());
291 }
292 entryString.append("|");
293
294 entryString.append(getRelyingPartyId());
295 entryString.append("|");
296
297 entryString.append(getMessageProfile());
298 entryString.append("|");
299
300 entryString.append(getAssertingPartyId());
301 entryString.append("|");
302
303 entryString.append(getResponseBinding());
304 entryString.append("|");
305
306 entryString.append(getResponseId());
307 entryString.append("|");
308
309 if (getPrincipalName() != null) {
310 entryString.append(getPrincipalName());
311 }
312 entryString.append("|");
313
314 if (getPrincipalAuthenticationMethod() != null) {
315 entryString.append(getPrincipalAuthenticationMethod());
316 }
317 entryString.append("|");
318
319 for (String attribute : getReleasedAttributes()) {
320 entryString.append(attribute);
321 entryString.append(",");
322 }
323 entryString.append("|");
324
325 return entryString.toString();
326 }
327 }