private void checkSecuritySettings( String principal, String credential, String authentication ) throws NamingException
private void checkSecuritySettings( String principal, byte[] credential, String authentication ) throws NamingException
    private void checkSecuritySettings( String principal, String credential, String authentication ) throws NamingException    {        if( authentication == null )        {            authentication = "";        }                /*         * If bind is simple make sure we have the credentials and the         * principal name set within the environment, otherwise complain         */        if ( "simple".equalsIgnoreCase( authentication ) )        {            if ( credential == null )            {                throw new LdapConfigurationException( "missing required "                        + Context.SECURITY_CREDENTIALS + " property for simple authentication" );            }            if ( principal == null )            {                throw new LdapConfigurationException( "missing required "                        + Context.SECURITY_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 ( "none".equalsIgnoreCase( authentication ) )        {            if ( credential != null )            {                throw new LdapConfigurationException( "ambiguous bind "                        + "settings encountered where bind is anonymous yet "                        + Context.SECURITY_CREDENTIALS + " property is set" );            }            if ( principal != null )            {                throw new LdapConfigurationException( "ambiguous bind "                        + "settings encountered where bind is anonymous yet "                        + Context.SECURITY_PRINCIPAL + " property is set" );            }                        if( !configuration.isAllowAnonymousAccess() )            {                throw new LdapNoPermissionException( "Anonymous access disabled." );            }        }        else        {            /*             * If bind is anything other than simple or none we need to             * complain because SASL is not a supported auth method yet             */            throw new LdapAuthenticationNotSupportedException( "Unknown authentication type: '" + authentication + "'", ResultCodeEnum.AUTHMETHODNOTSUPPORTED );        }    }