You are here

public static function Utilities::createAuthnRequest in SAML SP 2.0 Single Sign On (SSO) - SAML Service Provider 7

4 calls to Utilities::createAuthnRequest()
MiniOrangeAuthnRequest::initiateLogin in includes/AuthnRequest.php
The function initiateLogin.
SAML_Request_Generator in ./miniorange_saml.module
Show SAML Request
SAML_Response_Generator in ./miniorange_saml.module
Show SAML Response
test_configuration in ./miniorange_saml.module
Test configuration callback

File

includes/Utilities.php, line 650

Class

Utilities
This file is part of miniOrange SAML plugin.

Code

public static function createAuthnRequest($acsUrl, $issuer, $destination, $nameid_format, $force_authn = 'false', $showRequest = 'false') {
  $requestXmlStr = '<?xml version="1.0" encoding="UTF-8"?>' . '<samlp:AuthnRequest xmlns:samlp="urn:oasis:names:tc:SAML:2.0:protocol" ID="' . self::generateID() . '" Version="2.0" IssueInstant="' . self::generateTimestamp() . '"';
  if ($force_authn == 'true') {
    $requestXmlStr .= ' ForceAuthn="true"';
  }
  $requestXmlStr .= ' ProtocolBinding="urn:oasis:names:tc:SAML:2.0:bindings:HTTP-POST" AssertionConsumerServiceURL="' . $acsUrl . '" Destination="' . $destination . '"><saml:Issuer xmlns:saml="urn:oasis:names:tc:SAML:2.0:assertion">' . $issuer . '</saml:Issuer><samlp:NameIDPolicy AllowCreate="true" Format="' . $nameid_format . '"
                        /></samlp:AuthnRequest>';
  if ($showRequest === 'TRUE') {
    return $requestXmlStr;
  }
  $deflatedStr = gzdeflate($requestXmlStr);
  $base64EncodedStr = base64_encode($deflatedStr);
  $urlEncoded = urlencode($base64EncodedStr);
  return $urlEncoded;
}