Skip to content

Commit ab12db3

Browse files
committed
Move the creation of the AuthnRequest object to separate function
1 parent b672770 commit ab12db3

1 file changed

Lines changed: 16 additions & 1 deletion

File tree

src/Saml2/Auth.php

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -527,7 +527,7 @@ public function getAttributeWithFriendlyName($friendlyName)
527527
*/
528528
public function login($returnTo = null, array $parameters = array(), $forceAuthn = false, $isPassive = false, $stay = false, $setNameIdPolicy = true)
529529
{
530-
$authnRequest = new AuthnRequest($this->_settings, $forceAuthn, $isPassive, $setNameIdPolicy);
530+
$authnRequest = $this->buildAuthnRequest($this->_settings, $forceAuthn, $isPassive, $setNameIdPolicy);
531531

532532
$this->_lastRequest = $authnRequest->getXML();
533533
$this->_lastRequestID = $authnRequest->getId();
@@ -642,6 +642,21 @@ public function getLastRequestID()
642642
return $this->_lastRequestID;
643643
}
644644

645+
/**
646+
* Creates an AuthnRequest
647+
*
648+
* @param Settings $settings Setting data
649+
* @param bool $forceAuthn When true the AuthNRequest will set the ForceAuthn='true'
650+
* @param bool $isPassive When true the AuthNRequest will set the Ispassive='true'
651+
* @param bool $setNameIdPolicy When true the AuthNRequest will set a nameIdPolicy element
652+
*
653+
* @return AuthnRequest The AuthnRequest object
654+
*/
655+
public function buildAuthnRequest($settings, $forceAuthn, $isPassive, $setNameIdPolicy)
656+
{
657+
return new AuthnRequest($settings, $forceAuthn, $isPassive, $setNameIdPolicy);
658+
}
659+
645660
/**
646661
* Generates the Signature for a SAML Request
647662
*

0 commit comments

Comments
 (0)