allow injecting CsrfTokenManager by class
Signed-off-by: Robin Appelman <robin@icewind.nl>
This commit is contained in:
parent
6cfe29b0e0
commit
5cb00aba09
1 changed files with 3 additions and 2 deletions
|
@ -1018,7 +1018,7 @@ class Server extends ServerContainer implements IServerContainer {
|
|||
$request
|
||||
);
|
||||
});
|
||||
$this->registerService('CsrfTokenManager', function (Server $c) {
|
||||
$this->registerService(CsrfTokenManager::class, function (Server $c) {
|
||||
$tokenGenerator = new CsrfTokenGenerator($c->getSecureRandom());
|
||||
|
||||
return new CsrfTokenManager(
|
||||
|
@ -1026,6 +1026,7 @@ class Server extends ServerContainer implements IServerContainer {
|
|||
$c->query(SessionStorage::class)
|
||||
);
|
||||
});
|
||||
$this->registerAlias('CsrfTokenManager', CsrfTokenManager::class);
|
||||
$this->registerService(SessionStorage::class, function (Server $c) {
|
||||
return new SessionStorage($c->getSession());
|
||||
});
|
||||
|
@ -1901,7 +1902,7 @@ class Server extends ServerContainer implements IServerContainer {
|
|||
* @return CsrfTokenManager
|
||||
*/
|
||||
public function getCsrfTokenManager() {
|
||||
return $this->query('CsrfTokenManager');
|
||||
return $this->query(CsrfTokenManager::class);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in a new issue