1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package edu.internet2.middleware.shibboleth.idp.session.impl;
18
19 import org.joda.time.DateTime;
20 import org.joda.time.chrono.ISOChronology;
21
22 import edu.internet2.middleware.shibboleth.idp.session.AuthenticationMethodInformation;
23 import edu.internet2.middleware.shibboleth.idp.session.ServiceInformation;
24
25
26 public class ServiceInformationImpl implements ServiceInformation {
27
28
29 private static final long serialVersionUID = 1185342879825302743L;
30
31
32 private String entityID;
33
34
35 private long authenticationInstant;
36
37
38 private AuthenticationMethodInformation methodInfo;
39
40
41
42
43
44
45
46
47 public ServiceInformationImpl(String id, DateTime loginInstant, AuthenticationMethodInformation method) {
48 entityID = id;
49 authenticationInstant = loginInstant.toDateTime(ISOChronology.getInstanceUTC()).getMillis();
50 methodInfo = method;
51 }
52
53
54 public synchronized String getEntityID() {
55 return entityID;
56 }
57
58
59 public synchronized DateTime getLoginInstant() {
60 return new DateTime(authenticationInstant, ISOChronology.getInstanceUTC());
61 }
62
63
64 public synchronized AuthenticationMethodInformation getAuthenticationMethod() {
65 return methodInfo;
66 }
67
68
69 public synchronized int hashCode() {
70 return entityID.hashCode();
71 }
72
73
74 public synchronized boolean equals(Object obj) {
75 if (obj == this) {
76 return true;
77 }
78
79 if (!(obj instanceof ServiceInformation)) {
80 return false;
81 }
82
83 ServiceInformation si = (ServiceInformation) obj;
84 return entityID.equals(si.getEntityID());
85 }
86 }