<commit_before>import {Strategy} from 'passport-saml'

// ===================================================================

function extract (obj, prop, defaultValue = undefined) {
  if (prop in obj) {
    const value = obj[prop]
    delete obj[prop]

    return value
  }

  return defaultValue
}

// ===================================================================

export const configurationSchema = {
  type: 'object',
  properties: {
    cert: {
      type: 'string'
    },
    entryPoint: {
      type: 'string'
    },
    issuer: {
      type: 'string'
    },
    usernameField: {
      type: 'string'
    }
  },
  required: ['cert', 'entryPoint', 'issuer']
}

// ===================================================================

class AuthSamlXoPlugin {
  constructor (xo) {
    this._xo = xo
  }

  configure (conf) {
    this._usernameField = extract(conf, 'usernameField', 'uid')
    this._conf = conf
  }

  load () {
    const {_xo: xo} = this<commit_msg>Use object spread instead of altering passed object.<commit_after>import {Strategy} from 'passport-saml'

// ===================================================================

function extract (obj, prop, defaultValue = undefined) {
  if (prop in obj) {
    const value = obj[prop]
    delete obj[prop]

    return value
  }

  return defaultValue
}

// ===================================================================

export const configurationSchema = {
  type: 'object',
  properties: {
    cert: {
      type: 'string'
    },
    entryPoint: {
      type: 'string'
    },
    issuer: {
      type: 'string'
    },
    usernameField: {
      type: 'string'
    }
  },
  required: ['cert', 'entryPoint', 'issuer']
}

// ===================================================================

class AuthSamlXoPlugin {
  constructor (xo) {
    this._xo = xo
  }

  configure ({ usernameField, ...conf }) {
    this._usernameField = usernameField
    this._conf = conf
  }

  load () {
    const {_xo: xo} = this
{'fraction_non_alphanumeric': 0.31089904570567556, 'fraction_numerical': 0.0, 'mean_word_length': 3.2655246252676657, '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': '1071553', 'n_tokens_mistral': 586, 'n_tokens_neox': 552, 'n_words': 133}