Skip to content

Commit

Permalink
chore(jans-auth-server): remove "rev" attribute from UmaResource as r…
Browse files Browse the repository at this point in the history
…edundant #2392 (#2393)

docs: no docs
#2392
  • Loading branch information
yuriyz authored Sep 15, 2022
1 parent 739b939 commit 2e02d5e
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 30 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -59,9 +54,6 @@ public class UmaResource implements Serializable {
@AttributeName(name = "jansResource")
private List<String> resources;

@AttributeName(name = "jansRevision")
private String rev;

@AttributeName(name = "owner")
private String creator;

Expand Down Expand Up @@ -199,14 +191,6 @@ public void setResources(List<String> resources) {
this.resources = resources;
}

public String getRev() {
return rev;
}

public void setRev(String rev) {
this.rev = rev;
}

public String getCreator() {
return creator;
}
Expand Down Expand Up @@ -248,7 +232,6 @@ public String toString() {
", scopeExpression='" + scopeExpression + '\'' +
", clients=" + clients +
", resources=" + resources +
", rev='" + rev + '\'' +
", creator='" + creator + '\'' +
", description='" + description + '\'' +
", type='" + type + '\'' +
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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));
Expand All @@ -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> T throwNotFoundException(String rsid) {
if (log.isErrorEnabled()) {
log.error("Specified resource description doesn't exist, id: {}", escapeLog(rsid));
Expand Down

0 comments on commit 2e02d5e

Please sign in to comment.