From 2e02d5e3a426361da72ae10849cd9affe0607c75 Mon Sep 17 00:00:00 2001 From: YuriyZ Date: Thu, 15 Sep 2022 17:11:18 +0300 Subject: [PATCH] chore(jans-auth-server): remove "rev" attribute from UmaResource as redundant #2392 (#2393) docs: no docs https://github.com/JanssenProject/jans/issues/2392 --- .../as/model/uma/persistence/UmaResource.java | 21 ++----------------- .../uma/ws/rs/UmaResourceRegistrationWS.java | 11 ---------- 2 files changed, 2 insertions(+), 30 deletions(-) diff --git a/jans-auth-server/model/src/main/java/io/jans/as/model/uma/persistence/UmaResource.java b/jans-auth-server/model/src/main/java/io/jans/as/model/uma/persistence/UmaResource.java index 38b484aec0d..3a6fc92e2a7 100644 --- a/jans-auth-server/model/src/main/java/io/jans/as/model/uma/persistence/UmaResource.java +++ b/jans-auth-server/model/src/main/java/io/jans/as/model/uma/persistence/UmaResource.java @@ -8,14 +8,9 @@ import com.fasterxml.jackson.annotation.JsonIgnore; import com.google.common.collect.Lists; -import io.jans.as.model.util.Util; -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; - +import io.jans.orm.annotation.*; import jakarta.validation.constraints.NotNull; + import java.io.Serializable; import java.time.Duration; import java.util.ArrayList; @@ -59,9 +54,6 @@ public class UmaResource implements Serializable { @AttributeName(name = "jansResource") private List resources; - @AttributeName(name = "jansRevision") - private String rev; - @AttributeName(name = "owner") private String creator; @@ -199,14 +191,6 @@ public void setResources(List resources) { this.resources = resources; } - public String getRev() { - return rev; - } - - public void setRev(String rev) { - this.rev = rev; - } - public String getCreator() { return creator; } @@ -248,7 +232,6 @@ public String toString() { ", scopeExpression='" + scopeExpression + '\'' + ", clients=" + clients + ", resources=" + resources + - ", rev='" + rev + '\'' + ", creator='" + creator + '\'' + ", description='" + description + '\'' + ", type='" + type + '\'' + diff --git a/jans-auth-server/server/src/main/java/io/jans/as/server/uma/ws/rs/UmaResourceRegistrationWS.java b/jans-auth-server/server/src/main/java/io/jans/as/server/uma/ws/rs/UmaResourceRegistrationWS.java index 5f96a2e525d..5f059fafc98 100644 --- a/jans-auth-server/server/src/main/java/io/jans/as/server/uma/ws/rs/UmaResourceRegistrationWS.java +++ b/jans-auth-server/server/src/main/java/io/jans/as/server/uma/ws/rs/UmaResourceRegistrationWS.java @@ -317,7 +317,6 @@ private io.jans.as.model.uma.persistence.UmaResource addResource(String rsid, io ldapResource.setDescription(resource.getDescription()); ldapResource.setIconUri(resource.getIconUri()); ldapResource.setId(rsid); - ldapResource.setRev("1"); ldapResource.setCreator(userDn); ldapResource.setDn(resourceDn); ldapResource.setScopes(scopeDNs); @@ -357,7 +356,6 @@ private io.jans.as.model.uma.persistence.UmaResource updateResource(String rsid, ldapResource.setIconUri(resource.getIconUri()); ldapResource.setScopes(umaScopeService.getScopeDNsByIdsAndAddToPersistenceIfNeeded(resource.getScopes())); ldapResource.setScopeExpression(resource.getScopeExpression()); - ldapResource.setRev(String.valueOf(incrementRev(ldapResource.getRev()))); ldapResource.setType(resource.getType()); if (resource.getExp() != null && resource.getExp() > 0) { ldapResource.setExpirationDate(new Date(resource.getExp() * 1000L)); @@ -369,15 +367,6 @@ private io.jans.as.model.uma.persistence.UmaResource updateResource(String rsid, return ldapResource; } - private int incrementRev(String rev) { - try { - return Integer.parseInt(rev) + 1; - } catch (Exception e) { - log.error(e.getMessage(), e); - } - return 1; // fallback - } - private T throwNotFoundException(String rsid) { if (log.isErrorEnabled()) { log.error("Specified resource description doesn't exist, id: {}", escapeLog(rsid));