Browse Source
add test for skipping cookie checks for ocs
Signed-off-by: Robin Appelman <robin@icewind.nl>
pull/3787/head
Robin Appelman
9 years ago
No known key found for this signature in database
GPG Key ID: CBCA68FBAEBF98C9
1 changed files with
25 additions and
0 deletions
-
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 |
|
|
|
*/ |
|
|
|
|