Skip to content
This repository was archived by the owner on Nov 21, 2024. It is now read-only.
This repository was archived by the owner on Nov 21, 2024. It is now read-only.

Encryption with Openfire 3.10.3 #21

@andreabenini

Description

@andreabenini

Hi there,
As told on issue #16 I have had troubles with authentication when using this library, I don't think there's a special setting inside openfire for bosh encryption setup. I have had weird behavior with auth. My php code is just

// Fake proof of concept, just a test but works
ini_set('max_execution_time', 300); //300 seconds = 5 minutes
try {
    require_once("lib/XmppPrebind.php");
    $username = "test";
    $password = "test";
    $jabberHost = "myhost.domain.local";
    $boshUri    = "http://myhost.domain.local:7070/http-bind/";
    $resource   = "resource";
    $xmppPrebind = new XmppPrebind($jabberHost, $boshUri, $resource, false, false);
    $xmppPrebind->connect($username, $password);
    $xmppPrebind->auth();
    var_dump($xmppPrebind->getSessionInfo());
} catch (Exception $e) {
    echo $e->getMessage();
}

I have added a line in your connect() function, I know this is just a weird and dirty hack but works. I don't like it so suggestions are welcomed, Changes:

        if (in_array(self::ENCRYPTION_DIGEST_MD5, $this->mechanisms)) {
            $this->encryption = self::ENCRYPTION_DIGEST_MD5;
        } elseif (in_array(self::ENCRYPTION_CRAM_MD5, $this->mechanisms)) {
            $this->encryption = self::ENCRYPTION_CRAM_MD5;
        } elseif (in_array(self::ENCRYPTION_PLAIN, $this->mechanisms)) {
            $this->encryption = self::ENCRYPTION_PLAIN;
        } else {
            throw new XmppPrebindConnectionException("No encryption supported by the server is supported by this library.");
        }
        $this->encryption = self::ENCRYPTION_PLAIN;
        $this->debug($this->encryption, 'encryption used');

my add is just "$this->encryption = self::ENCRYPTION_PLAIN;". I was thinking about adding
a third (optional) parameter on connect() for specifying preferred authentication method, may I submit a pull request for it ?

Ben

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions