use of password.pwm.config.value.ChallengeValue in project pwm by pwm-project.
the class ChallengeProfile method valueToChallengeItemArray.
static List<ChallengeItemConfiguration> valueToChallengeItemArray(final StoredValue value, final Locale locale) {
if (!(value instanceof ChallengeValue)) {
throw new IllegalArgumentException("may not read ChallengeValue value");
}
final Map<String, List<ChallengeItemConfiguration>> storedValues = (Map<String, List<ChallengeItemConfiguration>>) value.toNativeObject();
final Map<Locale, List<ChallengeItemConfiguration>> availableLocaleMap = new LinkedHashMap<>();
for (final Map.Entry<String, List<ChallengeItemConfiguration>> entry : storedValues.entrySet()) {
final String localeStr = entry.getKey();
availableLocaleMap.put(LocaleHelper.parseLocaleString(localeStr), entry.getValue());
}
final Locale matchedLocale = LocaleHelper.localeResolver(locale, availableLocaleMap.keySet());
return availableLocaleMap.get(matchedLocale);
}
Aggregations