You are here

public function saml_sp_Response::validateSignedElements in SAML Service Provider 7.8

Verifies that the document has the expected signed nodes.

Return value

bool

File

includes/saml_sp.Response.inc, line 9

Class

saml_sp_Response

Code

public function validateSignedElements($signedElements) {
  if (count($signedElements) > 2) {
    return false;
  }
  $ocurrence = array_count_values($signedElements);
  if (in_array('samlp:Response', $signedElements) && $ocurrence['samlp:Response'] > 1 || in_array('saml:Assertion', $signedElements) && $ocurrence['saml:Assertion'] > 1 || in_array('Assertion', $signedElements) && $ocurrence['Assertion'] > 1 || !in_array('samlp:Response', $signedElements) && !in_array('saml:Assertion', $signedElements) && !in_array('Assertion', $signedElements)) {
    return false;
  }
  return true;
}