CAS_Client::_validatePGT PHP Méthode

_validatePGT() private méthode

This method is used to validate a PGT; halt on failure.
private _validatePGT ( &$validate_url, string $text_response, string $tree_response ) : boolean
$text_response string the response of the CAS server, as is (XML text); result of CAS_Client::validateCAS10() or CAS_Client::validateCAS20().
$tree_response string the response of the CAS server, as a DOM XML tree; result of CAS_Client::validateCAS10() or CAS_Client::validateCAS20().
Résultat boolean true when successfull and issue a CAS_AuthenticationException and false on an error
    private function _validatePGT(&$validate_url, $text_response, $tree_response)
    {
        phpCAS::traceBegin();
        if ($tree_response->getElementsByTagName("proxyGrantingTicket")->length == 0) {
            phpCAS::trace('<proxyGrantingTicket> not found');
            // authentication succeded, but no PGT Iou was transmitted
            throw new CAS_AuthenticationException($this, 'Ticket validated but no PGT Iou transmitted', $validate_url, false, false, $text_response);
        } else {
            // PGT Iou transmitted, extract it
            $pgt_iou = trim($tree_response->getElementsByTagName("proxyGrantingTicket")->item(0)->nodeValue);
            if (preg_match('/PGTIOU-[\\.\\-\\w]/', $pgt_iou)) {
                $pgt = $this->_loadPGT($pgt_iou);
                if ($pgt == false) {
                    phpCAS::trace('could not load PGT');
                    throw new CAS_AuthenticationException($this, 'PGT Iou was transmitted but PGT could not be retrieved', $validate_url, false, false, $text_response);
                }
                $this->_setPGT($pgt);
            } else {
                phpCAS::trace('PGTiou format error');
                throw new CAS_AuthenticationException($this, 'PGT Iou was transmitted but has wrong format', $validate_url, false, false, $text_response);
            }
        }
        phpCAS::traceEnd(true);
        return true;
    }
CAS_Client