private LDAPConnection createLDAPConnection ( ) throws GuacamoleException { // Map encryption method to proper connection and socket factory EncryptionMethod encryptionMethod = confService . getEncryptionMethod ( ) ; switch ( encryptionMethod ) { // Unencrypted LDAP connection case NONE : logger . debug ( "Connection to LDAP server without encryption." ) ; return new LDAPConnection ( ) ; // LDAP over SSL (LDAPS) case SSL : logger . debug ( "Connecting to LDAP server using SSL/TLS." ) ; return new LDAPConnection ( new LDAPJSSESecureSocketFactory ( ) ) ; // LDAP + STARTTLS case STARTTLS : logger . debug ( "Connecting to LDAP server using STARTTLS." ) ; return new LDAPConnection ( new LDAPJSSEStartTLSFactory ( ) ) ; // The encryption method, though known, is not actually // implemented. If encountered, this would be a bug. default : throw new GuacamoleUnsupportedException ( "Unimplemented encryption method: " + encryptionMethod ) ; } }
Creates a new instance of LDAPConnection configured as required to use whichever encryption method is requested within guacamole . properties .