Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Encryption with Openfire 3.10.3 #21

Open
andreabenini opened this issue Nov 24, 2015 · 2 comments
Open

Encryption with Openfire 3.10.3 #21

andreabenini opened this issue Nov 24, 2015 · 2 comments

Comments

@andreabenini
Copy link

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

@papaaldrin
Copy link

Thanks! It works. But maybe sooner, the developer of this plugin will notice this.

@linksilver
Copy link

Yeah thanks !!!!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants