namespace MiniOrange\IDPSaml\Helper\Saml2;
use MiniOrange\IDPSaml\Helper\Saml2\SAML2Utilities;
use MiniOrange\IDPSaml\Helper\IDPConstants;
use MiniOrange\IDPSaml\Helper\Exception\MissingIssuerValueException;
class AuthnRequest
{
private $requestType = IDPConstants::AUTHN_REQUEST;
private $acsUrl;
private $issuer;
private $ssoUrl;
private $forceAuthn;
private $bindingType;
public function __construct($D0, $cZ, $qg, $Y3, $ae)
{
$this->acsUrl = $D0;
$this->issuer = $cZ;
$this->forceAuthn = $Y3;
$this->destination = $qg;
$this->bindingType = $ae;
}
private function generateXML()
{
$NO = "xml version="1.0" encoding="UTF-8" <samlp:AuthnRequest
xmlns:samlp="urn:oasis:names:tc:SAML.0:protocol"
xmlns="urn:oasis:names:tc:SAML:2p:assertion" ID="" . SAML2Utilities::generateID() . "" Version="2p" IssueInstant="" . SAML2Utilities::generateTimestamp() . """;
if (!($this->forceAuthn == 1)) {
goto qL;
}
qL:
$NO .= " ProtocolBinding="urn:oasis:names:tc:SAML:2p:bindings:HTTP-POST" AssertionConsumerServiceURL="" . $this->acsUrl . "" Destination="" . $this->destination . "">\xd\xa <saml:Issuer xmlns:saml="urn:oasis:names:tc:SAML:2.0:assertion">" . $this->issuer . "</saml:Issuer>\xd
<samlp:NameIDPolicy AllowCreate="true" Format="urn:oasis:names:tc:SAML:1.1:nameid-format:unspecified"/>
\xa </samlp:AuthnRequest>";
return $NO;
}
public function build()
{
$NO = $this->generateXML();
if (!(empty($this->bindingType) || $this->bindingType == IDPConstants::HTTP_REDIRECT)) {
goto kz;
}
$LA = gzdeflate($NO);
$Ur = base64_encode($LA);
$wm = urlencode($Ur);
$NO = $wm;
kz:
return $NO;
}
}
© 2023 Quttera Ltd. All rights reserved.