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();