Initial Drupal 11 with DDEV setup
This commit is contained in:
		
							
								
								
									
										35
									
								
								vendor/symfony/mailer/Transport/Smtp/Auth/AuthenticatorInterface.php
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										35
									
								
								vendor/symfony/mailer/Transport/Smtp/Auth/AuthenticatorInterface.php
									
									
									
									
										vendored
									
									
										Normal file
									
								
							@ -0,0 +1,35 @@
 | 
			
		||||
<?php
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
 * This file is part of the Symfony package.
 | 
			
		||||
 *
 | 
			
		||||
 * (c) Fabien Potencier <fabien@symfony.com>
 | 
			
		||||
 *
 | 
			
		||||
 * For the full copyright and license information, please view the LICENSE
 | 
			
		||||
 * file that was distributed with this source code.
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
namespace Symfony\Component\Mailer\Transport\Smtp\Auth;
 | 
			
		||||
 | 
			
		||||
use Symfony\Component\Mailer\Exception\TransportExceptionInterface;
 | 
			
		||||
use Symfony\Component\Mailer\Transport\Smtp\EsmtpTransport;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * An Authentication mechanism.
 | 
			
		||||
 *
 | 
			
		||||
 * @author Chris Corbyn
 | 
			
		||||
 */
 | 
			
		||||
interface AuthenticatorInterface
 | 
			
		||||
{
 | 
			
		||||
    /**
 | 
			
		||||
     * Tries to authenticate the user.
 | 
			
		||||
     *
 | 
			
		||||
     * @throws TransportExceptionInterface
 | 
			
		||||
     */
 | 
			
		||||
    public function authenticate(EsmtpTransport $client): void;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Gets the name of the AUTH mechanism this Authenticator handles.
 | 
			
		||||
     */
 | 
			
		||||
    public function getAuthKeyword(): string;
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										64
									
								
								vendor/symfony/mailer/Transport/Smtp/Auth/CramMd5Authenticator.php
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										64
									
								
								vendor/symfony/mailer/Transport/Smtp/Auth/CramMd5Authenticator.php
									
									
									
									
										vendored
									
									
										Normal file
									
								
							@ -0,0 +1,64 @@
 | 
			
		||||
<?php
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
 * This file is part of the Symfony package.
 | 
			
		||||
 *
 | 
			
		||||
 * (c) Fabien Potencier <fabien@symfony.com>
 | 
			
		||||
 *
 | 
			
		||||
 * For the full copyright and license information, please view the LICENSE
 | 
			
		||||
 * file that was distributed with this source code.
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
namespace Symfony\Component\Mailer\Transport\Smtp\Auth;
 | 
			
		||||
 | 
			
		||||
use Symfony\Component\Mailer\Exception\InvalidArgumentException;
 | 
			
		||||
use Symfony\Component\Mailer\Transport\Smtp\EsmtpTransport;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Handles CRAM-MD5 authentication.
 | 
			
		||||
 *
 | 
			
		||||
 * @author Chris Corbyn
 | 
			
		||||
 */
 | 
			
		||||
class CramMd5Authenticator implements AuthenticatorInterface
 | 
			
		||||
{
 | 
			
		||||
    public function getAuthKeyword(): string
 | 
			
		||||
    {
 | 
			
		||||
        return 'CRAM-MD5';
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @see https://www.ietf.org/rfc/rfc4954.txt
 | 
			
		||||
     */
 | 
			
		||||
    public function authenticate(EsmtpTransport $client): void
 | 
			
		||||
    {
 | 
			
		||||
        $challenge = $client->executeCommand("AUTH CRAM-MD5\r\n", [334]);
 | 
			
		||||
        $challenge = base64_decode(substr($challenge, 4));
 | 
			
		||||
        $message = base64_encode($client->getUsername().' '.$this->getResponse($client->getPassword(), $challenge));
 | 
			
		||||
        $client->executeCommand(\sprintf("%s\r\n", $message), [235]);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Generates a CRAM-MD5 response from a server challenge.
 | 
			
		||||
     */
 | 
			
		||||
    private function getResponse(#[\SensitiveParameter] string $secret, string $challenge): string
 | 
			
		||||
    {
 | 
			
		||||
        if (!$secret) {
 | 
			
		||||
            throw new InvalidArgumentException('A non-empty secret is required.');
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        if (\strlen($secret) > 64) {
 | 
			
		||||
            $secret = pack('H32', md5($secret));
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        if (\strlen($secret) < 64) {
 | 
			
		||||
            $secret = str_pad($secret, 64, \chr(0));
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        $kipad = substr($secret, 0, 64) ^ str_repeat(\chr(0x36), 64);
 | 
			
		||||
        $kopad = substr($secret, 0, 64) ^ str_repeat(\chr(0x5C), 64);
 | 
			
		||||
 | 
			
		||||
        $inner = pack('H32', md5($kipad.$challenge));
 | 
			
		||||
 | 
			
		||||
        return md5($kopad.$inner);
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										37
									
								
								vendor/symfony/mailer/Transport/Smtp/Auth/LoginAuthenticator.php
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										37
									
								
								vendor/symfony/mailer/Transport/Smtp/Auth/LoginAuthenticator.php
									
									
									
									
										vendored
									
									
										Normal file
									
								
							@ -0,0 +1,37 @@
 | 
			
		||||
<?php
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
 * This file is part of the Symfony package.
 | 
			
		||||
 *
 | 
			
		||||
 * (c) Fabien Potencier <fabien@symfony.com>
 | 
			
		||||
 *
 | 
			
		||||
 * For the full copyright and license information, please view the LICENSE
 | 
			
		||||
 * file that was distributed with this source code.
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
namespace Symfony\Component\Mailer\Transport\Smtp\Auth;
 | 
			
		||||
 | 
			
		||||
use Symfony\Component\Mailer\Transport\Smtp\EsmtpTransport;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Handles LOGIN authentication.
 | 
			
		||||
 *
 | 
			
		||||
 * @author Chris Corbyn
 | 
			
		||||
 */
 | 
			
		||||
class LoginAuthenticator implements AuthenticatorInterface
 | 
			
		||||
{
 | 
			
		||||
    public function getAuthKeyword(): string
 | 
			
		||||
    {
 | 
			
		||||
        return 'LOGIN';
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @see https://www.ietf.org/rfc/rfc4954.txt
 | 
			
		||||
     */
 | 
			
		||||
    public function authenticate(EsmtpTransport $client): void
 | 
			
		||||
    {
 | 
			
		||||
        $client->executeCommand("AUTH LOGIN\r\n", [334]);
 | 
			
		||||
        $client->executeCommand(\sprintf("%s\r\n", base64_encode($client->getUsername())), [334]);
 | 
			
		||||
        $client->executeCommand(\sprintf("%s\r\n", base64_encode($client->getPassword())), [235]);
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										35
									
								
								vendor/symfony/mailer/Transport/Smtp/Auth/PlainAuthenticator.php
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										35
									
								
								vendor/symfony/mailer/Transport/Smtp/Auth/PlainAuthenticator.php
									
									
									
									
										vendored
									
									
										Normal file
									
								
							@ -0,0 +1,35 @@
 | 
			
		||||
<?php
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
 * This file is part of the Symfony package.
 | 
			
		||||
 *
 | 
			
		||||
 * (c) Fabien Potencier <fabien@symfony.com>
 | 
			
		||||
 *
 | 
			
		||||
 * For the full copyright and license information, please view the LICENSE
 | 
			
		||||
 * file that was distributed with this source code.
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
namespace Symfony\Component\Mailer\Transport\Smtp\Auth;
 | 
			
		||||
 | 
			
		||||
use Symfony\Component\Mailer\Transport\Smtp\EsmtpTransport;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Handles PLAIN authentication.
 | 
			
		||||
 *
 | 
			
		||||
 * @author Chris Corbyn
 | 
			
		||||
 */
 | 
			
		||||
class PlainAuthenticator implements AuthenticatorInterface
 | 
			
		||||
{
 | 
			
		||||
    public function getAuthKeyword(): string
 | 
			
		||||
    {
 | 
			
		||||
        return 'PLAIN';
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @see https://www.ietf.org/rfc/rfc4954.txt
 | 
			
		||||
     */
 | 
			
		||||
    public function authenticate(EsmtpTransport $client): void
 | 
			
		||||
    {
 | 
			
		||||
        $client->executeCommand(\sprintf("AUTH PLAIN %s\r\n", base64_encode($client->getUsername().\chr(0).$client->getUsername().\chr(0).$client->getPassword())), [235]);
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										37
									
								
								vendor/symfony/mailer/Transport/Smtp/Auth/XOAuth2Authenticator.php
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										37
									
								
								vendor/symfony/mailer/Transport/Smtp/Auth/XOAuth2Authenticator.php
									
									
									
									
										vendored
									
									
										Normal file
									
								
							@ -0,0 +1,37 @@
 | 
			
		||||
<?php
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
 * This file is part of the Symfony package.
 | 
			
		||||
 *
 | 
			
		||||
 * (c) Fabien Potencier <fabien@symfony.com>
 | 
			
		||||
 *
 | 
			
		||||
 * For the full copyright and license information, please view the LICENSE
 | 
			
		||||
 * file that was distributed with this source code.
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
namespace Symfony\Component\Mailer\Transport\Smtp\Auth;
 | 
			
		||||
 | 
			
		||||
use Symfony\Component\Mailer\Transport\Smtp\EsmtpTransport;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Handles XOAUTH2 authentication.
 | 
			
		||||
 *
 | 
			
		||||
 * @author xu.li<AthenaLightenedMyPath@gmail.com>
 | 
			
		||||
 *
 | 
			
		||||
 * @see https://developers.google.com/google-apps/gmail/xoauth2_protocol
 | 
			
		||||
 */
 | 
			
		||||
class XOAuth2Authenticator implements AuthenticatorInterface
 | 
			
		||||
{
 | 
			
		||||
    public function getAuthKeyword(): string
 | 
			
		||||
    {
 | 
			
		||||
        return 'XOAUTH2';
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @see https://developers.google.com/google-apps/gmail/xoauth2_protocol#the_sasl_xoauth2_mechanism
 | 
			
		||||
     */
 | 
			
		||||
    public function authenticate(EsmtpTransport $client): void
 | 
			
		||||
    {
 | 
			
		||||
        $client->executeCommand('AUTH XOAUTH2 '.base64_encode('user='.$client->getUsername()."\1auth=Bearer ".$client->getPassword()."\1\1")."\r\n", [235]);
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
		Reference in New Issue
	
	Block a user