1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 package org.apache.syncope.common.lib.wa;
20
21 import java.time.LocalDateTime;
22 import org.apache.commons.lang3.builder.EqualsBuilder;
23 import org.apache.commons.lang3.builder.HashCodeBuilder;
24 import org.apache.commons.lang3.builder.ToStringBuilder;
25 import org.apache.syncope.common.lib.BaseBean;
26
27 public class GoogleMfaAuthToken implements BaseBean {
28
29 private static final long serialVersionUID = 2185073386484048953L;
30
31 public static class Builder {
32
33 private final GoogleMfaAuthToken instance = new GoogleMfaAuthToken();
34
35 public GoogleMfaAuthToken.Builder issueDate(final LocalDateTime issueDate) {
36 instance.setIssueDate(issueDate);
37 return this;
38 }
39
40 public GoogleMfaAuthToken.Builder token(final int otp) {
41 instance.setOtp(otp);
42 return this;
43 }
44
45 public GoogleMfaAuthToken build() {
46 return instance;
47 }
48 }
49
50 private int otp;
51
52 private LocalDateTime issueDate;
53
54 public int getOtp() {
55 return otp;
56 }
57
58 public void setOtp(final int otp) {
59 this.otp = otp;
60 }
61
62 public LocalDateTime getIssueDate() {
63 return issueDate;
64 }
65
66 public void setIssueDate(final LocalDateTime issueDate) {
67 this.issueDate = issueDate;
68 }
69
70 @Override
71 public int hashCode() {
72 return new HashCodeBuilder()
73 .append(otp)
74 .append(issueDate)
75 .toHashCode();
76 }
77
78 @Override
79 public boolean equals(final Object obj) {
80 if (obj == null) {
81 return false;
82 }
83 if (obj == this) {
84 return true;
85 }
86 if (obj.getClass() != getClass()) {
87 return false;
88 }
89 GoogleMfaAuthToken other = (GoogleMfaAuthToken) obj;
90 return new EqualsBuilder()
91 .append(this.otp, other.otp)
92 .append(this.issueDate, other.issueDate)
93 .isEquals();
94 }
95
96 @Override
97 public String toString() {
98 return new ToStringBuilder(this)
99 .append("token", otp)
100 .append("issueDate", issueDate)
101 .toString();
102 }
103 }