moving configuration keys to a constant class
git-svn-id: https://svn.apache.org/repos/asf/archiva/redback/redback-core/trunk@1417396 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
eef9c73382
commit
3c6f8dc455
|
@ -20,6 +20,7 @@ package org.apache.archiva.redback.common.ldap;
|
|||
*/
|
||||
|
||||
import org.apache.archiva.redback.configuration.UserConfiguration;
|
||||
import org.apache.archiva.redback.configuration.UserConfigurationKeys;
|
||||
import org.apache.archiva.redback.users.User;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
@ -33,7 +34,6 @@ import java.util.Date;
|
|||
|
||||
/**
|
||||
* @author <a href="jesse@codehaus.org"> jesse
|
||||
*
|
||||
*/
|
||||
@Service( "userMapper#ldap" )
|
||||
public class LdapUserMapper
|
||||
|
@ -86,14 +86,17 @@ public class LdapUserMapper
|
|||
@PostConstruct
|
||||
public void initialize()
|
||||
{
|
||||
emailAttribute = userConf.getString( "ldap.config.mapper.attribute.email", emailAttribute );
|
||||
fullNameAttribute = userConf.getString( "ldap.config.mapper.attribute.fullname", fullNameAttribute );
|
||||
passwordAttribute = userConf.getString( "ldap.config.mapper.attribute.password", passwordAttribute );
|
||||
userIdAttribute = userConf.getString( "ldap.config.mapper.attribute.user.id", userIdAttribute );
|
||||
emailAttribute = userConf.getString( UserConfigurationKeys.LDAP_MAPPER_ATTRIBUTE_EMAIL, emailAttribute );
|
||||
fullNameAttribute =
|
||||
userConf.getString( UserConfigurationKeys.LDAP_MAPPER_ATTRIBUTE_FULLNAME, fullNameAttribute );
|
||||
passwordAttribute =
|
||||
userConf.getString( UserConfigurationKeys.LDAP_MAPPER_ATTRIBUTE_PASSWORD, passwordAttribute );
|
||||
userIdAttribute = userConf.getString( UserConfigurationKeys.LDAP_MAPPER_ATTRIBUTE_ID, userIdAttribute );
|
||||
userBaseDn = userConf.getConcatenatedList( "ldap.config.mapper.attribute.user.base.dn",
|
||||
userConf.getConcatenatedList( "ldap.config.base.dn", userBaseDn ) );
|
||||
userObjectClass = userConf.getString( "ldap.config.mapper.attribute.user.object.class", userObjectClass );
|
||||
userFilter = userConf.getString( "ldap.config.mapper.attribute.user.filter", userFilter );
|
||||
userObjectClass =
|
||||
userConf.getString( UserConfigurationKeys.LDAP_MAPPER_ATTRIBUTE_OBJECT_CLASS, userObjectClass );
|
||||
userFilter = userConf.getString( UserConfigurationKeys.LDAP_MAPPER_ATTRIBUTE_FILTER, userFilter );
|
||||
maxResultCount = userConf.getInt( "ldap.config.max.result.count", maxResultCount );
|
||||
}
|
||||
|
||||
|
|
|
@ -20,6 +20,7 @@ package org.apache.archiva.redback.common.ldap.connection;
|
|||
*/
|
||||
|
||||
import org.apache.archiva.redback.configuration.UserConfiguration;
|
||||
import org.apache.archiva.redback.configuration.UserConfigurationKeys;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
|
@ -34,7 +35,6 @@ import java.util.Properties;
|
|||
|
||||
/**
|
||||
* @author <a href="mailto:trygvis@inamo.no">Trygve Laugstøl</a>
|
||||
*
|
||||
*/
|
||||
@Service( "ldapConnectionFactory#configurable" )
|
||||
public class ConfigurableLdapConnectionFactory
|
||||
|
@ -75,15 +75,16 @@ public class ConfigurableLdapConnectionFactory
|
|||
try
|
||||
{
|
||||
configuration = new LdapConnectionConfiguration();
|
||||
configuration.setHostname( userConf.getString( "ldap.config.hostname", hostname ) );
|
||||
configuration.setHostname( userConf.getString( UserConfigurationKeys.LDAP_HOSTNAME, hostname ) );
|
||||
configuration.setPort( userConf.getInt( "ldap.config.port", port ) );
|
||||
configuration.setSsl( userConf.getBoolean( "ldap.config.ssl", ssl ) );
|
||||
configuration.setBaseDn( userConf.getConcatenatedList( "ldap.config.base.dn", baseDn ) );
|
||||
configuration.setContextFactory( userConf.getString( "ldap.config.context.factory", contextFactory ) );
|
||||
configuration.setContextFactory(
|
||||
userConf.getString( UserConfigurationKeys.LDAP_CONTEX_FACTORY, contextFactory ) );
|
||||
configuration.setBindDn( userConf.getConcatenatedList( "ldap.config.bind.dn", bindDn ) );
|
||||
configuration.setPassword( userConf.getString( "ldap.config.password", password ) );
|
||||
configuration.setPassword( userConf.getString( UserConfigurationKeys.LDAP_PASSWORD, password ) );
|
||||
configuration.setAuthenticationMethod(
|
||||
userConf.getString( "ldap.config.authentication.method", authenticationMethod ) );
|
||||
userConf.getString( UserConfigurationKeys.LDAP_AUTHENTICATION_METHOD, authenticationMethod ) );
|
||||
configuration.setExtraProperties( extraProperties );
|
||||
}
|
||||
catch ( InvalidNameException e )
|
||||
|
|
|
@ -24,30 +24,52 @@ package org.apache.archiva.redback.configuration;
|
|||
*/
|
||||
public interface UserConfigurationKeys
|
||||
{
|
||||
static final String USER_MANAGER_IMPL = "user.manager.impl";
|
||||
String USER_MANAGER_IMPL = "user.manager.impl";
|
||||
|
||||
static final String DEFAULT_ADMIN = "redback.default.admin";
|
||||
String DEFAULT_ADMIN = "redback.default.admin";
|
||||
|
||||
static final String EMAIL_FROM_ADDRESS = "email.from.address";
|
||||
String EMAIL_FROM_ADDRESS = "email.from.address";
|
||||
|
||||
static final String EMAIL_FROM_NAME = "email.from.name";
|
||||
String EMAIL_FROM_NAME = "email.from.name";
|
||||
|
||||
static final String EMAIL_FEEDBACK_PATH = "email.feedback.path";
|
||||
String EMAIL_FEEDBACK_PATH = "email.feedback.path";
|
||||
|
||||
static final String APPLICATION_TIMESTAMP = "application.timestamp";
|
||||
String APPLICATION_TIMESTAMP = "application.timestamp";
|
||||
|
||||
static final String PASSWORD_ENCODER = "security.policy.password.encoder";
|
||||
String PASSWORD_ENCODER = "security.policy.password.encoder";
|
||||
|
||||
|
||||
static final String EMAIL_VALIDATION_SUBJECT = "email.validation.subject";
|
||||
String EMAIL_VALIDATION_SUBJECT = "email.validation.subject";
|
||||
|
||||
static final String REMEMBER_ME_PATH = "security.rememberme.path";
|
||||
String REMEMBER_ME_PATH = "security.rememberme.path";
|
||||
|
||||
static final String REMEMBER_ME_DOMAIN = "security.rememberme.domain";
|
||||
String REMEMBER_ME_DOMAIN = "security.rememberme.domain";
|
||||
|
||||
static final String SIGNON_DOMAIN = "security.signon.domain";
|
||||
String SIGNON_DOMAIN = "security.signon.domain";
|
||||
|
||||
static final String SIGNON_PATH = "security.signon.path";
|
||||
String SIGNON_PATH = "security.signon.path";
|
||||
|
||||
static final String USER_MANAGER_IMPL = "user.manager.impl";
|
||||
String LDAP_HOSTNAME = "ldap.config.hostname";
|
||||
|
||||
String LDAP_CONTEX_FACTORY = "ldap.config.context.factory";
|
||||
|
||||
String LDAP_PASSWORD = "ldap.config.password";
|
||||
|
||||
String LDAP_AUTHENTICATION_METHOD = "ldap.config.authentication.method";
|
||||
|
||||
String APPLICATION_URL = "application.url";
|
||||
|
||||
String EMAIL_URL_PATH = "email.url.path";
|
||||
|
||||
String LDAP_MAPPER_ATTRIBUTE_EMAIL = "ldap.config.mapper.attribute.email";
|
||||
|
||||
String LDAP_MAPPER_ATTRIBUTE_FULLNAME = "ldap.config.mapper.attribute.fullname";
|
||||
|
||||
String LDAP_MAPPER_ATTRIBUTE_PASSWORD = "ldap.config.mapper.attribute.password";
|
||||
|
||||
String LDAP_MAPPER_ATTRIBUTE_ID = "ldap.config.mapper.attribute.user.id";
|
||||
|
||||
String LDAP_MAPPER_ATTRIBUTE_OBJECT_CLASS = "ldap.config.mapper.attribute.user.object.class";
|
||||
|
||||
String LDAP_MAPPER_ATTRIBUTE_FILTER = "ldap.config.mapper.attribute.user.filter";
|
||||
}
|
||||
|
|
|
@ -94,7 +94,7 @@ public class VelocityMailGenerator
|
|||
{
|
||||
VelocityContext context = new VelocityContext();
|
||||
|
||||
context.put( "applicationUrl", config.getString( "application.url", appUrl ) );
|
||||
context.put( "applicationUrl", config.getString( UserConfigurationKeys.APPLICATION_URL, appUrl ) );
|
||||
|
||||
String feedback = config.getString( UserConfigurationKeys.EMAIL_FEEDBACK_PATH );
|
||||
|
||||
|
@ -108,7 +108,8 @@ public class VelocityMailGenerator
|
|||
context.put( "feedback", feedback );
|
||||
}
|
||||
|
||||
context.put( "urlPath", config.getString( "email.url.path", "security/login!login.action" ) );
|
||||
context.put( "urlPath",
|
||||
config.getString( UserConfigurationKeys.EMAIL_URL_PATH, "security/login!login.action" ) );
|
||||
|
||||
context.put( "authkey", authkey.getKey() );
|
||||
|
||||
|
|
|
@ -52,7 +52,7 @@ public class ConfigurableUserManager
|
|||
@PostConstruct
|
||||
public void initialize()
|
||||
{
|
||||
String userManagerRole = config.getString();
|
||||
String userManagerRole = config.getString( UserConfigurationKeys.USER_MANAGER_IMPL );
|
||||
|
||||
if ( userManagerRole == null )
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue