OneLogin_Saml2_Settings::getIdPData PHP Method

getIdPData() public method

Gets the IdP data.
public getIdPData ( ) : array
return array IdP info
    public function getIdPData()
    {
        return $this->_idp;
    }

Usage Example

Beispiel #1
0
    /**
     * Constructs the AuthnRequest object.
     *
     * @param OneLogin_Saml2_Settings $settings Settings
     */
    public function __construct(OneLogin_Saml2_Settings $settings)
    {
        $this->_settings = $settings;
        $spData = $this->_settings->getSPData();
        $idpData = $this->_settings->getIdPData();
        $security = $this->_settings->getSecurityData();
        $id = OneLogin_Saml2_Utils::generateUniqueID();
        $issueInstant = OneLogin_Saml2_Utils::parseTime2SAML(time());
        $nameIDPolicyFormat = $spData['NameIDFormat'];
        if (isset($security['wantNameIdEncrypted']) && $security['wantNameIdEncrypted']) {
            $nameIDPolicyFormat = OneLogin_Saml2_Constants::NAMEID_ENCRYPTED;
        }
        $providerNameStr = '';
        $organizationData = $settings->getOrganization();
        if (!empty($organizationData)) {
            $langs = array_keys($organizationData);
            if (in_array('en-US', $langs)) {
                $lang = 'en-US';
            } else {
                $lang = $langs[0];
            }
            if (isset($organizationData[$lang]['displayname']) && !empty($organizationData[$lang]['displayname'])) {
                $providerNameStr = <<<PROVIDERNAME
    ProviderName="{$organizationData[$lang]['displayname']}" 
PROVIDERNAME;
            }
        }
        $request = <<<AUTHNREQUEST
<samlp:AuthnRequest
    xmlns:samlp="urn:oasis:names:tc:SAML:2.0:protocol"
    xmlns:saml="urn:oasis:names:tc:SAML:2.0:assertion"
    ID="{$id}"
    Version="2.0"
{$providerNameStr}
    IssueInstant="{$issueInstant}"
    Destination="{$idpData['singleSignOnService']['url']}"
    ProtocolBinding="urn:oasis:names:tc:SAML:2.0:bindings:HTTP-POST"
    AssertionConsumerServiceURL="{$spData['assertionConsumerService']['url']}">
    <saml:Issuer>{$spData['entityId']}</saml:Issuer>
    <samlp:NameIDPolicy
        Format="{$nameIDPolicyFormat}"
        AllowCreate="true" />
AUTHNREQUEST;
        if (!isset($security['allowedAuthContexts'])) {
            $security['allowedAuthContexts'] = array('urn:oasis:names:tc:SAML:2.0:ac:classes:PasswordProtectedTransport');
        }
        if ($security['allowedAuthContexts'] && is_array($security['allowedAuthContexts'])) {
            $request .= '<samlp:RequestedAuthnContext Comparison="exact">' . "\n";
            foreach ($security['allowedAuthContexts'] as $authCtx) {
                $request .= '<saml:AuthnContextClassRef>' . $authCtx . "</saml:AuthnContextClassRef>\n";
            }
            $request .= '</samlp:RequestedAuthnContext> ' . "\n";
        }
        $request .= '</samlp:AuthnRequest>';
        $this->_id = $id;
        $this->_authnRequest = $request;
    }
All Usage Examples Of OneLogin_Saml2_Settings::getIdPData