]> source.dussan.org Git - archiva.git/blob
cf12b6877ccc7ede8b915571b42017cb0f22eb9d
[archiva.git] /
1 package org.apache.archiva.admin.repository.runtime;
2 /*
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
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
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
18  * under the License.
19  */
20
21 import net.sf.beanlib.provider.replicator.BeanReplicator;
22 import org.apache.archiva.admin.model.RepositoryAdminException;
23 import org.apache.archiva.admin.model.beans.CacheConfiguration;
24 import org.apache.archiva.admin.model.beans.LdapConfiguration;
25 import org.apache.archiva.admin.model.beans.RedbackRuntimeConfiguration;
26 import org.apache.archiva.admin.model.runtime.RedbackRuntimeConfigurationAdmin;
27 import org.apache.archiva.configuration.ArchivaConfiguration;
28 import org.apache.archiva.configuration.Configuration;
29 import org.apache.archiva.configuration.IndeterminateConfigurationException;
30 import org.apache.archiva.redback.components.cache.Cache;
31 import org.apache.archiva.redback.components.registry.RegistryException;
32 import org.apache.archiva.redback.configuration.UserConfiguration;
33 import org.apache.archiva.redback.configuration.UserConfigurationException;
34 import org.apache.archiva.redback.configuration.UserConfigurationKeys;
35 import org.apache.commons.lang.StringUtils;
36 import org.slf4j.Logger;
37 import org.slf4j.LoggerFactory;
38 import org.springframework.stereotype.Service;
39
40 import javax.annotation.PostConstruct;
41 import javax.inject.Inject;
42 import javax.inject.Named;
43 import java.util.Collection;
44 import java.util.HashMap;
45 import java.util.HashSet;
46 import java.util.List;
47 import java.util.Map;
48 import java.util.Set;
49
50 /**
51  * @author Olivier Lamy
52  * @since 1.4-M4
53  */
54 @Service( "userConfiguration#archiva" )
55 public class DefaultRedbackRuntimeConfigurationAdmin
56     implements RedbackRuntimeConfigurationAdmin, UserConfiguration
57 {
58
59     protected Logger log = LoggerFactory.getLogger( getClass() );
60
61     @Inject
62     private ArchivaConfiguration archivaConfiguration;
63
64     @Inject
65     @Named( value = "userConfiguration#redback" )
66     UserConfiguration userConfiguration;
67
68     @Inject
69     @Named( value = "cache#users" )
70     private Cache usersCache;
71
72     private RedbackRuntimeConfiguration currentRedbackRuntimeConfiguration;
73
74     @PostConstruct
75     public void initialize()
76         throws UserConfigurationException
77     {
78         try
79         {
80             RedbackRuntimeConfiguration redbackRuntimeConfiguration = getRedbackRuntimeConfiguration();
81             // migrate or not data from redback
82             if ( !redbackRuntimeConfiguration.isMigratedFromRedbackConfiguration() )
83             {
84                 // not migrated so build a new fresh one
85                 redbackRuntimeConfiguration = new RedbackRuntimeConfiguration();
86                 // so migrate if available
87                 String userManagerImpl =
88                     userConfiguration.getConcatenatedList( UserConfigurationKeys.USER_MANAGER_IMPL, "jdo" );
89                 if ( StringUtils.isNotEmpty( userManagerImpl ) )
90                 {
91                     String[] impls = StringUtils.split( userManagerImpl, ',' );
92                     for ( String impl : impls )
93                     {
94                         redbackRuntimeConfiguration.getUserManagerImpls().add( impl );
95                     }
96                 }
97
98                 String rbacManagerImpls =
99                     userConfiguration.getConcatenatedList( UserConfigurationKeys.RBAC_MANAGER_IMPL, "cached" );
100
101                 if ( StringUtils.isNotEmpty( rbacManagerImpls ) )
102                 {
103                     String[] impls = StringUtils.split( rbacManagerImpls, ',' );
104                     for ( String impl : impls )
105                     {
106                         redbackRuntimeConfiguration.getRbacManagerImpls().add( impl );
107                     }
108                 }
109
110                 // now ldap
111
112                 LdapConfiguration ldapConfiguration = redbackRuntimeConfiguration.getLdapConfiguration();
113                 if ( ldapConfiguration == null )
114                 {
115                     ldapConfiguration = new LdapConfiguration();
116                     redbackRuntimeConfiguration.setLdapConfiguration( ldapConfiguration );
117                 }
118
119                 ldapConfiguration.setHostName(
120                     userConfiguration.getString( UserConfigurationKeys.LDAP_HOSTNAME, null ) );
121                 ldapConfiguration.setPort( userConfiguration.getInt( UserConfigurationKeys.LDAP_PORT, -1 ) );
122                 ldapConfiguration.setSsl( userConfiguration.getBoolean( UserConfigurationKeys.LDAP_SSL, false ) );
123                 ldapConfiguration.setBaseDn(
124                     userConfiguration.getConcatenatedList( UserConfigurationKeys.LDAP_BASEDN, null ) );
125
126                 ldapConfiguration.setBaseGroupsDn(
127                     userConfiguration.getConcatenatedList( UserConfigurationKeys.LDAP_GROUPS_BASEDN,
128                                                            ldapConfiguration.getBaseDn() ) );
129
130                 ldapConfiguration.setContextFactory(
131                     userConfiguration.getString( UserConfigurationKeys.LDAP_CONTEX_FACTORY, null ) );
132                 ldapConfiguration.setBindDn(
133                     userConfiguration.getConcatenatedList( UserConfigurationKeys.LDAP_BINDDN, null ) );
134                 ldapConfiguration.setPassword(
135                     userConfiguration.getString( UserConfigurationKeys.LDAP_PASSWORD, null ) );
136                 ldapConfiguration.setAuthenticationMethod(
137                     userConfiguration.getString( UserConfigurationKeys.LDAP_AUTHENTICATION_METHOD, null ) );
138
139                 ldapConfiguration.setWritable(
140                     userConfiguration.getBoolean( UserConfigurationKeys.LDAP_WRITABLE, false ) );
141
142                 ldapConfiguration.setUseRoleNameAsGroup(
143                     userConfiguration.getBoolean( UserConfigurationKeys.LDAP_GROUPS_USE_ROLENAME, false ) );
144
145                 ldapConfiguration.setBindAuthenticatorEnabled(
146                     userConfiguration.getBoolean( UserConfigurationKeys.LDAP_BIND_AUTHENTICATOR_ENABLED, false ) );
147
148                 redbackRuntimeConfiguration.setMigratedFromRedbackConfiguration( true );
149
150                 updateRedbackRuntimeConfiguration( redbackRuntimeConfiguration );
151
152             }
153             // we must ensure userManagerImpls list is not empty if so put at least jdo one !
154             if ( redbackRuntimeConfiguration.getUserManagerImpls().isEmpty() )
155             {
156                 log.info(
157                     "redbackRuntimeConfiguration with empty userManagerImpls so force at least jdo implementation !" );
158                 redbackRuntimeConfiguration.getUserManagerImpls().add( "jdo" );
159                 updateRedbackRuntimeConfiguration( redbackRuntimeConfiguration );
160             }
161
162             // we ensure authorizerImpls is not empty if so put
163             if ( redbackRuntimeConfiguration.getRbacManagerImpls().isEmpty() )
164             {
165                 log.info(
166                     "redbackRuntimeConfiguration with empty rbacManagerImpls so force at least cached implementation !" );
167                 redbackRuntimeConfiguration.getRbacManagerImpls().add( "cached" );
168                 updateRedbackRuntimeConfiguration( redbackRuntimeConfiguration );
169             }
170
171             boolean save = false;
172
173             // NPE free
174             if ( redbackRuntimeConfiguration.getUsersCacheConfiguration() == null )
175             {
176                 redbackRuntimeConfiguration.setUsersCacheConfiguration( new CacheConfiguration() );
177             }
178             // if -1 it means non initialized to take values from the spring bean
179             if ( redbackRuntimeConfiguration.getUsersCacheConfiguration().getTimeToIdleSeconds() < 0 )
180             {
181                 redbackRuntimeConfiguration.getUsersCacheConfiguration().setTimeToIdleSeconds(
182                     usersCache.getTimeToIdleSeconds() );
183                 save = true;
184
185             }
186             usersCache.setTimeToIdleSeconds(
187                 redbackRuntimeConfiguration.getUsersCacheConfiguration().getTimeToIdleSeconds() );
188
189             if ( redbackRuntimeConfiguration.getUsersCacheConfiguration().getTimeToLiveSeconds() < 0 )
190             {
191                 redbackRuntimeConfiguration.getUsersCacheConfiguration().setTimeToLiveSeconds(
192                     usersCache.getTimeToLiveSeconds() );
193                 save = true;
194
195             }
196             usersCache.setTimeToLiveSeconds(
197                 redbackRuntimeConfiguration.getUsersCacheConfiguration().getTimeToLiveSeconds() );
198
199             if ( redbackRuntimeConfiguration.getUsersCacheConfiguration().getMaxElementsInMemory() < 0 )
200             {
201                 redbackRuntimeConfiguration.getUsersCacheConfiguration().setMaxElementsInMemory(
202                     usersCache.getMaxElementsInMemory() );
203                 save = true;
204             }
205             usersCache.setMaxElementsInMemory(
206                 redbackRuntimeConfiguration.getUsersCacheConfiguration().getMaxElementsInMemory() );
207
208             if ( redbackRuntimeConfiguration.getUsersCacheConfiguration().getMaxElementsOnDisk() < 0 )
209             {
210                 redbackRuntimeConfiguration.getUsersCacheConfiguration().setMaxElementsOnDisk(
211                     usersCache.getMaxElementsOnDisk() );
212                 save = true;
213             }
214             usersCache.setMaxElementsOnDisk(
215                 redbackRuntimeConfiguration.getUsersCacheConfiguration().getMaxElementsOnDisk() );
216
217             if ( save )
218             {
219                 updateRedbackRuntimeConfiguration( redbackRuntimeConfiguration );
220             }
221
222             this.currentRedbackRuntimeConfiguration = redbackRuntimeConfiguration;
223
224         }
225         catch ( RepositoryAdminException e )
226         {
227             throw new UserConfigurationException( e.getMessage(), e );
228         }
229     }
230
231     public RedbackRuntimeConfiguration getRedbackRuntimeConfiguration()
232     {
233         return build( archivaConfiguration.getConfiguration().getRedbackRuntimeConfiguration() );
234     }
235
236     public void updateRedbackRuntimeConfiguration( RedbackRuntimeConfiguration redbackRuntimeConfiguration )
237         throws RepositoryAdminException
238     {
239         org.apache.archiva.configuration.RedbackRuntimeConfiguration runtimeConfiguration =
240             build( redbackRuntimeConfiguration );
241         Configuration configuration = archivaConfiguration.getConfiguration();
242         configuration.setRedbackRuntimeConfiguration( runtimeConfiguration );
243         try
244         {
245             archivaConfiguration.save( configuration );
246             this.currentRedbackRuntimeConfiguration = redbackRuntimeConfiguration;
247         }
248         catch ( RegistryException e )
249         {
250             throw new RepositoryAdminException( e.getMessage(), e );
251         }
252         catch ( IndeterminateConfigurationException e )
253         {
254             throw new RepositoryAdminException( e.getMessage(), e );
255         }
256     }
257
258     private RedbackRuntimeConfiguration build(
259         org.apache.archiva.configuration.RedbackRuntimeConfiguration runtimeConfiguration )
260     {
261         if ( this.currentRedbackRuntimeConfiguration != null )
262         {
263             return this.currentRedbackRuntimeConfiguration;
264         }
265         RedbackRuntimeConfiguration redbackRuntimeConfiguration =
266             new BeanReplicator().replicateBean( runtimeConfiguration, RedbackRuntimeConfiguration.class );
267
268         if ( runtimeConfiguration.getLdapConfiguration() != null )
269         {
270             redbackRuntimeConfiguration.setLdapConfiguration(
271                 new BeanReplicator().replicateBean( runtimeConfiguration.getLdapConfiguration(),
272                                                     LdapConfiguration.class ) );
273         }
274
275         if ( runtimeConfiguration.getUsersCacheConfiguration() != null )
276         {
277             redbackRuntimeConfiguration.setUsersCacheConfiguration(
278                 new BeanReplicator().replicateBean( runtimeConfiguration.getUsersCacheConfiguration(),
279                                                     CacheConfiguration.class ) );
280         }
281
282         if ( redbackRuntimeConfiguration.getLdapConfiguration() == null )
283         {
284             // prevent NPE
285             redbackRuntimeConfiguration.setLdapConfiguration( new LdapConfiguration() );
286         }
287
288         if ( redbackRuntimeConfiguration.getUsersCacheConfiguration() == null )
289         {
290             redbackRuntimeConfiguration.setUsersCacheConfiguration( new CacheConfiguration() );
291         }
292
293         cleanupProperties( redbackRuntimeConfiguration );
294
295         this.currentRedbackRuntimeConfiguration = redbackRuntimeConfiguration;
296
297         return redbackRuntimeConfiguration;
298     }
299
300     /**
301      * cleaning from map properties used directly in archiva configuration fields
302      *
303      * @param redbackRuntimeConfiguration
304      */
305     private void cleanupProperties( RedbackRuntimeConfiguration redbackRuntimeConfiguration )
306     {
307         Map<String, String> properties = redbackRuntimeConfiguration.getConfigurationProperties();
308         properties.remove( UserConfigurationKeys.LDAP_HOSTNAME );
309         properties.remove( UserConfigurationKeys.LDAP_PORT );
310         properties.remove( UserConfigurationKeys.LDAP_BIND_AUTHENTICATOR_ENABLED );
311         properties.remove( UserConfigurationKeys.LDAP_SSL );
312         properties.remove( UserConfigurationKeys.LDAP_BASEDN );
313         properties.remove( UserConfigurationKeys.LDAP_GROUPS_BASEDN );
314         properties.remove( UserConfigurationKeys.LDAP_CONTEX_FACTORY );
315         properties.remove( UserConfigurationKeys.LDAP_BINDDN );
316         properties.remove( UserConfigurationKeys.LDAP_PASSWORD );
317         properties.remove( UserConfigurationKeys.LDAP_AUTHENTICATION_METHOD );
318         properties.remove( UserConfigurationKeys.LDAP_WRITABLE );
319         properties.remove( UserConfigurationKeys.LDAP_GROUPS_USE_ROLENAME );
320         // cleanup groups <-> role mapping
321         /**for ( Map.Entry<String, String> entry : new HashMap<String, String>( properties ).entrySet() )
322          {
323          if ( entry.getKey().startsWith( UserConfigurationKeys.LDAP_GROUPS_ROLE_START_KEY ) )
324          {
325          properties.remove( entry.getKey() );
326          }
327          }*/
328     }
329
330     private org.apache.archiva.configuration.RedbackRuntimeConfiguration build(
331         RedbackRuntimeConfiguration archivaRuntimeConfiguration )
332     {
333         org.apache.archiva.configuration.RedbackRuntimeConfiguration redbackRuntimeConfiguration =
334             new BeanReplicator().replicateBean( archivaRuntimeConfiguration,
335                                                 org.apache.archiva.configuration.RedbackRuntimeConfiguration.class );
336
337         if ( archivaRuntimeConfiguration.getLdapConfiguration() == null )
338         {
339             archivaRuntimeConfiguration.setLdapConfiguration( new LdapConfiguration() );
340         }
341         redbackRuntimeConfiguration.setLdapConfiguration(
342             new BeanReplicator().replicateBean( archivaRuntimeConfiguration.getLdapConfiguration(),
343                                                 org.apache.archiva.configuration.LdapConfiguration.class ) );
344
345         if ( archivaRuntimeConfiguration.getUsersCacheConfiguration() == null )
346         {
347             archivaRuntimeConfiguration.setUsersCacheConfiguration( new CacheConfiguration() );
348         }
349
350         redbackRuntimeConfiguration.setUsersCacheConfiguration(
351             new BeanReplicator().replicateBean( archivaRuntimeConfiguration.getUsersCacheConfiguration(),
352                                                 org.apache.archiva.configuration.CacheConfiguration.class ) );
353
354         return redbackRuntimeConfiguration;
355     }
356
357     // wrapper for UserConfiguration to intercept values (and store it not yet migrated
358
359
360     public String getString( String key )
361     {
362         if ( UserConfigurationKeys.USER_MANAGER_IMPL.equals( key ) )
363         {
364             // possible false for others than archiva user manager
365             return getRedbackRuntimeConfiguration().getUserManagerImpls().get( 0 );
366         }
367
368         RedbackRuntimeConfiguration conf = getRedbackRuntimeConfiguration();
369
370         if ( conf.getConfigurationProperties().containsKey( key ) )
371         {
372             return conf.getConfigurationProperties().get( key );
373         }
374
375         String value = userConfiguration.getString( key );
376         if ( value == null )
377         {
378             return null;
379         }
380         conf.getConfigurationProperties().put( key, value );
381
382         try
383         {
384             updateRedbackRuntimeConfiguration( conf );
385         }
386         catch ( RepositoryAdminException e )
387         {
388             log.error( "fail to save RedbackRuntimeConfiguration: {}", e.getMessage(), e );
389             throw new RuntimeException( e.getMessage(), e );
390         }
391
392         return value;
393     }
394
395     public String getString( String key, String defaultValue )
396     {
397         if ( UserConfigurationKeys.LDAP_HOSTNAME.equals( key ) )
398         {
399             return getRedbackRuntimeConfiguration().getLdapConfiguration().getHostName();
400         }
401         if ( UserConfigurationKeys.LDAP_CONTEX_FACTORY.equals( key ) )
402         {
403             return getRedbackRuntimeConfiguration().getLdapConfiguration().getContextFactory();
404         }
405         if ( UserConfigurationKeys.LDAP_PASSWORD.equals( key ) )
406         {
407             return getRedbackRuntimeConfiguration().getLdapConfiguration().getPassword();
408         }
409         if ( UserConfigurationKeys.LDAP_AUTHENTICATION_METHOD.equals( key ) )
410         {
411             return getRedbackRuntimeConfiguration().getLdapConfiguration().getAuthenticationMethod();
412         }
413
414         RedbackRuntimeConfiguration conf = getRedbackRuntimeConfiguration();
415
416         if ( conf.getConfigurationProperties().containsKey( key ) )
417         {
418             return conf.getConfigurationProperties().get( key );
419         }
420
421         String value = userConfiguration.getString( key, defaultValue );
422
423         if ( value == null )
424         {
425             return null;
426         }
427
428         conf.getConfigurationProperties().put( key, value );
429         try
430         {
431             updateRedbackRuntimeConfiguration( conf );
432         }
433         catch ( RepositoryAdminException e )
434         {
435             log.error( "fail to save RedbackRuntimeConfiguration: {}", e.getMessage(), e );
436             throw new RuntimeException( e.getMessage(), e );
437         }
438
439         return value;
440     }
441
442     public int getInt( String key )
443     {
444         RedbackRuntimeConfiguration conf = getRedbackRuntimeConfiguration();
445
446         if ( conf.getConfigurationProperties().containsKey( key ) )
447         {
448             return Integer.valueOf( conf.getConfigurationProperties().get( key ) );
449         }
450
451         int value = userConfiguration.getInt( key );
452
453         conf.getConfigurationProperties().put( key, Integer.toString( value ) );
454         try
455         {
456             updateRedbackRuntimeConfiguration( conf );
457         }
458         catch ( RepositoryAdminException e )
459         {
460             log.error( "fail to save RedbackRuntimeConfiguration: {}", e.getMessage(), e );
461             throw new RuntimeException( e.getMessage(), e );
462         }
463
464         return value;
465     }
466
467     public int getInt( String key, int defaultValue )
468     {
469         if ( UserConfigurationKeys.LDAP_PORT.equals( key ) )
470         {
471             return getRedbackRuntimeConfiguration().getLdapConfiguration().getPort();
472         }
473
474         RedbackRuntimeConfiguration conf = getRedbackRuntimeConfiguration();
475
476         if ( conf.getConfigurationProperties().containsKey( key ) )
477         {
478             return Integer.valueOf( conf.getConfigurationProperties().get( key ) );
479         }
480
481         int value = userConfiguration.getInt( key, defaultValue );
482
483         conf.getConfigurationProperties().put( key, Integer.toString( value ) );
484         try
485         {
486             updateRedbackRuntimeConfiguration( conf );
487         }
488         catch ( RepositoryAdminException e )
489         {
490             log.error( "fail to save RedbackRuntimeConfiguration: {}", e.getMessage(), e );
491             throw new RuntimeException( e.getMessage(), e );
492         }
493
494         return value;
495     }
496
497     public boolean getBoolean( String key )
498     {
499         RedbackRuntimeConfiguration conf = getRedbackRuntimeConfiguration();
500
501         if ( UserConfigurationKeys.LDAP_WRITABLE.equals( key ) )
502         {
503             return conf.getLdapConfiguration().isWritable();
504         }
505
506         if ( UserConfigurationKeys.LDAP_GROUPS_USE_ROLENAME.equals( key ) )
507         {
508             return conf.getLdapConfiguration().isUseRoleNameAsGroup();
509         }
510
511         if ( UserConfigurationKeys.LDAP_BIND_AUTHENTICATOR_ENABLED.equals( key ) )
512         {
513             return conf.getLdapConfiguration().isBindAuthenticatorEnabled();
514         }
515
516         if ( conf.getConfigurationProperties().containsKey( key ) )
517         {
518             return Boolean.valueOf( conf.getConfigurationProperties().get( key ) );
519         }
520
521         boolean value = userConfiguration.getBoolean( key );
522
523         conf.getConfigurationProperties().put( key, Boolean.toString( value ) );
524         try
525         {
526             updateRedbackRuntimeConfiguration( conf );
527         }
528         catch ( RepositoryAdminException e )
529         {
530             log.error( "fail to save RedbackRuntimeConfiguration: {}", e.getMessage(), e );
531             throw new RuntimeException( e.getMessage(), e );
532         }
533
534         return value;
535     }
536
537     public boolean getBoolean( String key, boolean defaultValue )
538     {
539         if ( UserConfigurationKeys.LDAP_SSL.equals( key ) )
540         {
541             return getRedbackRuntimeConfiguration().getLdapConfiguration().isSsl();
542         }
543
544         if ( UserConfigurationKeys.LDAP_WRITABLE.equals( key ) )
545         {
546             return getRedbackRuntimeConfiguration().getLdapConfiguration().isWritable();
547         }
548
549         if ( UserConfigurationKeys.LDAP_GROUPS_USE_ROLENAME.equals( key ) )
550         {
551             return getRedbackRuntimeConfiguration().getLdapConfiguration().isUseRoleNameAsGroup();
552         }
553
554         if ( UserConfigurationKeys.LDAP_BIND_AUTHENTICATOR_ENABLED.equals( key ) )
555         {
556             return getRedbackRuntimeConfiguration().getLdapConfiguration().isBindAuthenticatorEnabled();
557         }
558
559         RedbackRuntimeConfiguration conf = getRedbackRuntimeConfiguration();
560
561         if ( conf.getConfigurationProperties().containsKey( key ) )
562         {
563             return Boolean.valueOf( conf.getConfigurationProperties().get( key ) );
564         }
565
566         boolean value = userConfiguration.getBoolean( key, defaultValue );
567
568         conf.getConfigurationProperties().put( key, Boolean.toString( value ) );
569         try
570         {
571             updateRedbackRuntimeConfiguration( conf );
572         }
573         catch ( RepositoryAdminException e )
574         {
575             log.error( "fail to save RedbackRuntimeConfiguration: {}", e.getMessage(), e );
576             throw new RuntimeException( e.getMessage(), e );
577         }
578
579         return value;
580     }
581
582     public List<String> getList( String key )
583     {
584         List<String> value = userConfiguration.getList( key );
585
586         RedbackRuntimeConfiguration conf = getRedbackRuntimeConfiguration();
587         // TODO concat values
588         conf.getConfigurationProperties().put( key, "" );
589         try
590         {
591             updateRedbackRuntimeConfiguration( conf );
592         }
593         catch ( RepositoryAdminException e )
594         {
595             log.error( "fail to save RedbackRuntimeConfiguration: {}", e.getMessage(), e );
596             throw new RuntimeException( e.getMessage(), e );
597         }
598
599         return value;
600     }
601
602     public String getConcatenatedList( String key, String defaultValue )
603     {
604         if ( UserConfigurationKeys.LDAP_BASEDN.equals( key ) )
605         {
606             return getRedbackRuntimeConfiguration().getLdapConfiguration().getBaseDn();
607         }
608         if ( UserConfigurationKeys.LDAP_BINDDN.equals( key ) )
609         {
610             return getRedbackRuntimeConfiguration().getLdapConfiguration().getBindDn();
611         }
612         if ( UserConfigurationKeys.LDAP_GROUPS_BASEDN.equals( key ) )
613         {
614             return getRedbackRuntimeConfiguration().getLdapConfiguration().getBaseGroupsDn();
615         }
616         return userConfiguration.getConcatenatedList( key, defaultValue );
617     }
618
619     public Collection<String> getKeys()
620     {
621         Collection<String> keys = userConfiguration.getKeys();
622
623         Set<String> keysSet = new HashSet<String>( keys );
624
625         keysSet.addAll( getRedbackRuntimeConfiguration().getConfigurationProperties().keySet() );
626
627         return keysSet;
628     }
629 }