Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
forAsymmetricSigner example
/** @var non-empty-string $publicKeyText */
$publicKeyText
=
$publicKey
->
getKeyContents
(
)
;
if
(
$privateKey
->
getKeyPath
(
)
=== ''
)
{
$privateKey
= InMemory::
plainText
(
$privateKeyText
,
$privateKey
->
getPassPhrase
(
)
?? ''
)
;
$publicKey
= InMemory::
plainText
(
$publicKeyText
,
$publicKey
->
getPassPhrase
(
)
?? ''
)
;
}
else
{
$privateKey
= InMemory::
file
(
$privateKey
->
getKeyPath
(
)
,
$privateKey
->
getPassPhrase
(
)
?? ''
)
;
$publicKey
= InMemory::
file
(
$publicKey
->
getKeyPath
(
)
,
$publicKey
->
getPassPhrase
(
)
?? ''
)
;
}
$configuration
= Configuration::
forAsymmetricSigner
(
$signer
,
$privateKey
,
$publicKey
,
$encoder
,
$decoder
)
;
// add basic constraint for token signature validation
$constraint
=
new
SignedWith
(
$signer
,
$publicKey
)
;
$configuration
->
setValidationConstraints
(
$constraint
)
;