generated from Nodarx/template
feat: initial version
Signed-off-by: Sebastian Krupinski <root@LAPTOP-7DVOR6NC>
This commit was merged in pull request #1.
This commit is contained in:
26
lib/Client/Protocol/Command/Authenticate/XOAuth2.php
Normal file
26
lib/Client/Protocol/Command/Authenticate/XOAuth2.php
Normal file
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Gricob\IMAP\Protocol\Command\Authenticate;
|
||||
|
||||
final readonly class XOAuth2 implements SASLMechanism
|
||||
{
|
||||
public function __construct(
|
||||
private string $user,
|
||||
private string $accessToken
|
||||
) {
|
||||
}
|
||||
|
||||
public function __toString(): string
|
||||
{
|
||||
return 'XOAUTH2';
|
||||
}
|
||||
|
||||
public function continue(): string
|
||||
{
|
||||
return base64_encode(
|
||||
sprintf("user=%s\1auth=Bearer %s\1\1", $this->user, $this->accessToken)
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user