private function _setSessionAttributes($text_response)
    {
        phpCAS::traceBegin();

        $result = false;

        $attr_array = array();

        // create new DOMDocument Object
        $dom = new DOMDocument();
        // Fix possible whitspace problems
        $dom->preserveWhiteSpace = false;
        if (($dom->loadXML($text_response))) {
            $xPath = new DOMXpath($dom);
            $xPath->registerNamespace('samlp', 'urn:oasis:names:tc:SAML:1.0:protocol');
            $xPath->registerNamespace('saml', 'urn:oasis:names:tc:SAML:1.0:assertion');
            $nodelist = $xPath->query("//saml:Attribute");

            if ($nodelist) {
                foreach ($nodelist as $node) {
                    $xres = $xPath->query("saml:AttributeValue", $node);
                    $name = $node->getAttribute("AttributeName");
                    $value_array = array();
                    foreach ($xres as $node2) {
                        $value_array[] = $node2->nodeValue;
                    }
                    $attr_array[$name] = $value_array;
                }
                // UGent addition...
                foreach ($attr_array as $attr_key => $attr_value) {
                    if (count($attr_value) > 1) {
                        $this->_attributes[$attr_key] = $attr_value;
                        phpCAS::trace("* " . $attr_key . "=" . print_r($attr_value, true));
                    } else {
                        $this->_attributes[$attr_key] = $attr_value[0];
                        phpCAS::trace("* " . $attr_key . "=" . $attr_value[0]);
                    }
                }
                $result = true;
            } else {
                phpCAS::trace("SAML Attributes are empty");
                $result = false;
            }
        }
        phpCAS::traceEnd($result);
        return $result;
    }
private function _setSessionAttributes($text_response)
    {
        phpCAS::traceBegin();

        $result = false;

        $attr_array = array();

        // create new DOMDocument Object
        $dom = new DOMDocument();
        // Fix possible whitspace problems
        $dom->preserveWhiteSpace = false;
        if (($dom->loadXML($text_response))) {
            $xPath = new DOMXpath($dom);
            $xPath->registerNamespace('samlp', 'urn:oasis:names:tc:SAML:1.0:protocol');
            $xPath->registerNamespace('saml', 'urn:oasis:names:tc:SAML:1.0:assertion');
            $nodelist = $xPath->query("//saml:Attribute");

            if ($nodelist) {
                foreach ($nodelist as $node) {
                    $xres = $xPath->query("saml:AttributeValue", $node);
                    $name = $node->getAttribute("AttributeName");
                    $value_array = array();
                    foreach ($xres as $node2) {
                        $value_array[] = $node2->nodeValue;
                    }
                    $attr_array[$name] = $value_array;
                }
                // UGent addition...
                foreach ($attr_array as $attr_key => $attr_value) {
                    if (count($attr_value) > 1) {
                        $this->_attributes[$attr_key] = $attr_value;
                        phpCAS::trace("* " . $attr_key . "=" . print_r($attr_value, true));
                    } else {
                        $this->_attributes[$attr_key] = $attr_value[0];
                        phpCAS::trace("* " . $attr_key . "=" . $attr_value[0]);
                    }
                }
                $result = true;
            } else {
                phpCAS::trace("SAML Attributes are empty");
                $result = false;
            }
        }
        phpCAS::traceEnd($result);
        return $result;
    }
private function _setSessionAttributes ( $ text_response ) { phpCAS :: traceBegin ( ) ; $ result = false ; $ attr_array = array ( ) ; // create new DOMDocument Object $ dom = new DOMDocument ( ) ; // Fix possible whitspace problems $ dom -> preserveWhiteSpace = false ; if ( ( $ dom -> loadXML ( $ text_response ) ) ) { $ xPath = new DOMXpath ( $ dom ) ; $ xPath -> registerNamespace ( 'samlp' , 'urn:oasis:names:tc:SAML:1.0:protocol' ) ; $ xPath -> registerNamespace ( 'saml' , 'urn:oasis:names:tc:SAML:1.0:assertion' ) ; $ nodelist = $ xPath -> query ( "//saml:Attribute" ) ; if ( $ nodelist ) { foreach ( $ nodelist as $ node ) { $ xres = $ xPath -> query ( "saml:AttributeValue" , $ node ) ; $ name = $ node -> getAttribute ( "AttributeName" ) ; $ value_array = array ( ) ; foreach ( $ xres as $ node2 ) { $ value_array [ ] = $ node2 -> nodeValue ; } $ attr_array [ $ name ] = $ value_array ; } // UGent addition... foreach ( $ attr_array as $ attr_key => $ attr_value ) { if ( count ( $ attr_value ) > 1 ) { $ this -> _attributes [ $ attr_key ] = $ attr_value ; phpCAS :: trace ( "* " . $ attr_key . "=" . print_r ( $ attr_value , true ) ) ; } else { $ this -> _attributes [ $ attr_key ] = $ attr_value [ 0 ] ; phpCAS :: trace ( "* " . $ attr_key . "=" . $ attr_value [ 0 ] ) ; } } $ result = true ; } else { phpCAS :: trace ( "SAML Attributes are empty" ) ; $ result = false ; } } phpCAS :: traceEnd ( $ result ) ; return $ result ; }
This method will parse the DOM and pull out the attributes from the SAML
payload and put them into an array, then put the array into the session.

@param string $text_response the SAML payload.

@return bool true when successfull and false if no attributes a found
This method will parse the DOM and pull out the attributes from the SAML payload and put them into an array then put the array into the session .