Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions src/ManageSieve/Auth/ExternalAuthMechanism.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?php

namespace PhpSieveManager\ManageSieve\Auth;

use PhpSieveManager\ManageSieve\SieveCommand;

class ExternalAuthMechanism extends BaseAuthMechanism
{
/**
* SASL Authentication
*
* @return SieveCommand
*/
function parse()
{
$args = base64_encode($this->username);
return new SieveCommand(
"AUTHENTICATE",
['"EXTERNAL"', '"'.$args.'"']
);
}
}
22 changes: 22 additions & 0 deletions src/ManageSieve/Auth/OauthbearerAuthMechanism.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?php

namespace PhpSieveManager\ManageSieve\Auth;

use PhpSieveManager\ManageSieve\SieveCommand;

class OauthbearerAuthMechanism extends BaseAuthMechanism
{
/**
* SASL Authentication
*
* @return SieveCommand
*/
function parse()
{
$args = base64_encode("n,a={$this->username}\001auth=$this->password\001\001");
return new SieveCommand(
"AUTHENTICATE",
['"OAUTHBEARER"', '"'.$args.'"']
);
}
}
22 changes: 22 additions & 0 deletions src/ManageSieve/Auth/Xoauth2AuthMechanism.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?php

namespace PhpSieveManager\ManageSieve\Auth;

use PhpSieveManager\ManageSieve\SieveCommand;

class Xoauth2AuthMechanism extends BaseAuthMechanism
{
/**
* SASL Authentication
*
* @return SieveCommand
*/
function parse()
{
$args = base64_encode("user={$this->username}\001auth={$this->password}\001\001");
return new SieveCommand(
"AUTHENTICATE",
['"XOAUTH2"', '"'.$args.'"']
);
}
}
2 changes: 1 addition & 1 deletion src/ManageSieve/Client.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
*/
class Client implements SieveClient
{
const SUPPORTED_AUTH_MECHS = ["DIGEST-MD5", "PLAIN", "LOGIN"];
const SUPPORTED_AUTH_MECHS = ["DIGEST-MD5", "PLAIN", "LOGIN", "EXTERNAL", "OAUTHBEARER", "XOAUTH2"];
const KNOWN_CAPABILITIES = ["IMPLEMENTATION", "SASL", "SIEVE", "STARTTLS", "NOTIFY", "LANGUAGE", "VERSION"];

private $readSize = 4096;
Expand Down