*/
if ( env.get( TYPE ).equals( "simple" ) )
{
if ( !env.containsKey( CREDS ) )
{
throw new LdapConfigurationException( "missing required "
+ CREDS + " property for simple authentication" );
}
if ( !env.containsKey( PRINCIPAL ) )
{
throw new LdapConfigurationException( "missing required "
+ PRINCIPAL + " property for simple authentication" );
}
}
/*
* If bind is none make sure credentials and the principal
* name are NOT set within the environment, otherwise complain
*/
else if ( env.get( TYPE ).equals( "none" ) )
{
if ( env.containsKey( CREDS ) )
{
throw new LdapConfigurationException( "ambiguous bind "
+ "settings encountered where bind is anonymous yet "
+ CREDS + " property is set" );
}
if ( env.containsKey( PRINCIPAL ) )
{
throw new LdapConfigurationException( "ambiguous bind "
+ "settings encountered where bind is anonymous yet "
+ PRINCIPAL + " property is set" );
}
}
/*
* If bind is anything other than simple or none we need to
* complain because SASL is not a supported auth method yet
*/
else
{
throw new LdapAuthenticationNotSupportedException( ResultCodeEnum.AUTHMETHODNOTSUPPORTED );
}
}
else if ( env.containsKey( CREDS ) )
{
if ( !env.containsKey( PRINCIPAL ) )
{
throw new LdapConfigurationException( "credentials provided "
+ "without principal name property: " + PRINCIPAL );
}
}
}