docs: function validateCasResponse(req, res, ticket, casBody, options, next) {
  
    xml2js(casBody, {
      explicitRoot: false,
      tagNameProcessors: [stripPrefix]
    }, function(err, serviceResponse) {
      if (err) {
        console.error('Failed to parse CAS server response when trying to validate ticket.');
        console.error(err);
        return res.status(500).send({
          message: 'Failed to parse CAS server response when trying to validate ticket.',
          error: err
        });
      }
  
      var success = serviceResponse && serviceResponse.authenticationSuccess && serviceResponse.authenticationSuccess[0],
        user = success && success.user && success.user[0],
        pgtIou = success && success.proxyGrantingTicket && success.proxyGrantingTicket[0];
  
      if (!serviceResponse) {
        console.error('Invalid CAS server response.');
        return res.status(500).send({
          message: 'Invalid CAS server response, serviceResponse empty.'
        });
      }
  
      // TODO: 不成功回首页
      if (!success) {
        console.log('Receive response from CAS when validating ticket, but the validation is failed. Redirect to the last request url: ' + req.session.lastUrl);
        if (typeof options.redirect === 'function' && options.redirect(req, res, next)) {
          return;
        }
  
        return res.redirect(302, req.session.lastUrl);
      }
  
      req.session.st = ticket;
  
      if (req.ssoff) {
        req.sessionStore.set(ticket, { sid: req.session.id }, function(err) {
          if (err) {
            console.log('Trying to store ticket in sessionStore for ssoff failed!');
            console.error(err);
          }
        });
      }
  
      req.session.cas = {};
      for (var casProperty in success) {
        if (casProperty != 'proxyGrantingTicket') {
          req.session.cas[casProperty] = success[casProperty][0];
        }
      }
  
      if (!pgtIou) {
        if (options.paths.proxyCallback) {
          console.log('pgtUrl is specific, but havn\'t find pgtIou from CAS validation response!');
          return res.status(401).send({
            message: 'pgtUrl is specific, but havn\'t find pgtIou from CAS validation response!'
          });
        } else {
          if (debug) {
            console.log('None-proxy mode, validate ticket succeed, redirecting to lastUrl: ' + req.session.lastUrl);
          }
          req.session.save(function(err) {
            if (err) {
              console.log('Trying to save session failed!');
              console.error(err);
              return res.status(500).send({
                message: 'Trying to save session failed!',
                error: err
              });
            }
            if (typeof options.redirect === 'function' && options.redirect(req, res)) {
              return;
            }
  
            return res.redirect(302, req.session.lastUrl);
          });
        }
  
        return;
      }
  
      retrievePGTFromPGTIOU(req, res, pgtIou, options);
    });
  }