mirror of
https://github.com/snipe/snipe-it.git
synced 2025-01-14 15:33:54 -08:00
Merge remote-tracking branch 'origin/develop'
This commit is contained in:
commit
b941ea6950
|
@ -104,15 +104,12 @@ class LoginController extends Controller
|
||||||
*/
|
*/
|
||||||
private function loginViaSaml(Request $request)
|
private function loginViaSaml(Request $request)
|
||||||
{
|
{
|
||||||
\Log::debug('Attempting to login via SAML');
|
|
||||||
$saml = $this->saml;
|
$saml = $this->saml;
|
||||||
$samlData = $request->session()->get('saml_login');
|
$samlData = $request->session()->get('saml_login');
|
||||||
|
|
||||||
if ($saml->isEnabled() && ! empty($samlData)) {
|
if ($saml->isEnabled() && ! empty($samlData)) {
|
||||||
\Log::debug('SAML is enabled, and the samleData is not empty');
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
Log::debug('Attempting to log user in by SAML authentication.');
|
|
||||||
$user = $saml->samlLogin($samlData);
|
$user = $saml->samlLogin($samlData);
|
||||||
|
|
||||||
if (!is_null($user)) {
|
if (!is_null($user)) {
|
||||||
|
|
|
@ -130,11 +130,12 @@ class Saml
|
||||||
$this->clearData();
|
$this->clearData();
|
||||||
}
|
}
|
||||||
|
|
||||||
\Log::debug('Trying to create a new OneLogin_Saml2_Auth object ');
|
|
||||||
try {
|
try {
|
||||||
$this->_auth = new OneLogin_Saml2_Auth($this->_settings);
|
$this->_auth = new OneLogin_Saml2_Auth($this->_settings);
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
|
if ( $this->isEnabled() ) { // $this->loadSettings() initializes this to true if SAML is enabled by settings.
|
||||||
\Log::error('Trying OneLogin_Saml2_Auth failed. Setting SAML enabled to false. OneLogin_Saml2_Auth error message is: '. $e->getMessage());
|
\Log::error('Trying OneLogin_Saml2_Auth failed. Setting SAML enabled to false. OneLogin_Saml2_Auth error message is: '. $e->getMessage());
|
||||||
|
}
|
||||||
$this->_enabled = false;
|
$this->_enabled = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -157,7 +158,6 @@ class Saml
|
||||||
$this->_enabled = $setting->saml_enabled == '1';
|
$this->_enabled = $setting->saml_enabled == '1';
|
||||||
|
|
||||||
if ($this->isEnabled()) {
|
if ($this->isEnabled()) {
|
||||||
\Log::debug('SAML is enabled according to loadSettings()');
|
|
||||||
//Let onelogin/php-saml know to use 'X-Forwarded-*' headers if it is from a trusted proxy
|
//Let onelogin/php-saml know to use 'X-Forwarded-*' headers if it is from a trusted proxy
|
||||||
OneLogin_Saml2_Utils::setProxyVars(request()->isFromTrustedProxy());
|
OneLogin_Saml2_Utils::setProxyVars(request()->isFromTrustedProxy());
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue