saml issue solved
This commit is contained in:
parent
4266c9e47b
commit
fd93ddef32
@ -53,30 +53,55 @@ class SamlController extends BaseController
|
||||
$email = $this->request->getGet('email');
|
||||
|
||||
if (! $email) {
|
||||
return $this->response->setStatusCode(400)->setBody('Email required');
|
||||
return $this->redirectToFrontendSso([
|
||||
'status' => 'failed',
|
||||
'code' => 400,
|
||||
'data' => '',
|
||||
'message' => 'Email required',
|
||||
]);
|
||||
}
|
||||
|
||||
|
||||
$email = trim((string) $email);
|
||||
$at = strrchr($email, '@');
|
||||
if ($at === false) {
|
||||
return $this->response->setStatusCode(400)->setBody('Invalid email');
|
||||
return $this->redirectToFrontendSso([
|
||||
'status' => 'failed',
|
||||
'code' => 400,
|
||||
'data' => '',
|
||||
'message' => 'Invalid email',
|
||||
]);
|
||||
}
|
||||
|
||||
|
||||
|
||||
$domain = strtolower(substr($at, 1));
|
||||
|
||||
|
||||
$model = new SamlClientModel();
|
||||
$samlClient = $model->getByDomain($domain);
|
||||
|
||||
|
||||
if (! $samlClient) {
|
||||
return $this->response->setStatusCode(404)->setBody('SAML not configured for this domain');
|
||||
return $this->redirectToFrontendSso([
|
||||
'status' => 'failed',
|
||||
'code' => 404,
|
||||
'data' => '',
|
||||
'message' => 'SAML not configured for this domain',
|
||||
]);
|
||||
}
|
||||
|
||||
// dd($samlClient);
|
||||
|
||||
|
||||
$auth = $this->getSamlAuth($samlClient['id']);
|
||||
|
||||
} catch (\Throwable $e) {
|
||||
return redirect()->to(site_url('login'))->with('error', $e->getMessage());
|
||||
return $this->redirectToFrontendSso([
|
||||
'status' => 'failed',
|
||||
'code' => 500,
|
||||
'data' => '',
|
||||
'message' => $e->getMessage(),
|
||||
]);
|
||||
}
|
||||
|
||||
$url = $auth->login(null, [], false, false, true);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user