use of password.pwm.config.Configuration in project pwm by pwm-project.
the class HealthMessageTest method testHealthMessageDescription.
@Test
public void testHealthMessageDescription() throws PwmUnrecoverableException {
final Configuration configuration = new Configuration(StoredConfigurationImpl.newStoredConfiguration());
final Locale locale = PwmConstants.DEFAULT_LOCALE;
for (final HealthMessage healthMessage : HealthMessage.values()) {
healthMessage.getDescription(locale, configuration, new String[] { "field1", "field2" });
}
}
use of password.pwm.config.Configuration in project pwm by pwm-project.
the class RestResultBean method fromError.
public static RestResultBean fromError(final RestRequest restRequestBean, final ErrorInformation errorInformation) {
final PwmApplication pwmApplication = restRequestBean.getPwmApplication();
final Configuration config = restRequestBean.getPwmApplication().getConfig();
final Locale locale = restRequestBean.getLocale();
return fromError(errorInformation, pwmApplication, locale, config, false);
}
use of password.pwm.config.Configuration in project pwm by pwm-project.
the class SecureService method init.
@Override
public void init(final PwmApplication pwmApplication) throws PwmException {
final Configuration config = pwmApplication.getConfig();
pwmSecurityKey = config.getSecurityKey();
{
final String defaultBlockAlgString = config.readAppProperty(AppProperty.SECURITY_DEFAULT_EPHEMERAL_BLOCK_ALG);
defaultBlockAlgorithm = JavaHelper.readEnumFromString(PwmBlockAlgorithm.class, PwmBlockAlgorithm.AES, defaultBlockAlgString);
LOGGER.debug("using default ephemeral block algorithm: " + defaultBlockAlgorithm.getLabel());
}
{
final String defaultHashAlgString = config.readAppProperty(AppProperty.SECURITY_DEFAULT_EPHEMERAL_HASH_ALG);
defaultHashAlgorithm = JavaHelper.readEnumFromString(PwmHashAlgorithm.class, PwmHashAlgorithm.SHA512, defaultHashAlgString);
LOGGER.debug("using default ephemeral hash algorithm: " + defaultHashAlgString.toString());
}
}
use of password.pwm.config.Configuration in project pwm by pwm-project.
the class LDAPStatusChecker method doHealthCheck.
public List<HealthRecord> doHealthCheck(final PwmApplication pwmApplication) {
final Configuration config = pwmApplication.getConfig();
final List<HealthRecord> returnRecords = new ArrayList<>();
final Map<String, LdapProfile> ldapProfiles = pwmApplication.getConfig().getLdapProfiles();
for (final Map.Entry<String, LdapProfile> entry : ldapProfiles.entrySet()) {
final String profileID = entry.getKey();
final List<HealthRecord> profileRecords = new ArrayList<>();
profileRecords.addAll(checkBasicLdapConnectivity(pwmApplication, config, entry.getValue(), true));
if (profileRecords.isEmpty()) {
profileRecords.addAll(checkLdapServerUrls(pwmApplication, config, ldapProfiles.get(profileID)));
}
if (profileRecords.isEmpty()) {
profileRecords.add(HealthRecord.forMessage(HealthMessage.LDAP_OK));
profileRecords.addAll(doLdapTestUserCheck(config, ldapProfiles.get(profileID), pwmApplication));
}
returnRecords.addAll(profileRecords);
}
for (final LdapProfile ldapProfile : pwmApplication.getLdapConnectionService().getLastLdapFailure().keySet()) {
final ErrorInformation errorInfo = pwmApplication.getLdapConnectionService().getLastLdapFailure().get(ldapProfile);
if (errorInfo != null) {
final TimeDuration errorAge = TimeDuration.fromCurrent(errorInfo.getDate());
final long cautionDurationMS = Long.parseLong(pwmApplication.getConfig().readAppProperty(AppProperty.HEALTH_LDAP_CAUTION_DURATION_MS));
if (errorAge.isShorterThan(cautionDurationMS)) {
final String ageString = errorAge.asLongString();
final String errorDate = JavaHelper.toIsoDate(errorInfo.getDate());
final String errorMsg = errorInfo.toDebugStr();
returnRecords.add(HealthRecord.forMessage(HealthMessage.LDAP_RecentlyUnreachable, ldapProfile.getDisplayName(PwmConstants.DEFAULT_LOCALE), ageString, errorDate, errorMsg));
}
}
}
if (config.getLdapProfiles() != null && !config.getLdapProfiles().isEmpty()) {
final List<String> urls = config.getLdapProfiles().values().iterator().next().readSettingAsStringArray(PwmSetting.LDAP_SERVER_URLS);
if (urls != null && !urls.isEmpty() && !StringUtil.isEmpty(urls.iterator().next())) {
returnRecords.addAll(checkVendorSameness(pwmApplication));
returnRecords.addAll(checkUserPermissionValues(pwmApplication));
returnRecords.addAll(checkLdapDNSyntaxValues(pwmApplication));
}
}
return returnRecords;
}
use of password.pwm.config.Configuration in project pwm by pwm-project.
the class ConfigurationReader method getConfiguration.
public Configuration getConfiguration() throws PwmUnrecoverableException {
if (configuration == null) {
final StoredConfigurationImpl newStoredConfig = this.storedConfiguration == null ? StoredConfigurationImpl.newStoredConfiguration() : this.storedConfiguration;
configuration = new Configuration(newStoredConfig);
if (storedConfiguration != null) {
storedConfiguration.lock();
}
}
return configuration;
}
Aggregations