Created
January 3, 2023 17:18
-
-
Save spoonerWeb/09c529ac983546b1c320faeb82678ff1 to your computer and use it in GitHub Desktop.
TYPO3 - get signed storage in TypoScript
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
page.10.variables { | |
usersPid = USER | |
usersPid.userFunc = Vendor\Extension\User\SignedStorageFolders->getSignedStorageFolders | |
usersPid.pidList = 42 | |
usersPid.additionalSecret = TYPO3\CMS\Frontend\Authentication\FrontendUserAuthentication | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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