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

Fix login flow form actions #16711

Merged
merged 1 commit into from
Aug 12, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 14 additions & 2 deletions core/Controller/ClientFlowLoginController.php
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,10 @@ public function showAuthPickerPage($clientIdentifier = '') {
);
$this->session->set(self::stateName, $stateToken);

return new StandaloneTemplateResponse(
$csp = new Http\ContentSecurityPolicy();
$csp->addAllowedFormActionDomain('nc://*');

$response = new StandaloneTemplateResponse(
$this->appName,
'loginflow/authpicker',
[
Expand All @@ -209,6 +212,9 @@ public function showAuthPickerPage($clientIdentifier = '') {
],
'guest'
);

$response->setContentSecurityPolicy($csp);
return $response;
}

/**
Expand All @@ -234,7 +240,10 @@ public function grantPage($stateToken = '',
$clientName = $client->getName();
}

return new StandaloneTemplateResponse(
$csp = new Http\ContentSecurityPolicy();
$csp->addAllowedFormActionDomain('nc://*');

$response = new StandaloneTemplateResponse(
$this->appName,
'loginflow/grant',
[
Expand All @@ -248,6 +257,9 @@ public function grantPage($stateToken = '',
],
'guest'
);

$response->setContentSecurityPolicy($csp);
return $response;
}

/**
Expand Down
6 changes: 6 additions & 0 deletions tests/Core/Controller/ClientFlowLoginControllerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,9 @@ public function testShowAuthPickerPageWithOcsHeader() {
],
'guest'
);
$csp = new Http\ContentSecurityPolicy();
$csp->addAllowedFormActionDomain('nc://*');
$expected->setContentSecurityPolicy($csp);
$this->assertEquals($expected, $this->clientFlowLoginController->showAuthPickerPage());
}

Expand Down Expand Up @@ -245,6 +248,9 @@ public function testShowAuthPickerPageWithOauth() {
],
'guest'
);
$csp = new Http\ContentSecurityPolicy();
$csp->addAllowedFormActionDomain('nc://*');
$expected->setContentSecurityPolicy($csp);
$this->assertEquals($expected, $this->clientFlowLoginController->showAuthPickerPage('MyClientIdentifier'));
}

Expand Down