Skip to content

Commit

Permalink
Merge pull request #488 from onelogin/3.6.1
Browse files Browse the repository at this point in the history
Upgrade 3.X branch
  • Loading branch information
pitbulk authored Sep 6, 2021
2 parents 287540a + e7765b8 commit 6f4cf30
Showing 1 changed file with 36 additions and 5 deletions.
41 changes: 36 additions & 5 deletions src/Saml2/Auth.php
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,7 @@ public function processSLO($keepLocalSession = false, $requestId = null, $retrie
$this->_errors = array();
$this->_lastError = $this->_lastErrorException = null;
if (isset($_GET['SAMLResponse'])) {
$logoutResponse = new LogoutResponse($this->_settings, $_GET['SAMLResponse']);
$logoutResponse = $this->buildLogoutResponse($this->_settings, $_GET['SAMLResponse']);
$this->_lastResponse = $logoutResponse->getXML();
if (!$logoutResponse->isValid($requestId, $retrieveParametersFromServer)) {
$this->_errors[] = 'invalid_logout_response';
Expand All @@ -299,7 +299,7 @@ public function processSLO($keepLocalSession = false, $requestId = null, $retrie
}
}
} else if (isset($_GET['SAMLRequest'])) {
$logoutRequest = new LogoutRequest($this->_settings, $_GET['SAMLRequest']);
$logoutRequest = $this->buildLogoutRequest($this->_settings, $_GET['SAMLRequest']);
$this->_lastRequest = $logoutRequest->getXML();
if (!$logoutRequest->isValid($retrieveParametersFromServer)) {
$this->_errors[] = 'invalid_logout_request';
Expand All @@ -315,7 +315,7 @@ public function processSLO($keepLocalSession = false, $requestId = null, $retrie
}
$inResponseTo = $logoutRequest->id;
$this->_lastMessageId = $logoutRequest->id;
$responseBuilder = new LogoutResponse($this->_settings);
$responseBuilder = $this->buildLogoutResponse($this->_settings);
$responseBuilder->build($inResponseTo);
$this->_lastResponse = $responseBuilder->getXML();

Expand Down Expand Up @@ -594,7 +594,7 @@ public function logout($returnTo = null, array $parameters = array(), $nameId =
$nameIdFormat = $this->_nameidFormat;
}

$logoutRequest = new LogoutRequest($this->_settings, null, $nameId, $sessionIndex, $nameIdFormat, $nameIdNameQualifier, $nameIdSPNameQualifier);
$logoutRequest = $this->buildLogoutRequest($this->_settings, null, $nameId, $sessionIndex, $nameIdFormat, $nameIdNameQualifier, $nameIdSPNameQualifier);

$this->_lastRequest = $logoutRequest->getXML();
$this->_lastRequestID = $logoutRequest->id;
Expand Down Expand Up @@ -670,11 +670,42 @@ public function getLastRequestID()
*
* @return AuthnRequest The AuthnRequest object
*/
public function buildAuthnRequest($settings, $forceAuthn, $isPassive, $setNameIdPolicy, $nameIdValueReq = null)
public function buildAuthnRequest(Settings $settings, $forceAuthn, $isPassive, $setNameIdPolicy, $nameIdValueReq = null)
{
return new AuthnRequest($settings, $forceAuthn, $isPassive, $setNameIdPolicy, $nameIdValueReq);
}

/**
* Creates an LogoutRequest
*
* @param Settings $settings Settings
* @param string|null $request A UUEncoded Logout Request.
* @param string|null $nameId The NameID that will be set in the LogoutRequest.
* @param string|null $sessionIndex The SessionIndex (taken from the SAML Response in the SSO process).
* @param string|null $nameIdFormat The NameID Format will be set in the LogoutRequest.
* @param string|null $nameIdNameQualifier The NameID NameQualifier will be set in the LogoutRequest.
* @param string|null $nameIdSPNameQualifier The NameID SP NameQualifier will be set in the LogoutRequest.
*/
public function buildLogoutRequest(Settings $settings, $request = null, $nameId = null, $sessionIndex = null, $nameIdFormat = null, $nameIdNameQualifier = null, $nameIdSPNameQualifier = null)
{
return new LogoutRequest($settings, $request, $nameId, $sessionIndex, $nameIdFormat, $nameIdNameQualifier, $nameIdSPNameQualifier);
}

/**
* Constructs a Logout Response object (Initialize params from settings and if provided
* load the Logout Response.
*
* @param Settings $settings Settings.
* @param string|null $response An UUEncoded SAML Logout response from the IdP.
*
* @throws Error
* @throws Exception
*/
public function buildLogoutResponse(Settings $settings, $response = null)
{
return new LogoutResponse($settings, $response);
}

/**
* Generates the Signature for a SAML Request
*
Expand Down

0 comments on commit 6f4cf30

Please sign in to comment.