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 public AuditLogEntry() {
73 auditEventTime = new DateTime();
74 releasedAttributes = new ArrayList<String>();
75 }
76
77
78
79
80
81
82 public String getMessageProfile() {
83 return messageProfile;
84 }
85
86
87
88
89
90
91 public void setMessageProfile(String profileURI) {
92 messageProfile = profileURI;
93 }
94
95
96
97
98
99
100 public String getPrincipalAuthenticationMethod() {
101 return principalAuthenticationMethod;
102 }
103
104
105
106
107
108
109 public void setPrincipalAuthenticationMethod(String method) {
110 principalAuthenticationMethod = method;
111 }
112
113
114
115
116
117
118 public String getPrincipalName() {
119 return principalName;
120 }
121
122
123
124
125
126
127 public void setPrincipalName(String id) {
128 principalName = id;
129 }
130
131
132
133
134
135
136 public String getAssertingPartyId() {
137 return assertingPartyId;
138 }
139
140
141
142
143
144
145 public void setAssertingPartyId(String id) {
146 assertingPartyId = id;
147 }
148
149
150
151
152
153
154 public List<String> getReleasedAttributes() {
155 return releasedAttributes;
156 }
157
158
159
160
161
162
163 public String getRelyingPartyId() {
164 return relyingPartyId;
165 }
166
167
168
169
170
171
172 public void setRelyingPartyId(String entityId) {
173 relyingPartyId = entityId;
174 }
175
176
177
178
179
180
181 public String getRequestBinding() {
182 return requestBinding;
183 }
184
185
186
187
188
189
190 public void setRequestBinding(String bindingURI) {
191 requestBinding = bindingURI;
192 }
193
194
195
196
197
198
199 public String getRequestId() {
200 return requestId;
201 }
202
203
204
205
206
207
208 public void setRequestId(String id) {
209 requestId = id;
210 }
211
212
213
214
215
216
217 public String getResponseBinding() {
218 return responseBinding;
219 }
220
221
222
223
224
225
226 public void setResponseBinding(String bindingURI) {
227 responseBinding = bindingURI;
228 }
229
230
231
232
233
234
235 public String getResponseId() {
236 return responseId;
237 }
238
239
240
241
242
243
244 public void setResponseId(String id) {
245 responseId = id;
246 }
247
248
249
250
251
252
253 public DateTime getAuditEventTime() {
254 return auditEventTime;
255 }
256
257
258 public String toString() {
259 StringBuilder entryString = new StringBuilder();
260
261 entryString.append(getAuditEventTime().toString(dateFormatter.withZone(DateTimeZone.UTC)));
262 entryString.append("|");
263
264 if (getRequestBinding() != null) {
265 entryString.append(getRequestBinding());
266 }
267 entryString.append("|");
268
269 if (getRequestId() != null) {
270 entryString.append(getRequestId());
271 }
272 entryString.append("|");
273
274 entryString.append(getRelyingPartyId());
275 entryString.append("|");
276
277 entryString.append(getMessageProfile());
278 entryString.append("|");
279
280 entryString.append(getAssertingPartyId());
281 entryString.append("|");
282
283 entryString.append(getResponseBinding());
284 entryString.append("|");
285
286 entryString.append(getResponseId());
287 entryString.append("|");
288
289 if (getPrincipalName() != null) {
290 entryString.append(getPrincipalName());
291 }
292 entryString.append("|");
293
294 if (getPrincipalAuthenticationMethod() != null) {
295 entryString.append(getPrincipalAuthenticationMethod());
296 }
297 entryString.append("|");
298
299 for (String attribute : getReleasedAttributes()) {
300 entryString.append(attribute);
301 entryString.append(",");
302 }
303 entryString.append("|");
304
305 return entryString.toString();
306 }
307 }