Skip to content

Instantly share code, notes, and snippets.

@spoonerWeb
Created January 3, 2023 17:18
Show Gist options
  • Save spoonerWeb/09c529ac983546b1c320faeb82678ff1 to your computer and use it in GitHub Desktop.
Save spoonerWeb/09c529ac983546b1c320faeb82678ff1 to your computer and use it in GitHub Desktop.
TYPO3 - get signed storage in TypoScript
page.10.variables {
usersPid = USER
usersPid.userFunc = Vendor\Extension\User\SignedStorageFolders->getSignedStorageFolders
usersPid.pidList = 42
usersPid.additionalSecret = TYPO3\CMS\Frontend\Authentication\FrontendUserAuthentication
}
<?php
namespace Vendor\Extension\User;
use TYPO3\CMS\Core\Utility\GeneralUtility;
class SignedStorageFolders
{
public function getSignedStorageFolders(string $content, array $config): string
{
$pidList = $config['pidList'];
$additionalSecret = $config['additionalSecret'] ?? '';
return sprintf(
'%s@%s',
$pidList,
GeneralUtility::hmac($pidList, $additionalSecret)
);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment