From 1a39d0882eb1875396d637ad5142eaae88be526e Mon Sep 17 00:00:00 2001 From: Yuriy Movchan Date: Fri, 23 Dec 2022 20:38:59 +0300 Subject: [PATCH 1/2] fix: user attributes not updated #2753 --- .../jans/as/server/service/ClientService.java | 1 - .../io/jans/scim/service/PersonService.java | 39 +++++++++++++------ 2 files changed, 27 insertions(+), 13 deletions(-) diff --git a/jans-auth-server/server/src/main/java/io/jans/as/server/service/ClientService.java b/jans-auth-server/server/src/main/java/io/jans/as/server/service/ClientService.java index 99116bf2a84..b21d91395a8 100644 --- a/jans-auth-server/server/src/main/java/io/jans/as/server/service/ClientService.java +++ b/jans-auth-server/server/src/main/java/io/jans/as/server/service/ClientService.java @@ -78,7 +78,6 @@ public void persist(Client client) { ldapEntryManager.persist(client); } - private Client ignoreCustomObjectClassesForNonLDAP(Client client) { String persistenceType = ldapEntryManager.getPersistenceType(); log.debug("persistenceType: {}", persistenceType); diff --git a/jans-scim/service/src/main/java/io/jans/scim/service/PersonService.java b/jans-scim/service/src/main/java/io/jans/scim/service/PersonService.java index 835ab807762..c6fbcf48864 100644 --- a/jans-scim/service/src/main/java/io/jans/scim/service/PersonService.java +++ b/jans-scim/service/src/main/java/io/jans/scim/service/PersonService.java @@ -6,6 +6,18 @@ package io.jans.scim.service; +import java.io.Serializable; +import java.time.Instant; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Date; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import java.util.UUID; + +import org.slf4j.Logger; + import io.jans.as.model.common.IdType; import io.jans.model.GluuAttribute; import io.jans.orm.PersistenceEntryManager; @@ -23,20 +35,8 @@ import io.jans.util.ArrayHelper; import io.jans.util.OxConstants; import io.jans.util.StringHelper; - import jakarta.enterprise.context.ApplicationScoped; import jakarta.inject.Inject; -import java.io.Serializable; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Date; -import java.util.Iterator; -import java.util.List; -import java.util.Map; -import java.time.Instant; -import java.util.UUID; - -import org.slf4j.Logger; /** * Provides operations with persons @@ -91,6 +91,8 @@ public void addPerson(GluuCustomPerson person) throws Exception { if (persons == null || persons.size() == 0) { person.setCreationDate(new Date()); attributeService.applyMetaData(person.getCustomAttributes()); + + ignoreCustomObjectClassesForNonLDAP(person); persistenceEntryManager.persist(person); } else { throw new DuplicateEntryException("Duplicate UID value: " + person.getUid()); @@ -105,6 +107,19 @@ public void addPerson(GluuCustomPerson person) throws Exception { } + private GluuCustomPerson ignoreCustomObjectClassesForNonLDAP(GluuCustomPerson person) { + String persistenceType = persistenceEntryManager.getPersistenceType(); + log.debug("persistenceType: {}", persistenceType); + if (!PersistenceEntryManager.PERSITENCE_TYPES.ldap.name().equals(persistenceType)) { + log.debug( + "Setting CustomObjectClasses :{} to null as it's used only for LDAP and current persistenceType is {} ", + person.getCustomObjectClasses(), persistenceType); + person.setCustomObjectClasses(null); + } + + return person; + } + public void updatePerson(GluuCustomPerson person) throws Exception { try { Date updateDate = new Date(); From 863c8d58a1238cc2c5992059cd38448111c9f896 Mon Sep 17 00:00:00 2001 From: Yuriy Movchan Date: Wed, 28 Dec 2022 12:52:59 +0300 Subject: [PATCH 2/2] fix: fix clnId type definition and token indexes --- .../jans_setup/schema/jans_schema.json | 2 +- .../jans_setup/static/rdbm/mysql_index.json | 18 ++++++------------ .../jans_setup/static/rdbm/pgsql_index.json | 18 ++++++------------ .../jans_setup/static/rdbm/spanner_index.json | 2 +- 4 files changed, 14 insertions(+), 26 deletions(-) diff --git a/jans-linux-setup/jans_setup/schema/jans_schema.json b/jans-linux-setup/jans_setup/schema/jans_schema.json index 3658ccb0a35..f76f8815d4c 100644 --- a/jans-linux-setup/jans_setup/schema/jans_schema.json +++ b/jans-linux-setup/jans_setup/schema/jans_schema.json @@ -447,7 +447,7 @@ "names": [ "clnId" ], - "multivalued": true, + "multivalued": false, "oid": "jansAttr", "substr": "caseIgnoreSubstringsMatch", "syntax": "1.3.6.1.4.1.1466.115.121.1.15", diff --git a/jans-linux-setup/jans_setup/static/rdbm/mysql_index.json b/jans-linux-setup/jans_setup/static/rdbm/mysql_index.json index c12885a8f10..e995ccf0b83 100644 --- a/jans-linux-setup/jans_setup/static/rdbm/mysql_index.json +++ b/jans-linux-setup/jans_setup/static/rdbm/mysql_index.json @@ -72,7 +72,12 @@ ] }, "jansToken": { - "fields": [], + "fields": [ + "authzCode", + "grtId", + "ssnId", + "tknCde" + ], "custom": [ "`del`, `exp`" ] @@ -139,17 +144,6 @@ ], "custom": [] }, - "token": { - "fields": [ - "authzCode", - "grtId", - "ssnId", - "tknCde" - ], - "custom": [ - "`del`, `exp`" - ] - }, "cache": { "fields": [], "custom": [ diff --git a/jans-linux-setup/jans_setup/static/rdbm/pgsql_index.json b/jans-linux-setup/jans_setup/static/rdbm/pgsql_index.json index 7d484e338ce..423312d2e88 100644 --- a/jans-linux-setup/jans_setup/static/rdbm/pgsql_index.json +++ b/jans-linux-setup/jans_setup/static/rdbm/pgsql_index.json @@ -72,7 +72,12 @@ ] }, "jansToken": { - "fields": [], + "fields": [ + "authzCode", + "grtId", + "ssnId", + "tknCde" + ], "custom": [ "(\"del\", \"exp\")" ] @@ -139,17 +144,6 @@ ], "custom": [] }, - "token": { - "fields": [ - "authzCode", - "grtId", - "ssnId", - "tknCde" - ], - "custom": [ - "(\"del\", \"exp\")" - ] - }, "cache": { "fields": [], "custom": [ diff --git a/jans-linux-setup/jans_setup/static/rdbm/spanner_index.json b/jans-linux-setup/jans_setup/static/rdbm/spanner_index.json index 9e1cfbf99b3..68f68f525bd 100644 --- a/jans-linux-setup/jans_setup/static/rdbm/spanner_index.json +++ b/jans-linux-setup/jans_setup/static/rdbm/spanner_index.json @@ -82,7 +82,7 @@ "`del`, `exp`" ] }, - "token": { + "jansToken": { "fields": [ "authzCode", "grtId",