Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cleanup middleware registering #12224

Closed
rullzer opened this issue Nov 2, 2018 · 1 comment
Closed

Cleanup middleware registering #12224

rullzer opened this issue Nov 2, 2018 · 1 comment
Labels
1. to develop Accepted and waiting to be taken care of technical debt
Milestone

Comments

@rullzer
Copy link
Member

rullzer commented Nov 2, 2018

We register the middleware services in each and every DIContainer.

This is not really needed as the only place we query them is in:

$this->registerService('MiddlewareDispatcher', function(SimpleContainer $c) use (&$middleWares) {
$dispatcher = new MiddlewareDispatcher();
$dispatcher->registerMiddleware($c[OC\AppFramework\Middleware\Security\SameSiteCookieMiddleware::class]);
$dispatcher->registerMiddleware($c['CORSMiddleware']);
$dispatcher->registerMiddleware($c['OCSMiddleware']);
$dispatcher->registerMiddleware($c['SecurityMiddleware']);
$dispatcher->registerMiddleware($c[OC\AppFramework\Middleware\Security\PasswordConfirmationMiddleware::class]);
$dispatcher->registerMiddleware($c['TwoFactorMiddleware']);
$dispatcher->registerMiddleware($c['BruteForceMiddleware']);
$dispatcher->registerMiddleware($c['RateLimitingMiddleware']);
$dispatcher->registerMiddleware(new OC\AppFramework\Middleware\PublicShare\PublicShareMiddleware(
$c['Request'],
$c->query(ISession::class),
$c->query(\OCP\IConfig::class)
));
foreach($middleWares as $middleWare) {
$dispatcher->registerMiddleware($c[$middleWare]);
}
$dispatcher->registerMiddleware($c['SessionMiddleware']);
return $dispatcher;
});

We can just properly query or register them there.

@rullzer rullzer added 1. to develop Accepted and waiting to be taken care of technical debt labels Nov 2, 2018
@rullzer rullzer added this to the Nextcloud 16 milestone Nov 2, 2018
@nextcloud-bot
Copy link
Member

GitMate.io thinks possibly related issues are #4415 (Cleanup \OCP\Share), #3173 (corruption cleanup?), #1056 (OCSResponse cleanup), #12185 (Cleanup the DIContainer), and #9982 (Cleanup structure).

rullzer added a commit that referenced this issue Nov 23, 2018
Fixes #12224

Since we only use the middleware at 1 location it makes no sense to
register them in each and every container.

Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
@ChristophWurst ChristophWurst added this to SELECTED in Christoph's Tasks via automation Nov 29, 2018
@ChristophWurst ChristophWurst removed this from SELECTED in Christoph's Tasks Dec 3, 2018
rullzer added a commit that referenced this issue Dec 10, 2018
Fixes #12224

Since we only use the middleware at 1 location it makes no sense to
register them in each and every container.

Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
rullzer added a commit that referenced this issue Dec 27, 2018
Fixes #12224

Since we only use the middleware at 1 location it makes no sense to
register them in each and every container.

Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
rullzer added a commit that referenced this issue Jan 3, 2019
Fixes #12224

Since we only use the middleware at 1 location it makes no sense to
register them in each and every container.

Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
rullzer added a commit that referenced this issue Jan 3, 2019
Fixes #12224

Since we only use the middleware at 1 location it makes no sense to
register them in each and every container.

Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
1. to develop Accepted and waiting to be taken care of technical debt
Projects
None yet
Development

No branches or pull requests

2 participants