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

Handle LoginException when authenticating with Apache #910

Merged
Merged
Changes from 1 commit
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
17 changes: 16 additions & 1 deletion appinfo/app.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
* SPDX-License-Identifier: AGPL-3.0-or-later
*/

use OC\User\LoginException;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think there should be a fitting Exception or interface in the OCP space, no?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sheesh 😨

use OCA\User_SAML\GroupBackend;
use OCA\User_SAML\SAMLSettings;
use OCA\User_SAML\UserBackend;
Expand Down Expand Up @@ -63,7 +64,21 @@
return;
}

OC_User::handleApacheAuth();
try {
OC_User::handleApacheAuth();
} catch (LoginException $e) {
if ($request->getPathInfo() === '/apps/user_saml/saml/error') {
return;
}
$targetUrl = $urlGenerator->linkToRouteAbsolute(
'user_saml.SAML.genericError',
[
'message' => $e->getMessage()
]
);
header('Location: ' . $targetUrl);
exit();
}
}

if ($returnScript === true) {
Expand Down
Loading