Search in sources :

Example 1 with UserInfoBean

use of password.pwm.ldap.UserInfoBean in project pwm by pwm-project.

the class NewUserUtils method createMacroMachineForNewUser.

static MacroMachine createMacroMachineForNewUser(final PwmApplication pwmApplication, final SessionLabel sessionLabel, final NewUserForm newUserForm, final TokenDestinationItem tokenDestinationItem) throws PwmUnrecoverableException {
    final Map<String, String> formValues = newUserForm.getFormData();
    final String emailAddressAttribute = pwmApplication.getConfig().getDefaultLdapProfile().readSettingAsString(PwmSetting.EMAIL_USER_MAIL_ATTRIBUTE);
    final String usernameAttribute = pwmApplication.getConfig().getDefaultLdapProfile().readSettingAsString(PwmSetting.LDAP_USERNAME_ATTRIBUTE);
    final LoginInfoBean stubLoginBean = new LoginInfoBean();
    stubLoginBean.setUserCurrentPassword(newUserForm.getNewUserPassword());
    final UserInfoBean stubUserBean = UserInfoBean.builder().userEmailAddress(formValues.get(emailAddressAttribute)).username(formValues.get(usernameAttribute)).attributes(formValues).build();
    final MacroMachine.StringReplacer stringReplacer = tokenDestinationItem == null ? null : TokenUtil.makeTokenDestStringReplacer(tokenDestinationItem);
    return MacroMachine.forUser(pwmApplication, sessionLabel, stubUserBean, stubLoginBean, stringReplacer);
}
Also used : UserInfoBean(password.pwm.ldap.UserInfoBean) LoginInfoBean(password.pwm.bean.LoginInfoBean) MacroMachine(password.pwm.util.macro.MacroMachine)

Aggregations

LoginInfoBean (password.pwm.bean.LoginInfoBean)1 UserInfoBean (password.pwm.ldap.UserInfoBean)1 MacroMachine (password.pwm.util.macro.MacroMachine)1