From 8d17c0986896b3c7ba59200c725d20c79e1b2ea6 Mon Sep 17 00:00:00 2001 From: Yuriy Syrota Date: Thu, 10 Oct 2024 15:13:01 +0300 Subject: [PATCH] Remove dependency on Lombok --- duo-universal-sdk/pom.xml | 6 - .../com/duosecurity/model/AccessDevice.java | 89 ++++++++- .../com/duosecurity/model/Application.java | 71 ++++++- .../com/duosecurity/model/AuthContext.java | 187 +++++++++++++++++- .../com/duosecurity/model/AuthDevice.java | 85 +++++++- .../com/duosecurity/model/AuthResult.java | 88 ++++++++- .../model/HealthCheckResponse.java | 129 +++++++++++- .../java/com/duosecurity/model/Location.java | 85 +++++++- .../java/com/duosecurity/model/Response.java | 52 ++++- .../java/com/duosecurity/model/Token.java | 173 +++++++++++++++- .../com/duosecurity/model/TokenResponse.java | 99 +++++++++- .../main/java/com/duosecurity/model/User.java | 65 +++++- 12 files changed, 1100 insertions(+), 29 deletions(-) diff --git a/duo-universal-sdk/pom.xml b/duo-universal-sdk/pom.xml index de3ced7..2e4cb9b 100644 --- a/duo-universal-sdk/pom.xml +++ b/duo-universal-sdk/pom.xml @@ -112,12 +112,6 @@ converter-jackson 2.11.0 - - org.projectlombok - lombok - 1.18.20 - provided - com.auth0 java-jwt diff --git a/duo-universal-sdk/src/main/java/com/duosecurity/model/AccessDevice.java b/duo-universal-sdk/src/main/java/com/duosecurity/model/AccessDevice.java index 8197397..8147090 100644 --- a/duo-universal-sdk/src/main/java/com/duosecurity/model/AccessDevice.java +++ b/duo-universal-sdk/src/main/java/com/duosecurity/model/AccessDevice.java @@ -1,13 +1,98 @@ package com.duosecurity.model; import java.io.Serializable; -import lombok.Data; +import java.util.Objects; -@Data public class AccessDevice implements Serializable { private static final long serialVersionUID = -1130960392429229150L; private String hostname; private String ip; private Location location; + + + /** + * Constructor with all properties. + * + * @param hostname hostname + * @param ip ip + * @param location location + */ + public AccessDevice(String hostname, String ip, Location location) { + this.hostname = hostname; + this.ip = ip; + this.location = location; + } + + public AccessDevice() { + } + + public static long getSerialversionuid() { + return serialVersionUID; + } + + public String getHostname() { + return hostname; + } + + public void setHostname(String hostname) { + this.hostname = hostname; + } + + public String getIp() { + return ip; + } + + public void setIp(String ip) { + this.ip = ip; + } + + public Location getLocation() { + return location; + } + + public void setLocation(Location location) { + this.location = location; + } + + @Override + public String toString() { + return "AccessDevice [hostname=" + hostname + + ", ip=" + ip + + ", location=" + location + + ", getHostname()=" + getHostname() + + ", getIp()=" + getIp() + + ", getLocation()=" + getLocation() + + ", hashCode()=" + hashCode() + + ", getClass()=" + getClass() + + ", toString()=" + super.toString() + + "]"; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (obj == null) { + return false; + } + if (getClass() != obj.getClass()) { + return false; + } + AccessDevice other = (AccessDevice) obj; + return Objects.equals(hostname, other.hostname) + && Objects.equals(ip, other.ip) + && Objects.equals(location, other.location); + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((hostname == null) ? 0 : hostname.hashCode()); + result = prime * result + ((ip == null) ? 0 : ip.hashCode()); + result = prime * result + ((location == null) ? 0 : location.hashCode()); + return result; + } } diff --git a/duo-universal-sdk/src/main/java/com/duosecurity/model/Application.java b/duo-universal-sdk/src/main/java/com/duosecurity/model/Application.java index 389ff87..cf692e7 100644 --- a/duo-universal-sdk/src/main/java/com/duosecurity/model/Application.java +++ b/duo-universal-sdk/src/main/java/com/duosecurity/model/Application.java @@ -1,12 +1,79 @@ package com.duosecurity.model; import java.io.Serializable; -import lombok.Data; +import java.util.Objects; -@Data public class Application implements Serializable { private static final long serialVersionUID = -5324896038503981781L; private String key; private String name; + + /** + * Constructor with all properties. + * + * @param key key + * @param name name + */ + public Application(String key, String name) { + this.key = key; + this.name = name; + } + + public Application() { + } + + public static long getSerialversionuid() { + return serialVersionUID; + } + + public String getKey() { + return key; + } + + public void setKey(String key) { + this.key = key; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + @Override + public String toString() { + return "Application [key=" + key + + ", name=" + name + + ", getKey()=" + getKey() + + ", getName()=" + getName() + + ", hashCode()=" + hashCode() + + ", getClass()=" + getClass() + + ", toString()=" + super.toString() + + "]"; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (obj == null || getClass() != obj.getClass()) { + return false; + } + Application other = (Application) obj; + return Objects.equals(key, other.key) + && Objects.equals(name, other.name); + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((key == null) ? 0 : key.hashCode()); + result = prime * result + ((name == null) ? 0 : name.hashCode()); + return result; + } } diff --git a/duo-universal-sdk/src/main/java/com/duosecurity/model/AuthContext.java b/duo-universal-sdk/src/main/java/com/duosecurity/model/AuthContext.java index 3945289..6ef47e1 100644 --- a/duo-universal-sdk/src/main/java/com/duosecurity/model/AuthContext.java +++ b/duo-universal-sdk/src/main/java/com/duosecurity/model/AuthContext.java @@ -1,9 +1,8 @@ package com.duosecurity.model; import java.io.Serializable; -import lombok.Data; +import java.util.Objects; -@Data public class AuthContext implements Serializable { private static final long serialVersionUID = -2431823399834806194L; @@ -16,5 +15,187 @@ public class AuthContext implements Serializable { private AccessDevice access_device; private Application application; private String factor; - private User user; + private User user; + + /** + * Constructor with all properties. + * + * @param result result + * @param timestamp timestamp + * @param authDevice auth_device + * @param txid txid + * @param eventType event_type + * @param reason reason + * @param accessDevice access_device + * @param application application + * @param factor factor + * @param user user + */ + public AuthContext(String result, Integer timestamp, AuthDevice authDevice, String txid, + String eventType, String reason, AccessDevice accessDevice, Application application, + String factor, User user) { + this.result = result; + this.timestamp = timestamp; + this.auth_device = authDevice; + this.txid = txid; + this.event_type = eventType; + this.reason = reason; + this.access_device = accessDevice; + this.application = application; + this.factor = factor; + this.user = user; + } + + public AuthContext() { + } + + public static long getSerialversionuid() { + return serialVersionUID; + } + + public String getResult() { + return result; + } + + public void setResult(String result) { + this.result = result; + } + + public Integer getTimestamp() { + return timestamp; + } + + public void setTimestamp(Integer timestamp) { + this.timestamp = timestamp; + } + + public AuthDevice getAuth_device() { + return auth_device; + } + + public void setAuth_device(AuthDevice authDevice) { + this.auth_device = authDevice; + } + + public String getTxid() { + return txid; + } + + public void setTxid(String txid) { + this.txid = txid; + } + + public String getEvent_type() { + return event_type; + } + + public void setEvent_type(String eventType) { + this.event_type = eventType; + } + + public String getReason() { + return reason; + } + + public void setReason(String reason) { + this.reason = reason; + } + + public AccessDevice getAccess_device() { + return access_device; + } + + public void setAccess_device(AccessDevice accessDevice) { + this.access_device = accessDevice; + } + + public Application getApplication() { + return application; + } + + public void setApplication(Application application) { + this.application = application; + } + + public String getFactor() { + return factor; + } + + public void setFactor(String factor) { + this.factor = factor; + } + + public User getUser() { + return user; + } + + public void setUser(User user) { + this.user = user; + } + + @Override + public String toString() { + return "AuthContext [result=" + result + + ", timestamp=" + timestamp + + ", auth_device=" + auth_device + + ", txid=" + txid + + ", event_type=" + event_type + + ", reason=" + reason + + ", access_device=" + access_device + + ", application=" + application + + ", factor=" + factor + + ", user=" + user + + ", getAccess_device()=" + getAccess_device() + + ", getApplication()=" + getApplication() + + ", getAuth_device()=" + getAuth_device() + + ", getEvent_type()=" + getEvent_type() + + ", getFactor()=" + getFactor() + + ", getReason()=" + getReason() + + ", getResult()=" + getResult() + + ", getTimestamp()=" + getTimestamp() + + ", getTxid()=" + getTxid() + + ", getUser()=" + getUser() + + ", hashCode()=" + hashCode() + + ", getClass()=" + getClass() + + ", toString()=" + super.toString() + + "]"; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (obj == null || getClass() != obj.getClass()) { + return false; + } + AuthContext other = (AuthContext) obj; + return Objects.equals(result, other.result) + && Objects.equals(timestamp, other.timestamp) + && Objects.equals(auth_device, other.auth_device) + && Objects.equals(txid, other.txid) + && Objects.equals(event_type, other.event_type) + && Objects.equals(reason, other.reason) + && Objects.equals(access_device, other.access_device) + && Objects.equals(application, other.application) + && Objects.equals(factor, other.factor) + && Objects.equals(user, other.user); + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((this.result == null) ? 0 : this.result.hashCode()); + result = prime * result + ((timestamp == null) ? 0 : timestamp.hashCode()); + result = prime * result + ((auth_device == null) ? 0 : auth_device.hashCode()); + result = prime * result + ((txid == null) ? 0 : txid.hashCode()); + result = prime * result + ((event_type == null) ? 0 : event_type.hashCode()); + result = prime * result + ((reason == null) ? 0 : reason.hashCode()); + result = prime * result + ((access_device == null) ? 0 : access_device.hashCode()); + result = prime * result + ((application == null) ? 0 : application.hashCode()); + result = prime * result + ((factor == null) ? 0 : factor.hashCode()); + result = prime * result + ((user == null) ? 0 : user.hashCode()); + return result; + } } diff --git a/duo-universal-sdk/src/main/java/com/duosecurity/model/AuthDevice.java b/duo-universal-sdk/src/main/java/com/duosecurity/model/AuthDevice.java index 0bae9b5..505f95c 100644 --- a/duo-universal-sdk/src/main/java/com/duosecurity/model/AuthDevice.java +++ b/duo-universal-sdk/src/main/java/com/duosecurity/model/AuthDevice.java @@ -1,13 +1,94 @@ package com.duosecurity.model; import java.io.Serializable; -import lombok.Data; +import java.util.Objects; -@Data public class AuthDevice implements Serializable { private static final long serialVersionUID = -1538823399834806194L; private String ip; private String name; private Location location; + + /** + * Constructor with all properties. + * + * @param ip ip + * @param name name + * @param location location + */ + public AuthDevice(String ip, String name, Location location) { + this.ip = ip; + this.name = name; + this.location = location; + } + + public AuthDevice() { + } + + public static long getSerialversionuid() { + return serialVersionUID; + } + + public String getIp() { + return ip; + } + + public void setIp(String ip) { + this.ip = ip; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public Location getLocation() { + return location; + } + + public void setLocation(Location location) { + this.location = location; + } + + @Override + public String toString() { + return "AuthDevice [ip=" + ip + + ", name=" + name + + ", location=" + location + + ", getIp()=" + getIp() + + ", getLocation()=" + getLocation() + + ", getName()=" + getName() + + ", hashCode()=" + hashCode() + + ", getClass()=" + getClass() + + ", toString()=" + super.toString() + + "]"; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (obj == null || getClass() != obj.getClass()) { + return false; + } + AuthDevice other = (AuthDevice) obj; + return Objects.equals(ip, other.ip) + && Objects.equals(name, other.name) + && Objects.equals(location, other.location); + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((ip == null) ? 0 : ip.hashCode()); + result = prime * result + ((name == null) ? 0 : name.hashCode()); + result = prime * result + ((location == null) ? 0 : location.hashCode()); + return result; + } } diff --git a/duo-universal-sdk/src/main/java/com/duosecurity/model/AuthResult.java b/duo-universal-sdk/src/main/java/com/duosecurity/model/AuthResult.java index 00e74ee..34670de 100644 --- a/duo-universal-sdk/src/main/java/com/duosecurity/model/AuthResult.java +++ b/duo-universal-sdk/src/main/java/com/duosecurity/model/AuthResult.java @@ -1,13 +1,97 @@ package com.duosecurity.model; import java.io.Serializable; -import lombok.Data; +import java.util.Objects; -@Data public class AuthResult implements Serializable { private static final long serialVersionUID = -1438823399834806194L; private String status_msg; private String status; private String result; + + /** + * Constructor with all properties. + * + * @param statusMsg status_msg + * @param status status + * @param result result + */ + public AuthResult(String statusMsg, String status, String result) { + this.status_msg = statusMsg; + this.status = status; + this.result = result; + } + + public AuthResult() { + } + + public static long getSerialversionuid() { + return serialVersionUID; + } + + public String getStatus_msg() { + return status_msg; + } + + public void setStatus_msg(String statusMsg) { + this.status_msg = statusMsg; + } + + public String getStatus() { + return status; + } + + public void setStatus(String status) { + this.status = status; + } + + public String getResult() { + return result; + } + + public void setResult(String result) { + this.result = result; + } + + @Override + public String toString() { + return "AuthResult [status_msg=" + status_msg + + ", status=" + status + + ", result=" + result + + ", getResult()=" + getResult() + + ", getStatus()=" + getStatus() + + ", getStatus_msg()=" + getStatus_msg() + + ", hashCode()=" + hashCode() + + ", getClass()=" + getClass() + + ", toString()=" + super.toString() + + "]"; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (obj == null) { + return false; + } + if (getClass() != obj.getClass()) { + return false; + } + AuthResult other = (AuthResult) obj; + return Objects.equals(status_msg, other.status_msg) + && Objects.equals(status, other.status) + && Objects.equals(result, other.result); + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((status_msg == null) ? 0 : status_msg.hashCode()); + result = prime * result + ((status == null) ? 0 : status.hashCode()); + result = prime * result + ((this.result == null) ? 0 : this.result.hashCode()); + return result; + } } diff --git a/duo-universal-sdk/src/main/java/com/duosecurity/model/HealthCheckResponse.java b/duo-universal-sdk/src/main/java/com/duosecurity/model/HealthCheckResponse.java index ffd21fd..2af344a 100644 --- a/duo-universal-sdk/src/main/java/com/duosecurity/model/HealthCheckResponse.java +++ b/duo-universal-sdk/src/main/java/com/duosecurity/model/HealthCheckResponse.java @@ -3,9 +3,8 @@ import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonInclude.Include; import java.io.Serializable; -import lombok.Data; +import java.util.Objects; -@Data public class HealthCheckResponse implements Serializable { private static final long serialVersionUID = 8515018216883786859L; @@ -30,4 +29,130 @@ public class HealthCheckResponse implements Serializable { public Boolean wasSuccess() { return stat.equalsIgnoreCase("OK"); } + + /** + * Constructor with all properties. + * + * @param stat stat + * @param response response + * @param code code + * @param timestamp timestamp + * @param message message + * @param messageDetail message_detail + */ + public HealthCheckResponse(String stat, Response response, String code, String timestamp, + String message, String messageDetail) { + this.stat = stat; + this.response = response; + this.code = code; + this.timestamp = timestamp; + this.message = message; + this.message_detail = messageDetail; + } + + public HealthCheckResponse() { + } + + public static long getSerialversionuid() { + return serialVersionUID; + } + + public String getStat() { + return stat; + } + + public void setStat(String stat) { + this.stat = stat; + } + + public Response getResponse() { + return response; + } + + public void setResponse(Response response) { + this.response = response; + } + + public String getCode() { + return code; + } + + public void setCode(String code) { + this.code = code; + } + + public String getTimestamp() { + return timestamp; + } + + public void setTimestamp(String timestamp) { + this.timestamp = timestamp; + } + + public String getMessage() { + return message; + } + + public void setMessage(String message) { + this.message = message; + } + + public String getMessage_detail() { + return message_detail; + } + + public void setMessage_detail(String messageDetail) { + this.message_detail = messageDetail; + } + + @Override + public String toString() { + return "HealthCheckResponse [stat=" + stat + + ", response=" + response + + ", code=" + code + + ", timestamp=" + timestamp + + ", message=" + message + + ", message_detail=" + message_detail + + ", getCode()=" + getCode() + + ", getMessage()=" + getMessage() + + ", getMessage_detail()=" + getMessage_detail() + + ", getResponse()=" + getResponse() + + ", getStat()=" + getStat() + + ", getTimestamp()=" + getTimestamp() + + ", hashCode()=" + hashCode() + + ", wasSuccess()=" + wasSuccess() + + ", getClass()=" + getClass() + + ", toString()=" + super.toString() + + "]"; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (obj == null || getClass() != obj.getClass()) { + return false; + } + HealthCheckResponse other = (HealthCheckResponse) obj; + return Objects.equals(stat, other.stat) + && Objects.equals(response, other.response) + && Objects.equals(code, other.code) + && Objects.equals(timestamp, other.timestamp) + && Objects.equals(message, other.message) + && Objects.equals(message_detail, other.message_detail); + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((stat == null) ? 0 : stat.hashCode()); + result = prime * result + ((response == null) ? 0 : response.hashCode()); + result = prime * result + ((code == null) ? 0 : code.hashCode()); + result = prime * result + ((timestamp == null) ? 0 : timestamp.hashCode()); + result = prime * result + ((message == null) ? 0 : message.hashCode()); + result = prime * result + ((message_detail == null) ? 0 : message_detail.hashCode()); + return result; + } } diff --git a/duo-universal-sdk/src/main/java/com/duosecurity/model/Location.java b/duo-universal-sdk/src/main/java/com/duosecurity/model/Location.java index 439bddd..d08bff0 100644 --- a/duo-universal-sdk/src/main/java/com/duosecurity/model/Location.java +++ b/duo-universal-sdk/src/main/java/com/duosecurity/model/Location.java @@ -1,9 +1,8 @@ package com.duosecurity.model; import java.io.Serializable; -import lombok.Data; +import java.util.Objects; -@Data public class Location implements Serializable { private static final long serialVersionUID = 8138286056784653212L; @@ -11,4 +10,86 @@ public class Location implements Serializable { private String state; private String city; private String country; + + /** + * Constructor with all properties. + * + * @param state state + * @param city city + * @param country country + */ + public Location(String state, String city, String country) { + this.state = state; + this.city = city; + this.country = country; + } + + public Location() { + } + + public static long getSerialversionuid() { + return serialVersionUID; + } + + public String getState() { + return state; + } + + public void setState(String state) { + this.state = state; + } + + public String getCity() { + return city; + } + + public void setCity(String city) { + this.city = city; + } + + public String getCountry() { + return country; + } + + public void setCountry(String country) { + this.country = country; + } + + @Override + public String toString() { + return "Location [state=" + state + + ", city=" + city + + ", country=" + country + + ", getCity()=" + getCity() + + ", getCountry()=" + getCountry() + + ", getState()=" + getState() + + ", hashCode()=" + hashCode() + + ", getClass()=" + getClass() + + ", toString()=" + super.toString() + + "]"; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (obj == null || getClass() != obj.getClass()) { + return false; + } + Location other = (Location) obj; + return Objects.equals(state, other.state) + && Objects.equals(city, other.city) + && Objects.equals(country, other.country); + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((state == null) ? 0 : state.hashCode()); + result = prime * result + ((city == null) ? 0 : city.hashCode()); + result = prime * result + ((country == null) ? 0 : country.hashCode()); + return result; + } } diff --git a/duo-universal-sdk/src/main/java/com/duosecurity/model/Response.java b/duo-universal-sdk/src/main/java/com/duosecurity/model/Response.java index c7d0e0c..f1dbc95 100644 --- a/duo-universal-sdk/src/main/java/com/duosecurity/model/Response.java +++ b/duo-universal-sdk/src/main/java/com/duosecurity/model/Response.java @@ -1,11 +1,59 @@ package com.duosecurity.model; import java.io.Serializable; -import lombok.Data; +import java.util.Objects; -@Data public class Response implements Serializable { private static final long serialVersionUID = -1372743752722717159L; private Integer timestamp; + + public Response(Integer timestamp) { + this.timestamp = timestamp; + } + + public Response() { + } + + public static long getSerialversionuid() { + return serialVersionUID; + } + + public Integer getTimestamp() { + return timestamp; + } + + public void setTimestamp(Integer timestamp) { + this.timestamp = timestamp; + } + + @Override + public String toString() { + return "Response [timestamp=" + timestamp + + ", getTimestamp()=" + getTimestamp() + + ", hashCode()=" + hashCode() + + ", getClass()=" + getClass() + + ", toString()=" + super.toString() + + "]"; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (obj == null || getClass() != obj.getClass()) { + return false; + } + Response other = (Response) obj; + return Objects.equals(timestamp, other.timestamp); + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((timestamp == null) ? 0 : timestamp.hashCode()); + return result; + } } diff --git a/duo-universal-sdk/src/main/java/com/duosecurity/model/Token.java b/duo-universal-sdk/src/main/java/com/duosecurity/model/Token.java index 09eb206..90d0ea6 100644 --- a/duo-universal-sdk/src/main/java/com/duosecurity/model/Token.java +++ b/duo-universal-sdk/src/main/java/com/duosecurity/model/Token.java @@ -1,9 +1,8 @@ package com.duosecurity.model; import java.io.Serializable; -import lombok.Data; +import java.util.Objects; -@Data public class Token implements Serializable { private static final long serialVersionUID = -8768823399834806194L; @@ -16,4 +15,174 @@ public class Token implements Serializable { private Integer auth_time; private AuthResult auth_result; private AuthContext auth_context; + + /** + * Constructor with all properties. + * + * @param iss iss + * @param sub sub + * @param preferredUsername preferred_username + * @param aud aud + * @param exp exp + * @param iat iat + * @param authTime auth_time + * @param authResult auth_result + * @param authContext auth_context + */ + public Token(String iss, String sub, String preferredUsername, String aud, Integer exp, + Double iat, Integer authTime, AuthResult authResult, AuthContext authContext) { + this.iss = iss; + this.sub = sub; + this.preferred_username = preferredUsername; + this.aud = aud; + this.exp = exp; + this.iat = iat; + this.auth_time = authTime; + this.auth_result = authResult; + this.auth_context = authContext; + } + + public Token() { + } + + public static long getSerialversionuid() { + return serialVersionUID; + } + + public String getIss() { + return iss; + } + + public void setIss(String iss) { + this.iss = iss; + } + + public String getSub() { + return sub; + } + + public void setSub(String sub) { + this.sub = sub; + } + + public String getPreferred_username() { + return preferred_username; + } + + public void setPreferred_username(String preferredUsername) { + this.preferred_username = preferredUsername; + } + + public String getAud() { + return aud; + } + + public void setAud(String aud) { + this.aud = aud; + } + + public Integer getExp() { + return exp; + } + + public void setExp(Integer exp) { + this.exp = exp; + } + + public Double getIat() { + return iat; + } + + public void setIat(Double iat) { + this.iat = iat; + } + + public Integer getAuth_time() { + return auth_time; + } + + public void setAuth_time(Integer authTime) { + this.auth_time = authTime; + } + + public AuthResult getAuth_result() { + return auth_result; + } + + public void setAuth_result(AuthResult authResult) { + this.auth_result = authResult; + } + + public AuthContext getAuth_context() { + return auth_context; + } + + public void setAuth_context(AuthContext authContext) { + this.auth_context = authContext; + } + + @Override + public String toString() { + return "Token [iss=" + iss + + ", sub=" + sub + + ", preferred_username=" + preferred_username + + ", aud=" + aud + + ", exp=" + exp + + ", iat=" + iat + + ", auth_time=" + auth_time + + ", auth_result=" + auth_result + + ", auth_context=" + auth_context + + ", getAud()=" + getAud() + + ", getAuth_context()=" + getAuth_context() + + ", getAuth_result()=" + getAuth_result() + + ", getAuth_time()=" + getAuth_time() + + ", getExp()=" + getExp() + + ", getIat()=" + getIat() + + ", getIss()=" + getIss() + + ", getPreferred_username()=" + getPreferred_username() + + ", getSub()=" + getSub() + + ", hashCode()=" + hashCode() + + ", getClass()=" + getClass() + + ", toString()=" + super.toString() + + "]"; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (obj == null) { + return false; + } + if (getClass() != obj.getClass()) { + return false; + } + Token other = (Token) obj; + return Objects.equals(iss, other.iss) + && Objects.equals(sub, other.sub) + && Objects.equals(preferred_username, other.preferred_username) + && Objects.equals(aud, other.aud) + && Objects.equals(exp, other.exp) + && Objects.equals(iat, other.iat) + && Objects.equals(auth_time, other.auth_time) + && Objects.equals(auth_result, other.auth_result) + && Objects.equals(auth_context, other.auth_context); + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((iss == null) ? 0 : iss.hashCode()); + result = prime * result + ((sub == null) ? 0 : sub.hashCode()); + result = prime * result + ((preferred_username == null) ? 0 : preferred_username.hashCode()); + result = prime * result + ((aud == null) ? 0 : aud.hashCode()); + result = prime * result + ((exp == null) ? 0 : exp.hashCode()); + result = prime * result + ((iat == null) ? 0 : iat.hashCode()); + result = prime * result + ((auth_time == null) ? 0 : auth_time.hashCode()); + result = prime * result + ((auth_result == null) ? 0 : auth_result.hashCode()); + result = prime * result + ((auth_context == null) ? 0 : auth_context.hashCode()); + return result; + } } diff --git a/duo-universal-sdk/src/main/java/com/duosecurity/model/TokenResponse.java b/duo-universal-sdk/src/main/java/com/duosecurity/model/TokenResponse.java index b4fece2..8ea8097 100644 --- a/duo-universal-sdk/src/main/java/com/duosecurity/model/TokenResponse.java +++ b/duo-universal-sdk/src/main/java/com/duosecurity/model/TokenResponse.java @@ -1,9 +1,8 @@ package com.duosecurity.model; import java.io.Serializable; -import lombok.Data; +import java.util.Objects; -@Data public class TokenResponse implements Serializable { private static final long serialVersionUID = -3138823399834806194L; @@ -11,4 +10,100 @@ public class TokenResponse implements Serializable { private String access_token; private String token_type; private Integer expires_in; + + /** + * Constructor with all properties. + * + * @param idToken id_token + * @param accessToken access_token + * @param tokenType token_type + * @param expiresIn expires_in + */ + public TokenResponse(String idToken, String accessToken, String tokenType, Integer expiresIn) { + this.id_token = idToken; + this.access_token = accessToken; + this.token_type = tokenType; + this.expires_in = expiresIn; + } + + public TokenResponse() { + } + + public static long getSerialversionuid() { + return serialVersionUID; + } + + public String getId_token() { + return id_token; + } + + public void setId_token(String idToken) { + this.id_token = idToken; + } + + public String getAccess_token() { + return access_token; + } + + public void setAccess_token(String accessToken) { + this.access_token = accessToken; + } + + public String getToken_type() { + return token_type; + } + + public void setToken_type(String tokenType) { + this.token_type = tokenType; + } + + public Integer getExpires_in() { + return expires_in; + } + + public void setExpires_in(Integer expiresIn) { + this.expires_in = expiresIn; + } + + @Override + public String toString() { + return "TokenResponse [id_token=" + id_token + + ", access_token=" + access_token + + ", token_type=" + token_type + + ", expires_in=" + expires_in + + ", getAccess_token()=" + getAccess_token() + + ", getExpires_in()=" + getExpires_in() + + ", getId_token()=" + getId_token() + + ", getToken_type()=" + getToken_type() + + ", hashCode()=" + hashCode() + + ", getClass()=" + getClass() + + ", toString()=" + super.toString() + + "]"; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (obj == null || getClass() != obj.getClass()) { + return false; + } + TokenResponse other = (TokenResponse) obj; + return Objects.equals(id_token, other.id_token) + && Objects.equals(access_token, other.access_token) + && Objects.equals(token_type, other.token_type) + && Objects.equals(expires_in, other.expires_in); + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((id_token == null) ? 0 : id_token.hashCode()); + result = prime * result + ((access_token == null) ? 0 : access_token.hashCode()); + result = prime * result + ((token_type == null) ? 0 : token_type.hashCode()); + result = prime * result + ((expires_in == null) ? 0 : expires_in.hashCode()); + return result; + } } diff --git a/duo-universal-sdk/src/main/java/com/duosecurity/model/User.java b/duo-universal-sdk/src/main/java/com/duosecurity/model/User.java index 7120497..8595554 100644 --- a/duo-universal-sdk/src/main/java/com/duosecurity/model/User.java +++ b/duo-universal-sdk/src/main/java/com/duosecurity/model/User.java @@ -1,12 +1,73 @@ package com.duosecurity.model; import java.io.Serializable; -import lombok.Data; +import java.util.Objects; -@Data public class User implements Serializable { private static final long serialVersionUID = 8222207159539569949L; private String key; private String name; + + public User(String key, String name) { + this.key = key; + this.name = name; + } + + public User() { + } + + public static long getSerialversionuid() { + return serialVersionUID; + } + + public String getKey() { + return key; + } + + public void setKey(String key) { + this.key = key; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + @Override + public String toString() { + return "User [key=" + key + + ", name=" + name + + ", getKey()=" + getKey() + + ", getName()=" + getName() + + ", hashCode()=" + hashCode() + + ", getClass()=" + getClass() + + ", toString()=" + super.toString() + + "]"; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (obj == null || getClass() != obj.getClass()) { + return false; + } + User other = (User) obj; + return Objects.equals(key, other.key) + && Objects.equals(name, other.name); + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((key == null) ? 0 : key.hashCode()); + result = prime * result + ((name == null) ? 0 : name.hashCode()); + return result; + } }