Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
identifiedBy example
if
(
$tokenStruct
->
getExpires
(
)
> 0
)
{
$expires
=
$expires
->
modify
(
sprintf
(
'+%d seconds',
$tokenStruct
->
getExpires
(
)
)
)
;
}
else
{
$expires
=
$expires
->
modify
(
sprintf
(
'-%d seconds',
abs
(
$tokenStruct
->
getExpires
(
)
)
)
)
;
}
$jwtToken
=
$this
->configuration->
builder
(
)
->
identifiedBy
(
Uuid::
randomHex
(
)
)
->
issuedAt
(
new
\
DateTimeImmutable
(
'@' .
time
(
)
)
)
->
canOnlyBeUsedAfter
(
new
\
DateTimeImmutable
(
'@' .
time
(
)
)
)
->
expiresAt
(
$expires
)
->
relatedTo
(
$tokenStruct
->
getTransactionId
(
)
?? ''
)
->
withClaim
(
'pmi',
$tokenStruct
->
getPaymentMethodId
(
)
)
->
withClaim
(
'ful',
$tokenStruct
->
getFinishUrl
(
)
)
->
withClaim
(
'eul',
$tokenStruct
->
getErrorUrl
(
)
)
->
getToken
(
$this
->configuration->
signer
(
)
,
$this
->configuration->
signingKey
(
)
)
;
$this
->
write
(
$jwtToken
->
toString
(
)
,
$expires
)
;