use of org.apache.archiva.admin.model.beans.RedbackRuntimeConfiguration in project archiva by apache.
the class ArchivaLdapRoleMapperConfiguration method removeLdapMapping.
@Override
public void removeLdapMapping(String group) throws MappingException {
try {
RedbackRuntimeConfiguration redbackRuntimeConfiguration = redbackRuntimeConfigurationAdmin.getRedbackRuntimeConfiguration();
boolean removed = redbackRuntimeConfiguration.getLdapGroupMappings().remove(new LdapGroupMapping(group));
redbackRuntimeConfigurationAdmin.updateRedbackRuntimeConfiguration(redbackRuntimeConfiguration);
logger.debug("removeLdapMapping ldapGroup: {}, removed: {}", group, removed);
} catch (RepositoryAdminException e) {
throw new MappingException(e.getMessage(), e);
}
}
use of org.apache.archiva.admin.model.beans.RedbackRuntimeConfiguration in project archiva by apache.
the class DefaultRuntimeInfoService method getApplicationRuntimeInfo.
@Override
public ApplicationRuntimeInfo getApplicationRuntimeInfo(String locale) throws ArchivaRestServiceException {
ApplicationRuntimeInfo applicationRuntimeInfo = new ApplicationRuntimeInfo();
applicationRuntimeInfo.setBuildNumber(this.archivaRuntimeInfo.getBuildNumber());
applicationRuntimeInfo.setTimestamp(this.archivaRuntimeInfo.getTimestamp());
applicationRuntimeInfo.setVersion(this.archivaRuntimeInfo.getVersion());
applicationRuntimeInfo.setBaseUrl(getBaseUrl(httpServletRequest));
SimpleDateFormat sfd = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssz", new Locale(StringUtils.isEmpty(locale) ? "en" : locale));
applicationRuntimeInfo.setTimestampStr(sfd.format(new Date(archivaRuntimeInfo.getTimestamp())));
CookieInformation cookieInformation = new CookieInformation();
RedbackRuntimeConfiguration redbackRuntimeConfiguration = redbackRuntimeConfigurationService.getRedbackRuntimeConfiguration();
cookieInformation.setDomain(redbackRuntimeConfiguration.getConfigurationProperties().get(UserConfigurationKeys.REMEMBER_ME_DOMAIN));
cookieInformation.setPath(redbackRuntimeConfiguration.getConfigurationProperties().get(UserConfigurationKeys.REMEMBER_ME_PATH));
cookieInformation.setSecure(redbackRuntimeConfiguration.getConfigurationProperties().get(UserConfigurationKeys.REMEMBER_ME_SECURE));
cookieInformation.setTimeout(redbackRuntimeConfiguration.getConfigurationProperties().get(UserConfigurationKeys.REMEMBER_ME_TIMEOUT));
cookieInformation.setRememberMeEnabled(BooleanUtils.toBoolean(redbackRuntimeConfiguration.getConfigurationProperties().get(UserConfigurationKeys.REMEMBER_ME_ENABLED)));
applicationRuntimeInfo.setCookieInformation(cookieInformation);
return applicationRuntimeInfo;
}
use of org.apache.archiva.admin.model.beans.RedbackRuntimeConfiguration in project archiva by apache.
the class DefaultRedbackRuntimeConfigurationService method getRedbackRuntimeConfiguration.
@Override
public RedbackRuntimeConfiguration getRedbackRuntimeConfiguration() throws ArchivaRestServiceException {
try {
RedbackRuntimeConfiguration redbackRuntimeConfiguration = redbackRuntimeConfigurationAdmin.getRedbackRuntimeConfiguration();
log.debug("getRedbackRuntimeConfiguration -> {}", redbackRuntimeConfiguration);
return redbackRuntimeConfiguration;
} catch (RepositoryAdminException e) {
throw new ArchivaRestServiceException(e.getMessage(), e);
}
}
use of org.apache.archiva.admin.model.beans.RedbackRuntimeConfiguration in project archiva by apache.
the class RedbackRuntimeConfigurationServiceTest method nonnullConfiguration.
@Test
public void nonnullConfiguration() throws Exception {
RedbackRuntimeConfiguration redbackRuntimeConfiguration = getRedbackRuntimeConfigurationService().getRedbackRuntimeConfiguration();
assertEquals("jpa", redbackRuntimeConfiguration.getUserManagerImpls().get(0));
}
use of org.apache.archiva.admin.model.beans.RedbackRuntimeConfiguration in project archiva by apache.
the class DefaultRedbackRuntimeConfigurationAdmin method getString.
@Override
public String getString(String key, String defaultValue) {
if (UserConfigurationKeys.LDAP_HOSTNAME.equals(key)) {
return getRedbackRuntimeConfiguration().getLdapConfiguration().getHostName();
}
if (UserConfigurationKeys.LDAP_CONTEX_FACTORY.equals(key)) {
return getRedbackRuntimeConfiguration().getLdapConfiguration().getContextFactory();
}
if (UserConfigurationKeys.LDAP_PASSWORD.equals(key)) {
return getRedbackRuntimeConfiguration().getLdapConfiguration().getPassword();
}
if (UserConfigurationKeys.LDAP_AUTHENTICATION_METHOD.equals(key)) {
return getRedbackRuntimeConfiguration().getLdapConfiguration().getAuthenticationMethod();
}
RedbackRuntimeConfiguration conf = getRedbackRuntimeConfiguration();
if (conf.getConfigurationProperties().containsKey(key)) {
return conf.getConfigurationProperties().get(key);
}
String value = userConfiguration.getString(key, defaultValue);
if (value == null) {
return null;
}
conf.getConfigurationProperties().put(key, value);
try {
updateRedbackRuntimeConfiguration(conf);
} catch (RepositoryAdminException e) {
log.error("fail to save RedbackRuntimeConfiguration: {}", e.getMessage(), e);
throw new RuntimeException(e.getMessage(), e);
}
return value;
}
Aggregations