use of password.pwm.config.value.data.FormConfiguration in project pwm by pwm-project.
the class GuestRegistrationServlet method checkConfiguration.
private static void checkConfiguration(final Configuration configuration) throws PwmUnrecoverableException {
final String namingAttribute = configuration.getDefaultLdapProfile().readSettingAsString(PwmSetting.LDAP_NAMING_ATTRIBUTE);
final List<FormConfiguration> formItems = configuration.readSettingAsForm(PwmSetting.GUEST_FORM);
{
boolean namingIsInForm = false;
for (final FormConfiguration formItem : formItems) {
if (namingAttribute.equalsIgnoreCase(formItem.getName())) {
namingIsInForm = true;
}
}
if (!namingIsInForm) {
final String errorMsg = "ldap naming attribute '" + namingAttribute + "' is not in form configuration, but is required";
final ErrorInformation errorInformation = new ErrorInformation(PwmError.ERROR_INVALID_CONFIG, errorMsg, new String[] { namingAttribute });
throw new PwmUnrecoverableException(errorInformation);
}
}
}
use of password.pwm.config.value.data.FormConfiguration in project pwm by pwm-project.
the class GuestRegistrationServlet method forwardToUpdateJSP.
private void forwardToUpdateJSP(final PwmRequest pwmRequest, final GuestRegistrationBean guestRegistrationBean) throws IOException, ServletException, PwmUnrecoverableException {
calculateFutureDateFlags(pwmRequest, guestRegistrationBean);
final List<FormConfiguration> guestUpdateForm = pwmRequest.getConfig().readSettingAsForm(PwmSetting.GUEST_UPDATE_FORM);
final Map<FormConfiguration, String> formValueMap = new LinkedHashMap<>();
for (final FormConfiguration formConfiguration : guestUpdateForm) {
final String value = guestRegistrationBean.getFormValues().get(formConfiguration.getName());
formValueMap.put(formConfiguration, value);
}
pwmRequest.addFormInfoToRequestAttr(guestUpdateForm, formValueMap, false, false);
pwmRequest.forwardToJsp(JspUrl.GUEST_UPDATE);
}
use of password.pwm.config.value.data.FormConfiguration in project pwm by pwm-project.
the class ChangePasswordServletUtil method validateParamsAgainstLDAP.
static void validateParamsAgainstLDAP(final Map<FormConfiguration, String> formValues, final PwmSession pwmSession, final ChaiUser theUser) throws ChaiUnavailableException, PwmDataValidationException {
for (final Map.Entry<FormConfiguration, String> entry : formValues.entrySet()) {
final FormConfiguration formItem = entry.getKey();
final String attrName = formItem.getName();
final String value = entry.getValue();
try {
if (!theUser.compareStringAttribute(attrName, value)) {
final String errorMsg = "incorrect value for '" + attrName + "'";
final ErrorInformation errorInfo = new ErrorInformation(PwmError.ERROR_INCORRECT_RESPONSE, errorMsg, new String[] { attrName });
LOGGER.debug(pwmSession, errorInfo.toDebugStr());
throw new PwmDataValidationException(errorInfo);
}
LOGGER.trace(pwmSession, "successful validation of ldap value for '" + attrName + "'");
} catch (ChaiOperationException e) {
LOGGER.error(pwmSession, "error during param validation of '" + attrName + "', error: " + e.getMessage());
throw new PwmDataValidationException(new ErrorInformation(PwmError.ERROR_INCORRECT_RESPONSE, "ldap error testing value for '" + attrName + "'", new String[] { attrName }));
}
}
}
Aggregations