Skip to content

Support TLS client certificates for IMAP authentication - #213

Open
stevebauman wants to merge 13 commits into
masterfrom
feature/tls-client-certificates
Open

stevebauman wants to merge 13 commits into
masterfrom
feature/tls-client-certificates

Conversation

@stevebauman

Copy link
Copy Markdown
Member

You can now connect to an IMAP server using a TLS client certificate. If the server advertises AUTH=EXTERNAL, set authentication to external to sign in with the certificate alone.

$mailbox = Mailbox::make([
    'host' => 'imap.example.com',
    'authentication' => 'external',
    'tls' => [
        'local_cert' => '/path/to/client.pem',
        'local_pk' => '/path/to/client.key',
    ],
]);

You can omit username to let the server identify the mailbox from the certificate. If the server also requires a password, use the same tls options with your usual username and password. Both implicit TLS and STARTTLS support client certificates.

Existing calls to authenticate($user, $token) still use XOAUTH2. If you implement ConnectionInterface or override ImapConnection::authenticate(), update the signature to accept ?string $token = null and ImapAuthMechanism $mechanism = ImapAuthMechanism::XOAuth2.

Closes #212.

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

Successfully merging this pull request may close these issues.

Suggestion: Support TLS client certificates for authentication

1 participant