Search in sources :

Example 1 with StoredValue

use of password.pwm.config.StoredValue in project pwm by pwm-project.

the class ForgottenPasswordProfile method getMinOptionalRequired.

public int getMinOptionalRequired() {
    final StoredValue configValue = storedValueMap.get(PwmSetting.RECOVERY_VERIFICATION_METHODS);
    final VerificationMethodValue.VerificationMethodSettings verificationMethodSettings = (VerificationMethodValue.VerificationMethodSettings) configValue.toNativeObject();
    return verificationMethodSettings.getMinOptionalRequired();
}
Also used : VerificationMethodValue(password.pwm.config.value.VerificationMethodValue) StoredValue(password.pwm.config.StoredValue)

Example 2 with StoredValue

use of password.pwm.config.StoredValue in project pwm by pwm-project.

the class StoredConfigurationImpl method modifiedSettings.

public List<SettingValueRecord> modifiedSettings() {
    final List<SettingValueRecord> returnObj = new ArrayList<>();
    domModifyLock.readLock().lock();
    try {
        for (final PwmSetting setting : PwmSetting.values()) {
            if (setting.getSyntax() != PwmSettingSyntax.PROFILE && !setting.getCategory().hasProfiles()) {
                if (!isDefaultValue(setting, null)) {
                    final StoredValue value = readSetting(setting);
                    if (value != null) {
                        returnObj.add(new SettingValueRecord(setting, null, value));
                    }
                }
            }
        }
        for (final PwmSettingCategory category : PwmSettingCategory.values()) {
            if (category.hasProfiles()) {
                for (final String profileID : this.profilesForSetting(category.getProfileSetting())) {
                    for (final PwmSetting profileSetting : category.getSettings()) {
                        if (!isDefaultValue(profileSetting, profileID)) {
                            final StoredValue value = readSetting(profileSetting, profileID);
                            if (value != null) {
                                returnObj.add(new SettingValueRecord(profileSetting, profileID, value));
                            }
                        }
                    }
                }
            }
        }
        return returnObj;
    } finally {
        domModifyLock.readLock().unlock();
    }
}
Also used : PwmSetting(password.pwm.config.PwmSetting) PwmSettingCategory(password.pwm.config.PwmSettingCategory) ArrayList(java.util.ArrayList) StoredValue(password.pwm.config.StoredValue)

Example 3 with StoredValue

use of password.pwm.config.StoredValue in project pwm by pwm-project.

the class StoredConfigurationImpl method settingChecksum.

public String settingChecksum() throws PwmUnrecoverableException {
    final Date startTime = new Date();
    final List<SettingValueRecord> modifiedSettings = modifiedSettings();
    final StringBuilder sb = new StringBuilder();
    sb.append("PwmSettingsChecksum");
    for (final SettingValueRecord settingValueRecord : modifiedSettings) {
        final StoredValue storedValue = settingValueRecord.getStoredValue();
        sb.append(storedValue.valueHash());
    }
    final String result = SecureEngine.hash(sb.toString(), PwmConstants.SETTING_CHECKSUM_HASH_METHOD);
    LOGGER.trace("computed setting checksum in " + TimeDuration.fromCurrent(startTime).asCompactString());
    return result;
}
Also used : StoredValue(password.pwm.config.StoredValue) Date(java.util.Date)

Example 4 with StoredValue

use of password.pwm.config.StoredValue in project pwm by pwm-project.

the class StoredConfigurationImpl method matchSetting.

private boolean matchSetting(final ConfigRecordID configRecordID, final String searchTerm, final Locale locale) {
    final PwmSetting pwmSetting = (PwmSetting) configRecordID.getRecordID();
    final StoredValue value = readSetting(pwmSetting, configRecordID.getProfileID());
    return StringUtil.whitespaceSplit(searchTerm).parallelStream().allMatch(s -> matchSetting(pwmSetting, value, s, locale));
}
Also used : PwmSetting(password.pwm.config.PwmSetting) StoredValue(password.pwm.config.StoredValue)

Example 5 with StoredValue

use of password.pwm.config.StoredValue in project pwm by pwm-project.

the class StoredConfigurationImpl method toJsonDebugObject.

public Serializable toJsonDebugObject() {
    domModifyLock.readLock().lock();
    try {
        final TreeMap<String, Object> outputObject = new TreeMap<>();
        for (final PwmSetting setting : PwmSetting.values()) {
            if (setting.getSyntax() != PwmSettingSyntax.PROFILE && !setting.getCategory().hasProfiles()) {
                if (!isDefaultValue(setting, null)) {
                    final StoredValue value = readSetting(setting);
                    outputObject.put(setting.getKey(), value.toDebugJsonObject(null));
                }
            }
        }
        for (final PwmSettingCategory category : PwmSettingCategory.values()) {
            if (category.hasProfiles()) {
                final TreeMap<String, Object> profiles = new TreeMap<>();
                for (final String profileID : this.profilesForSetting(category.getProfileSetting())) {
                    final TreeMap<String, Object> profileObject = new TreeMap<>();
                    for (final PwmSetting profileSetting : category.getSettings()) {
                        if (!isDefaultValue(profileSetting, profileID)) {
                            final StoredValue value = readSetting(profileSetting, profileID);
                            profileObject.put(profileSetting.getKey(), value.toDebugJsonObject(null));
                        }
                    }
                    profiles.put(profileID, profileObject);
                }
                outputObject.put(category.getProfileSetting().getKey(), profiles);
            }
        }
        return outputObject;
    } finally {
        domModifyLock.readLock().unlock();
    }
}
Also used : PwmSetting(password.pwm.config.PwmSetting) PwmSettingCategory(password.pwm.config.PwmSettingCategory) TreeMap(java.util.TreeMap) StoredValue(password.pwm.config.StoredValue)

Aggregations

StoredValue (password.pwm.config.StoredValue)21 PwmSetting (password.pwm.config.PwmSetting)11 ArrayList (java.util.ArrayList)6 IOException (java.io.IOException)4 LinkedHashMap (java.util.LinkedHashMap)4 PwmSettingCategory (password.pwm.config.PwmSettingCategory)4 StoredConfigurationImpl (password.pwm.config.stored.StoredConfigurationImpl)4 PwmUnrecoverableException (password.pwm.error.PwmUnrecoverableException)4 List (java.util.List)3 TreeMap (java.util.TreeMap)3 StringValue (password.pwm.config.value.StringValue)3 PwmException (password.pwm.error.PwmException)3 PwmOperationalException (password.pwm.error.PwmOperationalException)3 ChaiUnavailableException (com.novell.ldapchai.exception.ChaiUnavailableException)2 X509Certificate (java.security.cert.X509Certificate)2 ServletException (javax.servlet.ServletException)2 StringArrayValue (password.pwm.config.value.StringArrayValue)2 VerificationMethodValue (password.pwm.config.value.VerificationMethodValue)2 Serializable (java.io.Serializable)1 URISyntaxException (java.net.URISyntaxException)1