Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork5.2k
[Mailer][Mime] Refactor S/MIME encryption handling inSMimeEncryptionListener
#20935
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Changes fromall commits
File filter
Filter by extension
Conversations
Uh oh!
There was an error while loading.Please reload this page.
Jump to
Uh oh!
There was an error while loading.Please reload this page.
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1532,7 +1532,7 @@ | ||
framework: | ||
mailer: | ||
smime_encrypter: | ||
repository: app.my_smime_encrypter | ||
.. code-block:: xml | ||
@@ -1549,7 +1549,7 @@ | ||
<framework:config> | ||
<framework:mailer> | ||
<framework:smime-encrypter> | ||
<framework:repository>app.my_smime_encrypter</framework:repository> | ||
</framework:smime-encrypter> | ||
</framework:mailer> | ||
</framework:config> | ||
@@ -1563,10 +1563,35 @@ | ||
return static function (FrameworkConfig $framework): void { | ||
$mailer = $framework->mailer(); | ||
$mailer->smimeEncrypter() | ||
->repository('app.my_smime_encrypter') | ||
; | ||
}; | ||
The ``repository`` option must be a service ID that implements | ||
:class:`Symfony\\Component\\Mailer\\EventListener\\SmimeCertificateRepositoryInterface`:: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others.Learn more. The purpose of the method | ||
namespace App\Security; | ||
use Symfony\Component\DependencyInjection\Attribute\Autowire; | ||
use Symfony\Component\Mailer\EventListener\SmimeCertificateRepositoryInterface; | ||
class LocalFileCertificateRepository implements SmimeCertificateRepositoryInterface | ||
{ | ||
public function __construct( | ||
#[Autowire(param: 'kernel.project_dir')] | ||
private readonly string $projectDir | ||
){} | ||
public function findCertificatePathFor(string $email): ?string | ||
{ | ||
$hash = hash('sha256', strtolower(trim($email))); | ||
$path = sprintf('%s/storage/%s.crt', $this->projectDir, $hash); | ||
return file_exists($path) ? $path : null; | ||
} | ||
} | ||
.. versionadded:: 7.3 | ||
Global message encryption configuration was introduced in Symfony 7.3. | ||
Uh oh!
There was an error while loading.Please reload this page.