<commit_before>/**
 * Module dependencies.
 */
var util = require('util')
  , OAuth2Strategy = require('passport-oauth2')
  , Profile = require('./profile')
  , InternalOAuthError = require('passport-oauth2').InternalOAuthError;


/**
 * `Strategy` constructor.
 *
 * The Buddy authentication strategy authenticates requests by delegating to
 * Buddy using the OAuth 2.0 protocol.
 *
 * Applications must supply a `verify` callback which accepts an `accessToken`,
 * `refreshToken` and service-specific `profile`, and then calls the `done`
 * callback supplying a `user`, which should be set to `false` if the
 * credentials are not valid.  If an exception occured, `err` should be set.
 *
 * Options:
 *   - `clientID`      your Buddy application's Client ID
 *   - `clientSecret`  your Buddy application's Client Secret
 *   - `callbackURL`   URL to which Buddy will redirect the user after granting authorization
 *   - `scope`         array of permission scopes to request.  valid scopes include:
 *                     'WORKSPACE', 'PROJECT_DELETE', 'REPOSITORY_READ', 'REPOSITORY_WRITE',
 *                     'RELEASE_INFO', 'RELEASE_RUN', 'RELEASE_MANAGE', 'USER_INFO', 'USER_KEY',
 *                     'USER_EMAIL', 'MEMBER_EMAIL', 'MANAGE_EMAILS'
 *                     (see http://buddy.works/api/reference/getting-started/oauth#scopes for more info)
 *   — `userAgent`     All API requests MUST include a valid User Agent string.
 *                     e.g: domain name of your application.
 *
 * Examples:
 *
 *     passport.use(new BuddyStrategy({
 *         clientID: '1-api-buddy-client',
 *         clientSecret: 'shhh-its-a-secret'
 *         callbackURL: 'https://www.example.net/auth/buddy/callback',
 *         userAgent: 'myapp.com'
 *       },
 *       function(accessToken, refreshToken, profile, done) {
 *         User.findOrCreate(..., function (err, user) {
 *           done(err, user);
 *         });
 *       }
 *     ));
 *
 * @param {Object} options
 * @param {Function} verify
 * @api public
 */
function Strategy(options, verify) {
  options = options || {};
  options.authorizationURL = options.authorizationURL || 'https://api.buddy.works/oauth2/authorize';
  options.tokenURL = options.tokenURL || 'https://api.buddy.works/oauth2/token';
  options.scopeSeparator = options.scopeSeparator || '+';
  options.customHeaders = options.customHeaders || {};

  if (!options.customHeaders['User-Agent']) {
    options.customHeaders['User-Agent'] = options.userAgent || 'passport-buddy';
  }

  OAuth2Strategy.call(this, options, verify);<commit_msg>Fix scope separator<commit_after>/**
 * Module dependencies.
 */
var util = require('util')
  , OAuth2Strategy = require('passport-oauth2')
  , Profile = require('./profile')
  , InternalOAuthError = require('passport-oauth2').InternalOAuthError;


/**
 * `Strategy` constructor.
 *
 * The Buddy authentication strategy authenticates requests by delegating to
 * Buddy using the OAuth 2.0 protocol.
 *
 * Applications must supply a `verify` callback which accepts an `accessToken`,
 * `refreshToken` and service-specific `profile`, and then calls the `done`
 * callback supplying a `user`, which should be set to `false` if the
 * credentials are not valid.  If an exception occured, `err` should be set.
 *
 * Options:
 *   - `clientID`      your Buddy application's Client ID
 *   - `clientSecret`  your Buddy application's Client Secret
 *   - `callbackURL`   URL to which Buddy will redirect the user after granting authorization
 *   - `scope`         array of permission scopes to request.  valid scopes include:
 *                     'WORKSPACE', 'PROJECT_DELETE', 'REPOSITORY_READ', 'REPOSITORY_WRITE',
 *                     'RELEASE_INFO', 'RELEASE_RUN', 'RELEASE_MANAGE', 'USER_INFO', 'USER_KEY',
 *                     'USER_EMAIL', 'MEMBER_EMAIL', 'MANAGE_EMAILS'
 *                     (see http://buddy.works/api/reference/getting-started/oauth#scopes for more info)
 *   — `userAgent`     All API requests MUST include a valid User Agent string.
 *                     e.g: domain name of your application.
 *
 * Examples:
 *
 *     passport.use(new BuddyStrategy({
 *         clientID: '1-api-buddy-client',
 *         clientSecret: 'shhh-its-a-secret'
 *         callbackURL: 'https://www.example.net/auth/buddy/callback',
 *         userAgent: 'myapp.com'
 *       },
 *       function(accessToken, refreshToken, profile, done) {
 *         User.findOrCreate(..., function (err, user) {
 *           done(err, user);
 *         });
 *       }
 *     ));
 *
 * @param {Object} options
 * @param {Function} verify
 * @api public
 */
function Strategy(options, verify) {
  options = options || {};
  options.authorizationURL = options.authorizationURL || 'https://api.buddy.works/oauth2/authorize';
  options.tokenURL = options.tokenURL || 'https://api.buddy.works/oauth2/token';
  options.scopeSeparator = options.scopeSeparator || ' ';
  options.customHeaders = options.customHeaders || {};

  if (!options.customHeaders['User-Agent']) {
    options.customHeaders['User-Agent'] = options.userAgent || 'passport-buddy';
  }

  OAuth2Strategy.call(this, options, verify);
{'fraction_non_alphanumeric': 0.13172147001934237, 'fraction_numerical': 0.003481624758220503, 'mean_word_length': 3.0335413416536663, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 6, 'lorem ipsum': 0, 'www.': 2, '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': '6151177', 'n_tokens_mistral': 1534, 'n_tokens_neox': 1497, 'n_words': 389}