<commit_before>/**
 * Satellizer
 * (c) 2014 <NAME> <<EMAIL>>
 * License: MIT
 */

(function(window, angular, undefined) {
  'use strict';

  angular.module('Satellizer', [])
    .provider('$auth', $auth)
    .factory('RunBlock', RunBlock)
    .factory('Local', Local)
    .factory('Oauth2', Oauth2)
    .factory('Oauth1', Oauth1)
    .factory('Popup', Popup)
    .service('Utils', Utils)
    .config(httpInterceptor)
    .run(onRun);

  var config = {
    logoutRedirect: '/',
    loginRedirect: '/',
    loginUrl: '/auth/login',
    signupUrl: '/auth/signup',
    signupRedirect: '/login',
    loginRoute: '/login',
    signupRoute: '/signup',
    user: 'currentUser'
  };

  var providers = {
    google: {
      url: '/auth/google',
      authorizationEndpoint: 'https://accounts.google.com/o/oauth2/auth',
      redirectUri: window.location.origin,
      scope: 'openid profile email',
      scopeDelimiter: ' ',
      requiredUrlParams: ['scope'],
      optionalUrlParams: ['display'],
      display: 'popup',
      type: '2.0',
      popupOptions: {
        width: 452,
        height: 633
      }
    },
    facebook: {
      url: '/auth/facebook',
      authorizationEndpoint: 'https://www.facebook.com/dialog/oauth',
      redirectUri: window.location.origin + '/',
      scope: 'email',
      scopeDelimiter: ',',
      requiredUrlParams: ['display'],
      display: 'popup',
      type: '2.0',
      popupOptions: {
        width: 481,
        height: 269
      }
    },
    linkedin: {
      url: '/auth/linkedin',
      authorizationEndpoint: 'https://www.linkedin.com/uas/oauth2/authorization',
      redirectUri: window.location.origin,
      requiredUrlParams: ['state'],
      scope: [],
      scopeDelimiter: ' ',
      state: 'STATE',
      type: '2.0',
      popupOptions: {
        width: 527,
        height: 582
      }
    },
    twitter: {
      url: '/auth/twitter',
      type: '1.0'
    }
  };

  function $auth() {

    this.config = config;

    this.facebook = function(params) {
      angular.extend(providers.facebook, params);
    };

    this.google = function(params) {
      angular.extend(providers.google, params);
    };

    this.linkedin = function(params) {
      angular.extend(providers.linkedin, params);
    };

    this.twitter = function(params) {
      angular.extend(providers.twitter, params);
    };

    this.oauth2 = function(params) {
      providers[params.name] = providers[params.name] || {};
      providers[params.name].type = '2.0';
      angular.extend(providers[params.name], params);
    };

    this.oauth1 = function(params) {
      providers[params.name] = providers[params.name] || {};
      providers[params.name].type = '1.0';
      angular.extend(providers[params.name], params);
    };

    this.setProvider = function(params) {
      angular.extend(providers[params.name], params);
    };

    this.addProvider = function(params) {
      providers[params.name] = {};
      angular.extend(providers[params.name], params);
    };

    this.getProvider = function(name) {
      return providers[name];
    };

    this.$get = function($q, $http, Oauth1, Oauth2, Local) {

      var $auth = {};

      $auth.authenticate = function(name) {
        var deferred = $q.defer();
        var provider = (providers[name].type === '1.0') ? Oauth1 : Oauth2;
        provider.open(providers[name]).then(function(response) {
          Local.parseUser(response.token, deferred);
        });
        return deferred.promise;<commit_msg>removed set,add,get provider methods<commit_after>/**
 * Satellizer
 * (c) 2014 <NAME> <<EMAIL>>
 * License: MIT
 */

(function(window, angular, undefined) {
  'use strict';

  angular.module('Satellizer', [])
    .provider('$auth', $auth)
    .factory('RunBlock', RunBlock)
    .factory('Local', Local)
    .factory('Oauth2', Oauth2)
    .factory('Oauth1', Oauth1)
    .factory('Popup', Popup)
    .service('Utils', Utils)
    .config(httpInterceptor)
    .run(onRun);

  var config = {
    logoutRedirect: '/',
    loginRedirect: '/',
    loginUrl: '/auth/login',
    signupUrl: '/auth/signup',
    signupRedirect: '/login',
    loginRoute: '/login',
    signupRoute: '/signup',
    user: 'currentUser'
  };

  var providers = {
    google: {
      url: '/auth/google',
      authorizationEndpoint: 'https://accounts.google.com/o/oauth2/auth',
      redirectUri: window.location.origin,
      scope: 'openid profile email',
      scopeDelimiter: ' ',
      requiredUrlParams: ['scope'],
      optionalUrlParams: ['display'],
      display: 'popup',
      type: '2.0',
      popupOptions: {
        width: 452,
        height: 633
      }
    },
    facebook: {
      url: '/auth/facebook',
      authorizationEndpoint: 'https://www.facebook.com/dialog/oauth',
      redirectUri: window.location.origin + '/',
      scope: 'email',
      scopeDelimiter: ',',
      requiredUrlParams: ['display'],
      display: 'popup',
      type: '2.0',
      popupOptions: {
        width: 481,
        height: 269
      }
    },
    linkedin: {
      url: '/auth/linkedin',
      authorizationEndpoint: 'https://www.linkedin.com/uas/oauth2/authorization',
      redirectUri: window.location.origin,
      requiredUrlParams: ['state'],
      scope: [],
      scopeDelimiter: ' ',
      state: 'STATE',
      type: '2.0',
      popupOptions: {
        width: 527,
        height: 582
      }
    },
    twitter: {
      url: '/auth/twitter',
      type: '1.0'
    }
  };

  function $auth() {

    this.config = config;

    this.facebook = function(params) {
      angular.extend(providers.facebook, params);
    };

    this.google = function(params) {
      angular.extend(providers.google, params);
    };

    this.linkedin = function(params) {
      angular.extend(providers.linkedin, params);
    };

    this.twitter = function(params) {
      angular.extend(providers.twitter, params);
    };

    this.oauth2 = function(params) {
      providers[params.name] = providers[params.name] || {};
      providers[params.name].type = '2.0';
      angular.extend(providers[params.name], params);
    };

    this.oauth1 = function(params) {
      providers[params.name] = providers[params.name] || {};
      providers[params.name].type = '1.0';
      angular.extend(providers[params.name], params);
    };

    this.$get = function($q, $http, Oauth1, Oauth2, Local) {

      var $auth = {};

      $auth.authenticate = function(name) {
        var deferred = $q.defer();
        var provider = (providers[name].type === '1.0') ? Oauth1 : Oauth2;
        provider.open(providers[name]).then(function(response) {
          Local.parseUser(response.token, deferred);
        });
        return deferred.promise;
{'fraction_non_alphanumeric': 0.16273161984459056, 'fraction_numerical': 0.01434548714883443, 'mean_word_length': 2.5060240963855422, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, 'https://': 6, 'lorem ipsum': 0, 'www.': 4, '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': '2429631', 'n_tokens_mistral': 2187, 'n_tokens_neox': 2110, 'n_words': 373}