5
5
6
6
import io .jans .orm .PersistenceEntryManager ;
7
7
import io .jans .orm .PersistenceEntryManagerFactory ;
8
+ import io .jans .orm .ldap .impl .LdapEntryManagerFactory ;
8
9
import io .jans .orm .ldap .operation .LdapOperationService ;
9
10
import io .jans .orm .model .PersistenceConfiguration ;
10
11
import io .jans .orm .model .SearchScope ;
@@ -340,7 +341,7 @@ private boolean loadApplianceSettings(Properties properties) {
340
341
341
342
boolean success = false ;
342
343
try {
343
- loadASSettings (properties .getProperty ("jansAuth_ConfigurationEntryDN" ));
344
+ loadASSettings (properties .getProperty ("jansAuth_ConfigurationEntryDN" ), properties . getProperty ( "persistence.type" ) );
344
345
rootDn = "o=jans" ;
345
346
success = true ;
346
347
@@ -354,27 +355,31 @@ private boolean loadApplianceSettings(Properties properties) {
354
355
355
356
}
356
357
357
- private void loadASSettings (String dn ) throws Exception {
358
+ private void loadASSettings (String dn , String persistenceType ) throws Exception {
358
359
359
360
ASConfiguration conf = get (ASConfiguration .class , dn );
360
- dynamicConfig = mapper .readTree (conf .getJansConfStatic ());
361
- staticConfig = mapper .readTree (conf .getJansConfDyn ());
362
-
363
- personCustomObjectClasses = Optional .ofNullable (dynamicConfig .get ("personCustomObjectClassList" ))
364
- .map (node -> {
365
- try {
366
- Set <String > ocs = new HashSet <>();
367
- Iterator <JsonNode > it = node .elements ();
368
- while (it .hasNext ()) {
369
- ocs .add (it .next ().asText ());
361
+ dynamicConfig = mapper .readTree (conf .getJansConfDyn ());
362
+ staticConfig = mapper .readTree (conf .getJansConfStatic ());
363
+
364
+ if (persistenceType .equals (LdapEntryManagerFactory .PERSISTENCE_TYPE )) {
365
+
366
+ personCustomObjectClasses = Optional .ofNullable (dynamicConfig .get ("personCustomObjectClassList" ))
367
+ .map (node -> {
368
+ try {
369
+ List <String > ocs = new ArrayList <>();
370
+ node .elements ().forEachRemaining (e -> ocs .add (e .asText ()));
371
+
372
+ return Set .copyOf (ocs );
373
+ } catch (Exception e ) {
374
+ logger .error (e .getMessage ());
375
+ return null ;
370
376
}
371
- return ocs ;
372
- } catch (Exception e ) {
373
- logger .error (e .getMessage ());
374
- return null ;
375
- }
376
- })
377
- .orElse (Collections .singleton ("gluuCustomPerson" ));
377
+ })
378
+ .orElse (Collections .singleton ("jansCustomPerson" ));
379
+ }
380
+ if (personCustomObjectClasses == null ) {
381
+ personCustomObjectClasses = Collections .emptySet ();
382
+ }
378
383
379
384
}
380
385
0 commit comments