SAML2\Message::validate PHP Method

validate() public method

true is returned on success, false is returned if we don't have any signature we can validate. An exception is thrown if the signature validation fails.
public validate ( XMLSecurityKey $key ) : boolean
$key RobRichards\XMLSecLibs\XMLSecurityKey The key we should check against
return boolean true on success, false when we don't have a signature
    public function validate(XMLSecurityKey $key)
    {
        if (count($this->validators) === 0) {
            return false;
        }
        $exceptions = array();
        foreach ($this->validators as $validator) {
            $function = $validator['Function'];
            $data = $validator['Data'];
            try {
                call_user_func($function, $data, $key);
                /* We were able to validate the message with this validator. */
                return true;
            } catch (\Exception $e) {
                $exceptions[] = $e;
            }
        }
        /* No validators were able to validate the message. */
        throw $exceptions[0];
    }