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();
}
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();
}
}
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;
}
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));
}
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();
}
}
Aggregations