acs endpoint to always return a RedirectResponse

* the void statements end up in a useless blank page

Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
This commit is contained in:
Arthur Schiwon 2020-09-08 13:23:26 +02:00
parent d9606dfb81
commit 238b578cf1
No known key found for this signature in database
GPG key ID: 7424F1874854DF23

View file

@ -260,15 +260,16 @@ class SAMLController extends Controller {
* @OnlyUnauthenticatedUsers * @OnlyUnauthenticatedUsers
* @NoSameSiteCookieRequired * @NoSameSiteCookieRequired
* *
* @return Http\RedirectResponse|void * @return Http\RedirectResponse
* @throws Error * @throws Error
* @throws ValidationError * @throws ValidationError
*/ */
public function assertionConsumerService() { public function assertionConsumerService(): Http\RedirectResponse {
// Fetch and decrypt the cookie // Fetch and decrypt the cookie
$cookie = $this->request->getCookie('saml_data'); $cookie = $this->request->getCookie('saml_data');
if ($cookie === null) { if ($cookie === null) {
return; $this->logger->debug('Cookie was not present', ['app' => 'user_saml']);
return new Http\RedirectResponse($this->urlGenerator->getAbsoluteURL('/'));
} }
// Base64 decode // Base64 decode
@ -278,7 +279,8 @@ class SAMLController extends Controller {
try { try {
$cookie = $this->crypto->decrypt($cookie); $cookie = $this->crypto->decrypt($cookie);
} catch (\Exception $e) { } catch (\Exception $e) {
return; $this->logger->debug('Could not decrypt SAML cookie', ['app' => 'user_saml']);
return new Http\RedirectResponse($this->urlGenerator->getAbsoluteURL('/'));
} }
$data = json_decode($cookie, true); $data = json_decode($cookie, true);
@ -286,7 +288,8 @@ class SAMLController extends Controller {
$AuthNRequestID = $data['AuthNRequestID']; $AuthNRequestID = $data['AuthNRequestID'];
$idp = $data['Idp']; $idp = $data['Idp'];
if(is_null($AuthNRequestID) || $AuthNRequestID === '' || is_null($idp)) { if(is_null($AuthNRequestID) || $AuthNRequestID === '' || is_null($idp)) {
return; $this->logger->debug('Invalid auth payload', ['app' => 'user_saml']);
return new Http\RedirectResponse($this->urlGenerator->getAbsoluteURL('/'));
} }
$auth = new Auth($this->SAMLSettings->getOneLoginSettingsArray($idp)); $auth = new Auth($this->SAMLSettings->getOneLoginSettingsArray($idp));