CodeExplorer withClaim example
$expiration =
new \
DateTimeImmutable('+10 minutes'
);
$shopId =
$this->shopIdProvider->
getShopId();
$builder =
$configuration ->
builder() ->
issuedBy($shopId) ->
issuedAt(new \
DateTimeImmutable()) ->
canOnlyBeUsedAfter(new \
DateTimeImmutable()) ->
expiresAt($expiration);
if (\
in_array('sales_channel:read',
$privileges, true
)) { $builder->
withClaim('salesChannelId',
$context->
getSalesChannel()->
getId());
} if (\
in_array('customer:read',
$privileges, true
)) { $builder->
withClaim('customerId',
$context->
getCustomer()->
getId());
} if (\
in_array('currency:read',
$privileges, true
)) { $builder->
withClaim('currencyId',
$context->
getCurrency()->
getId());
} if (\
in_array('language:read',
$privileges, true
)) {