<commit_before>'use strict'

/* logout */
module.exports = function (app, config, req, res, next) {
  let serviceUrl = req.query['service']

  if (req.accesstoken) {
    eval('app.models.' + config.userModel).logout(req.accessToken.id,function(err) {
      let error = new Error(err || 'could not logout:' + req.accessToken.id)
      error.status = 500
      next(error)
      return
    })

    // TODO here : Single Logout (SLO): Send here SAML messages to deconnect (TGT, service)

  }

  if (!serviceUrl) {
    return res.redirect(config.logoutPage)
  } else {
    return res.redirect(config.logoutPage + "?redirect=" + encodeURIComponent(serviceUrl))
  }
}<commit_msg>see CAS 3.0 protocol # 2.3.1. /logout parameters<commit_after>'use strict'

/* logout */
module.exports = function (app, config, req, res, next) {
  let serviceUrl = req.query['service']

  if (req.accesstoken) {
    eval('app.models.' + config.userModel).logout(req.accessToken.id,function(err) {
      let error = new Error(err || 'could not logout:' + req.accessToken.id)
      error.status = 500
      next(error)
      return
    })

    // TODO here : Single Logout (SLO): Send here SAML messages to deconnect (TGT, service)

  }

  if (!serviceUrl) {
    return res.redirect(config.logoutPage)
  } else {
    return res.redirect(serviceUrl)
  }
}
{'fraction_non_alphanumeric': 0.14102564102564102, 'fraction_numerical': 0.008295625942684766, 'mean_word_length': 3.199367088607595, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4167032', 'n_tokens_mistral': 455, 'n_tokens_neox': 436, 'n_words': 106}