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 0344f111242..99116bf2a84 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 @@ -74,9 +74,24 @@ public class ClientService { private StaticConfiguration staticConfiguration; public void persist(Client client) { + ignoreCustomObjectClassesForNonLDAP(client); ldapEntryManager.persist(client); } + + private Client ignoreCustomObjectClassesForNonLDAP(Client client) { + String persistenceType = ldapEntryManager.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 {} ", + client.getCustomObjectClasses(), persistenceType); + client.setCustomObjectClasses(null); + } + + return client; + } + public void merge(Client client) { ldapEntryManager.merge(client); removeFromCache(client);