aboutsummaryrefslogtreecommitdiffstats
path: root/tests/lib/AppFramework/Middleware
Commit message (Collapse)AuthorAgeFilesLines
...
* More test fixingJoas Schilling2020-08-191-2/+2
| | | | Signed-off-by: Joas Schilling <coding@schilljs.com>
* Change PHPDoc type hint from PHPUnit_Framework_MockObject_MockObject to ↵Morris Jobke2020-08-127-43/+43
| | | | | | \PHPUnit\Framework\MockObject\MockObject Signed-off-by: Morris Jobke <hey@morrisjobke.de>
* Add real events to load additionalscriptsRoeland Jago Douma2020-07-151-9/+46
| | | | Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
* Update SecurityMiddleware.phpHolger Hees2020-07-061-1/+1
| | | | | | OC::$WEBROOT can be empty in case if your nextcloud installation has no url prefix. This will result in an empty Location Header. in other areas OC::$WEBROOT is always used together with an /
* Move the notmodified check to middleware where it belongsRoeland Jago Douma2020-05-131-0/+106
| | | | Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
* Add AppFramework GZip middleware to gzip responsesRoeland Jago Douma2020-05-121-0/+163
| | | | Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
* Format control structures, classes, methods and functionChristoph Wurst2020-04-107-13/+5
| | | | | | | | | | | | | | | To continue this formatting madness, here's a tiny patch that adds unified formatting for control structures like if and loops as well as classes, their methods and anonymous functions. This basically forces the constructs to start on the same line. This is not exactly what PSR2 wants, but I think we can have a few exceptions with "our" style. The starting of braces on the same line is pracrically standard for our code. This also removes and empty lines from method/function bodies at the beginning and end. Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
* Unify function spacing to PSR2 recommendationChristoph Wurst2020-04-093-36/+36
| | | | Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
* Use a blank line after the opening tagChristoph Wurst2020-04-093-0/+3
| | | | Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
* Merge pull request #20170 from nextcloud/techdebt/remove-unused-importsChristoph Wurst2020-03-275-14/+0
|\ | | | | Remove unused imports
| * Remove unused importsChristoph Wurst2020-03-255-14/+0
| | | | | | | | Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
* | Use the shorter phpunit syntax for mocked return valuesChristoph Wurst2020-03-253-18/+18
|/ | | | Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
* Mode to modern phpunitRoeland Jago Douma2019-11-276-18/+24
| | | | Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
* Make phpunit8 compatibleRoeland Jago Douma2019-11-2714-14/+14
| | | | Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
* Some php-cs fixesRoeland Jago Douma2019-11-229-13/+9
| | | | | | | | | | | * Order the imports * No leading slash on imports * Empty line before namespace * One line per import * Empty after imports * Emmpty line at bottom of file Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
* SessionMiddleware: declare session propertyRoeland Jago Douma2019-08-281-12/+4
| | | | | | | * Remove request since we don't useit * Update tests as well Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
* Add testsRoeland Jago Douma2019-08-101-0/+89
| | | | Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
* Split up security middlewareRoeland Jago Douma2019-07-272-97/+149
| | | | | | | | | | With upcoming work for the feature policy header. Splitting this in smaller classes that just do 1 thing makes sense. I rather have a few small classes that are tiny and do 1 thing right (and we all understand what is going on) than have big ones. Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
* Make it possible to show admin settings for sub adminsChristoph Wurst2019-05-231-16/+47
| | | | Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
* Add StandaloneTemplateResponseRoeland Jago Douma2019-02-061-0/+17
| | | | | | | This can be used by pages that do not have the full Nextcloud UI. So notifications etc do not load there. Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
* No need to emit additonalscript event on public pagesRoeland Jago Douma2019-02-051-0/+10
| | | | | | | There already is a separate event for this. This will make it possible to only inject code with the logged in one on default rendered pages. Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
* Emit to load additionalscriptsRoeland Jago Douma2019-01-311-0/+108
| | | | | | | | | | | | | Fixes #13662 This will fire of an event after a Template Response has been returned. There is an event for the generic loading and one when logged in. So apps can chose to load only on loged in pages. This is a more generic approach than the files app event. As some things we might want to load on other pages as well besides the files app. Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
* Do not use file as template parameterRoeland Jago Douma2018-08-091-1/+1
| | | | | | | | Using file will overwrite the $file parameter in the template base. Leading to trying to include a file that is the exception message. Which will of course fail. Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
* Add PublicShareMiddlewareTestRoeland Jago Douma2018-06-201-0/+287
| | | | Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
* Add testsRoeland Jago Douma2018-03-081-10/+78
| | | | Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
* Provide translated error message for permission errorMorris Jobke2018-02-261-7/+7
| | | | Signed-off-by: Morris Jobke <hey@morrisjobke.de>
* Fix testsRoeland Jago Douma2018-02-211-0/+2
| | | | Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
* Update testsRoeland Jago Douma2018-01-291-8/+20
| | | | Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
* Fix risky tests without assertionsJoas Schilling2018-01-253-4/+7
| | | | Signed-off-by: Joas Schilling <coding@schilljs.com>
* Fix "Undefined method setExpectedException()"Joas Schilling2018-01-243-7/+7
| | | | Signed-off-by: Joas Schilling <coding@schilljs.com>
* Properly log the full exception instead of only the messageMorris Jobke2018-01-231-4/+2
| | | | Signed-off-by: Morris Jobke <hey@morrisjobke.de>
* Move passwordconfirmation to its own midlewareRoeland Jago Douma2018-01-022-10/+130
| | | | | | Add tests Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
* disable password confirmation with SSOBjoern Schiessle2018-01-021-1/+10
| | | | Signed-off-by: Bjoern Schiessle <bjoern@schiessle.org>
* Merge pull request #6921 from nextcloud/appmanager-securitymiddlewareRoeland Jago Douma2017-10-241-1/+9
|\ | | | | Use proper DI for security middleware for app enabled check
| * Use proper DI for security middleware for app enabled checkMorris Jobke2017-10-241-1/+9
| | | | | | | | Signed-off-by: Morris Jobke <hey@morrisjobke.de>
* | Use ::class in test mocksMorris Jobke2017-10-243-3/+6
|/ | | | Signed-off-by: Morris Jobke <hey@morrisjobke.de>
* Handle SameSiteCookie check for index.php in AppFramework MiddlewareRoeland Jago Douma2017-09-241-0/+133
| | | | Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
* Remove explicit type hints for ControllerLukas Reschke2017-08-011-4/+4
| | | | | | This is public API and breaks the middlewares of existing apps. Since this also requires maintaining two different code paths for 12 and 13 I'm at the moment voting for reverting this change. Signed-off-by: Lukas Reschke <lukas@statuscode.ch>
* Merge pull request #5907 from nextcloud/add-metadata-to-throttle-callMorris Jobke2017-08-011-0/+4
|\ | | | | Add metadata to \OCP\AppFramework\Http\Response::throttle
| * Add metadata to \OCP\AppFramework\Http\Response::throttleLukas Reschke2017-07-271-0/+4
| | | | | | | | | | | | Fixes https://github.com/nextcloud/server/issues/5891 Signed-off-by: Lukas Reschke <lukas@statuscode.ch>
* | Fix testsRoeland Jago Douma2017-07-313-61/+66
| | | | | | | | Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
* | Fix middleware implementations signaturesRoeland Jago Douma2017-07-311-4/+5
|/ | | | Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
* Make BruteForceProtection annotation more cleverLukas Reschke2017-04-132-75/+191
| | | | | | | | This makes the new `@BruteForceProtection` annotation more clever and moves the relevant code into it's own middleware. Basically you can now set `@BruteForceProtection(action=$key)` as annotation and that will make the controller bruteforce protected. However, the difference to before is that you need to call `$responmse->throttle()` to increase the counter. Before the counter was increased every time which leads to all kind of unexpected problems. Signed-off-by: Lukas Reschke <lukas@statuscode.ch>
* Move to dedicated MiddleWareLukas Reschke2017-04-132-40/+287
| | | | Signed-off-by: Lukas Reschke <lukas@statuscode.ch>
* Add support for ratelimiting via annotationsLukas Reschke2017-04-131-4/+40
| | | | | | | | | | | | | This allows adding rate limiting via annotations to controllers, as one example: ``` @UserRateThrottle(limit=5, period=100) @AnonRateThrottle(limit=1, period=100) ``` Would mean that logged-in users can access the page 5 times within 100 seconds, and anonymous users 1 time within 100 seconds. If only an AnonRateThrottle is specified that one will also be applied to logged-in users. Signed-off-by: Lukas Reschke <lukas@statuscode.ch>
* add some unit testsBjoern Schiessle2017-01-181-1/+72
| | | | Signed-off-by: Bjoern Schiessle <bjoern@schiessle.org>
* Merge pull request #2066 from nextcloud/fix-redirect-double-encodingMorris Jobke2016-11-291-6/+6
|\ | | | | do not double encode the redirect url
| * do not double encode the redirect urlChristoph Wurst2016-11-091-6/+6
| | | | | | | | Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
* | Fix unit testsJoas Schilling2016-11-181-0/+5
|/ | | | Signed-off-by: Joas Schilling <coding@schilljs.com>
* Move browserSupportsCspV3 to CSPNonceManagerRoeland Jago Douma2016-10-251-5/+10
| | | | Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>