no need to expose keys which are stored in archiva configuration

git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1445899 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Olivier Lamy 2013-02-13 20:21:33 +00:00
parent 1e890d9d07
commit dd4703f181
1 changed files with 38 additions and 4 deletions

View File

@ -41,15 +41,17 @@ import javax.annotation.PostConstruct;
import javax.inject.Inject; import javax.inject.Inject;
import javax.inject.Named; import javax.inject.Named;
import java.util.Collection; import java.util.Collection;
import java.util.HashMap;
import java.util.HashSet; import java.util.HashSet;
import java.util.List; import java.util.List;
import java.util.Map;
import java.util.Set; import java.util.Set;
/** /**
* @author Olivier Lamy * @author Olivier Lamy
* @since 1.4-M4 * @since 1.4-M4
*/ */
@Service("userConfiguration#archiva") @Service( "userConfiguration#archiva" )
public class DefaultRedbackRuntimeConfigurationAdmin public class DefaultRedbackRuntimeConfigurationAdmin
implements RedbackRuntimeConfigurationAdmin, UserConfiguration implements RedbackRuntimeConfigurationAdmin, UserConfiguration
{ {
@ -60,11 +62,11 @@ public class DefaultRedbackRuntimeConfigurationAdmin
private ArchivaConfiguration archivaConfiguration; private ArchivaConfiguration archivaConfiguration;
@Inject @Inject
@Named(value = "userConfiguration#redback") @Named( value = "userConfiguration#redback" )
UserConfiguration userConfiguration; UserConfiguration userConfiguration;
@Inject @Inject
@Named(value = "cache#users") @Named( value = "cache#users" )
private Cache usersCache; private Cache usersCache;
@PostConstruct @PostConstruct
@ -279,7 +281,39 @@ public class DefaultRedbackRuntimeConfigurationAdmin
redbackRuntimeConfiguration.setUsersCacheConfiguration( new CacheConfiguration() ); redbackRuntimeConfiguration.setUsersCacheConfiguration( new CacheConfiguration() );
} }
return redbackRuntimeConfiguration; cleanupProperties( redbackRuntimeConfiguration );
t return redbackRuntimeConfiguration;
}
/**
* cleaning from map properties used directly in archiva configuration fields
*
* @param redbackRuntimeConfiguration
*/
private void cleanupProperties( RedbackRuntimeConfiguration redbackRuntimeConfiguration )
{
Map<String, String> properties = redbackRuntimeConfiguration.getConfigurationProperties();
properties.remove( UserConfigurationKeys.LDAP_HOSTNAME );
properties.remove( UserConfigurationKeys.LDAP_PORT );
properties.remove( UserConfigurationKeys.LDAP_BIND_AUTHENTICATOR_ENABLED );
properties.remove( UserConfigurationKeys.LDAP_SSL );
properties.remove( UserConfigurationKeys.LDAP_BASEDN );
properties.remove( UserConfigurationKeys.LDAP_GROUPS_BASEDN );
properties.remove( UserConfigurationKeys.LDAP_CONTEX_FACTORY );
properties.remove( UserConfigurationKeys.LDAP_BINDDN );
properties.remove( UserConfigurationKeys.LDAP_PASSWORD );
properties.remove( UserConfigurationKeys.LDAP_AUTHENTICATION_METHOD );
properties.remove( UserConfigurationKeys.LDAP_WRITABLE );
properties.remove( UserConfigurationKeys.LDAP_GROUPS_USE_ROLENAME );
// cleanup groups <-> role mapping
for ( Map.Entry<String, String> entry : new HashMap<String, String>( properties ).entrySet() )
{
if ( entry.getKey().startsWith( UserConfigurationKeys.LDAP_GROUPS_ROLE_START_KEY ) )
{
properties.remove( entry.getKey() );
}
}
} }
private org.apache.archiva.configuration.RedbackRuntimeConfiguration build( private org.apache.archiva.configuration.RedbackRuntimeConfiguration build(