Skip to content

Commit

Permalink
Add option to environment to require SAML for a more secure installat…
Browse files Browse the repository at this point in the history
…ion.
  • Loading branch information
adagioajanes committed Dec 16, 2021
1 parent 5232280 commit 3c8d70c
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
6 changes: 6 additions & 0 deletions app/Http/Controllers/Auth/LoginController.php
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,12 @@ public function showLoginForm(Request $request)
return redirect()->intended('/');
}

//If the environment is set to ALWAYS require SAML, go straight to the SAML route.
if((env("REQUIRE_SAML", false)))
{
return redirect()->route('saml.login');
}

if ($this->saml->isEnabled() && Setting::getSettings()->saml_forcelogin == '1' && ! ($request->has('nosaml') || $request->session()->has('error'))) {
return redirect()->route('saml.login');
}
Expand Down
13 changes: 12 additions & 1 deletion config/app.php
Original file line number Diff line number Diff line change
Expand Up @@ -250,8 +250,19 @@

'enable_csp' => env('ENABLE_CSP', false),

/*
|--------------------------------------------------------------------------
| Require SAML Login
|--------------------------------------------------------------------------
|
| Disable the ability to login via form login, and require all logins to
| process via SAML login. (If you are not using SAML, this option should
| be left alone.)
|
*/


'require_saml' => env('REQUIRE_SAML', false),


/*
|--------------------------------------------------------------------------
Expand Down

0 comments on commit 3c8d70c

Please sign in to comment.