1 package org.apache.archiva.admin.repository.runtime;
3 * Licensed to the Apache Software Foundation (ASF) under one
4 * or more contributor license agreements. See the NOTICE file
5 * distributed with this work for additional information
6 * regarding copyright ownership. The ASF licenses this file
7 * to you under the Apache License, Version 2.0 (the
8 * "License"); you may not use this file except in compliance
9 * with the License. You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing,
14 * software distributed under the License is distributed on an
15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16 * KIND, either express or implied. See the License for the
17 * specific language governing permissions and limitations
21 import org.apache.archiva.admin.model.RepositoryAdminException;
22 import org.apache.archiva.admin.model.beans.CacheConfiguration;
23 import org.apache.archiva.admin.model.beans.LdapConfiguration;
24 import org.apache.archiva.admin.model.beans.LdapGroupMapping;
25 import org.apache.archiva.admin.model.beans.RedbackRuntimeConfiguration;
26 import org.apache.archiva.admin.model.runtime.RedbackRuntimeConfigurationAdmin;
27 import org.apache.archiva.admin.repository.AbstractRepositoryAdmin;
28 import org.apache.archiva.configuration.ArchivaConfiguration;
29 import org.apache.archiva.configuration.Configuration;
30 import org.apache.archiva.configuration.IndeterminateConfigurationException;
31 import org.apache.archiva.components.cache.Cache;
32 import org.apache.archiva.components.registry.RegistryException;
33 import org.apache.archiva.configuration.util.ConfigMapper;
34 import org.apache.archiva.redback.configuration.UserConfiguration;
35 import org.apache.archiva.redback.configuration.UserConfigurationException;
36 import org.apache.archiva.redback.configuration.UserConfigurationKeys;
37 import org.apache.commons.lang3.StringUtils;
38 import org.slf4j.Logger;
39 import org.slf4j.LoggerFactory;
40 import org.springframework.stereotype.Service;
42 import javax.annotation.PostConstruct;
43 import javax.inject.Inject;
44 import javax.inject.Named;
45 import java.util.ArrayList;
46 import java.util.Arrays;
47 import java.util.Collection;
48 import java.util.HashMap;
49 import java.util.HashSet;
50 import java.util.List;
53 import java.util.function.Function;
55 import static org.apache.archiva.redback.configuration.UserConfigurationKeys.*;
58 * @author Olivier Lamy
61 @Service( "redbackRuntimeConfigurationAdmin#default" )
62 public class DefaultRedbackRuntimeConfigurationAdmin
63 extends AbstractRepositoryAdmin
64 implements RedbackRuntimeConfigurationAdmin, UserConfiguration
67 protected Logger log = LoggerFactory.getLogger( getClass() );
69 private ArchivaConfiguration archivaConfiguration;
71 private UserConfiguration userConfiguration;
73 private static final Map<String, List<String>> LDAP_PROPERTIES = new HashMap<>( );
75 private static final ConfigMapper<LdapConfiguration, List<LdapGroupMapping>> LDAP_MAPPER = new ConfigMapper( );
78 LDAP_MAPPER.addStringMapping( LDAP_HOSTNAME, LdapConfiguration::getHostName );
79 LDAP_MAPPER.addStringMapping( LDAP_CONTEX_FACTORY, LdapConfiguration::getContextFactory );
80 LDAP_MAPPER.addStringMapping( LDAP_PASSWORD, LdapConfiguration::getPassword );
81 LDAP_MAPPER.addStringMapping( LDAP_AUTHENTICATION_METHOD, LdapConfiguration::getAuthenticationMethod );
82 LDAP_MAPPER.addStringMapping( LDAP_BASEDN, LdapConfiguration::getBaseDn );
83 LDAP_MAPPER.addStringMapping( LDAP_GROUPS_BASEDN, LdapConfiguration::getBaseGroupsDn );
84 LDAP_MAPPER.addStringMapping( LDAP_BINDDN, LdapConfiguration::getBindDn );
85 LDAP_MAPPER.addPrefixStringMapping( LDAP_GROUPS_ROLE_START_KEY, (String attributeName, List<LdapGroupMapping> mapping)-> {
86 int index = mapping.indexOf( new LdapGroupMapping(
87 StringUtils.substringAfter( attributeName, LDAP_GROUPS_ROLE_START_KEY ) ) );
90 return StringUtils.join( mapping.get( index ).getRoleNames(),
96 LDAP_MAPPER.addIntMapping( LDAP_PORT, LdapConfiguration::getPort );
97 LDAP_MAPPER.addBooleanMapping( LDAP_SSL, LdapConfiguration::isSsl );
98 LDAP_MAPPER.addBooleanMapping( LDAP_WRITABLE, LdapConfiguration::isWritable );
99 LDAP_MAPPER.addBooleanMapping( LDAP_GROUPS_USE_ROLENAME, LdapConfiguration::isUseRoleNameAsGroup );
100 LDAP_MAPPER.addBooleanMapping( LDAP_BIND_AUTHENTICATOR_ENABLED, LdapConfiguration::isBindAuthenticatorEnabled );
103 private Cache usersCache;
106 public DefaultRedbackRuntimeConfigurationAdmin( ArchivaConfiguration archivaConfiguration,//
107 @Named( value = "userConfiguration#redback" ) //
108 UserConfiguration userConfiguration,
109 @Named( value = "cache#users" ) Cache usersCache )
111 this.archivaConfiguration = archivaConfiguration;
112 this.userConfiguration = userConfiguration;
113 this.usersCache = usersCache;
118 public void initialize()
119 throws UserConfigurationException
123 RedbackRuntimeConfiguration redbackRuntimeConfiguration = getRedbackRuntimeConfiguration();
124 Function<RedbackRuntimeConfiguration, LdapConfiguration> kk = RedbackRuntimeConfiguration::getLdapConfiguration;
125 // migrate or not data from redback
126 if ( !redbackRuntimeConfiguration.isMigratedFromRedbackConfiguration() )
128 // not migrated so build a new fresh one
129 redbackRuntimeConfiguration = new RedbackRuntimeConfiguration();
130 // so migrate if available
131 String userManagerImpl =
132 userConfiguration.getConcatenatedList( USER_MANAGER_IMPL, //
133 DEFAULT_USER_MANAGER_IMPL );
134 if ( StringUtils.isNotEmpty( userManagerImpl ) )
136 String[] impls = StringUtils.split( userManagerImpl, ',' );
137 for ( String impl : impls )
139 if (StringUtils.equalsIgnoreCase( "jdo", impl ))
141 impl = DEFAULT_USER_MANAGER_IMPL;
143 redbackRuntimeConfiguration.getUserManagerImpls().add( impl );
148 redbackRuntimeConfiguration.getUserManagerImpls().add( DEFAULT_USER_MANAGER_IMPL );
151 String rbacManagerImpls =
152 userConfiguration.getConcatenatedList( RBAC_MANAGER_IMPL, //
153 DEFAULT_RBAC_MANAGER_IMPL );
155 if ( StringUtils.isNotEmpty( rbacManagerImpls ) )
157 String[] impls = StringUtils.split( rbacManagerImpls, ',' );
158 for ( String impl : impls )
160 if (StringUtils.equalsIgnoreCase( "jdo", impl ))
162 impl = DEFAULT_RBAC_MANAGER_IMPL;
164 redbackRuntimeConfiguration.getRbacManagerImpls().add( impl );
169 redbackRuntimeConfiguration.getRbacManagerImpls().add( DEFAULT_RBAC_MANAGER_IMPL );
174 LdapConfiguration ldapConfiguration = redbackRuntimeConfiguration.getLdapConfiguration();
175 if ( ldapConfiguration == null )
177 ldapConfiguration = new LdapConfiguration();
178 redbackRuntimeConfiguration.setLdapConfiguration( ldapConfiguration );
181 ldapConfiguration.setHostName(
182 userConfiguration.getString( LDAP_HOSTNAME, null ) );
183 ldapConfiguration.setPort( userConfiguration.getInt( LDAP_PORT, -1 ) );
184 ldapConfiguration.setSsl( userConfiguration.getBoolean( LDAP_SSL, false ) );
185 ldapConfiguration.setBaseDn(
186 userConfiguration.getConcatenatedList( LDAP_BASEDN, null ) );
188 ldapConfiguration.setBaseGroupsDn(
189 userConfiguration.getConcatenatedList( LDAP_GROUPS_BASEDN,
190 ldapConfiguration.getBaseDn() ) );
192 ldapConfiguration.setContextFactory(
193 userConfiguration.getString( LDAP_CONTEX_FACTORY,
194 isSunContextFactoryAvailable()
195 ? "com.sun.jndi.ldap.LdapCtxFactory"
197 ldapConfiguration.setBindDn(
198 userConfiguration.getConcatenatedList( LDAP_BINDDN, null ) );
199 ldapConfiguration.setPassword(
200 userConfiguration.getString( LDAP_PASSWORD, null ) );
201 ldapConfiguration.setAuthenticationMethod(
202 userConfiguration.getString( LDAP_AUTHENTICATION_METHOD, null ) );
204 ldapConfiguration.setWritable(
205 userConfiguration.getBoolean( LDAP_WRITABLE, false ) );
207 ldapConfiguration.setUseRoleNameAsGroup(
208 userConfiguration.getBoolean( LDAP_GROUPS_USE_ROLENAME, false ) );
210 boolean ldapBindAuthenticatorEnabled =
211 userConfiguration.getBoolean( LDAP_BIND_AUTHENTICATOR_ENABLED, false );
212 ldapConfiguration.setBindAuthenticatorEnabled( ldapBindAuthenticatorEnabled );
214 // LDAP groups mapping reading !!
215 // UserConfigurationKeys.LDAP_GROUPS_ROLE_START_KEY
216 // userConfiguration.getKeys()
218 Collection<String> keys = userConfiguration.getKeys();
220 List<LdapGroupMapping> ldapGroupMappings = new ArrayList<>();
222 for ( String key : keys )
224 if ( key.startsWith( LDAP_GROUPS_ROLE_START_KEY ) )
227 StringUtils.substringAfter( key, LDAP_GROUPS_ROLE_START_KEY );
228 String val = userConfiguration.getConcatenatedList( key, "" );
229 if ( !StringUtils.isEmpty( val ) )
231 String[] roles = StringUtils.split( val, ',' );
232 ldapGroupMappings.add( new LdapGroupMapping( group, roles ) );
237 redbackRuntimeConfiguration.setLdapGroupMappings( ldapGroupMappings );
239 redbackRuntimeConfiguration.setMigratedFromRedbackConfiguration( true );
241 updateRedbackRuntimeConfiguration( redbackRuntimeConfiguration );
244 // we must ensure userManagerImpls list is not empty if so put at least jdo one !
245 if ( redbackRuntimeConfiguration.getUserManagerImpls().isEmpty() )
248 "redbackRuntimeConfiguration with empty userManagerImpls so force at least jdo implementation !" );
249 redbackRuntimeConfiguration.getUserManagerImpls().add( "jdo" );
250 updateRedbackRuntimeConfiguration( redbackRuntimeConfiguration );
254 log.info( "using userManagerImpls: {}", redbackRuntimeConfiguration.getUserManagerImpls() );
257 // we ensure rbacManagerImpls is not empty if so put at least cached
258 if ( redbackRuntimeConfiguration.getRbacManagerImpls().isEmpty() )
261 "redbackRuntimeConfiguration with empty rbacManagerImpls so force at least cached implementation !" );
262 redbackRuntimeConfiguration.getRbacManagerImpls().add( "cached" );
263 updateRedbackRuntimeConfiguration( redbackRuntimeConfiguration );
267 log.info( "using rbacManagerImpls: {}", redbackRuntimeConfiguration.getRbacManagerImpls() );
270 boolean save = false;
273 if ( redbackRuntimeConfiguration.getUsersCacheConfiguration() == null )
275 redbackRuntimeConfiguration.setUsersCacheConfiguration( new CacheConfiguration() );
277 // if -1 it means non initialized to take values from the spring bean
278 if ( redbackRuntimeConfiguration.getUsersCacheConfiguration().getTimeToIdleSeconds() < 0 )
280 redbackRuntimeConfiguration.getUsersCacheConfiguration().setTimeToIdleSeconds(
281 usersCache.getTimeToIdleSeconds() );
285 usersCache.setTimeToIdleSeconds(
286 redbackRuntimeConfiguration.getUsersCacheConfiguration().getTimeToIdleSeconds() );
288 if ( redbackRuntimeConfiguration.getUsersCacheConfiguration().getTimeToLiveSeconds() < 0 )
290 redbackRuntimeConfiguration.getUsersCacheConfiguration().setTimeToLiveSeconds(
291 usersCache.getTimeToLiveSeconds() );
295 usersCache.setTimeToLiveSeconds(
296 redbackRuntimeConfiguration.getUsersCacheConfiguration().getTimeToLiveSeconds() );
298 if ( redbackRuntimeConfiguration.getUsersCacheConfiguration().getMaxElementsInMemory() < 0 )
300 redbackRuntimeConfiguration.getUsersCacheConfiguration().setMaxElementsInMemory(
301 usersCache.getMaxElementsInMemory() );
304 usersCache.setMaxElementsInMemory(
305 redbackRuntimeConfiguration.getUsersCacheConfiguration().getMaxElementsInMemory() );
307 if ( redbackRuntimeConfiguration.getUsersCacheConfiguration().getMaxElementsOnDisk() < 0 )
309 redbackRuntimeConfiguration.getUsersCacheConfiguration().setMaxElementsOnDisk(
310 usersCache.getMaxElementsOnDisk() );
313 usersCache.setMaxElementsOnDisk(
314 redbackRuntimeConfiguration.getUsersCacheConfiguration().getMaxElementsOnDisk() );
318 updateRedbackRuntimeConfiguration( redbackRuntimeConfiguration );
322 catch ( RepositoryAdminException e )
324 throw new UserConfigurationException( e.getMessage(), e );
328 private boolean isSunContextFactoryAvailable()
332 return Thread.currentThread().getContextClassLoader().loadClass( "com.sun.jndi.ldap.LdapCtxFactory" )
335 catch ( ClassNotFoundException e )
342 public RedbackRuntimeConfiguration getRedbackRuntimeConfiguration()
344 return build( archivaConfiguration.getConfiguration().getRedbackRuntimeConfiguration() );
348 public void updateRedbackRuntimeConfiguration( RedbackRuntimeConfiguration redbackRuntimeConfiguration )
349 throws RepositoryAdminException
351 org.apache.archiva.configuration.RedbackRuntimeConfiguration runtimeConfiguration =
352 build( redbackRuntimeConfiguration );
353 Configuration configuration = archivaConfiguration.getConfiguration();
354 configuration.setRedbackRuntimeConfiguration( runtimeConfiguration );
357 archivaConfiguration.save( configuration );
359 catch ( RegistryException e )
361 throw new RepositoryAdminException( e.getMessage(), e );
363 catch ( IndeterminateConfigurationException e )
365 throw new RepositoryAdminException( e.getMessage(), e );
369 private RedbackRuntimeConfiguration build(
370 org.apache.archiva.configuration.RedbackRuntimeConfiguration runtimeConfiguration )
372 RedbackRuntimeConfiguration redbackRuntimeConfiguration =
373 getModelMapper().map( runtimeConfiguration, RedbackRuntimeConfiguration.class );
375 if ( runtimeConfiguration.getLdapConfiguration() != null )
377 redbackRuntimeConfiguration.setLdapConfiguration(
378 getModelMapper().map( runtimeConfiguration.getLdapConfiguration(), LdapConfiguration.class ) );
381 if ( runtimeConfiguration.getUsersCacheConfiguration() != null )
383 redbackRuntimeConfiguration.setUsersCacheConfiguration(
384 getModelMapper().map( runtimeConfiguration.getUsersCacheConfiguration(), CacheConfiguration.class ) );
387 if ( redbackRuntimeConfiguration.getLdapConfiguration() == null )
390 redbackRuntimeConfiguration.setLdapConfiguration( new LdapConfiguration() );
393 if ( redbackRuntimeConfiguration.getUsersCacheConfiguration() == null )
395 redbackRuntimeConfiguration.setUsersCacheConfiguration( new CacheConfiguration() );
398 List<org.apache.archiva.configuration.LdapGroupMapping> mappings = runtimeConfiguration.getLdapGroupMappings();
400 if ( mappings != null && mappings.size() > 0 )
402 List<LdapGroupMapping> ldapGroupMappings = new ArrayList<>( mappings.size() );
404 for ( org.apache.archiva.configuration.LdapGroupMapping mapping : mappings )
406 ldapGroupMappings.add( new LdapGroupMapping( mapping.getGroup(), mapping.getRoleNames() ) );
409 redbackRuntimeConfiguration.setLdapGroupMappings( ldapGroupMappings );
412 cleanupProperties( redbackRuntimeConfiguration );
414 return redbackRuntimeConfiguration;
418 * cleaning from map properties used directly in archiva configuration fields
420 * @param redbackRuntimeConfiguration
422 private void cleanupProperties( RedbackRuntimeConfiguration redbackRuntimeConfiguration )
424 Map<String, String> properties = redbackRuntimeConfiguration.getConfigurationProperties();
425 LDAP_MAPPER.getAllAttributes( ).stream( ).forEach( att -> properties.remove( att ) );
427 // cleanup groups <-> role mapping
428 /**for ( Map.Entry<String, String> entry : new HashMap<String, String>( properties ).entrySet() )
430 if ( entry.getKey().startsWith( UserConfigurationKeys.LDAP_GROUPS_ROLE_START_KEY ) )
432 properties.remove( entry.getKey() );
437 private org.apache.archiva.configuration.RedbackRuntimeConfiguration build(
438 RedbackRuntimeConfiguration redbackRuntimeConfiguration )
440 org.apache.archiva.configuration.RedbackRuntimeConfiguration res =
441 getModelMapper().map( redbackRuntimeConfiguration,
442 org.apache.archiva.configuration.RedbackRuntimeConfiguration.class );
444 if ( redbackRuntimeConfiguration.getLdapConfiguration() == null )
446 redbackRuntimeConfiguration.setLdapConfiguration( new LdapConfiguration() );
448 res.setLdapConfiguration( getModelMapper().map( redbackRuntimeConfiguration.getLdapConfiguration(),
449 org.apache.archiva.configuration.LdapConfiguration.class ) );
451 if ( redbackRuntimeConfiguration.getUsersCacheConfiguration() == null )
453 redbackRuntimeConfiguration.setUsersCacheConfiguration( new CacheConfiguration() );
456 res.setUsersCacheConfiguration( getModelMapper().map( redbackRuntimeConfiguration.getUsersCacheConfiguration(),
457 org.apache.archiva.configuration.CacheConfiguration.class ) );
459 List<LdapGroupMapping> ldapGroupMappings = redbackRuntimeConfiguration.getLdapGroupMappings();
461 if ( ldapGroupMappings != null && ldapGroupMappings.size() > 0 )
464 List<org.apache.archiva.configuration.LdapGroupMapping> mappings =
465 new ArrayList<>( ldapGroupMappings.size() );
467 for ( LdapGroupMapping ldapGroupMapping : ldapGroupMappings )
470 org.apache.archiva.configuration.LdapGroupMapping mapping =
471 new org.apache.archiva.configuration.LdapGroupMapping();
472 mapping.setGroup( ldapGroupMapping.getGroup() );
473 mapping.setRoleNames( new ArrayList<>( ldapGroupMapping.getRoleNames() ) );
474 mappings.add( mapping );
477 res.setLdapGroupMappings( mappings );
482 // wrapper for UserConfiguration to intercept values (and store it not yet migrated)
486 public String getString( String key )
488 final RedbackRuntimeConfiguration conf = getRedbackRuntimeConfiguration();
489 if (LDAP_MAPPER.isStringMapping( key )) {
490 final LdapConfiguration ldapConf = conf.getLdapConfiguration( );
491 return LDAP_MAPPER.getString( key, ldapConf );
493 if (LDAP_MAPPER.isPrefixMapping( key )) {
494 return LDAP_MAPPER.getPrefixString( key, conf.getLdapGroupMappings( ) );
497 if ( USER_MANAGER_IMPL.equals( key ) )
499 // possible false for others than archiva user manager
500 return conf.getUserManagerImpls().get( 0 );
503 if ( conf.getConfigurationProperties().containsKey( key ) )
505 return conf.getConfigurationProperties().get( key );
508 String value = userConfiguration.getString( key );
513 conf.getConfigurationProperties().put( key, value );
517 updateRedbackRuntimeConfiguration( conf );
519 catch ( RepositoryAdminException e )
521 log.error( "fail to save RedbackRuntimeConfiguration: {}", e.getMessage(), e );
522 throw new RuntimeException( e.getMessage(), e );
529 public String getString( String key, String defaultValue )
531 final RedbackRuntimeConfiguration conf = getRedbackRuntimeConfiguration();
532 if (LDAP_MAPPER.isStringMapping( key )) {
533 final LdapConfiguration ldapConf = conf.getLdapConfiguration( );
534 return LDAP_MAPPER.getString( key, ldapConf );
536 if (LDAP_MAPPER.isPrefixMapping( key )) {
537 return LDAP_MAPPER.getPrefixString( key, conf.getLdapGroupMappings( ) );
540 if ( conf.getConfigurationProperties().containsKey( key ) )
542 return conf.getConfigurationProperties().get( key );
545 String value = userConfiguration.getString( key, defaultValue );
552 conf.getConfigurationProperties().put( key, value );
555 updateRedbackRuntimeConfiguration( conf );
557 catch ( RepositoryAdminException e )
559 log.error( "fail to save RedbackRuntimeConfiguration: {}", e.getMessage(), e );
560 throw new RuntimeException( e.getMessage(), e );
567 public int getInt( String key )
569 final RedbackRuntimeConfiguration conf = getRedbackRuntimeConfiguration();
570 if (LDAP_MAPPER.isIntMapping( key )) {
571 return LDAP_MAPPER.getInt( key, conf.getLdapConfiguration( ) );
574 if ( conf.getConfigurationProperties().containsKey( key ) )
576 return Integer.valueOf( conf.getConfigurationProperties().get( key ) );
579 int value = userConfiguration.getInt( key );
581 conf.getConfigurationProperties().put( key, Integer.toString( value ) );
584 updateRedbackRuntimeConfiguration( conf );
586 catch ( RepositoryAdminException e )
588 log.error( "fail to save RedbackRuntimeConfiguration: {}", e.getMessage(), e );
589 throw new RuntimeException( e.getMessage(), e );
596 public int getInt( String key, int defaultValue )
598 final RedbackRuntimeConfiguration conf = getRedbackRuntimeConfiguration();
599 if (LDAP_MAPPER.isIntMapping( key )) {
600 return LDAP_MAPPER.getInt( key, conf.getLdapConfiguration( ) );
603 if ( conf.getConfigurationProperties().containsKey( key ) )
605 return Integer.valueOf( conf.getConfigurationProperties().get( key ) );
608 int value = userConfiguration.getInt( key, defaultValue );
610 conf.getConfigurationProperties().put( key, Integer.toString( value ) );
613 updateRedbackRuntimeConfiguration( conf );
615 catch ( RepositoryAdminException e )
617 log.error( "fail to save RedbackRuntimeConfiguration: {}", e.getMessage(), e );
618 throw new RuntimeException( e.getMessage(), e );
625 public boolean getBoolean( String key )
627 RedbackRuntimeConfiguration conf = getRedbackRuntimeConfiguration();
628 if (LDAP_MAPPER.isBooleanMapping( key )) {
629 return LDAP_MAPPER.getBoolean( key, conf.getLdapConfiguration( ) );
632 if ( conf.getConfigurationProperties().containsKey( key ) )
634 return Boolean.valueOf( conf.getConfigurationProperties().get( key ) );
637 boolean value = userConfiguration.getBoolean( key );
639 conf.getConfigurationProperties().put( key, Boolean.toString( value ) );
642 updateRedbackRuntimeConfiguration( conf );
644 catch ( RepositoryAdminException e )
646 log.error( "fail to save RedbackRuntimeConfiguration: {}", e.getMessage(), e );
647 throw new RuntimeException( e.getMessage(), e );
654 public boolean getBoolean( String key, boolean defaultValue )
656 RedbackRuntimeConfiguration conf = getRedbackRuntimeConfiguration();
657 if (LDAP_MAPPER.isBooleanMapping( key )) {
658 return LDAP_MAPPER.getBoolean( key, conf.getLdapConfiguration( ) );
661 if ( conf.getConfigurationProperties().containsKey( key ) )
663 return Boolean.valueOf( conf.getConfigurationProperties().get( key ) );
666 boolean value = userConfiguration.getBoolean( key, defaultValue );
668 conf.getConfigurationProperties().put( key, Boolean.toString( value ) );
671 updateRedbackRuntimeConfiguration( conf );
673 catch ( RepositoryAdminException e )
675 log.error( "fail to save RedbackRuntimeConfiguration: {}", e.getMessage(), e );
676 throw new RuntimeException( e.getMessage(), e );
683 public List<String> getList( String key )
685 RedbackRuntimeConfiguration conf = getRedbackRuntimeConfiguration();
686 if (conf.getConfigurationProperties().containsKey(key)) {
687 return Arrays.asList(conf.getConfigurationProperties().get(key).split(","));
690 List<String> value = userConfiguration.getList( key );
692 conf.getConfigurationProperties().put( key, "" );
695 updateRedbackRuntimeConfiguration( conf );
697 catch ( RepositoryAdminException e )
699 log.error( "fail to save RedbackRuntimeConfiguration: {}", e.getMessage(), e );
700 throw new RuntimeException( e.getMessage(), e );
707 public String getConcatenatedList( String key, String defaultValue )
709 if (LDAP_MAPPER.isStringMapping( key )) {
710 return LDAP_MAPPER.getString( key, getRedbackRuntimeConfiguration().getLdapConfiguration());
712 return userConfiguration.getConcatenatedList( key, defaultValue );
716 public Collection<String> getKeys()
718 Collection<String> keys = userConfiguration.getKeys();
720 Set<String> keysSet = new HashSet<>( keys );
722 keysSet.addAll( getRedbackRuntimeConfiguration().getConfigurationProperties().keySet() );