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