From d27659d99200246de68387273c308bda012f39af Mon Sep 17 00:00:00 2001 From: YuriyZ Date: Thu, 17 Mar 2022 21:10:07 +0200 Subject: [PATCH] fix(jans-auth-server): fixed equals/hashcode by removing redundant dn field https://github.com/GluuFederation/oxAuth/issues/1651 --- .../as/common/model/registration/Client.java | 16 ++-------------- .../java/io/jans/as/persistence/model/Par.java | 16 +--------------- .../java/io/jans/as/persistence/model/Scope.java | 12 +----------- .../cache/NativePersistenceCacheEntity.java | 12 +----------- .../cloud/spanner/model/SimpleCacheEntry.java | 13 +------------ .../io/jans/orm/sql/model/SimpleCacheEntry.java | 13 +------------ 6 files changed, 7 insertions(+), 75 deletions(-) diff --git a/jans-auth-server/common/src/main/java/io/jans/as/common/model/registration/Client.java b/jans-auth-server/common/src/main/java/io/jans/as/common/model/registration/Client.java index 688cff3b922..7bcd51ecc70 100644 --- a/jans-auth-server/common/src/main/java/io/jans/as/common/model/registration/Client.java +++ b/jans-auth-server/common/src/main/java/io/jans/as/common/model/registration/Client.java @@ -19,7 +19,6 @@ import io.jans.orm.annotation.AttributeName; import io.jans.orm.annotation.AttributesList; import io.jans.orm.annotation.CustomObjectClass; -import io.jans.orm.annotation.DN; import io.jans.orm.annotation.DataEntry; import io.jans.orm.annotation.Expiration; import io.jans.orm.annotation.JsonObject; @@ -42,10 +41,7 @@ @JsonInclude(JsonInclude.Include.NON_NULL) public class Client extends DeletableEntity implements Serializable { - private static final long serialVersionUID = -6832496019942067970L; - - @DN - private String dn; + private static final long serialVersionUID = -6832496019942067971L; @JsonProperty("inum") @AttributeName(name = "inum", ignoreDuringUpdate = true) @@ -196,7 +192,7 @@ public class Client extends DeletableEntity implements Serializable { private Integer accessTokenLifetime; @AttributesList(name = "name", value = "values", sortByName = true) - private List customAttributes = new ArrayList(); + private List customAttributes = new ArrayList<>(); @CustomObjectClass private String[] customObjectClasses; @@ -291,14 +287,6 @@ public AuthenticationMethod getAuthenticationMethod() { return AuthenticationMethod.fromString(tokenEndpointAuthMethod); } - public String getDn() { - return dn; - } - - public void setDn(String dn) { - this.dn = dn; - } - /** * Gets logout session required. * diff --git a/jans-auth-server/persistence-model/src/main/java/io/jans/as/persistence/model/Par.java b/jans-auth-server/persistence-model/src/main/java/io/jans/as/persistence/model/Par.java index fd369f6ffce..275a08c461e 100644 --- a/jans-auth-server/persistence-model/src/main/java/io/jans/as/persistence/model/Par.java +++ b/jans-auth-server/persistence-model/src/main/java/io/jans/as/persistence/model/Par.java @@ -1,7 +1,6 @@ package io.jans.as.persistence.model; import io.jans.orm.annotation.AttributeName; -import io.jans.orm.annotation.DN; import io.jans.orm.annotation.DataEntry; import io.jans.orm.annotation.Expiration; import io.jans.orm.annotation.JsonObject; @@ -22,9 +21,6 @@ public class Par extends DeletableEntity implements Serializable { private static final long serialVersionUID = -3332496019942067971L; - @DN - private String dn; - @AttributeName(name = "jansId", consistency = true) private String id; @@ -57,16 +53,6 @@ public boolean isExpired(Date now) { return exp == null || exp.before(now); } - @Override - public String getDn() { - return dn; - } - - @Override - public void setDn(String dn) { - this.dn = dn; - } - public String getId() { return id; } @@ -86,7 +72,7 @@ public void setTtl(Integer ttl) { @Override public String toString() { return "Par{" + - "dn='" + dn + '\'' + + "dn='" + getDn() + '\'' + ", id='" + id + '\'' + ", attributes=" + attributes + "} " + super.toString(); diff --git a/jans-auth-server/persistence-model/src/main/java/io/jans/as/persistence/model/Scope.java b/jans-auth-server/persistence-model/src/main/java/io/jans/as/persistence/model/Scope.java index 998f1c18983..34177e0c0ce 100644 --- a/jans-auth-server/persistence-model/src/main/java/io/jans/as/persistence/model/Scope.java +++ b/jans-auth-server/persistence-model/src/main/java/io/jans/as/persistence/model/Scope.java @@ -27,8 +27,6 @@ public class Scope extends DeletableEntity implements Serializable { private static final long serialVersionUID = 4308826784917052508L; - @DN - private String dn; @AttributeName(ignoreDuringUpdate = true) private String inum; @@ -77,14 +75,6 @@ public void setAttributes(ScopeAttributes attributes) { this.attributes = attributes; } - public String getDn() { - return dn; - } - - public void setDn(String dn) { - this.dn = dn; - } - public String getInum() { return this.inum; } @@ -188,7 +178,7 @@ public boolean isUmaType() { @Override public String toString() { return "Scope{" + - "dn='" + dn + '\'' + + "dn='" + getDn() + '\'' + ", inum='" + inum + '\'' + ", displayName='" + displayName + '\'' + ", id='" + id + '\'' + diff --git a/jans-core/cache/src/main/java/io/jans/service/cache/NativePersistenceCacheEntity.java b/jans-core/cache/src/main/java/io/jans/service/cache/NativePersistenceCacheEntity.java index 8bc0c69a679..9aa50581ce9 100644 --- a/jans-core/cache/src/main/java/io/jans/service/cache/NativePersistenceCacheEntity.java +++ b/jans-core/cache/src/main/java/io/jans/service/cache/NativePersistenceCacheEntity.java @@ -17,8 +17,6 @@ @ObjectClass(value = "jansCache") public class NativePersistenceCacheEntity extends DeletableEntity implements Serializable, Deletable { - @DN - private String dn; @Expiration private Integer ttl; @AttributeName(name = "uuid") @@ -28,14 +26,6 @@ public class NativePersistenceCacheEntity extends DeletableEntity implements Ser @AttributeName(name = "dat") private String data; - public String getDn() { - return dn; - } - - public void setDn(String dn) { - this.dn = dn; - } - public Integer getTtl() { return ttl; } @@ -70,7 +60,7 @@ public void setData(String data) { @Override public String toString() { - return "NativePersistenceCacheEntity [dn=" + dn + ", ttl=" + ttl + ", id=" + id + ", creationDate=" + creationDate + ", data=" + return "NativePersistenceCacheEntity [dn=" + getDn() + ", ttl=" + ttl + ", id=" + id + ", creationDate=" + creationDate + ", data=" + data + "]"; } } diff --git a/jans-orm/spanner-sample/src/main/java/io/jans/orm/cloud/spanner/model/SimpleCacheEntry.java b/jans-orm/spanner-sample/src/main/java/io/jans/orm/cloud/spanner/model/SimpleCacheEntry.java index 1a6b439a48c..b9f781a6f7c 100644 --- a/jans-orm/spanner-sample/src/main/java/io/jans/orm/cloud/spanner/model/SimpleCacheEntry.java +++ b/jans-orm/spanner-sample/src/main/java/io/jans/orm/cloud/spanner/model/SimpleCacheEntry.java @@ -9,7 +9,6 @@ * Copyright (c) 2020, Janssen Project */ import io.jans.orm.annotation.AttributeName; -import io.jans.orm.annotation.DN; import io.jans.orm.annotation.DataEntry; import io.jans.orm.annotation.Expiration; import io.jans.orm.annotation.ObjectClass; @@ -22,8 +21,6 @@ public class SimpleCacheEntry extends DeletableEntity implements Serializable, D private static final long serialVersionUID = 3360900373193184522L; - @DN - private String dn; @Expiration private Integer ttl; @AttributeName(name = "uuid") @@ -33,14 +30,6 @@ public class SimpleCacheEntry extends DeletableEntity implements Serializable, D @AttributeName(name = "dat") private String data; - public String getDn() { - return dn; - } - - public void setDn(String dn) { - this.dn = dn; - } - public Integer getTtl() { return ttl; } @@ -75,7 +64,7 @@ public void setData(String data) { @Override public String toString() { - return "NativePersistenceCacheEntity [dn=" + dn + ", ttl=" + ttl + ", id=" + id + ", creationDate=" + creationDate + ", data=" + return "NativePersistenceCacheEntity [dn=" + getDn() + ", ttl=" + ttl + ", id=" + id + ", creationDate=" + creationDate + ", data=" + data + "]"; } } diff --git a/jans-orm/sql-sample/src/main/java/io/jans/orm/sql/model/SimpleCacheEntry.java b/jans-orm/sql-sample/src/main/java/io/jans/orm/sql/model/SimpleCacheEntry.java index db7abea41da..11757620464 100644 --- a/jans-orm/sql-sample/src/main/java/io/jans/orm/sql/model/SimpleCacheEntry.java +++ b/jans-orm/sql-sample/src/main/java/io/jans/orm/sql/model/SimpleCacheEntry.java @@ -9,7 +9,6 @@ * Copyright (c) 2020, Janssen Project */ import io.jans.orm.annotation.AttributeName; -import io.jans.orm.annotation.DN; import io.jans.orm.annotation.DataEntry; import io.jans.orm.annotation.Expiration; import io.jans.orm.annotation.ObjectClass; @@ -22,8 +21,6 @@ public class SimpleCacheEntry extends DeletableEntity implements Serializable, D private static final long serialVersionUID = 3360900373193184522L; - @DN - private String dn; @Expiration private Integer ttl; @AttributeName(name = "uuid") @@ -33,14 +30,6 @@ public class SimpleCacheEntry extends DeletableEntity implements Serializable, D @AttributeName(name = "dat") private String data; - public String getDn() { - return dn; - } - - public void setDn(String dn) { - this.dn = dn; - } - public Integer getTtl() { return ttl; } @@ -75,7 +64,7 @@ public void setData(String data) { @Override public String toString() { - return "NativePersistenceCacheEntity [dn=" + dn + ", ttl=" + ttl + ", id=" + id + ", creationDate=" + creationDate + ", data=" + return "NativePersistenceCacheEntity [dn=" + getDn() + ", ttl=" + ttl + ", id=" + id + ", creationDate=" + creationDate + ", data=" + data + "]"; } }