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.archiva.redback.users.User;
38 import org.apache.commons.lang3.StringUtils;
39 import org.slf4j.Logger;
40 import org.slf4j.LoggerFactory;
41 import org.springframework.stereotype.Service;
43 import javax.annotation.PostConstruct;
44 import javax.inject.Inject;
45 import javax.inject.Named;
46 import java.util.ArrayList;
47 import java.util.Arrays;
48 import java.util.Collection;
49 import java.util.HashMap;
50 import java.util.HashSet;
51 import java.util.List;
54 import java.util.function.Function;
56 import static org.apache.archiva.redback.configuration.UserConfigurationKeys.*;
59 * @author Olivier Lamy
62 @Service( "redbackRuntimeConfigurationAdmin#default" )
63 public class DefaultRedbackRuntimeConfigurationAdmin
64 extends AbstractRepositoryAdmin
65 implements RedbackRuntimeConfigurationAdmin, UserConfiguration
68 protected Logger log = LoggerFactory.getLogger( getClass() );
70 private ArchivaConfiguration archivaConfiguration;
72 private UserConfiguration userConfiguration;
74 private static final Map<String, List<String>> LDAP_PROPERTIES = new HashMap<>( );
76 private static final ConfigMapper<LdapConfiguration, List<LdapGroupMapping>> LDAP_MAPPER = new ConfigMapper( );
79 LDAP_MAPPER.addStringMapping( LDAP_HOSTNAME, LdapConfiguration::getHostName );
80 LDAP_MAPPER.addStringMapping( LDAP_CONTEX_FACTORY, LdapConfiguration::getContextFactory );
81 LDAP_MAPPER.addStringMapping( LDAP_PASSWORD, LdapConfiguration::getPassword );
82 LDAP_MAPPER.addStringMapping( LDAP_AUTHENTICATION_METHOD, LdapConfiguration::getAuthenticationMethod );
83 LDAP_MAPPER.addStringMapping( LDAP_BASEDN, LdapConfiguration::getBaseDn );
84 LDAP_MAPPER.addStringMapping( LDAP_GROUPS_BASEDN, LdapConfiguration::getBaseGroupsDn );
85 LDAP_MAPPER.addStringMapping( LDAP_BINDDN, LdapConfiguration::getBindDn );
86 LDAP_MAPPER.addPrefixStringMapping( LDAP_GROUPS_ROLE_START_KEY, (String attributeName, List<LdapGroupMapping> mapping)-> {
87 int index = mapping.indexOf( new LdapGroupMapping(
88 StringUtils.substringAfter( attributeName, LDAP_GROUPS_ROLE_START_KEY ) ) );
91 return StringUtils.join( mapping.get( index ).getRoleNames(),
97 LDAP_MAPPER.addIntMapping( LDAP_PORT, LdapConfiguration::getPort );
98 LDAP_MAPPER.addBooleanMapping( LDAP_SSL, LdapConfiguration::isSsl );
99 LDAP_MAPPER.addBooleanMapping( LDAP_WRITABLE, LdapConfiguration::isWritable );
100 LDAP_MAPPER.addBooleanMapping( LDAP_GROUPS_USE_ROLENAME, LdapConfiguration::isUseRoleNameAsGroup );
101 LDAP_MAPPER.addBooleanMapping( LDAP_BIND_AUTHENTICATOR_ENABLED, LdapConfiguration::isBindAuthenticatorEnabled );
104 private Cache<String, User> usersCache;
107 public DefaultRedbackRuntimeConfigurationAdmin( ArchivaConfiguration archivaConfiguration,//
108 @Named( value = "userConfiguration#redback" ) //
109 UserConfiguration userConfiguration,
110 @Named( value = "cache#users" ) Cache<String, User> usersCache )
112 this.archivaConfiguration = archivaConfiguration;
113 this.userConfiguration = userConfiguration;
114 this.usersCache = usersCache;
119 public void initialize()
120 throws UserConfigurationException
124 RedbackRuntimeConfiguration redbackRuntimeConfiguration = getRedbackRuntimeConfiguration();
125 Function<RedbackRuntimeConfiguration, LdapConfiguration> kk = RedbackRuntimeConfiguration::getLdapConfiguration;
126 // migrate or not data from redback
127 if ( !redbackRuntimeConfiguration.isMigratedFromRedbackConfiguration() )
129 // not migrated so build a new fresh one
130 redbackRuntimeConfiguration = new RedbackRuntimeConfiguration();
131 // so migrate if available
132 String userManagerImpl =
133 userConfiguration.getConcatenatedList( USER_MANAGER_IMPL, //
134 DEFAULT_USER_MANAGER_IMPL );
135 if ( StringUtils.isNotEmpty( userManagerImpl ) )
137 String[] impls = StringUtils.split( userManagerImpl, ',' );
138 for ( String impl : impls )
140 if (StringUtils.equalsIgnoreCase( "jdo", impl ))
142 impl = DEFAULT_USER_MANAGER_IMPL;
144 redbackRuntimeConfiguration.getUserManagerImpls().add( impl );
149 redbackRuntimeConfiguration.getUserManagerImpls().add( DEFAULT_USER_MANAGER_IMPL );
152 String rbacManagerImpls =
153 userConfiguration.getConcatenatedList( RBAC_MANAGER_IMPL, //
154 DEFAULT_RBAC_MANAGER_IMPL );
156 if ( StringUtils.isNotEmpty( rbacManagerImpls ) )
158 String[] impls = StringUtils.split( rbacManagerImpls, ',' );
159 for ( String impl : impls )
161 if (StringUtils.equalsIgnoreCase( "jdo", impl ))
163 impl = DEFAULT_RBAC_MANAGER_IMPL;
165 redbackRuntimeConfiguration.getRbacManagerImpls().add( impl );
170 redbackRuntimeConfiguration.getRbacManagerImpls().add( DEFAULT_RBAC_MANAGER_IMPL );
175 LdapConfiguration ldapConfiguration = redbackRuntimeConfiguration.getLdapConfiguration();
176 if ( ldapConfiguration == null )
178 ldapConfiguration = new LdapConfiguration();
179 redbackRuntimeConfiguration.setLdapConfiguration( ldapConfiguration );
182 ldapConfiguration.setHostName(
183 userConfiguration.getString( LDAP_HOSTNAME, null ) );
184 ldapConfiguration.setPort( userConfiguration.getInt( LDAP_PORT, -1 ) );
185 ldapConfiguration.setSsl( userConfiguration.getBoolean( LDAP_SSL, false ) );
186 ldapConfiguration.setBaseDn(
187 userConfiguration.getConcatenatedList( LDAP_BASEDN, null ) );
189 ldapConfiguration.setBaseGroupsDn(
190 userConfiguration.getConcatenatedList( LDAP_GROUPS_BASEDN,
191 ldapConfiguration.getBaseDn() ) );
193 ldapConfiguration.setContextFactory(
194 userConfiguration.getString( LDAP_CONTEX_FACTORY,
195 isSunContextFactoryAvailable()
196 ? "com.sun.jndi.ldap.LdapCtxFactory"
198 ldapConfiguration.setBindDn(
199 userConfiguration.getConcatenatedList( LDAP_BINDDN, null ) );
200 ldapConfiguration.setPassword(
201 userConfiguration.getString( LDAP_PASSWORD, null ) );
202 ldapConfiguration.setAuthenticationMethod(
203 userConfiguration.getString( LDAP_AUTHENTICATION_METHOD, null ) );
205 ldapConfiguration.setWritable(
206 userConfiguration.getBoolean( LDAP_WRITABLE, false ) );
208 ldapConfiguration.setUseRoleNameAsGroup(
209 userConfiguration.getBoolean( LDAP_GROUPS_USE_ROLENAME, false ) );
211 boolean ldapBindAuthenticatorEnabled =
212 userConfiguration.getBoolean( LDAP_BIND_AUTHENTICATOR_ENABLED, false );
213 ldapConfiguration.setBindAuthenticatorEnabled( ldapBindAuthenticatorEnabled );
215 // LDAP groups mapping reading !!
216 // UserConfigurationKeys.LDAP_GROUPS_ROLE_START_KEY
217 // userConfiguration.getKeys()
219 Collection<String> keys = userConfiguration.getKeys();
221 List<LdapGroupMapping> ldapGroupMappings = new ArrayList<>();
223 for ( String key : keys )
225 if ( key.startsWith( LDAP_GROUPS_ROLE_START_KEY ) )
228 StringUtils.substringAfter( key, LDAP_GROUPS_ROLE_START_KEY );
229 String val = userConfiguration.getConcatenatedList( key, "" );
230 if ( !StringUtils.isEmpty( val ) )
232 String[] roles = StringUtils.split( val, ',' );
233 ldapGroupMappings.add( new LdapGroupMapping( group, roles ) );
238 redbackRuntimeConfiguration.setLdapGroupMappings( ldapGroupMappings );
240 redbackRuntimeConfiguration.setMigratedFromRedbackConfiguration( true );
242 updateRedbackRuntimeConfiguration( redbackRuntimeConfiguration );
245 // we must ensure userManagerImpls list is not empty if so put at least jdo one !
246 if ( redbackRuntimeConfiguration.getUserManagerImpls().isEmpty() )
249 "redbackRuntimeConfiguration with empty userManagerImpls so force at least jdo implementation !" );
250 redbackRuntimeConfiguration.getUserManagerImpls().add( "jdo" );
251 updateRedbackRuntimeConfiguration( redbackRuntimeConfiguration );
255 log.info( "using userManagerImpls: {}", redbackRuntimeConfiguration.getUserManagerImpls() );
258 // we ensure rbacManagerImpls is not empty if so put at least cached
259 if ( redbackRuntimeConfiguration.getRbacManagerImpls().isEmpty() )
262 "redbackRuntimeConfiguration with empty rbacManagerImpls so force at least cached implementation !" );
263 redbackRuntimeConfiguration.getRbacManagerImpls().add( "cached" );
264 updateRedbackRuntimeConfiguration( redbackRuntimeConfiguration );
268 log.info( "using rbacManagerImpls: {}", redbackRuntimeConfiguration.getRbacManagerImpls() );
271 boolean save = false;
274 if ( redbackRuntimeConfiguration.getUsersCacheConfiguration() == null )
276 redbackRuntimeConfiguration.setUsersCacheConfiguration( new CacheConfiguration() );
278 // if -1 it means non initialized to take values from the spring bean
279 if ( redbackRuntimeConfiguration.getUsersCacheConfiguration().getTimeToIdleSeconds() < 0 )
281 redbackRuntimeConfiguration.getUsersCacheConfiguration().setTimeToIdleSeconds(
282 usersCache.getTimeToIdleSeconds() );
286 usersCache.setTimeToIdleSeconds(
287 redbackRuntimeConfiguration.getUsersCacheConfiguration().getTimeToIdleSeconds() );
289 if ( redbackRuntimeConfiguration.getUsersCacheConfiguration().getTimeToLiveSeconds() < 0 )
291 redbackRuntimeConfiguration.getUsersCacheConfiguration().setTimeToLiveSeconds(
292 usersCache.getTimeToLiveSeconds() );
296 usersCache.setTimeToLiveSeconds(
297 redbackRuntimeConfiguration.getUsersCacheConfiguration().getTimeToLiveSeconds() );
299 if ( redbackRuntimeConfiguration.getUsersCacheConfiguration().getMaxElementsInMemory() < 0 )
301 redbackRuntimeConfiguration.getUsersCacheConfiguration().setMaxElementsInMemory(
302 usersCache.getMaxElementsInMemory() );
305 usersCache.setMaxElementsInMemory(
306 redbackRuntimeConfiguration.getUsersCacheConfiguration().getMaxElementsInMemory() );
308 if ( redbackRuntimeConfiguration.getUsersCacheConfiguration().getMaxElementsOnDisk() < 0 )
310 redbackRuntimeConfiguration.getUsersCacheConfiguration().setMaxElementsOnDisk(
311 usersCache.getMaxElementsOnDisk() );
314 usersCache.setMaxElementsOnDisk(
315 redbackRuntimeConfiguration.getUsersCacheConfiguration().getMaxElementsOnDisk() );
319 updateRedbackRuntimeConfiguration( redbackRuntimeConfiguration );
323 catch ( RepositoryAdminException e )
325 throw new UserConfigurationException( e.getMessage(), e );
329 private boolean isSunContextFactoryAvailable()
333 return Thread.currentThread().getContextClassLoader().loadClass( "com.sun.jndi.ldap.LdapCtxFactory" )
336 catch ( ClassNotFoundException e )
343 public RedbackRuntimeConfiguration getRedbackRuntimeConfiguration()
345 return build( archivaConfiguration.getConfiguration().getRedbackRuntimeConfiguration() );
349 public void updateRedbackRuntimeConfiguration( RedbackRuntimeConfiguration redbackRuntimeConfiguration )
350 throws RepositoryAdminException
352 org.apache.archiva.configuration.RedbackRuntimeConfiguration runtimeConfiguration =
353 build( redbackRuntimeConfiguration );
354 Configuration configuration = archivaConfiguration.getConfiguration();
355 configuration.setRedbackRuntimeConfiguration( runtimeConfiguration );
358 archivaConfiguration.save( configuration );
360 catch ( RegistryException e )
362 throw new RepositoryAdminException( e.getMessage(), e );
364 catch ( IndeterminateConfigurationException e )
366 throw new RepositoryAdminException( e.getMessage(), e );
370 private RedbackRuntimeConfiguration build(
371 org.apache.archiva.configuration.RedbackRuntimeConfiguration runtimeConfiguration )
373 RedbackRuntimeConfiguration redbackRuntimeConfiguration =
374 getModelMapper().map( runtimeConfiguration, RedbackRuntimeConfiguration.class );
376 if ( runtimeConfiguration.getLdapConfiguration() != null )
378 redbackRuntimeConfiguration.setLdapConfiguration(
379 getModelMapper().map( runtimeConfiguration.getLdapConfiguration(), LdapConfiguration.class ) );
382 if ( runtimeConfiguration.getUsersCacheConfiguration() != null )
384 redbackRuntimeConfiguration.setUsersCacheConfiguration(
385 getModelMapper().map( runtimeConfiguration.getUsersCacheConfiguration(), CacheConfiguration.class ) );
388 if ( redbackRuntimeConfiguration.getLdapConfiguration() == null )
391 redbackRuntimeConfiguration.setLdapConfiguration( new LdapConfiguration() );
394 if ( redbackRuntimeConfiguration.getUsersCacheConfiguration() == null )
396 redbackRuntimeConfiguration.setUsersCacheConfiguration( new CacheConfiguration() );
399 List<org.apache.archiva.configuration.LdapGroupMapping> mappings = runtimeConfiguration.getLdapGroupMappings();
401 if ( mappings != null && mappings.size() > 0 )
403 List<LdapGroupMapping> ldapGroupMappings = new ArrayList<>( mappings.size() );
405 for ( org.apache.archiva.configuration.LdapGroupMapping mapping : mappings )
407 ldapGroupMappings.add( new LdapGroupMapping( mapping.getGroup(), mapping.getRoleNames() ) );
410 redbackRuntimeConfiguration.setLdapGroupMappings( ldapGroupMappings );
413 cleanupProperties( redbackRuntimeConfiguration );
415 return redbackRuntimeConfiguration;
419 * cleaning from map properties used directly in archiva configuration fields
421 * @param redbackRuntimeConfiguration
423 private void cleanupProperties( RedbackRuntimeConfiguration redbackRuntimeConfiguration )
425 Map<String, String> properties = redbackRuntimeConfiguration.getConfigurationProperties();
426 LDAP_MAPPER.getAllAttributes( ).stream( ).forEach( att -> properties.remove( att ) );
429 private org.apache.archiva.configuration.RedbackRuntimeConfiguration build(
430 RedbackRuntimeConfiguration redbackRuntimeConfiguration )
432 org.apache.archiva.configuration.RedbackRuntimeConfiguration res =
433 getModelMapper().map( redbackRuntimeConfiguration,
434 org.apache.archiva.configuration.RedbackRuntimeConfiguration.class );
436 if ( redbackRuntimeConfiguration.getLdapConfiguration() == null )
438 redbackRuntimeConfiguration.setLdapConfiguration( new LdapConfiguration() );
440 res.setLdapConfiguration( getModelMapper().map( redbackRuntimeConfiguration.getLdapConfiguration(),
441 org.apache.archiva.configuration.LdapConfiguration.class ) );
443 if ( redbackRuntimeConfiguration.getUsersCacheConfiguration() == null )
445 redbackRuntimeConfiguration.setUsersCacheConfiguration( new CacheConfiguration() );
448 res.setUsersCacheConfiguration( getModelMapper().map( redbackRuntimeConfiguration.getUsersCacheConfiguration(),
449 org.apache.archiva.configuration.CacheConfiguration.class ) );
451 List<LdapGroupMapping> ldapGroupMappings = redbackRuntimeConfiguration.getLdapGroupMappings();
453 if ( ldapGroupMappings != null && ldapGroupMappings.size() > 0 )
456 List<org.apache.archiva.configuration.LdapGroupMapping> mappings =
457 new ArrayList<>( ldapGroupMappings.size() );
459 for ( LdapGroupMapping ldapGroupMapping : ldapGroupMappings )
462 org.apache.archiva.configuration.LdapGroupMapping mapping =
463 new org.apache.archiva.configuration.LdapGroupMapping();
464 mapping.setGroup( ldapGroupMapping.getGroup() );
465 mapping.setRoleNames( new ArrayList<>( ldapGroupMapping.getRoleNames() ) );
466 mappings.add( mapping );
469 res.setLdapGroupMappings( mappings );
474 // wrapper for UserConfiguration to intercept values (and store it not yet migrated)
478 public String getString( String key )
480 final RedbackRuntimeConfiguration conf = getRedbackRuntimeConfiguration();
481 if (LDAP_MAPPER.isStringMapping( key )) {
482 final LdapConfiguration ldapConf = conf.getLdapConfiguration( );
483 return LDAP_MAPPER.getString( key, ldapConf );
485 if (LDAP_MAPPER.isPrefixMapping( key )) {
486 return LDAP_MAPPER.getPrefixString( key, conf.getLdapGroupMappings( ) );
488 if (conf.getLdapConfiguration().getExtraProperties().containsKey( key )) {
489 return conf.getLdapConfiguration( ).getExtraProperties( ).get( key );
492 if ( USER_MANAGER_IMPL.equals( key ) )
494 // possible false for others than archiva user manager
495 return conf.getUserManagerImpls().get( 0 );
498 if ( conf.getConfigurationProperties().containsKey( key ) )
500 return conf.getConfigurationProperties().get( key );
503 String value = userConfiguration.getString( key );
508 conf.getConfigurationProperties().put( key, value );
512 updateRedbackRuntimeConfiguration( conf );
514 catch ( RepositoryAdminException e )
516 log.error( "fail to save RedbackRuntimeConfiguration: {}", e.getMessage(), e );
517 throw new RuntimeException( e.getMessage(), e );
524 public String getString( String key, String defaultValue )
526 final RedbackRuntimeConfiguration conf = getRedbackRuntimeConfiguration();
527 if (LDAP_MAPPER.isStringMapping( key )) {
528 final LdapConfiguration ldapConf = conf.getLdapConfiguration( );
529 return LDAP_MAPPER.getString( key, ldapConf );
531 if (LDAP_MAPPER.isPrefixMapping( key )) {
532 return LDAP_MAPPER.getPrefixString( key, conf.getLdapGroupMappings( ) );
534 if (conf.getLdapConfiguration().getExtraProperties().containsKey( key )) {
535 return conf.getLdapConfiguration( ).getExtraProperties( ).get( key );
538 if ( conf.getConfigurationProperties().containsKey( key ) )
540 return conf.getConfigurationProperties().get( key );
543 String value = userConfiguration.getString( key, defaultValue );
550 conf.getConfigurationProperties().put( key, value );
553 updateRedbackRuntimeConfiguration( conf );
555 catch ( RepositoryAdminException e )
557 log.error( "fail to save RedbackRuntimeConfiguration: {}", e.getMessage(), e );
558 throw new RuntimeException( e.getMessage(), e );
565 public int getInt( String key )
567 final RedbackRuntimeConfiguration conf = getRedbackRuntimeConfiguration();
568 if (LDAP_MAPPER.isIntMapping( key )) {
569 return LDAP_MAPPER.getInt( key, conf.getLdapConfiguration( ) );
572 if ( conf.getConfigurationProperties().containsKey( key ) )
574 return Integer.valueOf( conf.getConfigurationProperties().get( key ) );
577 int value = userConfiguration.getInt( key );
579 conf.getConfigurationProperties().put( key, Integer.toString( value ) );
582 updateRedbackRuntimeConfiguration( conf );
584 catch ( RepositoryAdminException e )
586 log.error( "fail to save RedbackRuntimeConfiguration: {}", e.getMessage(), e );
587 throw new RuntimeException( e.getMessage(), e );
594 public int getInt( String key, int defaultValue )
596 final RedbackRuntimeConfiguration conf = getRedbackRuntimeConfiguration();
597 if (LDAP_MAPPER.isIntMapping( key )) {
598 return LDAP_MAPPER.getInt( key, conf.getLdapConfiguration( ) );
601 if ( conf.getConfigurationProperties().containsKey( key ) )
603 return Integer.valueOf( conf.getConfigurationProperties().get( key ) );
606 int value = userConfiguration.getInt( key, defaultValue );
608 conf.getConfigurationProperties().put( key, Integer.toString( value ) );
611 updateRedbackRuntimeConfiguration( conf );
613 catch ( RepositoryAdminException e )
615 log.error( "fail to save RedbackRuntimeConfiguration: {}", e.getMessage(), e );
616 throw new RuntimeException( e.getMessage(), e );
623 public boolean getBoolean( String key )
625 RedbackRuntimeConfiguration conf = getRedbackRuntimeConfiguration();
626 if (LDAP_MAPPER.isBooleanMapping( key )) {
627 return LDAP_MAPPER.getBoolean( key, conf.getLdapConfiguration( ) );
630 if ( conf.getConfigurationProperties().containsKey( key ) )
632 return Boolean.valueOf( conf.getConfigurationProperties().get( key ) );
635 boolean value = userConfiguration.getBoolean( key );
637 conf.getConfigurationProperties().put( key, Boolean.toString( value ) );
640 updateRedbackRuntimeConfiguration( conf );
642 catch ( RepositoryAdminException e )
644 log.error( "fail to save RedbackRuntimeConfiguration: {}", e.getMessage(), e );
645 throw new RuntimeException( e.getMessage(), e );
652 public boolean getBoolean( String key, boolean defaultValue )
654 RedbackRuntimeConfiguration conf = getRedbackRuntimeConfiguration();
655 if (LDAP_MAPPER.isBooleanMapping( key )) {
656 return LDAP_MAPPER.getBoolean( key, conf.getLdapConfiguration( ) );
659 if ( conf.getConfigurationProperties().containsKey( key ) )
661 return Boolean.valueOf( conf.getConfigurationProperties().get( key ) );
664 boolean value = userConfiguration.getBoolean( key, defaultValue );
666 conf.getConfigurationProperties().put( key, Boolean.toString( value ) );
669 updateRedbackRuntimeConfiguration( conf );
671 catch ( RepositoryAdminException e )
673 log.error( "fail to save RedbackRuntimeConfiguration: {}", e.getMessage(), e );
674 throw new RuntimeException( e.getMessage(), e );
681 public List<String> getList( String key )
683 RedbackRuntimeConfiguration conf = getRedbackRuntimeConfiguration();
684 if (conf.getConfigurationProperties().containsKey(key)) {
685 return Arrays.asList(conf.getConfigurationProperties().get(key).split(","));
688 List<String> value = userConfiguration.getList( key );
690 conf.getConfigurationProperties().put( key, "" );
693 updateRedbackRuntimeConfiguration( conf );
695 catch ( RepositoryAdminException e )
697 log.error( "fail to save RedbackRuntimeConfiguration: {}", e.getMessage(), e );
698 throw new RuntimeException( e.getMessage(), e );
705 public String getConcatenatedList( String key, String defaultValue )
707 if (LDAP_MAPPER.isStringMapping( key )) {
708 return LDAP_MAPPER.getString( key, getRedbackRuntimeConfiguration().getLdapConfiguration());
710 return userConfiguration.getConcatenatedList( key, defaultValue );
714 public Collection<String> getKeys()
716 Collection<String> keys = userConfiguration.getKeys();
718 Set<String> keysSet = new HashSet<>( keys );
720 keysSet.addAll( getRedbackRuntimeConfiguration().getConfigurationProperties().keySet() );