Search in sources :

Example 21 with PwmPasswordPolicy

use of password.pwm.config.profile.PwmPasswordPolicy in project pwm by pwm-project.

the class UserDebugDataReader method readUserDebugData.

public static UserDebugDataBean readUserDebugData(final PwmApplication pwmApplication, final Locale locale, final SessionLabel sessionLabel, final UserIdentity userIdentity) throws PwmUnrecoverableException {
    final UserInfo userInfo = UserInfoFactory.newUserInfoUsingProxy(pwmApplication, sessionLabel, userIdentity, locale);
    final Map<Permission, String> permissions = UserDebugDataReader.permissionMap(pwmApplication, sessionLabel, userIdentity);
    final Map<ProfileType, String> profiles = UserDebugDataReader.profileMap(pwmApplication, sessionLabel, userIdentity);
    final PwmPasswordPolicy ldapPasswordPolicy = PasswordUtility.readLdapPasswordPolicy(pwmApplication, pwmApplication.getProxiedChaiUser(userIdentity));
    final PwmPasswordPolicy configPasswordPolicy = PasswordUtility.determineConfiguredPolicyProfileForUser(pwmApplication, sessionLabel, userIdentity, locale);
    boolean readablePassword = false;
    try {
        readablePassword = null != LdapOperationsHelper.readLdapPassword(pwmApplication, sessionLabel, userIdentity);
    } catch (ChaiUnavailableException e) {
    /* disregard */
    }
    final MacroMachine macroMachine = MacroMachine.forUser(pwmApplication, locale, sessionLabel, userIdentity);
    final UserDebugDataBean userDebugData = UserDebugDataBean.builder().userInfo(userInfo).publicUserInfoBean(PublicUserInfoBean.fromUserInfoBean(userInfo, pwmApplication.getConfig(), locale, macroMachine)).permissions(permissions).profiles(profiles).ldapPasswordPolicy(ldapPasswordPolicy).configuredPasswordPolicy(configPasswordPolicy).passwordReadable(readablePassword).passwordWithinMinimumLifetime(userInfo.isWithinPasswordMinimumLifetime()).build();
    return userDebugData;
}
Also used : ProfileType(password.pwm.config.profile.ProfileType) ChaiUnavailableException(com.novell.ldapchai.exception.ChaiUnavailableException) PwmPasswordPolicy(password.pwm.config.profile.PwmPasswordPolicy) Permission(password.pwm.Permission) UserPermission(password.pwm.config.value.data.UserPermission) MacroMachine(password.pwm.util.macro.MacroMachine) UserInfo(password.pwm.ldap.UserInfo)

Aggregations

PwmPasswordPolicy (password.pwm.config.profile.PwmPasswordPolicy)21 ErrorInformation (password.pwm.error.ErrorInformation)10 PwmUnrecoverableException (password.pwm.error.PwmUnrecoverableException)8 ChaiUser (com.novell.ldapchai.ChaiUser)7 PasswordData (password.pwm.util.PasswordData)7 Instant (java.time.Instant)6 ArrayList (java.util.ArrayList)6 ChaiOperationException (com.novell.ldapchai.exception.ChaiOperationException)5 List (java.util.List)5 Locale (java.util.Locale)5 UserIdentity (password.pwm.bean.UserIdentity)5 ChaiUnavailableException (com.novell.ldapchai.exception.ChaiUnavailableException)4 ChaiProvider (com.novell.ldapchai.provider.ChaiProvider)4 UserInfo (password.pwm.ldap.UserInfo)4 PwmApplication (password.pwm.PwmApplication)3 Configuration (password.pwm.config.Configuration)3 PwmException (password.pwm.error.PwmException)3 PwmOperationalException (password.pwm.error.PwmOperationalException)3 PwmSession (password.pwm.http.PwmSession)3 MacroMachine (password.pwm.util.macro.MacroMachine)3