summaryrefslogtreecommitdiffstats
path: root/tests/lib/AppFramework
diff options
context:
space:
mode:
authorRobin Appelman <robin@icewind.nl>2017-03-10 14:11:00 +0100
committerRobin Appelman <robin@icewind.nl>2017-03-10 14:11:00 +0100
commit9a8cef965f607fb8b73234fabcc5f47252e893cc (patch)
treea028d4e0986d4feffa0ffc87651873720547abd9 /tests/lib/AppFramework
parent8626ccab1c8344a5e2c392a0c26da42061e70332 (diff)
downloadnextcloud-server-9a8cef965f607fb8b73234fabcc5f47252e893cc.tar.gz
nextcloud-server-9a8cef965f607fb8b73234fabcc5f47252e893cc.zip
add test for skipping cookie checks for ocs
Signed-off-by: Robin Appelman <robin@icewind.nl>
Diffstat (limited to 'tests/lib/AppFramework')
-rw-r--r--tests/lib/AppFramework/Http/RequestTest.php25
1 files changed, 25 insertions, 0 deletions
diff --git a/tests/lib/AppFramework/Http/RequestTest.php b/tests/lib/AppFramework/Http/RequestTest.php
index 6c6504b4de8..cc4bbee2d8d 100644
--- a/tests/lib/AppFramework/Http/RequestTest.php
+++ b/tests/lib/AppFramework/Http/RequestTest.php
@@ -1787,6 +1787,31 @@ class RequestTest extends \Test\TestCase {
$this->assertFalse($request->passesLaxCookieCheck());
}
+ public function testSkipCookieCheckForOCSRequests() {
+ /** @var Request $request */
+ $request = $this->getMockBuilder('\OC\AppFramework\Http\Request')
+ ->setMethods(['getScriptName'])
+ ->setConstructorArgs([
+ [
+ 'server' => [
+ 'HTTP_REQUESTTOKEN' => 'AAAHGxsTCTc3BgMQESAcNR0OAR0=:MyTotalSecretShareds',
+ 'HTTP_OCS_APIREQUEST' => 'true',
+ ],
+ 'cookies' => [
+ session_name() => 'asdf',
+ 'nc_sameSiteCookiestrict' => 'false',
+ ],
+ ],
+ $this->secureRandom,
+ $this->config,
+ $this->csrfTokenManager,
+ $this->stream
+ ])
+ ->getMock();
+
+ $this->assertTrue($request->passesStrictCookieCheck());
+ }
+
/**
* @return array
*/