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.redback.components.cache.Cache;
32 import org.apache.archiva.redback.components.registry.RegistryException;
33 import org.apache.archiva.redback.configuration.UserConfiguration;
34 import org.apache.archiva.redback.configuration.UserConfigurationException;
35 import org.apache.archiva.redback.configuration.UserConfigurationKeys;
36 import org.apache.commons.lang.StringUtils;
37 import org.slf4j.Logger;
38 import org.slf4j.LoggerFactory;
39 import org.springframework.stereotype.Service;
41 import javax.annotation.PostConstruct;
42 import javax.inject.Inject;
43 import javax.inject.Named;
44 import java.util.ArrayList;
45 import java.util.Collection;
46 import java.util.HashSet;
47 import java.util.List;
52 * @author Olivier Lamy
55 @Service( "redbackRuntimeConfigurationAdmin#default" )
56 public class DefaultRedbackRuntimeConfigurationAdmin
57 extends AbstractRepositoryAdmin
58 implements RedbackRuntimeConfigurationAdmin, UserConfiguration
61 protected Logger log = LoggerFactory.getLogger( getClass() );
63 private ArchivaConfiguration archivaConfiguration;
65 private UserConfiguration userConfiguration;
67 private Cache usersCache;
70 public DefaultRedbackRuntimeConfigurationAdmin( ArchivaConfiguration archivaConfiguration,//
72 value = "userConfiguration#redback" ) UserConfiguration userConfiguration,
73 @Named( value = "cache#users" ) Cache usersCache )
75 this.archivaConfiguration = archivaConfiguration;
76 this.userConfiguration = userConfiguration;
77 this.usersCache = usersCache;
81 public void initialize()
82 throws UserConfigurationException
86 RedbackRuntimeConfiguration redbackRuntimeConfiguration = getRedbackRuntimeConfiguration();
87 // migrate or not data from redback
88 if ( !redbackRuntimeConfiguration.isMigratedFromRedbackConfiguration() )
90 // not migrated so build a new fresh one
91 redbackRuntimeConfiguration = new RedbackRuntimeConfiguration();
92 // so migrate if available
93 String userManagerImpl =
94 userConfiguration.getConcatenatedList( UserConfigurationKeys.USER_MANAGER_IMPL, "jdo" );
95 if ( StringUtils.isNotEmpty( userManagerImpl ) )
97 String[] impls = StringUtils.split( userManagerImpl, ',' );
98 for ( String impl : impls )
100 redbackRuntimeConfiguration.getUserManagerImpls().add( impl );
104 String rbacManagerImpls =
105 userConfiguration.getConcatenatedList( UserConfigurationKeys.RBAC_MANAGER_IMPL, "jdo" );
107 if ( StringUtils.isNotEmpty( rbacManagerImpls ) )
109 String[] impls = StringUtils.split( rbacManagerImpls, ',' );
110 for ( String impl : impls )
112 redbackRuntimeConfiguration.getRbacManagerImpls().add( impl );
118 LdapConfiguration ldapConfiguration = redbackRuntimeConfiguration.getLdapConfiguration();
119 if ( ldapConfiguration == null )
121 ldapConfiguration = new LdapConfiguration();
122 redbackRuntimeConfiguration.setLdapConfiguration( ldapConfiguration );
125 ldapConfiguration.setHostName(
126 userConfiguration.getString( UserConfigurationKeys.LDAP_HOSTNAME, null ) );
127 ldapConfiguration.setPort( userConfiguration.getInt( UserConfigurationKeys.LDAP_PORT, -1 ) );
128 ldapConfiguration.setSsl( userConfiguration.getBoolean( UserConfigurationKeys.LDAP_SSL, false ) );
129 ldapConfiguration.setBaseDn(
130 userConfiguration.getConcatenatedList( UserConfigurationKeys.LDAP_BASEDN, null ) );
132 ldapConfiguration.setBaseGroupsDn(
133 userConfiguration.getConcatenatedList( UserConfigurationKeys.LDAP_GROUPS_BASEDN,
134 ldapConfiguration.getBaseDn() ) );
136 ldapConfiguration.setContextFactory(
137 userConfiguration.getString( UserConfigurationKeys.LDAP_CONTEX_FACTORY,
138 isSunContextFactoryAvailable()
139 ? "com.sun.jndi.ldap.LdapCtxFactory"
141 ldapConfiguration.setBindDn(
142 userConfiguration.getConcatenatedList( UserConfigurationKeys.LDAP_BINDDN, null ) );
143 ldapConfiguration.setPassword(
144 userConfiguration.getString( UserConfigurationKeys.LDAP_PASSWORD, null ) );
145 ldapConfiguration.setAuthenticationMethod(
146 userConfiguration.getString( UserConfigurationKeys.LDAP_AUTHENTICATION_METHOD, null ) );
148 ldapConfiguration.setWritable(
149 userConfiguration.getBoolean( UserConfigurationKeys.LDAP_WRITABLE, false ) );
151 ldapConfiguration.setUseRoleNameAsGroup(
152 userConfiguration.getBoolean( UserConfigurationKeys.LDAP_GROUPS_USE_ROLENAME, false ) );
154 boolean ldapBindAuthenticatorEnabled =
155 userConfiguration.getBoolean( UserConfigurationKeys.LDAP_BIND_AUTHENTICATOR_ENABLED, false );
156 ldapConfiguration.setBindAuthenticatorEnabled( ldapBindAuthenticatorEnabled );
158 // LDAP groups mapping reading !!
159 // UserConfigurationKeys.LDAP_GROUPS_ROLE_START_KEY
160 // userConfiguration.getKeys()
162 Collection<String> keys = userConfiguration.getKeys();
164 List<LdapGroupMapping> ldapGroupMappings = new ArrayList<LdapGroupMapping>();
166 for ( String key : keys )
168 if ( key.startsWith( UserConfigurationKeys.LDAP_GROUPS_ROLE_START_KEY ) )
171 StringUtils.substringAfter( key, UserConfigurationKeys.LDAP_GROUPS_ROLE_START_KEY );
172 String val = userConfiguration.getConcatenatedList( key, "" );
173 if ( !StringUtils.isEmpty( val ) )
175 String[] roles = StringUtils.split( val, ',' );
176 ldapGroupMappings.add( new LdapGroupMapping( group, roles ) );
181 redbackRuntimeConfiguration.setLdapGroupMappings( ldapGroupMappings );
183 redbackRuntimeConfiguration.setMigratedFromRedbackConfiguration( true );
185 updateRedbackRuntimeConfiguration( redbackRuntimeConfiguration );
188 // we must ensure userManagerImpls list is not empty if so put at least jdo one !
189 if ( redbackRuntimeConfiguration.getUserManagerImpls().isEmpty() )
192 "redbackRuntimeConfiguration with empty userManagerImpls so force at least jdo implementation !" );
193 redbackRuntimeConfiguration.getUserManagerImpls().add( "jdo" );
194 updateRedbackRuntimeConfiguration( redbackRuntimeConfiguration );
197 log.info( "using userManagerImpls: {}", redbackRuntimeConfiguration.getUserManagerImpls() );
200 // we ensure rbacManagerImpls is not empty if so put at least cached
201 if ( redbackRuntimeConfiguration.getRbacManagerImpls().isEmpty() )
204 "redbackRuntimeConfiguration with empty rbacManagerImpls so force at least cached implementation !" );
205 redbackRuntimeConfiguration.getRbacManagerImpls().add( "cached" );
206 updateRedbackRuntimeConfiguration( redbackRuntimeConfiguration );
209 log.info( "using rbacManagerImpls: {}", redbackRuntimeConfiguration.getRbacManagerImpls());
212 boolean save = false;
215 if ( redbackRuntimeConfiguration.getUsersCacheConfiguration() == null )
217 redbackRuntimeConfiguration.setUsersCacheConfiguration( new CacheConfiguration() );
219 // if -1 it means non initialized to take values from the spring bean
220 if ( redbackRuntimeConfiguration.getUsersCacheConfiguration().getTimeToIdleSeconds() < 0 )
222 redbackRuntimeConfiguration.getUsersCacheConfiguration().setTimeToIdleSeconds(
223 usersCache.getTimeToIdleSeconds() );
227 usersCache.setTimeToIdleSeconds(
228 redbackRuntimeConfiguration.getUsersCacheConfiguration().getTimeToIdleSeconds() );
230 if ( redbackRuntimeConfiguration.getUsersCacheConfiguration().getTimeToLiveSeconds() < 0 )
232 redbackRuntimeConfiguration.getUsersCacheConfiguration().setTimeToLiveSeconds(
233 usersCache.getTimeToLiveSeconds() );
237 usersCache.setTimeToLiveSeconds(
238 redbackRuntimeConfiguration.getUsersCacheConfiguration().getTimeToLiveSeconds() );
240 if ( redbackRuntimeConfiguration.getUsersCacheConfiguration().getMaxElementsInMemory() < 0 )
242 redbackRuntimeConfiguration.getUsersCacheConfiguration().setMaxElementsInMemory(
243 usersCache.getMaxElementsInMemory() );
246 usersCache.setMaxElementsInMemory(
247 redbackRuntimeConfiguration.getUsersCacheConfiguration().getMaxElementsInMemory() );
249 if ( redbackRuntimeConfiguration.getUsersCacheConfiguration().getMaxElementsOnDisk() < 0 )
251 redbackRuntimeConfiguration.getUsersCacheConfiguration().setMaxElementsOnDisk(
252 usersCache.getMaxElementsOnDisk() );
255 usersCache.setMaxElementsOnDisk(
256 redbackRuntimeConfiguration.getUsersCacheConfiguration().getMaxElementsOnDisk() );
260 updateRedbackRuntimeConfiguration( redbackRuntimeConfiguration );
264 catch ( RepositoryAdminException e )
266 throw new UserConfigurationException( e.getMessage(), e );
270 private boolean isSunContextFactoryAvailable()
274 return Thread.currentThread().getContextClassLoader().loadClass( "com.sun.jndi.ldap.LdapCtxFactory" )
277 catch ( ClassNotFoundException e )
283 public RedbackRuntimeConfiguration getRedbackRuntimeConfiguration()
285 return build( archivaConfiguration.getConfiguration().getRedbackRuntimeConfiguration() );
288 public void updateRedbackRuntimeConfiguration( RedbackRuntimeConfiguration redbackRuntimeConfiguration )
289 throws RepositoryAdminException
291 org.apache.archiva.configuration.RedbackRuntimeConfiguration runtimeConfiguration =
292 build( redbackRuntimeConfiguration );
293 Configuration configuration = archivaConfiguration.getConfiguration();
294 configuration.setRedbackRuntimeConfiguration( runtimeConfiguration );
297 archivaConfiguration.save( configuration );
299 catch ( RegistryException e )
301 throw new RepositoryAdminException( e.getMessage(), e );
303 catch ( IndeterminateConfigurationException e )
305 throw new RepositoryAdminException( e.getMessage(), e );
309 private RedbackRuntimeConfiguration build(
310 org.apache.archiva.configuration.RedbackRuntimeConfiguration runtimeConfiguration )
312 RedbackRuntimeConfiguration redbackRuntimeConfiguration =
313 getModelMapper().map( runtimeConfiguration, RedbackRuntimeConfiguration.class );
315 if ( runtimeConfiguration.getLdapConfiguration() != null )
317 redbackRuntimeConfiguration.setLdapConfiguration(
318 getModelMapper().map( runtimeConfiguration.getLdapConfiguration(), LdapConfiguration.class ) );
321 if ( runtimeConfiguration.getUsersCacheConfiguration() != null )
323 redbackRuntimeConfiguration.setUsersCacheConfiguration(
324 getModelMapper().map( runtimeConfiguration.getUsersCacheConfiguration(), CacheConfiguration.class ) );
327 if ( redbackRuntimeConfiguration.getLdapConfiguration() == null )
330 redbackRuntimeConfiguration.setLdapConfiguration( new LdapConfiguration() );
333 if ( redbackRuntimeConfiguration.getUsersCacheConfiguration() == null )
335 redbackRuntimeConfiguration.setUsersCacheConfiguration( new CacheConfiguration() );
338 List<org.apache.archiva.configuration.LdapGroupMapping> mappings = runtimeConfiguration.getLdapGroupMappings();
340 if ( mappings != null && mappings.size() > 0 )
342 List<LdapGroupMapping> ldapGroupMappings = new ArrayList<LdapGroupMapping>( mappings.size() );
344 for ( org.apache.archiva.configuration.LdapGroupMapping mapping : mappings )
346 ldapGroupMappings.add( new LdapGroupMapping( mapping.getGroup(), mapping.getRoleNames() ) );
349 redbackRuntimeConfiguration.setLdapGroupMappings( ldapGroupMappings );
352 cleanupProperties( redbackRuntimeConfiguration );
354 return redbackRuntimeConfiguration;
358 * cleaning from map properties used directly in archiva configuration fields
360 * @param redbackRuntimeConfiguration
362 private void cleanupProperties( RedbackRuntimeConfiguration redbackRuntimeConfiguration )
364 Map<String, String> properties = redbackRuntimeConfiguration.getConfigurationProperties();
365 properties.remove( UserConfigurationKeys.LDAP_HOSTNAME );
366 properties.remove( UserConfigurationKeys.LDAP_PORT );
367 properties.remove( UserConfigurationKeys.LDAP_BIND_AUTHENTICATOR_ENABLED );
368 properties.remove( UserConfigurationKeys.LDAP_SSL );
369 properties.remove( UserConfigurationKeys.LDAP_BASEDN );
370 properties.remove( UserConfigurationKeys.LDAP_GROUPS_BASEDN );
371 properties.remove( UserConfigurationKeys.LDAP_CONTEX_FACTORY );
372 properties.remove( UserConfigurationKeys.LDAP_BINDDN );
373 properties.remove( UserConfigurationKeys.LDAP_PASSWORD );
374 properties.remove( UserConfigurationKeys.LDAP_AUTHENTICATION_METHOD );
375 properties.remove( UserConfigurationKeys.LDAP_WRITABLE );
376 properties.remove( UserConfigurationKeys.LDAP_GROUPS_USE_ROLENAME );
377 // cleanup groups <-> role mapping
378 /**for ( Map.Entry<String, String> entry : new HashMap<String, String>( properties ).entrySet() )
380 if ( entry.getKey().startsWith( UserConfigurationKeys.LDAP_GROUPS_ROLE_START_KEY ) )
382 properties.remove( entry.getKey() );
387 private org.apache.archiva.configuration.RedbackRuntimeConfiguration build(
388 RedbackRuntimeConfiguration redbackRuntimeConfiguration )
390 org.apache.archiva.configuration.RedbackRuntimeConfiguration res =
391 getModelMapper().map( redbackRuntimeConfiguration,
392 org.apache.archiva.configuration.RedbackRuntimeConfiguration.class );
394 if ( redbackRuntimeConfiguration.getLdapConfiguration() == null )
396 redbackRuntimeConfiguration.setLdapConfiguration( new LdapConfiguration() );
398 res.setLdapConfiguration( getModelMapper().map( redbackRuntimeConfiguration.getLdapConfiguration(),
399 org.apache.archiva.configuration.LdapConfiguration.class ) );
401 if ( redbackRuntimeConfiguration.getUsersCacheConfiguration() == null )
403 redbackRuntimeConfiguration.setUsersCacheConfiguration( new CacheConfiguration() );
406 res.setUsersCacheConfiguration( getModelMapper().map( redbackRuntimeConfiguration.getUsersCacheConfiguration(),
407 org.apache.archiva.configuration.CacheConfiguration.class ) );
409 List<LdapGroupMapping> ldapGroupMappings = redbackRuntimeConfiguration.getLdapGroupMappings();
411 if ( ldapGroupMappings != null && ldapGroupMappings.size() > 0 )
414 List<org.apache.archiva.configuration.LdapGroupMapping> mappings =
415 new ArrayList<org.apache.archiva.configuration.LdapGroupMapping>( ldapGroupMappings.size() );
417 for ( LdapGroupMapping ldapGroupMapping : ldapGroupMappings )
420 org.apache.archiva.configuration.LdapGroupMapping mapping =
421 new org.apache.archiva.configuration.LdapGroupMapping();
422 mapping.setGroup( ldapGroupMapping.getGroup() );
423 mapping.setRoleNames( new ArrayList<String>( ldapGroupMapping.getRoleNames() ) );
424 mappings.add( mapping );
427 res.setLdapGroupMappings( mappings );
432 // wrapper for UserConfiguration to intercept values (and store it not yet migrated)
435 public String getString( String key )
437 if ( UserConfigurationKeys.USER_MANAGER_IMPL.equals( key ) )
439 // possible false for others than archiva user manager
440 return getRedbackRuntimeConfiguration().getUserManagerImpls().get( 0 );
443 if ( StringUtils.startsWith( key, UserConfigurationKeys.LDAP_GROUPS_ROLE_START_KEY ) )
445 RedbackRuntimeConfiguration redbackRuntimeConfiguration = getRedbackRuntimeConfiguration();
446 int index = redbackRuntimeConfiguration.getLdapGroupMappings().indexOf( new LdapGroupMapping(
447 StringUtils.substringAfter( key, UserConfigurationKeys.LDAP_GROUPS_ROLE_START_KEY ) ) );
450 return StringUtils.join( redbackRuntimeConfiguration.getLdapGroupMappings().get( index ).getRoleNames(),
455 RedbackRuntimeConfiguration conf = getRedbackRuntimeConfiguration();
457 if ( conf.getConfigurationProperties().containsKey( key ) )
459 return conf.getConfigurationProperties().get( key );
462 String value = userConfiguration.getString( key );
467 conf.getConfigurationProperties().put( key, value );
471 updateRedbackRuntimeConfiguration( conf );
473 catch ( RepositoryAdminException e )
475 log.error( "fail to save RedbackRuntimeConfiguration: {}", e.getMessage(), e );
476 throw new RuntimeException( e.getMessage(), e );
482 public String getString( String key, String defaultValue )
484 if ( UserConfigurationKeys.LDAP_HOSTNAME.equals( key ) )
486 return getRedbackRuntimeConfiguration().getLdapConfiguration().getHostName();
488 if ( UserConfigurationKeys.LDAP_CONTEX_FACTORY.equals( key ) )
490 return getRedbackRuntimeConfiguration().getLdapConfiguration().getContextFactory();
492 if ( UserConfigurationKeys.LDAP_PASSWORD.equals( key ) )
494 return getRedbackRuntimeConfiguration().getLdapConfiguration().getPassword();
496 if ( UserConfigurationKeys.LDAP_AUTHENTICATION_METHOD.equals( key ) )
498 return getRedbackRuntimeConfiguration().getLdapConfiguration().getAuthenticationMethod();
501 RedbackRuntimeConfiguration conf = getRedbackRuntimeConfiguration();
503 if ( conf.getConfigurationProperties().containsKey( key ) )
505 return conf.getConfigurationProperties().get( key );
508 String value = userConfiguration.getString( key, defaultValue );
515 conf.getConfigurationProperties().put( key, value );
518 updateRedbackRuntimeConfiguration( conf );
520 catch ( RepositoryAdminException e )
522 log.error( "fail to save RedbackRuntimeConfiguration: {}", e.getMessage(), e );
523 throw new RuntimeException( e.getMessage(), e );
529 public int getInt( String key )
531 RedbackRuntimeConfiguration conf = getRedbackRuntimeConfiguration();
533 if ( conf.getConfigurationProperties().containsKey( key ) )
535 return Integer.valueOf( conf.getConfigurationProperties().get( key ) );
538 int value = userConfiguration.getInt( key );
540 conf.getConfigurationProperties().put( key, Integer.toString( value ) );
543 updateRedbackRuntimeConfiguration( conf );
545 catch ( RepositoryAdminException e )
547 log.error( "fail to save RedbackRuntimeConfiguration: {}", e.getMessage(), e );
548 throw new RuntimeException( e.getMessage(), e );
554 public int getInt( String key, int defaultValue )
556 if ( UserConfigurationKeys.LDAP_PORT.equals( key ) )
558 return getRedbackRuntimeConfiguration().getLdapConfiguration().getPort();
561 RedbackRuntimeConfiguration conf = getRedbackRuntimeConfiguration();
563 if ( conf.getConfigurationProperties().containsKey( key ) )
565 return Integer.valueOf( conf.getConfigurationProperties().get( key ) );
568 int value = userConfiguration.getInt( key, defaultValue );
570 conf.getConfigurationProperties().put( key, Integer.toString( value ) );
573 updateRedbackRuntimeConfiguration( conf );
575 catch ( RepositoryAdminException e )
577 log.error( "fail to save RedbackRuntimeConfiguration: {}", e.getMessage(), e );
578 throw new RuntimeException( e.getMessage(), e );
584 public boolean getBoolean( String key )
586 RedbackRuntimeConfiguration conf = getRedbackRuntimeConfiguration();
588 if ( UserConfigurationKeys.LDAP_WRITABLE.equals( key ) )
590 return conf.getLdapConfiguration().isWritable();
593 if ( UserConfigurationKeys.LDAP_GROUPS_USE_ROLENAME.equals( key ) )
595 return conf.getLdapConfiguration().isUseRoleNameAsGroup();
598 if ( UserConfigurationKeys.LDAP_BIND_AUTHENTICATOR_ENABLED.equals( key ) )
600 return conf.getLdapConfiguration().isBindAuthenticatorEnabled();
603 if ( conf.getConfigurationProperties().containsKey( key ) )
605 return Boolean.valueOf( conf.getConfigurationProperties().get( key ) );
608 boolean value = userConfiguration.getBoolean( key );
610 conf.getConfigurationProperties().put( key, Boolean.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 );
624 public boolean getBoolean( String key, boolean defaultValue )
626 if ( UserConfigurationKeys.LDAP_SSL.equals( key ) )
628 return getRedbackRuntimeConfiguration().getLdapConfiguration().isSsl();
631 if ( UserConfigurationKeys.LDAP_WRITABLE.equals( key ) )
633 return getRedbackRuntimeConfiguration().getLdapConfiguration().isWritable();
636 if ( UserConfigurationKeys.LDAP_GROUPS_USE_ROLENAME.equals( key ) )
638 return getRedbackRuntimeConfiguration().getLdapConfiguration().isUseRoleNameAsGroup();
641 if ( UserConfigurationKeys.LDAP_BIND_AUTHENTICATOR_ENABLED.equals( key ) )
643 return getRedbackRuntimeConfiguration().getLdapConfiguration().isBindAuthenticatorEnabled();
646 RedbackRuntimeConfiguration conf = getRedbackRuntimeConfiguration();
648 if ( conf.getConfigurationProperties().containsKey( key ) )
650 return Boolean.valueOf( conf.getConfigurationProperties().get( key ) );
653 boolean value = userConfiguration.getBoolean( key, defaultValue );
655 conf.getConfigurationProperties().put( key, Boolean.toString( value ) );
658 updateRedbackRuntimeConfiguration( conf );
660 catch ( RepositoryAdminException e )
662 log.error( "fail to save RedbackRuntimeConfiguration: {}", e.getMessage(), e );
663 throw new RuntimeException( e.getMessage(), e );
669 public List<String> getList( String key )
671 List<String> value = userConfiguration.getList( key );
673 RedbackRuntimeConfiguration conf = getRedbackRuntimeConfiguration();
674 // TODO concat values
675 conf.getConfigurationProperties().put( key, "" );
678 updateRedbackRuntimeConfiguration( conf );
680 catch ( RepositoryAdminException e )
682 log.error( "fail to save RedbackRuntimeConfiguration: {}", e.getMessage(), e );
683 throw new RuntimeException( e.getMessage(), e );
689 public String getConcatenatedList( String key, String defaultValue )
691 if ( UserConfigurationKeys.LDAP_BASEDN.equals( key ) )
693 return getRedbackRuntimeConfiguration().getLdapConfiguration().getBaseDn();
695 if ( UserConfigurationKeys.LDAP_BINDDN.equals( key ) )
697 return getRedbackRuntimeConfiguration().getLdapConfiguration().getBindDn();
699 if ( UserConfigurationKeys.LDAP_GROUPS_BASEDN.equals( key ) )
701 return getRedbackRuntimeConfiguration().getLdapConfiguration().getBaseGroupsDn();
703 return userConfiguration.getConcatenatedList( key, defaultValue );
706 public Collection<String> getKeys()
708 Collection<String> keys = userConfiguration.getKeys();
710 Set<String> keysSet = new HashSet<String>( keys );
712 keysSet.addAll( getRedbackRuntimeConfiguration().getConfigurationProperties().keySet() );