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