private static SaslConfig getSaslConfigFrom(final AbstractLdapProperties properties) {

        if (Mechanism.valueOf(properties.getSaslMechanism()) == Mechanism.DIGEST_MD5) {
            val sc = new SaslConfig();
            sc.setMechanism(Mechanism.DIGEST_MD5);
            sc.setRealm(properties.getSaslRealm());
            return sc;
        }
        if (Mechanism.valueOf(properties.getSaslMechanism()) == Mechanism.CRAM_MD5) {
            val sc = new SaslConfig();
            sc.setMechanism(Mechanism.CRAM_MD5);
            return sc;
        }
        if (Mechanism.valueOf(properties.getSaslMechanism()) == Mechanism.EXTERNAL) {
            val sc = new SaslConfig();
            sc.setMechanism(Mechanism.EXTERNAL);
            return sc;
        }
        val sc = new SaslConfig();
        sc.setMechanism(Mechanism.GSSAPI);
        sc.setRealm(properties.getSaslRealm());
        return sc;
    }
Gets authenticated authenticator.

@param properties the lDAP properties
@return the authenticated or anon search authenticator
support/cas-server-support-ldap-core/src/main/java/org/apereo/cas/util/LdapUtils.java