|
@@ -36,6 +36,7 @@ import password.pwm.PwmApplication;
|
|
|
import password.pwm.PwmConstants;
|
|
|
import password.pwm.PwmDomain;
|
|
|
import password.pwm.bean.PasswordStatus;
|
|
|
+import password.pwm.bean.ProfileID;
|
|
|
import password.pwm.bean.SessionLabel;
|
|
|
import password.pwm.bean.UserIdentity;
|
|
|
import password.pwm.config.DomainConfig;
|
|
@@ -103,11 +104,11 @@ public class LDAPHealthChecker implements HealthSupplier
|
|
|
{
|
|
|
final DomainConfig config = pwmDomain.getConfig();
|
|
|
final List<HealthRecord> returnRecords = new ArrayList<>();
|
|
|
- final Map<String, LdapProfile> ldapProfiles = pwmDomain.getConfig().getLdapProfiles();
|
|
|
+ final Map<ProfileID, LdapProfile> ldapProfiles = pwmDomain.getConfig().getLdapProfiles();
|
|
|
|
|
|
- for ( final Map.Entry<String, LdapProfile> entry : ldapProfiles.entrySet() )
|
|
|
+ for ( final Map.Entry<ProfileID, LdapProfile> entry : ldapProfiles.entrySet() )
|
|
|
{
|
|
|
- final String profileID = entry.getKey();
|
|
|
+ final ProfileID profileID = entry.getKey();
|
|
|
final List<HealthRecord> profileRecords = new ArrayList<>(
|
|
|
checkBasicLdapConnectivity( sessionLabel, pwmDomain, config, entry.getValue(), true )
|
|
|
);
|
|
@@ -125,7 +126,7 @@ public class LDAPHealthChecker implements HealthSupplier
|
|
|
returnRecords.addAll( profileRecords );
|
|
|
}
|
|
|
|
|
|
- for ( final Map.Entry<String, ErrorInformation> entry : pwmDomain.getLdapService().getLastLdapFailure().entrySet() )
|
|
|
+ for ( final Map.Entry<ProfileID, ErrorInformation> entry : pwmDomain.getLdapService().getLastLdapFailure().entrySet() )
|
|
|
{
|
|
|
final ErrorInformation errorInfo = entry.getValue();
|
|
|
final LdapProfile ldapProfile = pwmDomain.getConfig().getLdapProfiles().get( entry.getKey() );
|
|
@@ -164,7 +165,7 @@ public class LDAPHealthChecker implements HealthSupplier
|
|
|
|
|
|
returnRecords.addAll( checkNewUserPasswordTemplateSetting( sessionLabel, pwmDomain, config ) );
|
|
|
|
|
|
- // returnRecords.addAll( checkUserSearching( pwmApplication ) );
|
|
|
+ // returnRecords.addAll( checkUserSearching( pwmApplication ) );
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -201,7 +202,7 @@ public class LDAPHealthChecker implements HealthSupplier
|
|
|
LOGGER.trace( sessionLabel, () -> "unexpected error while testing test user (during object creation): message="
|
|
|
+ msgString + " debug info: " + JavaHelper.readHostileExceptionMessage( e ) );
|
|
|
returnRecords.add( HealthRecord.forMessage( pwmDomain.getDomainID(), HealthMessage.LDAP_TestUserUnexpected,
|
|
|
- PwmSetting.LDAP_TEST_USER_DN.toMenuLocationDebug( ldapProfile.getIdentifier(), PwmConstants.DEFAULT_LOCALE ),
|
|
|
+ PwmSetting.LDAP_TEST_USER_DN.toMenuLocationDebug( ldapProfile.getId(), PwmConstants.DEFAULT_LOCALE ),
|
|
|
msgString
|
|
|
) );
|
|
|
return returnRecords;
|
|
@@ -212,8 +213,8 @@ public class LDAPHealthChecker implements HealthSupplier
|
|
|
returnRecords.add( HealthRecord.forMessage(
|
|
|
pwmDomain.getDomainID(),
|
|
|
HealthMessage.LDAP_ProxyTestSameUser,
|
|
|
- PwmSetting.LDAP_TEST_USER_DN.toMenuLocationDebug( ldapProfile.getIdentifier(), PwmConstants.DEFAULT_LOCALE ),
|
|
|
- PwmSetting.LDAP_PROXY_USER_DN.toMenuLocationDebug( ldapProfile.getIdentifier(), PwmConstants.DEFAULT_LOCALE )
|
|
|
+ PwmSetting.LDAP_TEST_USER_DN.toMenuLocationDebug( ldapProfile.getId(), PwmConstants.DEFAULT_LOCALE ),
|
|
|
+ PwmSetting.LDAP_PROXY_USER_DN.toMenuLocationDebug( ldapProfile.getId(), PwmConstants.DEFAULT_LOCALE )
|
|
|
) );
|
|
|
return returnRecords;
|
|
|
}
|
|
@@ -243,7 +244,7 @@ public class LDAPHealthChecker implements HealthSupplier
|
|
|
returnRecords.add( HealthRecord.forMessage(
|
|
|
pwmDomain.getDomainID(),
|
|
|
HealthMessage.LDAP_TestUserUnavailable,
|
|
|
- PwmSetting.LDAP_TEST_USER_DN.toMenuLocationDebug( ldapProfile.getIdentifier(), PwmConstants.DEFAULT_LOCALE ),
|
|
|
+ PwmSetting.LDAP_TEST_USER_DN.toMenuLocationDebug( ldapProfile.getId(), PwmConstants.DEFAULT_LOCALE ),
|
|
|
e.getMessage()
|
|
|
) );
|
|
|
return returnRecords;
|
|
@@ -259,7 +260,7 @@ public class LDAPHealthChecker implements HealthSupplier
|
|
|
returnRecords.add( HealthRecord.forMessage(
|
|
|
pwmDomain.getDomainID(),
|
|
|
HealthMessage.LDAP_TestUserUnexpected,
|
|
|
- PwmSetting.LDAP_TEST_USER_DN.toMenuLocationDebug( ldapProfile.getIdentifier(), PwmConstants.DEFAULT_LOCALE ),
|
|
|
+ PwmSetting.LDAP_TEST_USER_DN.toMenuLocationDebug( ldapProfile.getId(), PwmConstants.DEFAULT_LOCALE ),
|
|
|
msgString
|
|
|
) );
|
|
|
return returnRecords;
|
|
@@ -274,7 +275,7 @@ public class LDAPHealthChecker implements HealthSupplier
|
|
|
returnRecords.add( HealthRecord.forMessage(
|
|
|
pwmDomain.getDomainID(),
|
|
|
HealthMessage.LDAP_TestUserError,
|
|
|
- PwmSetting.LDAP_TEST_USER_DN.toMenuLocationDebug( ldapProfile.getIdentifier(), PwmConstants.DEFAULT_LOCALE ),
|
|
|
+ PwmSetting.LDAP_TEST_USER_DN.toMenuLocationDebug( ldapProfile.getId(), PwmConstants.DEFAULT_LOCALE ),
|
|
|
e.getMessage()
|
|
|
) );
|
|
|
return returnRecords;
|
|
@@ -283,7 +284,7 @@ public class LDAPHealthChecker implements HealthSupplier
|
|
|
LOGGER.trace(
|
|
|
sessionLabel,
|
|
|
() -> "beginning process to check ldap test user password read/write operations for profile "
|
|
|
- + ldapProfile.getIdentifier()
|
|
|
+ + ldapProfile.getId()
|
|
|
);
|
|
|
try
|
|
|
{
|
|
@@ -303,7 +304,7 @@ public class LDAPHealthChecker implements HealthSupplier
|
|
|
pwmDomain.getDomainID(),
|
|
|
HealthMessage.LDAP_TestUserReadPwError,
|
|
|
PwmSetting.EDIRECTORY_READ_USER_PWD.toMenuLocationDebug( null, PwmConstants.DEFAULT_LOCALE ),
|
|
|
- PwmSetting.LDAP_TEST_USER_DN.toMenuLocationDebug( ldapProfile.getIdentifier(), PwmConstants.DEFAULT_LOCALE ),
|
|
|
+ PwmSetting.LDAP_TEST_USER_DN.toMenuLocationDebug( ldapProfile.getId(), PwmConstants.DEFAULT_LOCALE ),
|
|
|
e.getMessage()
|
|
|
) );
|
|
|
return returnRecords;
|
|
@@ -312,7 +313,7 @@ public class LDAPHealthChecker implements HealthSupplier
|
|
|
else
|
|
|
{
|
|
|
final Locale locale = PwmConstants.DEFAULT_LOCALE;
|
|
|
- final UserIdentity userIdentity = UserIdentity.create( testUserDN, ldapProfile.getIdentifier(), pwmDomain.getDomainID() );
|
|
|
+ final UserIdentity userIdentity = UserIdentity.create( testUserDN, ldapProfile.getId(), pwmDomain.getDomainID() );
|
|
|
|
|
|
final PwmPasswordPolicy passwordPolicy = PasswordUtility.readPasswordPolicyForUser(
|
|
|
pwmDomain, sessionLabel, userIdentity, theUser );
|
|
@@ -368,7 +369,7 @@ public class LDAPHealthChecker implements HealthSupplier
|
|
|
returnRecords.add( HealthRecord.forMessage(
|
|
|
pwmDomain.getDomainID(),
|
|
|
HealthMessage.LDAP_TestUserWritePwError,
|
|
|
- PwmSetting.LDAP_TEST_USER_DN.toMenuLocationDebug( ldapProfile.getIdentifier(), PwmConstants.DEFAULT_LOCALE ),
|
|
|
+ PwmSetting.LDAP_TEST_USER_DN.toMenuLocationDebug( ldapProfile.getId(), PwmConstants.DEFAULT_LOCALE ),
|
|
|
e.getMessage()
|
|
|
) );
|
|
|
return returnRecords;
|
|
@@ -384,7 +385,7 @@ public class LDAPHealthChecker implements HealthSupplier
|
|
|
returnRecords.add( HealthRecord.forMessage(
|
|
|
pwmDomain.getDomainID(),
|
|
|
HealthMessage.LDAP_TestUserUnexpected,
|
|
|
- PwmSetting.LDAP_TEST_USER_DN.toMenuLocationDebug( ldapProfile.getIdentifier(), PwmConstants.DEFAULT_LOCALE ),
|
|
|
+ PwmSetting.LDAP_TEST_USER_DN.toMenuLocationDebug( ldapProfile.getId(), PwmConstants.DEFAULT_LOCALE ),
|
|
|
msg
|
|
|
) );
|
|
|
return returnRecords;
|
|
@@ -392,7 +393,7 @@ public class LDAPHealthChecker implements HealthSupplier
|
|
|
|
|
|
try
|
|
|
{
|
|
|
- final UserIdentity userIdentity = UserIdentity.create( theUser.getEntryDN(), ldapProfile.getIdentifier(), pwmDomain.getDomainID() );
|
|
|
+ final UserIdentity userIdentity = UserIdentity.create( theUser.getEntryDN(), ldapProfile.getId(), pwmDomain.getDomainID() );
|
|
|
final UserInfo userInfo = UserInfoFactory.newUserInfo(
|
|
|
pwmDomain.getPwmApplication(),
|
|
|
sessionLabel,
|
|
@@ -417,7 +418,7 @@ public class LDAPHealthChecker implements HealthSupplier
|
|
|
returnRecords.add( HealthRecord.forMessage(
|
|
|
pwmDomain.getDomainID(),
|
|
|
HealthMessage.LDAP_TestUserError,
|
|
|
- PwmSetting.LDAP_TEST_USER_DN.toMenuLocationDebug( ldapProfile.getIdentifier(), PwmConstants.DEFAULT_LOCALE ),
|
|
|
+ PwmSetting.LDAP_TEST_USER_DN.toMenuLocationDebug( ldapProfile.getId(), PwmConstants.DEFAULT_LOCALE ),
|
|
|
"unable to read test user data: " + e.getMessage() ) );
|
|
|
return returnRecords;
|
|
|
}
|
|
@@ -521,20 +522,20 @@ public class LDAPHealthChecker implements HealthSupplier
|
|
|
final PasswordData proxyPW = ldapProfile.readSettingAsPassword( PwmSetting.LDAP_PROXY_USER_PASSWORD );
|
|
|
if ( proxyDN == null || proxyDN.length() < 1 )
|
|
|
{
|
|
|
- final String menuLocationStr = PwmSetting.LDAP_PROXY_USER_DN.toMenuLocationDebug( ldapProfile.getIdentifier(), PwmConstants.DEFAULT_LOCALE );
|
|
|
+ final String menuLocationStr = PwmSetting.LDAP_PROXY_USER_DN.toMenuLocationDebug( ldapProfile.getId(), PwmConstants.DEFAULT_LOCALE );
|
|
|
return Collections.singletonList( HealthRecord.forMessage(
|
|
|
pwmDomain.getDomainID(),
|
|
|
HealthMessage.LDAP_No_Connection,
|
|
|
- ldapProfile.getIdentifier(),
|
|
|
- "Missing Proxy User DN: " + menuLocationStr ) );
|
|
|
+ ldapProfile.getId().stringValue(),
|
|
|
+ "Missing Proxy User DN: " + menuLocationStr ) );
|
|
|
}
|
|
|
if ( proxyPW == null )
|
|
|
{
|
|
|
- final String menuLocationStr = PwmSetting.LDAP_PROXY_USER_PASSWORD.toMenuLocationDebug( ldapProfile.getIdentifier(), PwmConstants.DEFAULT_LOCALE );
|
|
|
+ final String menuLocationStr = PwmSetting.LDAP_PROXY_USER_PASSWORD.toMenuLocationDebug( ldapProfile.getId(), PwmConstants.DEFAULT_LOCALE );
|
|
|
return Collections.singletonList( HealthRecord.forMessage(
|
|
|
pwmDomain.getDomainID(),
|
|
|
HealthMessage.LDAP_No_Connection,
|
|
|
- ldapProfile.getIdentifier(),
|
|
|
+ ldapProfile.getId().stringValue(),
|
|
|
"Missing Proxy User Password: " + menuLocationStr ) );
|
|
|
}
|
|
|
chaiProvider = LdapOperationsHelper.createChaiProvider( pwmDomain, sessionLabel, ldapProfile, config, proxyDN, proxyPW );
|
|
@@ -566,7 +567,7 @@ public class LDAPHealthChecker implements HealthSupplier
|
|
|
final ChaiError chaiError = ChaiErrors.getErrorForMessage( e.getMessage() );
|
|
|
final PwmError pwmError = PwmError.forChaiError( chaiError ).orElse( PwmError.ERROR_INTERNAL );
|
|
|
final StringBuilder errorString = new StringBuilder();
|
|
|
- final String profileName = ldapProfile.getIdentifier();
|
|
|
+ final ProfileID profileName = ldapProfile.getId();
|
|
|
errorString.append( "error connecting to ldap directory (" ).append( profileName ).append( "), error: " ).append( e.getMessage() );
|
|
|
if ( chaiError != null && chaiError != ChaiError.UNKNOWN )
|
|
|
{
|
|
@@ -582,7 +583,7 @@ public class LDAPHealthChecker implements HealthSupplier
|
|
|
returnRecords.add( HealthRecord.forMessage(
|
|
|
pwmDomain.getDomainID(),
|
|
|
HealthMessage.LDAP_No_Connection,
|
|
|
- ldapProfile.getIdentifier(),
|
|
|
+ ldapProfile.getId().stringValue(),
|
|
|
errorString.toString() ) );
|
|
|
|
|
|
pwmDomain.getLdapService().setLastLdapFailure( ldapProfile,
|
|
@@ -618,24 +619,24 @@ public class LDAPHealthChecker implements HealthSupplier
|
|
|
if ( objectClasses == null || objectClasses.isEmpty() )
|
|
|
{
|
|
|
final String errorString = "ldap context setting '"
|
|
|
- + PwmSetting.LDAP_CONTEXTLESS_ROOT.toMenuLocationDebug( ldapProfile.getIdentifier(), PwmConstants.DEFAULT_LOCALE )
|
|
|
+ + PwmSetting.LDAP_CONTEXTLESS_ROOT.toMenuLocationDebug( ldapProfile.getId(), PwmConstants.DEFAULT_LOCALE )
|
|
|
+ "' value '" + loopContext + "' is not valid";
|
|
|
returnRecords.add( HealthRecord.forMessage(
|
|
|
pwmDomain.getDomainID(),
|
|
|
HealthMessage.LDAP_No_Connection,
|
|
|
- ldapProfile.getIdentifier(),
|
|
|
+ ldapProfile.getId().stringValue(),
|
|
|
errorString ) );
|
|
|
}
|
|
|
}
|
|
|
catch ( final Exception e )
|
|
|
{
|
|
|
final String errorString = "ldap context setting '"
|
|
|
- + PwmSetting.LDAP_CONTEXTLESS_ROOT.toMenuLocationDebug( ldapProfile.getIdentifier(), PwmConstants.DEFAULT_LOCALE )
|
|
|
+ + PwmSetting.LDAP_CONTEXTLESS_ROOT.toMenuLocationDebug( ldapProfile.getId(), PwmConstants.DEFAULT_LOCALE )
|
|
|
+ "' value '" + loopContext + "' is not valid: " + e.getMessage();
|
|
|
returnRecords.add( HealthRecord.forMessage(
|
|
|
pwmDomain.getDomainID(),
|
|
|
HealthMessage.LDAP_No_Connection,
|
|
|
- ldapProfile.getIdentifier(),
|
|
|
+ ldapProfile.getId().stringValue(),
|
|
|
errorString ) );
|
|
|
}
|
|
|
}
|
|
@@ -697,7 +698,7 @@ public class LDAPHealthChecker implements HealthSupplier
|
|
|
pwmDomain.getDomainID(),
|
|
|
HealthMessage.Config_ParseError,
|
|
|
e.getMessage(),
|
|
|
- PwmSetting.LDAP_SERVER_URLS.toMenuLocationDebug( ldapProfile.getIdentifier(), PwmConstants.DEFAULT_LOCALE ),
|
|
|
+ PwmSetting.LDAP_SERVER_URLS.toMenuLocationDebug( ldapProfile.getId(), PwmConstants.DEFAULT_LOCALE ),
|
|
|
loopURL
|
|
|
) );
|
|
|
}
|
|
@@ -906,7 +907,7 @@ public class LDAPHealthChecker implements HealthSupplier
|
|
|
&& pwmSetting.getFlags().contains( PwmSettingFlag.ldapDnSyntax )
|
|
|
)
|
|
|
{
|
|
|
- for ( final String profile : config.getLdapProfiles().keySet() )
|
|
|
+ for ( final ProfileID profile : config.getLdapProfiles().keySet() )
|
|
|
{
|
|
|
if ( pwmSetting.getSyntax() == PwmSettingSyntax.STRING )
|
|
|
{
|
|
@@ -971,7 +972,7 @@ public class LDAPHealthChecker implements HealthSupplier
|
|
|
HealthRecord.forMessage(
|
|
|
pwmDomain.getDomainID(),
|
|
|
HealthMessage.NewUser_PwTemplateBad,
|
|
|
- PwmSetting.NEWUSER_PASSWORD_POLICY_USER.toMenuLocationDebug( newUserProfile.getIdentifier(), locale ),
|
|
|
+ PwmSetting.NEWUSER_PASSWORD_POLICY_USER.toMenuLocationDebug( newUserProfile.getId(), locale ),
|
|
|
"Value missing"
|
|
|
)
|
|
|
);
|
|
@@ -989,7 +990,7 @@ public class LDAPHealthChecker implements HealthSupplier
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- final UserIdentity newUserTemplateIdentity = UserIdentity.create( policyUserStr, ldapProfile.getIdentifier(), pwmDomain.getDomainID() );
|
|
|
+ final UserIdentity newUserTemplateIdentity = UserIdentity.create( policyUserStr, ldapProfile.getId(), pwmDomain.getDomainID() );
|
|
|
final ChaiUser chaiUser = pwmDomain.getProxiedChaiUser( sessionLabel, newUserTemplateIdentity );
|
|
|
|
|
|
try
|
|
@@ -1000,7 +1001,7 @@ public class LDAPHealthChecker implements HealthSupplier
|
|
|
HealthRecord.forMessage(
|
|
|
pwmDomain.getDomainID(),
|
|
|
HealthMessage.NewUser_PwTemplateBad,
|
|
|
- PwmSetting.NEWUSER_PASSWORD_POLICY_USER.toMenuLocationDebug( newUserProfile.getIdentifier(), locale ),
|
|
|
+ PwmSetting.NEWUSER_PASSWORD_POLICY_USER.toMenuLocationDebug( newUserProfile.getId(), locale ),
|
|
|
"userDN value is not valid"
|
|
|
)
|
|
|
);
|
|
@@ -1081,12 +1082,11 @@ public class LDAPHealthChecker implements HealthSupplier
|
|
|
final String settingDebugName = pwmSetting.toMenuLocationDebug( null, PwmConstants.DEFAULT_LOCALE );
|
|
|
final List<HealthRecord> returnList = new ArrayList<>();
|
|
|
final DomainConfig config = pwmDomain.getConfig();
|
|
|
- final List<String> ldapProfilesToCheck = new ArrayList<>();
|
|
|
+ final List<ProfileID> ldapProfilesToCheck = new ArrayList<>();
|
|
|
{
|
|
|
- final String configuredLdapProfileID = userPermission.getLdapProfileID();
|
|
|
+ final ProfileID configuredLdapProfileID = userPermission.getLdapProfileID();
|
|
|
if ( configuredLdapProfileID == null
|
|
|
- || configuredLdapProfileID.isEmpty()
|
|
|
- || PwmConstants.PROFILE_ID_ALL.equals( configuredLdapProfileID ) )
|
|
|
+ || ProfileID.PROFILE_ID_ALL.equals( configuredLdapProfileID ) )
|
|
|
{
|
|
|
ldapProfilesToCheck.addAll( config.getLdapProfiles().keySet() );
|
|
|
}
|
|
@@ -1109,7 +1109,7 @@ public class LDAPHealthChecker implements HealthSupplier
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- for ( final String ldapProfileID : ldapProfilesToCheck )
|
|
|
+ for ( final ProfileID ldapProfileID : ldapProfilesToCheck )
|
|
|
{
|
|
|
switch ( userPermission.getType() )
|
|
|
{
|
|
@@ -1171,7 +1171,7 @@ public class LDAPHealthChecker implements HealthSupplier
|
|
|
final SessionLabel sessionLabel,
|
|
|
final PwmDomain pwmDomain,
|
|
|
final String dnValue,
|
|
|
- final String ldapProfileID
|
|
|
+ final ProfileID ldapProfileID
|
|
|
)
|
|
|
throws PwmUnrecoverableException
|
|
|
{
|
|
@@ -1239,7 +1239,7 @@ public class LDAPHealthChecker implements HealthSupplier
|
|
|
final PwmDomain pwmDomain,
|
|
|
final DomainConfig config,
|
|
|
final Locale locale,
|
|
|
- final String profileID,
|
|
|
+ final ProfileID profileID,
|
|
|
final boolean testContextless,
|
|
|
final boolean fullTest
|
|
|
|