aacotroneo / laravel-saml2

A Laravel 5 package for Saml2 integration as a SP (service provider) based on the simple OneLogin toolkit
MIT License
564 stars 237 forks source link

Undefined index: privateKey Certificate Issue #230

Open derynj opened 3 years ago

derynj commented 3 years ago

Hi guys,

I am very new to PHP and I am receiving the below error. I generated a self-assigned certificate using the OneLogin developer website and pasted them both in the idp_settings.php file.

xxxxxx represents x509cert and privateKey strings.

idp_settings.php

'x509cert' => env('SAML2_'.$this_idp_env_id.'_SP_x509', 'xxxxxx'),
'privateKey' => env('SAML2_'.$this_idp_env_id.'_SP_PRIVATEKEY', 'xxxxxxx'),

Undefined index: privateKey


            $config['sp']['privateKey'] = static::extractPkeyFromFile($config['sp']['privateKey']);
        }
        if (strpos($config['sp']['x509cert'], 'file://')===0) {
            $config['sp']['x509cert'] = static::extractCertFromFile($config['sp']['x509cert']);
        }
        if (strpos($config['idp']['x509cert'], 'file://')===0) {
            $config['idp']['x509cert'] = static::extractCertFromFile($config['idp']['x509cert']);
        }``
adiatma85 commented 3 years ago

Hi @derynj, I got the same issue. The problem is whether the name of your folder and the $this_idp_env_id at the idp_setting in config/saml2 must same.

Said your file named SSO, then your $this_idp_env_id must have the same name (in this case, it's SSO)

Note: Sorry for my bad English