diff --git a/README.md b/README.md
index 3420ea5f..945334f0 100644
--- a/README.md
+++ b/README.md
@@ -50,7 +50,7 @@ in the app *config* block.
```
```html
-
+
```
#### NPM
diff --git a/dist/satellizer.js b/dist/satellizer.js
index 6bfd82c4..0a5e4361 100644
--- a/dist/satellizer.js
+++ b/dist/satellizer.js
@@ -1,5 +1,5 @@
/**
- * Satellizer 0.15.0
+ * Satellizer 0.15.1
* (c) 2016 Sahat Yalkabov
* License: MIT
*/
@@ -49,7 +49,7 @@
display: 'popup',
oauthType: '2.0',
popupOptions: { width: 452, height: 633 },
- state: function () { encodeURIComponent(Math.random().toString(36).substr(2)); }
+ state: function () { return encodeURIComponent(Math.random().toString(36).substr(2)); }
},
github: {
name: 'github',
@@ -677,7 +677,6 @@
return new Promise(function (resolve, reject) {
Object.assign(_this.defaults, options);
_this.$timeout(function () {
- var url = [_this.defaults.authorizationEndpoint, _this.buildQueryString()].join('?');
var stateName = _this.defaults.name + '_state';
var _a = _this.defaults, name = _a.name, state = _a.state, popupOptions = _a.popupOptions, redirectUri = _a.redirectUri, responseType = _a.responseType;
if (typeof state === 'function') {
@@ -686,6 +685,7 @@
else if (typeof state === 'string') {
_this.SatellizerStorage.set(stateName, state);
}
+ var url = [_this.defaults.authorizationEndpoint, _this.buildQueryString()].join('?');
_this.SatellizerPopup.open(url, name, popupOptions);
_this.SatellizerPopup.polling(redirectUri).then(function (oauth) {
if (responseType === 'token' || !url) {
@@ -826,11 +826,10 @@
this.$window = $window;
this.SatellizerConfig = SatellizerConfig;
this.memoryStore = {};
- this.storageType = SatellizerConfig.storageType;
}
Storage.prototype.get = function (key) {
try {
- return this.$window[this.storageType].getItem(key);
+ return this.$window[this.SatellizerConfig.storageType].getItem(key);
}
catch (e) {
return this.memoryStore[key];
@@ -838,7 +837,7 @@
};
Storage.prototype.set = function (key, value) {
try {
- this.$window[this.storageType].setItem(key, value);
+ this.$window[this.SatellizerConfig.storageType].setItem(key, value);
}
catch (e) {
this.memoryStore[key] = value;
@@ -846,7 +845,7 @@
};
Storage.prototype.remove = function (key) {
try {
- this.$window[this.storageType].removeItem(key);
+ this.$window[this.SatellizerConfig.storageType].removeItem(key);
}
catch (e) {
delete this.memoryStore[key];
diff --git a/dist/satellizer.js.map b/dist/satellizer.js.map
index 0b0700cb..8b72df26 100644
--- a/dist/satellizer.js.map
+++ b/dist/satellizer.js.map
@@ -1 +1 @@
-{"version":3,"file":null,"sources":["../src/config.ts","../src/authProvider.ts","../src/utils.ts","../src/shared.ts","../src/local.ts","../src/popup.ts","../src/oauth.ts","../src/oauth2.ts","../src/oauth1.ts","../src/storage.ts","../src/interceptor.ts","../src/httpProviderConfig.ts","../src/ng1.ts"],"sourcesContent":["export default class Config {\n static get getConstant() {\n return new Config();\n }\n\n baseUrl = '/';\n loginUrl = '/auth/login';\n signupUrl = '/auth/signup';\n unlinkUrl = '/auth/unlink/';\n tokenName = 'token';\n tokenPrefix = 'satellizer';\n tokenHeader = 'Authorization';\n tokenType = 'Bearer';\n storageType = 'localStorage';\n tokenRoot = null;\n withCredentials = false;\n providers = {\n facebook: {\n name: 'facebook',\n url: '/auth/facebook',\n authorizationEndpoint: 'https://www.facebook.com/v2.5/dialog/oauth',\n redirectUri: window.location.origin + '/',\n requiredUrlParams: ['display', 'scope'],\n scope: ['email'],\n scopeDelimiter: ',',\n display: 'popup',\n oauthType: '2.0',\n popupOptions: { width: 580, height: 400 }\n },\n google: {\n name: 'google',\n url: '/auth/google',\n authorizationEndpoint: 'https://accounts.google.com/o/oauth2/auth',\n redirectUri: window.location.origin,\n requiredUrlParams: ['scope'],\n optionalUrlParams: ['display', 'state'],\n scope: ['profile', 'email'],\n scopePrefix: 'openid',\n scopeDelimiter: ' ',\n display: 'popup',\n oauthType: '2.0',\n popupOptions: { width: 452, height: 633 },\n state: () => { encodeURIComponent(Math.random().toString(36).substr(2)); }\n },\n github: {\n name: 'github',\n url: '/auth/github',\n authorizationEndpoint: 'https://github.com/login/oauth/authorize',\n redirectUri: window.location.origin,\n optionalUrlParams: ['scope'],\n scope: ['user:email'],\n scopeDelimiter: ' ',\n oauthType: '2.0',\n popupOptions: { width: 1020, height: 618 }\n },\n instagram: {\n name: 'instagram',\n url: '/auth/instagram',\n authorizationEndpoint: 'https://api.instagram.com/oauth/authorize',\n redirectUri: window.location.origin,\n requiredUrlParams: ['scope'],\n scope: ['basic'],\n scopeDelimiter: '+',\n oauthType: '2.0'\n },\n linkedin: {\n name: 'linkedin',\n url: '/auth/linkedin',\n authorizationEndpoint: 'https://www.linkedin.com/uas/oauth2/authorization',\n redirectUri: window.location.origin,\n requiredUrlParams: ['state'],\n scope: ['r_emailaddress'],\n scopeDelimiter: ' ',\n state: 'STATE',\n oauthType: '2.0',\n popupOptions: { width: 527, height: 582 }\n },\n twitter: {\n name: 'twitter',\n url: '/auth/twitter',\n authorizationEndpoint: 'https://api.twitter.com/oauth/authenticate',\n redirectUri: window.location.origin,\n oauthType: '1.0',\n popupOptions: { width: 495, height: 645 }\n },\n twitch: {\n name: 'twitch',\n url: '/auth/twitch',\n authorizationEndpoint: 'https://api.twitch.tv/kraken/oauth2/authorize',\n redirectUri: window.location.origin,\n requiredUrlParams: ['scope'],\n scope: ['user_read'],\n scopeDelimiter: ' ',\n display: 'popup',\n oauthType: '2.0',\n popupOptions: { width: 500, height: 560 }\n },\n live: {\n name: 'live',\n url: '/auth/live',\n authorizationEndpoint: 'https://login.live.com/oauth20_authorize.srf',\n redirectUri: window.location.origin,\n requiredUrlParams: ['display', 'scope'],\n scope: ['wl.emails'],\n scopeDelimiter: ' ',\n display: 'popup',\n oauthType: '2.0',\n popupOptions: { width: 500, height: 560 }\n },\n yahoo: {\n name: 'yahoo',\n url: '/auth/yahoo',\n authorizationEndpoint: 'https://api.login.yahoo.com/oauth2/request_auth',\n redirectUri: window.location.origin,\n scope: [],\n scopeDelimiter: ',',\n oauthType: '2.0',\n popupOptions: { width: 559, height: 519 }\n },\n bitbucket: {\n name: 'bitbucket',\n url: '/auth/bitbucket',\n authorizationEndpoint: 'https://bitbucket.org/site/oauth2/authorize',\n redirectUri: window.location.origin + '/',\n requiredUrlParams: ['scope'],\n scope: ['email'],\n scopeDelimiter: ' ',\n oauthType: '2.0',\n popupOptions: { width: 1028, height: 529 }\n }\n };\n httpInterceptor: any = (): boolean => true;\n};\n","import Config from './config';\nimport { IOAuth1Options } from './oauth1';\nimport { IOAuth2Options } from './oauth2';\n\nexport default class AuthProvider {\n static $inject = ['SatellizerConfig'];\n\n constructor(private SatellizerConfig: Config) {}\n\n get baseUrl(): string { return this.SatellizerConfig.baseUrl; }\n set baseUrl(value) { this.SatellizerConfig.baseUrl = value; }\n\n get loginUrl(): string { return this.SatellizerConfig.loginUrl; }\n set loginUrl(value) { this.SatellizerConfig.loginUrl = value; }\n\n get signupUrl(): string { return this.SatellizerConfig.signupUrl; }\n set signupUrl(value) { this.SatellizerConfig.signupUrl = value; }\n\n get unlinkUrl(): string { return this.SatellizerConfig.unlinkUrl; }\n set unlinkUrl(value) { this.SatellizerConfig.unlinkUrl = value; }\n\n get tokenRoot(): string { return this.SatellizerConfig.tokenRoot; }\n set tokenRoot(value) { this.SatellizerConfig.tokenRoot = value; }\n\n get tokenName(): string { return this.SatellizerConfig.tokenName; }\n set tokenName(value) { this.SatellizerConfig.tokenName = value; }\n\n get tokenPrefix(): string { return this.SatellizerConfig.tokenPrefix; }\n set tokenPrefix(value) { this.SatellizerConfig.tokenPrefix = value; }\n\n get tokenHeader(): string { return this.SatellizerConfig.tokenHeader; }\n set tokenHeader(value) { this.SatellizerConfig.tokenHeader = value; }\n\n get tokenType(): string { return this.SatellizerConfig.tokenType; }\n set tokenType(value) { this.SatellizerConfig.tokenType = value; }\n\n get withCredentials(): boolean { return this.SatellizerConfig.withCredentials; }\n set withCredentials(value) { this.SatellizerConfig.withCredentials = value; }\n\n get storageType(): string { return this.SatellizerConfig.storageType; }\n set storageType(value) { this.SatellizerConfig.storageType = value; }\n\n get httpInterceptor(): boolean { return this.SatellizerConfig.httpInterceptor; }\n set httpInterceptor(value) {\n if (typeof value === 'function') {\n this.SatellizerConfig.httpInterceptor = value;\n } else {\n this.SatellizerConfig.httpInterceptor = () => value;\n }\n }\n\n facebook(options: IOAuth2Options): void {\n angular.extend(this.SatellizerConfig.providers.facebook, options);\n }\n\n google(options: IOAuth2Options): void {\n angular.extend(this.SatellizerConfig.providers.google, options);\n }\n\n github(options: IOAuth2Options): void {\n angular.extend(this.SatellizerConfig.providers.github, options);\n }\n\n instagram(options: IOAuth2Options): void {\n angular.extend(this.SatellizerConfig.providers.instagram, options);\n }\n\n linkedin(options: IOAuth2Options): void {\n angular.extend(this.SatellizerConfig.providers.linkedin, options);\n }\n\n twitter(options: IOAuth1Options): void {\n angular.extend(this.SatellizerConfig.providers.twitter, options);\n }\n\n twitch(options: IOAuth2Options): void {\n angular.extend(this.SatellizerConfig.providers.twitch, options);\n }\n\n live(options: IOAuth2Options): void {\n angular.extend(this.SatellizerConfig.providers.live, options);\n }\n\n yahoo(options: IOAuth2Options): void {\n angular.extend(this.SatellizerConfig.providers.yahoo, options);\n }\n\n bitbucket(options: IOAuth2Options): void {\n angular.extend(this.SatellizerConfig.providers.bitbucket, options);\n }\n\n oauth1(options: IOAuth1Options): void {\n this.SatellizerConfig.providers[options.name] = angular.extend(options, {\n oauthType: '1.0'\n });\n }\n\n oauth2(options: IOAuth2Options): void {\n this.SatellizerConfig.providers[options.name] = angular.extend(options, {\n oauthType: '2.0'\n });\n }\n\n $get(SatellizerShared, SatellizerLocal, SatellizerOAuth): any {\n return {\n login: (user, options) => SatellizerLocal.login(user, options),\n signup: (user, options) => SatellizerLocal.signup(user, options),\n logout: () => SatellizerShared.logout(),\n authenticate: (name, data) => SatellizerOAuth.authenticate(name, data),\n link: (name, data) => SatellizerOAuth.authenticate(name, data),\n unlink: (name, options) => SatellizerOAuth.unlink(name, options),\n isAuthenticated: () => SatellizerShared.isAuthenticated(),\n getPayload: () => SatellizerShared.getPayload(),\n getToken: () => SatellizerShared.getToken(),\n setToken: (token) => SatellizerShared.setToken({ access_token: token }),\n removeToken: () => SatellizerShared.removeToken(),\n setStorageType: (type) => SatellizerShared.setStorageType(type)\n };\n }\n}\n","export function joinUrl (baseUrl, url) {\n if (/^(?:[a-z]+:)?\\/\\//i.test(url)) {\n return url;\n }\n let joined = [baseUrl, url].join('/');\n let normalize = function (str) {\n return str\n .replace(/[\\/]+/g, '/')\n .replace(/\\/\\?/g, '?')\n .replace(/\\/\\#/g, '#')\n .replace(/\\:\\//g, '://');\n };\n return normalize(joined);\n}\n\nexport function getFullUrlPath (location) {\n const isHttps = location.protocol === 'https:';\n return location.protocol + '//' + location.hostname +\n ':' + (location.port || (isHttps ? '443' : '80')) +\n (/^\\//.test(location.pathname) ? location.pathname : '/' + location.pathname);\n}\n\nexport function parseQueryString (str) {\n let obj = {};\n let key;\n let value;\n angular.forEach((str || '').split('&'), (keyValue) => {\n if (keyValue) {\n value = keyValue.split('=');\n key = decodeURIComponent(value[0]);\n obj[key] = angular.isDefined(value[1]) ? decodeURIComponent(value[1]) : true;\n }\n });\n return obj;\n}\n\nexport function decodeBase64 (str) {\n let buffer;\n if (typeof module !== 'undefined' && module.exports) {\n try {\n buffer = require('buffer').Buffer;\n } catch (err) {\n // noop\n }\n }\n\n let fromCharCode = String.fromCharCode;\n\n let re_btou = new RegExp([\n '[\\xC0-\\xDF][\\x80-\\xBF]',\n '[\\xE0-\\xEF][\\x80-\\xBF]{2}',\n '[\\xF0-\\xF7][\\x80-\\xBF]{3}'\n ].join('|'), 'g');\n\n let cb_btou = function (cccc) {\n switch (cccc.length) {\n case 4:\n let cp = ((0x07 & cccc.charCodeAt(0)) << 18)\n | ((0x3f & cccc.charCodeAt(1)) << 12)\n | ((0x3f & cccc.charCodeAt(2)) << 6)\n | (0x3f & cccc.charCodeAt(3));\n let offset = cp - 0x10000;\n return (fromCharCode((offset >>> 10) + 0xD800)\n + fromCharCode((offset & 0x3FF) + 0xDC00));\n case 3:\n return fromCharCode(\n ((0x0f & cccc.charCodeAt(0)) << 12)\n | ((0x3f & cccc.charCodeAt(1)) << 6)\n | (0x3f & cccc.charCodeAt(2))\n );\n default:\n return fromCharCode(\n ((0x1f & cccc.charCodeAt(0)) << 6)\n | (0x3f & cccc.charCodeAt(1))\n );\n }\n };\n\n let btou = function (b) {\n return b.replace(re_btou, cb_btou);\n };\n\n let _decode = buffer ? function (a) {\n return (a.constructor === buffer.constructor\n ? a : new buffer(a, 'base64')).toString();\n }\n : function (a) {\n return btou(atob(a));\n };\n\n return _decode(\n String(str).replace(/[-_]/g, function (m0) {\n return m0 === '-' ? '+' : '/';\n })\n .replace(/[^A-Za-z0-9\\+\\/]/g, '')\n );\n}\n","import Config from './config';\nimport Storage from './storage';\nimport { decodeBase64 } from './utils';\n\nclass Shared {\n static $inject = ['$q', '$window', '$log', 'SatellizerConfig', 'SatellizerStorage'];\n \n private prefixedTokenName: string;\n\n constructor(private $q: angular.IQService,\n private $window: angular.IWindowService,\n private $log: angular.ILogService,\n private SatellizerConfig: Config,\n private SatellizerStorage: Storage) {\n const { tokenName, tokenPrefix } = this.SatellizerConfig;\n this.prefixedTokenName = tokenPrefix ? [tokenPrefix, tokenName].join('_') : tokenName;\n }\n\n getToken(): string {\n return this.SatellizerStorage.get(this.prefixedTokenName);\n }\n\n getPayload(): any {\n const token = this.SatellizerStorage.get(this.prefixedTokenName);\n\n if (token && token.split('.').length === 3) {\n try {\n const base64Url = token.split('.')[1];\n const base64 = base64Url.replace('-', '+').replace('_', '/');\n return JSON.parse(decodeBase64(base64));\n } catch (e) {\n // no-op\n }\n }\n }\n\n setToken(response): void {\n if (!response) {\n return this.$log.warn('Can\\'t set token without passing a value');\n }\n\n let token;\n const accessToken = response && response.access_token;\n\n if (accessToken) {\n if (angular.isObject(accessToken) && angular.isObject(accessToken.data)) {\n response = accessToken;\n } else if (angular.isString(accessToken)) {\n token = accessToken;\n }\n }\n\n if (!token && response) {\n const tokenRootData = this.SatellizerConfig.tokenRoot && this.SatellizerConfig.tokenRoot.split('.').reduce(function(o, x) { return o[x]; }, response.data);\n token = tokenRootData ? tokenRootData[this.SatellizerConfig.tokenName] : response.data && response.data[this.SatellizerConfig.tokenName];\n }\n\n if (!token) {\n const tokenPath = this.SatellizerConfig.tokenRoot ? this.SatellizerConfig.tokenRoot + '.' + this.SatellizerConfig.tokenName : this.SatellizerConfig.tokenName;\n return this.$log.warn('Expecting a token named \"' + tokenPath);\n }\n\n this.SatellizerStorage.set(this.prefixedTokenName, token);\n }\n\n removeToken(): void {\n this.SatellizerStorage.remove(this.prefixedTokenName);\n }\n\n isAuthenticated(): boolean {\n const token = this.SatellizerStorage.get(this.prefixedTokenName);\n\n if (token) { // Token is present\n if (token.split('.').length === 3) { // Token with a valid JWT format XXX.YYY.ZZZ\n try { // Could be a valid JWT or an access token with the same format\n const base64Url = token.split('.')[1];\n const base64 = base64Url.replace('-', '+').replace('_', '/');\n const exp = JSON.parse(this.$window.atob(base64)).exp;\n if (exp) { // JWT with an optonal expiration claims\n return (Math.round(new Date().getTime() / 1000) >= exp) ? false : true;\n }\n } catch (e) {\n return true; // Pass: Non-JWT token that looks like JWT\n }\n }\n return true; // Pass: All other tokens\n }\n return false; // Fail: No token at all\n }\n\n logout(): angular.IPromise {\n this.SatellizerStorage.remove(this.prefixedTokenName);\n return this.$q.when();\n }\n\n setStorageType(type): void {\n this.SatellizerConfig.storageType = type;\n }\n}\n\nexport default Shared;\n","import { joinUrl } from './utils';\nimport Config from './config';\nimport Shared from './shared';\n\nclass Local {\n static $inject = ['$http', 'SatellizerConfig', 'SatellizerShared'];\n\n\n constructor(private $http: angular.IHttpService,\n private SatellizerConfig: Config,\n private SatellizerShared: Shared) {}\n\n login(user: string|Object, options: any = {}): angular.IHttpPromise {\n options.url = options.url ? options.url : joinUrl(this.SatellizerConfig.baseUrl, this.SatellizerConfig.loginUrl);\n options.data = user || options.data;\n options.method = options.method || 'POST';\n options.withCredentials = options.withCredentials || this.SatellizerConfig.withCredentials;\n\n return this.$http(options).then((response) => {\n this.SatellizerShared.setToken(response);\n return response;\n });\n }\n\n signup(user: string|Object, options: any = {}): angular.IHttpPromise {\n options.url = options.url ? options.url : joinUrl(this.SatellizerConfig.baseUrl, this.SatellizerConfig.signupUrl);\n options.data = user || options.data;\n options.method = options.method || 'POST';\n options.withCredentials = options.withCredentials || this.SatellizerConfig.withCredentials;\n\n return this.$http(options);\n }\n}\n\nexport default Local;\n","import { parseQueryString, getFullUrlPath } from './utils';\n\nexport interface IPopup {\n open(url: string, name: string, popupOptions: { width: number, height: number }): void;\n stringifyOptions (options: any): string;\n polling(redirectUri: string): Promise;\n eventListener(redirectUri: string): Promise;\n}\n\nexport default class Popup implements IPopup {\n static $inject = ['$interval', '$window'];\n\n public popup: any;\n private url: string;\n private defaults: { redirectUri: string };\n \n constructor(private $interval: angular.IIntervalService,\n private $window: angular.IWindowService) {\n this.popup = null;\n this.url = 'about:blank'; // TODO remove\n this.defaults = {\n redirectUri: null\n };\n }\n\n stringifyOptions (options: any): string {\n const parts = [];\n angular.forEach(options, function (value, key) {\n parts.push(key + '=' + value);\n });\n return parts.join(',');\n }\n\n open(url: string, name: string, popupOptions: { width: number, height: number }): void {\n this.url = url; // TODO remove\n\n const width = popupOptions.width || 500;\n const height = popupOptions.height || 500;\n\n const options = this.stringifyOptions({\n width: width,\n height: height,\n top: this.$window.screenY + ((this.$window.outerHeight - height) / 2.5),\n left: this.$window.screenX + ((this.$window.outerWidth - width) / 2)\n });\n\n const popupName = this.$window['cordova'] || this.$window.navigator.userAgent.indexOf('CriOS') > -1 ? '_blank' : name;\n\n this.popup = window.open(this.url, popupName, options);\n\n if (this.popup && this.popup.focus) {\n this.popup.focus();\n }\n //\n // if (this.$window['cordova']) {\n // return this.eventListener(this.defaults.redirectUri); // TODO pass redirect uri\n // } else {\n // return this.polling(redirectUri);\n // }\n }\n\n polling(redirectUri: string): Promise {\n return new Promise((resolve, reject) => {\n const redirectUriParser = document.createElement('a');\n redirectUriParser.href = redirectUri;\n const redirectUriPath = getFullUrlPath(redirectUriParser);\n\n const polling = this.$interval(() => {\n if (!this.popup || this.popup.closed || this.popup.closed === undefined) {\n this.$interval.cancel(polling);\n reject(new Error('The popup window was closed'));\n }\n\n try {\n const popupWindowPath = getFullUrlPath(this.popup.location);\n\n if (popupWindowPath === redirectUriPath) {\n if (this.popup.location.search || this.popup.location.hash) {\n const query = parseQueryString(this.popup.location.search.substring(1).replace(/\\/$/, ''));\n const hash = parseQueryString(this.popup.location.hash.substring(1).replace(/[\\/$]/, ''));\n const params = Object.assign({}, query, hash);\n\n if (params.error) {\n reject(new Error(params.error));\n } else {\n resolve(params);\n }\n } else {\n reject(new Error(\n 'OAuth redirect has occurred but no query or hash parameters were found. ' +\n 'They were either not set during the redirect, or were removed—typically by a ' +\n 'routing library—before Satellizer could read it.'\n ));\n }\n\n this.$interval.cancel(polling);\n this.popup.close();\n }\n } catch (error) {\n // Ignore DOMException: Blocked a frame with origin from accessing a cross-origin frame.\n // A hack to get around same-origin security policy errors in IE.\n }\n }, 500);\n });\n }\n\n eventListener(redirectUri): Promise {\n return new Promise((resolve, reject) => {\n this.popup.addEventListener('loadstart', (event) => {\n if (!event.url.includes(redirectUri)) {\n return;\n }\n\n const parser = document.createElement('a');\n parser.href = event.url;\n\n if (parser.search || parser.hash) {\n const query = parseQueryString(parser.search.substring(1).replace(/\\/$/, ''));\n const hash = parseQueryString(parser.hash.substring(1).replace(/[\\/$]/, ''));\n const params = Object.assign({}, query, hash);\n\n if (params.error) {\n reject(new Error(params.error));\n } else {\n resolve(params);\n }\n\n this.popup.close();\n }\n });\n\n this.popup.addEventListener('loaderror', () => {\n reject(new Error('Authorization failed'));\n });\n\n this.popup.addEventListener('exit', () => {\n reject(new Error('The popup window was closed'));\n });\n });\n }\n}\n","import { joinUrl } from './utils';\nimport Config from './config';\nimport Shared from './shared';\nimport OAuth1 from './oauth1';\nimport OAuth2 from './oauth2';\n\nexport default class OAuth {\n static $inject = ['$http', 'SatellizerConfig', 'SatellizerShared', 'SatellizerOAuth1', 'SatellizerOAuth2'];\n \n constructor(private $http: angular.IHttpService,\n private SatellizerConfig: Config,\n private SatellizerShared: Shared,\n private SatellizerOAuth1: OAuth1,\n private SatellizerOAuth2: OAuth2) {\n }\n\n authenticate(name: string, userData: any): Promise {\n return new Promise((resolve, reject) => {\n const provider = this.SatellizerConfig.providers[name];\n const initialize: any = provider.oauthType === '1.0' ? this.SatellizerOAuth1.init(provider, userData) : this.SatellizerOAuth2.init(provider, userData);\n\n return initialize.then((response) => {\n if (provider.url) {\n this.SatellizerShared.setToken(response);\n }\n resolve(response);\n }).catch((error) => {\n reject(error);\n });\n });\n }\n\n unlink(provider: string, httpOptions: any = {}): angular.IHttpPromise {\n httpOptions.url = httpOptions.url ? httpOptions.url : joinUrl(this.SatellizerConfig.baseUrl, this.SatellizerConfig.unlinkUrl);\n httpOptions.data = { provider: provider } || httpOptions.data;\n httpOptions.method = httpOptions.method || 'POST';\n httpOptions.withCredentials = httpOptions.withCredentials || this.SatellizerConfig.withCredentials;\n\n return this.$http(httpOptions);\n }\n}\n","import { joinUrl } from './utils';\nimport Config from './config';\nimport Popup from './popup';\nimport Storage from './storage';\n\nexport interface IOAuth2Options {\n name: string;\n url: string;\n clientId: string;\n authorizationEndpoint: string;\n redirectUri: string;\n scope: string[];\n scopePrefix: string;\n scopeDelimiter: string;\n state?: string|(() => string);\n requiredUrlParams: string[];\n defaultUrlParams: string[];\n responseType: string;\n responseParams: {\n code: string,\n clientId: string,\n redirectUri: string\n };\n oauthType: string;\n popupOptions: { width: number, height: number };\n}\n\nexport default class OAuth2 {\n static $inject = ['$http', '$window', '$timeout', 'SatellizerConfig', 'SatellizerPopup', 'SatellizerStorage'];\n\n static camelCase(name): string {\n return name.replace(/([\\:\\-\\_]+(.))/g, (_, separator, letter, offset) => {\n return offset ? letter.toUpperCase() : letter;\n });\n }\n\n public defaults: IOAuth2Options;\n\n constructor(private $http: angular.IHttpService,\n private $window: angular.IWindowService,\n private $timeout: angular.ITimeoutService,\n private SatellizerConfig: Config,\n private SatellizerPopup: Popup,\n private SatellizerStorage: Storage) {\n this.defaults = {\n name: null,\n url: null,\n clientId: null,\n authorizationEndpoint: null,\n redirectUri: null,\n scope: null,\n scopePrefix: null,\n scopeDelimiter: null,\n state: null,\n requiredUrlParams: null,\n defaultUrlParams: ['response_type', 'client_id', 'redirect_uri'],\n responseType: 'code',\n responseParams: {\n code: 'code',\n clientId: 'clientId',\n redirectUri: 'redirectUri'\n },\n oauthType: '2.0',\n popupOptions: { width: null, height: null }\n };\n }\n\n init(options: IOAuth2Options, userData: any): Promise {\n return new Promise((resolve, reject) => {\n Object.assign(this.defaults, options);\n\n this.$timeout(() => {\n const url = [this.defaults.authorizationEndpoint, this.buildQueryString()].join('?');\n const stateName = this.defaults.name + '_state';\n const { name, state, popupOptions, redirectUri, responseType } = this.defaults;\n\n if (typeof state === 'function') {\n this.SatellizerStorage.set(stateName, state());\n } else if (typeof state === 'string') {\n this.SatellizerStorage.set(stateName, state);\n }\n\n this.SatellizerPopup.open(url, name, popupOptions);\n\n this.SatellizerPopup.polling(redirectUri).then((oauth: any): void|Promise|angular.IHttpPromise => {\n\n if (responseType === 'token' || !url) {\n return resolve(oauth);\n }\n\n if (oauth.state && oauth.state !== this.SatellizerStorage.get(stateName)) {\n return reject(new Error(\n 'The value returned in the state parameter does not match the state value from your original ' +\n 'authorization code request.'\n ));\n }\n\n resolve(this.exchangeForToken(oauth, userData));\n })\n .catch(error => reject(error));\n });\n });\n }\n\n exchangeForToken(oauthData: { code?, state? }, userData: any): angular.IHttpPromise {\n const payload = Object.assign({}, userData);\n\n angular.forEach(this.defaults.responseParams, (value, key) => {\n switch (key) {\n case 'code':\n payload[value] = oauthData.code;\n break;\n case 'clientId':\n payload[value] = this.defaults.clientId;\n break;\n case 'redirectUri':\n payload[value] = this.defaults.redirectUri;\n break;\n default:\n payload[value] = oauthData[key];\n }\n });\n\n if (oauthData.state) {\n payload.state = oauthData.state;\n }\n\n let exchangeForTokenUrl = this.SatellizerConfig.baseUrl ?\n joinUrl(this.SatellizerConfig.baseUrl, this.defaults.url) :\n this.defaults.url;\n\n return this.$http.post(exchangeForTokenUrl, payload, { withCredentials: this.SatellizerConfig.withCredentials });\n }\n\n buildQueryString(): string {\n const keyValuePairs = [];\n const urlParamsCategories = ['defaultUrlParams', 'requiredUrlParams', 'optionalUrlParams'];\n\n angular.forEach(urlParamsCategories, (paramsCategory) => {\n angular.forEach(this.defaults[paramsCategory], (paramName) => {\n const camelizedName = OAuth2.camelCase(paramName);\n let paramValue = angular.isFunction(this.defaults[paramName]) ? this.defaults[paramName]() : this.defaults[camelizedName];\n\n if (paramName === 'redirect_uri' && !paramValue) {\n return;\n }\n if (paramName === 'state') {\n const stateName = this.defaults.name + '_state';\n paramValue = encodeURIComponent(this.SatellizerStorage.get(stateName));\n }\n if (paramName === 'scope' && Array.isArray(paramValue)) {\n paramValue = paramValue.join(this.defaults.scopeDelimiter);\n if (this.defaults.scopePrefix) {\n paramValue = [this.defaults.scopePrefix, paramValue].join(this.defaults.scopeDelimiter);\n }\n }\n\n keyValuePairs.push([paramName, paramValue]);\n });\n });\n\n return keyValuePairs.map(pair => pair.join('=')).join('&');\n }\n}\n","import { joinUrl } from './utils';\nimport Config from './config';\nimport Popup from './popup';\nimport { IOAuth1Options } from './oauth1';\n\nexport interface IOAuth1 {\n init(options: any, data: any): angular.IPromise;\n getRequestToken(): angular.IHttpPromise;\n openPopup(options: IOAuth1Options, response: angular.IHttpPromiseCallbackArg): Promise;\n exchangeForToken(oauthData: any, userData: any): angular.IHttpPromise;\n buildQueryString(obj: any): string;\n}\n\nexport interface IOAuth1Options {\n name: string;\n url: string;\n authorizationEndpoint: string;\n redirectUri: string;\n scope: string[];\n scopePrefix: string;\n scopeDelimiter: string;\n requiredUrlParams: string[];\n defaultUrlParams: string[];\n oauthType: string;\n popupOptions: { width: number, height: number };\n}\n\nexport default class OAuth1 implements IOAuth1 {\n static $inject = ['$http', '$window', 'SatellizerConfig', 'SatellizerPopup'];\n \n private defaults: IOAuth1Options;\n\n constructor(private $http: angular.IHttpService,\n private $window: angular.IWindowService,\n private SatellizerConfig: Config,\n private SatellizerPopup: Popup) {\n this.defaults = {\n name: null,\n url: null,\n authorizationEndpoint: null,\n scope: null,\n scopePrefix: null,\n scopeDelimiter: null,\n redirectUri: null,\n requiredUrlParams: null,\n defaultUrlParams: null,\n oauthType: '1.0',\n popupOptions: { width: null, height: null }\n };\n };\n\n init(options: IOAuth1Options, userData: any): angular.IHttpPromise {\n Object.assign(this.defaults, options);\n\n if (!this.$window['cordova']) {\n this.SatellizerPopup.open('about:blank', options.name, options.popupOptions);\n }\n\n return this.getRequestToken().then((response) => {\n return this.openPopup(options, response).then((popupResponse) => {\n return this.exchangeForToken(popupResponse, userData);\n });\n });\n }\n\n openPopup(options: IOAuth1Options, response: angular.IHttpPromiseCallbackArg): Promise {\n const popupUrl = [options.authorizationEndpoint, this.buildQueryString(response.data)].join('?');\n\n if (this.$window['cordova']) {\n this.SatellizerPopup.open(popupUrl, options.name, options.popupOptions);\n return this.SatellizerPopup.eventListener(this.defaults.redirectUri);\n } else {\n this.SatellizerPopup.popup.location = popupUrl;\n return this.SatellizerPopup.polling(this.defaults.redirectUri);\n }\n }\n\n getRequestToken(): angular.IHttpPromise {\n const url = this.SatellizerConfig.baseUrl ? joinUrl(this.SatellizerConfig.baseUrl, this.defaults.url) : this.defaults.url;\n return this.$http.post(url, this.defaults);\n }\n\n exchangeForToken(oauthData, userData): angular.IHttpPromise {\n const payload = Object.assign({}, userData, oauthData);\n const exchangeForTokenUrl = this.SatellizerConfig.baseUrl ? joinUrl(this.SatellizerConfig.baseUrl, this.defaults.url) : this.defaults.url;\n return this.$http.post(exchangeForTokenUrl, payload, { withCredentials: this.SatellizerConfig.withCredentials });\n }\n\n buildQueryString(obj): string {\n const str = [];\n angular.forEach(obj, function (value, key) {\n str.push(encodeURIComponent(key) + '=' + encodeURIComponent(value));\n });\n return str.join('&');\n }\n}\n","import Config from './config';\n\nexport default class Storage {\n static $inject = ['$window', 'SatellizerConfig'];\n\n private memoryStore: any;\n private storageType: string;\n\n constructor(private $window: angular.IHttpService,\n private SatellizerConfig: Config) {\n this.memoryStore = {};\n this.storageType = SatellizerConfig.storageType;\n }\n\n get(key: string): string {\n try {\n return this.$window[this.storageType].getItem(key);\n } catch (e) {\n return this.memoryStore[key];\n }\n }\n\n set(key: string, value: string): void {\n try {\n this.$window[this.storageType].setItem(key, value);\n } catch (e) {\n this.memoryStore[key] = value;\n }\n }\n\n remove(key: string): void {\n try {\n this.$window[this.storageType].removeItem(key);\n } catch (e) {\n delete this.memoryStore[key];\n }\n }\n}\n","import Config from './config';\nimport Shared from './shared';\nimport Storage from './storage';\n\nexport default class Interceptor implements angular.IHttpInterceptor {\n\n static $inject = ['SatellizerConfig', 'SatellizerShared', 'SatellizerStorage'];\n\n static Factory(SatellizerConfig: Config, SatellizerShared: Shared, SatellizerStorage: Storage): Interceptor {\n return new Interceptor(SatellizerConfig, SatellizerShared, SatellizerStorage);\n }\n\n constructor(private SatellizerConfig: Config,\n private SatellizerShared: Shared,\n private SatellizerStorage: Storage) {\n }\n\n request = (config: angular.IRequestConfig): angular.IRequestConfig => {\n if (config['skipAuthorization']) {\n return config;\n }\n\n if (this.SatellizerShared.isAuthenticated() && this.SatellizerConfig.httpInterceptor()) {\n const tokenName = this.SatellizerConfig.tokenPrefix ?\n [this.SatellizerConfig.tokenPrefix, this.SatellizerConfig.tokenName].join('_') : this.SatellizerConfig.tokenName;\n let token = this.SatellizerStorage.get(tokenName);\n\n if (this.SatellizerConfig.tokenHeader && this.SatellizerConfig.tokenType) {\n token = this.SatellizerConfig.tokenType + ' ' + token;\n }\n\n config.headers[this.SatellizerConfig.tokenHeader] = token;\n }\n\n return config;\n };\n}\n","import Interceptor from './interceptor';\n\nexport default class HttpProviderConfig {\n static $inject = ['$httpProvider'];\n\n constructor(private $httpProvider: angular.IHttpProvider) {\n $httpProvider.interceptors.push(Interceptor.Factory);\n }\n}\n","import Config from './config';\nimport AuthProvider from './authProvider';\nimport Shared from './shared';\nimport Local from './local';\nimport Popup from './popup';\nimport OAuth from './oauth';\nimport OAuth2 from './oauth2';\nimport OAuth1 from './oauth1';\nimport Storage from './storage';\nimport Interceptor from './interceptor';\nimport HttpProviderConfig from './httpProviderConfig';\n\nangular.module('satellizer', [])\n .provider('$auth', ['SatellizerConfig', (SatellizerConfig) => new AuthProvider(SatellizerConfig)])\n .constant('SatellizerConfig', Config.getConstant)\n .service('SatellizerShared', Shared)\n .service('SatellizerLocal', Local)\n .service('SatellizerPopup', Popup)\n .service('SatellizerOAuth', OAuth)\n .service('SatellizerOAuth2', OAuth2)\n .service('SatellizerOAuth1', OAuth1)\n .service('SatellizerStorage', Storage)\n .service('SatellizerInterceptor', Interceptor)\n .config(($httpProvider) => new HttpProviderConfig($httpProvider));\n\nexport default 'satellizer';\n\n"],"names":[],"mappings":";;;;;;;;;;;;IAAe;QAAA;YAKb,YAAO,GAAG,GAAG,CAAC;YACd,aAAQ,GAAG,aAAa,CAAC;YACzB,cAAS,GAAG,cAAc,CAAC;YAC3B,cAAS,GAAG,eAAe,CAAC;YAC5B,cAAS,GAAG,OAAO,CAAC;YACpB,gBAAW,GAAG,YAAY,CAAC;YAC3B,gBAAW,GAAG,eAAe,CAAC;YAC9B,cAAS,GAAG,QAAQ,CAAC;YACrB,gBAAW,GAAG,cAAc,CAAC;YAC7B,cAAS,GAAG,IAAI,CAAC;YACjB,oBAAe,GAAG,KAAK,CAAC;YACxB,cAAS,GAAG;gBACV,QAAQ,EAAE;oBACR,IAAI,EAAE,UAAU;oBAChB,GAAG,EAAE,gBAAgB;oBACrB,qBAAqB,EAAE,4CAA4C;oBACnE,WAAW,EAAE,MAAM,CAAC,QAAQ,CAAC,MAAM,GAAG,GAAG;oBACzC,iBAAiB,EAAE,CAAC,SAAS,EAAE,OAAO,CAAC;oBACvC,KAAK,EAAE,CAAC,OAAO,CAAC;oBAChB,cAAc,EAAE,GAAG;o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C,YAAY,EAAE,EAAE,CAAC;SAC7B,QAAQ,CAAC,OAAO,EAAE,CAAC,kBAAkB,EAAE,UAAC,gBAAgB,IAAK,OAAA,IAAI,YAAY,CAAC,gBAAgB,CAAC,GAAA,CAAC,CAAC;SACjG,QAAQ,CAAC,kBAAkB,EAAE,MAAM,CAAC,WAAW,CAAC;SAChD,OAAO,CAAC,kBAAkB,EAAE,MAAM,CAAC;SACnC,OAAO,CAAC,iBAAiB,EAAE,KAAK,CAAC;SACjC,OAAO,CAAC,iBAAiB,EAAE,KAAK,CAAC;SACjC,OAAO,CAAC,iBAAiB,EAAE,KAAK,CAAC;SACjC,OAAO,CAAC,kBAAkB,EAAE,MAAM,CAAC;SACnC,OAAO,CAAC,kBAAkB,EAAE,MAAM,CAAC;SACnC,OAAO,CAAC,mBAAmB,EAAE,OAAO,CAAC;SACrC,OAAO,CAAC,uBAAuB,EAAE,WAAW,CAAC;SAC7C,MAAM,CAAC,UAAC,aAAa,IAAK,OAAA,IAAI,kBAAkB,CAAC,aAAa,CAAC,GAAA,CAAC,CAAC;AAEpE,cAAe,YAAY,CAAC;;;;"}
\ No newline at end of file
+{"version":3,"file":null,"sources":["../src/config.ts","../src/authProvider.ts","../src/utils.ts","../src/shared.ts","../src/local.ts","../src/popup.ts","../src/oauth.ts","../src/oauth2.ts","../src/oauth1.ts","../src/storage.ts","../src/interceptor.ts","../src/httpProviderConfig.ts","../src/ng1.ts"],"sourcesContent":["export default class Config {\n static get getConstant() {\n return new Config();\n }\n\n baseUrl = '/';\n loginUrl = '/auth/login';\n signupUrl = '/auth/signup';\n unlinkUrl = '/auth/unlink/';\n tokenName = 'token';\n tokenPrefix = 'satellizer';\n tokenHeader = 'Authorization';\n tokenType = 'Bearer';\n storageType = 'localStorage';\n tokenRoot = null;\n withCredentials = false;\n providers = {\n facebook: {\n name: 'facebook',\n url: '/auth/facebook',\n authorizationEndpoint: 'https://www.facebook.com/v2.5/dialog/oauth',\n redirectUri: window.location.origin + '/',\n requiredUrlParams: ['display', 'scope'],\n scope: ['email'],\n scopeDelimiter: ',',\n display: 'popup',\n oauthType: '2.0',\n popupOptions: { width: 580, height: 400 }\n },\n google: {\n name: 'google',\n url: '/auth/google',\n authorizationEndpoint: 'https://accounts.google.com/o/oauth2/auth',\n redirectUri: window.location.origin,\n requiredUrlParams: ['scope'],\n optionalUrlParams: ['display', 'state'],\n scope: ['profile', 'email'],\n scopePrefix: 'openid',\n scopeDelimiter: ' ',\n display: 'popup',\n oauthType: '2.0',\n popupOptions: { width: 452, height: 633 },\n state: () => encodeURIComponent(Math.random().toString(36).substr(2))\n },\n github: {\n name: 'github',\n url: '/auth/github',\n authorizationEndpoint: 'https://github.com/login/oauth/authorize',\n redirectUri: window.location.origin,\n optionalUrlParams: ['scope'],\n scope: ['user:email'],\n scopeDelimiter: ' ',\n oauthType: '2.0',\n popupOptions: { width: 1020, height: 618 }\n },\n instagram: {\n name: 'instagram',\n url: '/auth/instagram',\n authorizationEndpoint: 'https://api.instagram.com/oauth/authorize',\n redirectUri: window.location.origin,\n requiredUrlParams: ['scope'],\n scope: ['basic'],\n scopeDelimiter: '+',\n oauthType: '2.0'\n },\n linkedin: {\n name: 'linkedin',\n url: '/auth/linkedin',\n authorizationEndpoint: 'https://www.linkedin.com/uas/oauth2/authorization',\n redirectUri: window.location.origin,\n requiredUrlParams: ['state'],\n scope: ['r_emailaddress'],\n scopeDelimiter: ' ',\n state: 'STATE',\n oauthType: '2.0',\n popupOptions: { width: 527, height: 582 }\n },\n twitter: {\n name: 'twitter',\n url: '/auth/twitter',\n authorizationEndpoint: 'https://api.twitter.com/oauth/authenticate',\n redirectUri: window.location.origin,\n oauthType: '1.0',\n popupOptions: { width: 495, height: 645 }\n },\n twitch: {\n name: 'twitch',\n url: '/auth/twitch',\n authorizationEndpoint: 'https://api.twitch.tv/kraken/oauth2/authorize',\n redirectUri: window.location.origin,\n requiredUrlParams: ['scope'],\n scope: ['user_read'],\n scopeDelimiter: ' ',\n display: 'popup',\n oauthType: '2.0',\n popupOptions: { width: 500, height: 560 }\n },\n live: {\n name: 'live',\n url: '/auth/live',\n authorizationEndpoint: 'https://login.live.com/oauth20_authorize.srf',\n redirectUri: window.location.origin,\n requiredUrlParams: ['display', 'scope'],\n scope: ['wl.emails'],\n scopeDelimiter: ' ',\n display: 'popup',\n oauthType: '2.0',\n popupOptions: { width: 500, height: 560 }\n },\n yahoo: {\n name: 'yahoo',\n url: '/auth/yahoo',\n authorizationEndpoint: 'https://api.login.yahoo.com/oauth2/request_auth',\n redirectUri: window.location.origin,\n scope: [],\n scopeDelimiter: ',',\n oauthType: '2.0',\n popupOptions: { width: 559, height: 519 }\n },\n bitbucket: {\n name: 'bitbucket',\n url: '/auth/bitbucket',\n authorizationEndpoint: 'https://bitbucket.org/site/oauth2/authorize',\n redirectUri: window.location.origin + '/',\n requiredUrlParams: ['scope'],\n scope: ['email'],\n scopeDelimiter: ' ',\n oauthType: '2.0',\n popupOptions: { width: 1028, height: 529 }\n }\n };\n httpInterceptor: any = (): boolean => true;\n};\n","import Config from './config';\nimport { IOAuth1Options } from './oauth1';\nimport { IOAuth2Options } from './oauth2';\n\nexport default class AuthProvider {\n static $inject = ['SatellizerConfig'];\n\n constructor(private SatellizerConfig: Config) {}\n\n get baseUrl(): string { return this.SatellizerConfig.baseUrl; }\n set baseUrl(value) { this.SatellizerConfig.baseUrl = value; }\n\n get loginUrl(): string { return this.SatellizerConfig.loginUrl; }\n set loginUrl(value) { this.SatellizerConfig.loginUrl = value; }\n\n get signupUrl(): string { return this.SatellizerConfig.signupUrl; }\n set signupUrl(value) { this.SatellizerConfig.signupUrl = value; }\n\n get unlinkUrl(): string { return this.SatellizerConfig.unlinkUrl; }\n set unlinkUrl(value) { this.SatellizerConfig.unlinkUrl = value; }\n\n get tokenRoot(): string { return this.SatellizerConfig.tokenRoot; }\n set tokenRoot(value) { this.SatellizerConfig.tokenRoot = value; }\n\n get tokenName(): string { return this.SatellizerConfig.tokenName; }\n set tokenName(value) { this.SatellizerConfig.tokenName = value; }\n\n get tokenPrefix(): string { return this.SatellizerConfig.tokenPrefix; }\n set tokenPrefix(value) { this.SatellizerConfig.tokenPrefix = value; }\n\n get tokenHeader(): string { return this.SatellizerConfig.tokenHeader; }\n set tokenHeader(value) { this.SatellizerConfig.tokenHeader = value; }\n\n get tokenType(): string { return this.SatellizerConfig.tokenType; }\n set tokenType(value) { this.SatellizerConfig.tokenType = value; }\n\n get withCredentials(): boolean { return this.SatellizerConfig.withCredentials; }\n set withCredentials(value) { this.SatellizerConfig.withCredentials = value; }\n\n get storageType(): string { return this.SatellizerConfig.storageType; }\n set storageType(value) { this.SatellizerConfig.storageType = value; }\n\n get httpInterceptor(): boolean { return this.SatellizerConfig.httpInterceptor; }\n set httpInterceptor(value) {\n if (typeof value === 'function') {\n this.SatellizerConfig.httpInterceptor = value;\n } else {\n this.SatellizerConfig.httpInterceptor = () => value;\n }\n }\n\n facebook(options: IOAuth2Options): void {\n angular.extend(this.SatellizerConfig.providers.facebook, options);\n }\n\n google(options: IOAuth2Options): void {\n angular.extend(this.SatellizerConfig.providers.google, options);\n }\n\n github(options: IOAuth2Options): void {\n angular.extend(this.SatellizerConfig.providers.github, options);\n }\n\n instagram(options: IOAuth2Options): void {\n angular.extend(this.SatellizerConfig.providers.instagram, options);\n }\n\n linkedin(options: IOAuth2Options): void {\n angular.extend(this.SatellizerConfig.providers.linkedin, options);\n }\n\n twitter(options: IOAuth1Options): void {\n angular.extend(this.SatellizerConfig.providers.twitter, options);\n }\n\n twitch(options: IOAuth2Options): void {\n angular.extend(this.SatellizerConfig.providers.twitch, options);\n }\n\n live(options: IOAuth2Options): void {\n angular.extend(this.SatellizerConfig.providers.live, options);\n }\n\n yahoo(options: IOAuth2Options): void {\n angular.extend(this.SatellizerConfig.providers.yahoo, options);\n }\n\n bitbucket(options: IOAuth2Options): void {\n angular.extend(this.SatellizerConfig.providers.bitbucket, options);\n }\n\n oauth1(options: IOAuth1Options): void {\n this.SatellizerConfig.providers[options.name] = angular.extend(options, {\n oauthType: '1.0'\n });\n }\n\n oauth2(options: IOAuth2Options): void {\n this.SatellizerConfig.providers[options.name] = angular.extend(options, {\n oauthType: '2.0'\n });\n }\n\n $get(SatellizerShared, SatellizerLocal, SatellizerOAuth): any {\n return {\n login: (user, options) => SatellizerLocal.login(user, options),\n signup: (user, options) => SatellizerLocal.signup(user, options),\n logout: () => SatellizerShared.logout(),\n authenticate: (name, data) => SatellizerOAuth.authenticate(name, data),\n link: (name, data) => SatellizerOAuth.authenticate(name, data),\n unlink: (name, options) => SatellizerOAuth.unlink(name, options),\n isAuthenticated: () => SatellizerShared.isAuthenticated(),\n getPayload: () => SatellizerShared.getPayload(),\n getToken: () => SatellizerShared.getToken(),\n setToken: (token) => SatellizerShared.setToken({ access_token: token }),\n removeToken: () => SatellizerShared.removeToken(),\n setStorageType: (type) => SatellizerShared.setStorageType(type)\n };\n }\n}\n","export function joinUrl (baseUrl, url) {\n if (/^(?:[a-z]+:)?\\/\\//i.test(url)) {\n return url;\n }\n let joined = [baseUrl, url].join('/');\n let normalize = function (str) {\n return str\n .replace(/[\\/]+/g, '/')\n .replace(/\\/\\?/g, '?')\n .replace(/\\/\\#/g, '#')\n .replace(/\\:\\//g, '://');\n };\n return normalize(joined);\n}\n\nexport function getFullUrlPath (location) {\n const isHttps = location.protocol === 'https:';\n return location.protocol + '//' + location.hostname +\n ':' + (location.port || (isHttps ? '443' : '80')) +\n (/^\\//.test(location.pathname) ? location.pathname : '/' + location.pathname);\n}\n\nexport function parseQueryString (str) {\n let obj = {};\n let key;\n let value;\n angular.forEach((str || '').split('&'), (keyValue) => {\n if (keyValue) {\n value = keyValue.split('=');\n key = decodeURIComponent(value[0]);\n obj[key] = angular.isDefined(value[1]) ? decodeURIComponent(value[1]) : true;\n }\n });\n return obj;\n}\n\nexport function decodeBase64 (str) {\n let buffer;\n if (typeof module !== 'undefined' && module.exports) {\n try {\n buffer = require('buffer').Buffer;\n } catch (err) {\n // noop\n }\n }\n\n let fromCharCode = String.fromCharCode;\n\n let re_btou = new RegExp([\n '[\\xC0-\\xDF][\\x80-\\xBF]',\n '[\\xE0-\\xEF][\\x80-\\xBF]{2}',\n '[\\xF0-\\xF7][\\x80-\\xBF]{3}'\n ].join('|'), 'g');\n\n let cb_btou = function (cccc) {\n switch (cccc.length) {\n case 4:\n let cp = ((0x07 & cccc.charCodeAt(0)) << 18)\n | ((0x3f & cccc.charCodeAt(1)) << 12)\n | ((0x3f & cccc.charCodeAt(2)) << 6)\n | (0x3f & cccc.charCodeAt(3));\n let offset = cp - 0x10000;\n return (fromCharCode((offset >>> 10) + 0xD800)\n + fromCharCode((offset & 0x3FF) + 0xDC00));\n case 3:\n return fromCharCode(\n ((0x0f & cccc.charCodeAt(0)) << 12)\n | ((0x3f & cccc.charCodeAt(1)) << 6)\n | (0x3f & cccc.charCodeAt(2))\n );\n default:\n return fromCharCode(\n ((0x1f & cccc.charCodeAt(0)) << 6)\n | (0x3f & cccc.charCodeAt(1))\n );\n }\n };\n\n let btou = function (b) {\n return b.replace(re_btou, cb_btou);\n };\n\n let _decode = buffer ? function (a) {\n return (a.constructor === buffer.constructor\n ? a : new buffer(a, 'base64')).toString();\n }\n : function (a) {\n return btou(atob(a));\n };\n\n return _decode(\n String(str).replace(/[-_]/g, function (m0) {\n return m0 === '-' ? '+' : '/';\n })\n .replace(/[^A-Za-z0-9\\+\\/]/g, '')\n );\n}\n","import Config from './config';\nimport Storage from './storage';\nimport { decodeBase64 } from './utils';\n\nclass Shared {\n static $inject = ['$q', '$window', '$log', 'SatellizerConfig', 'SatellizerStorage'];\n \n private prefixedTokenName: string;\n\n constructor(private $q: angular.IQService,\n private $window: angular.IWindowService,\n private $log: angular.ILogService,\n private SatellizerConfig: Config,\n private SatellizerStorage: Storage) {\n const { tokenName, tokenPrefix } = this.SatellizerConfig;\n this.prefixedTokenName = tokenPrefix ? [tokenPrefix, tokenName].join('_') : tokenName;\n }\n\n getToken(): string {\n return this.SatellizerStorage.get(this.prefixedTokenName);\n }\n\n getPayload(): any {\n const token = this.SatellizerStorage.get(this.prefixedTokenName);\n\n if (token && token.split('.').length === 3) {\n try {\n const base64Url = token.split('.')[1];\n const base64 = base64Url.replace('-', '+').replace('_', '/');\n return JSON.parse(decodeBase64(base64));\n } catch (e) {\n // no-op\n }\n }\n }\n\n setToken(response): void {\n if (!response) {\n return this.$log.warn('Can\\'t set token without passing a value');\n }\n\n let token;\n const accessToken = response && response.access_token;\n\n if (accessToken) {\n if (angular.isObject(accessToken) && angular.isObject(accessToken.data)) {\n response = accessToken;\n } else if (angular.isString(accessToken)) {\n token = accessToken;\n }\n }\n\n if (!token && response) {\n const tokenRootData = this.SatellizerConfig.tokenRoot && this.SatellizerConfig.tokenRoot.split('.').reduce(function(o, x) { return o[x]; }, response.data);\n token = tokenRootData ? tokenRootData[this.SatellizerConfig.tokenName] : response.data && response.data[this.SatellizerConfig.tokenName];\n }\n\n if (!token) {\n const tokenPath = this.SatellizerConfig.tokenRoot ? this.SatellizerConfig.tokenRoot + '.' + this.SatellizerConfig.tokenName : this.SatellizerConfig.tokenName;\n return this.$log.warn('Expecting a token named \"' + tokenPath);\n }\n\n this.SatellizerStorage.set(this.prefixedTokenName, token);\n }\n\n removeToken(): void {\n this.SatellizerStorage.remove(this.prefixedTokenName);\n }\n\n isAuthenticated(): boolean {\n const token = this.SatellizerStorage.get(this.prefixedTokenName);\n\n if (token) { // Token is present\n if (token.split('.').length === 3) { // Token with a valid JWT format XXX.YYY.ZZZ\n try { // Could be a valid JWT or an access token with the same format\n const base64Url = token.split('.')[1];\n const base64 = base64Url.replace('-', '+').replace('_', '/');\n const exp = JSON.parse(this.$window.atob(base64)).exp;\n if (exp) { // JWT with an optonal expiration claims\n return (Math.round(new Date().getTime() / 1000) >= exp) ? false : true;\n }\n } catch (e) {\n return true; // Pass: Non-JWT token that looks like JWT\n }\n }\n return true; // Pass: All other tokens\n }\n return false; // Fail: No token at all\n }\n\n logout(): angular.IPromise {\n this.SatellizerStorage.remove(this.prefixedTokenName);\n return this.$q.when();\n }\n\n setStorageType(type): void {\n this.SatellizerConfig.storageType = type;\n }\n}\n\nexport default Shared;\n","import { joinUrl } from './utils';\nimport Config from './config';\nimport Shared from './shared';\n\nclass Local {\n static $inject = ['$http', 'SatellizerConfig', 'SatellizerShared'];\n\n\n constructor(private $http: angular.IHttpService,\n private SatellizerConfig: Config,\n private SatellizerShared: Shared) {}\n\n login(user: string|Object, options: any = {}): angular.IHttpPromise {\n options.url = options.url ? options.url : joinUrl(this.SatellizerConfig.baseUrl, this.SatellizerConfig.loginUrl);\n options.data = user || options.data;\n options.method = options.method || 'POST';\n options.withCredentials = options.withCredentials || this.SatellizerConfig.withCredentials;\n\n return this.$http(options).then((response) => {\n this.SatellizerShared.setToken(response);\n return response;\n });\n }\n\n signup(user: string|Object, options: any = {}): angular.IHttpPromise {\n options.url = options.url ? options.url : joinUrl(this.SatellizerConfig.baseUrl, this.SatellizerConfig.signupUrl);\n options.data = user || options.data;\n options.method = options.method || 'POST';\n options.withCredentials = options.withCredentials || this.SatellizerConfig.withCredentials;\n\n return this.$http(options);\n }\n}\n\nexport default Local;\n","import { parseQueryString, getFullUrlPath } from './utils';\n\nexport interface IPopup {\n open(url: string, name: string, popupOptions: { width: number, height: number }): void;\n stringifyOptions (options: any): string;\n polling(redirectUri: string): Promise;\n eventListener(redirectUri: string): Promise;\n}\n\nexport default class Popup implements IPopup {\n static $inject = ['$interval', '$window'];\n\n public popup: any;\n private url: string;\n private defaults: { redirectUri: string };\n \n constructor(private $interval: angular.IIntervalService,\n private $window: angular.IWindowService) {\n this.popup = null;\n this.url = 'about:blank'; // TODO remove\n this.defaults = {\n redirectUri: null\n };\n }\n\n stringifyOptions (options: any): string {\n const parts = [];\n angular.forEach(options, function (value, key) {\n parts.push(key + '=' + value);\n });\n return parts.join(',');\n }\n\n open(url: string, name: string, popupOptions: { width: number, height: number }): void {\n this.url = url; // TODO remove\n\n const width = popupOptions.width || 500;\n const height = popupOptions.height || 500;\n\n const options = this.stringifyOptions({\n width: width,\n height: height,\n top: this.$window.screenY + ((this.$window.outerHeight - height) / 2.5),\n left: this.$window.screenX + ((this.$window.outerWidth - width) / 2)\n });\n\n const popupName = this.$window['cordova'] || this.$window.navigator.userAgent.indexOf('CriOS') > -1 ? '_blank' : name;\n\n this.popup = window.open(this.url, popupName, options);\n\n if (this.popup && this.popup.focus) {\n this.popup.focus();\n }\n //\n // if (this.$window['cordova']) {\n // return this.eventListener(this.defaults.redirectUri); // TODO pass redirect uri\n // } else {\n // return this.polling(redirectUri);\n // }\n }\n\n polling(redirectUri: string): Promise {\n return new Promise((resolve, reject) => {\n const redirectUriParser = document.createElement('a');\n redirectUriParser.href = redirectUri;\n const redirectUriPath = getFullUrlPath(redirectUriParser);\n\n const polling = this.$interval(() => {\n if (!this.popup || this.popup.closed || this.popup.closed === undefined) {\n this.$interval.cancel(polling);\n reject(new Error('The popup window was closed'));\n }\n\n try {\n const popupWindowPath = getFullUrlPath(this.popup.location);\n\n if (popupWindowPath === redirectUriPath) {\n if (this.popup.location.search || this.popup.location.hash) {\n const query = parseQueryString(this.popup.location.search.substring(1).replace(/\\/$/, ''));\n const hash = parseQueryString(this.popup.location.hash.substring(1).replace(/[\\/$]/, ''));\n const params = Object.assign({}, query, hash);\n\n if (params.error) {\n reject(new Error(params.error));\n } else {\n resolve(params);\n }\n } else {\n reject(new Error(\n 'OAuth redirect has occurred but no query or hash parameters were found. ' +\n 'They were either not set during the redirect, or were removed—typically by a ' +\n 'routing library—before Satellizer could read it.'\n ));\n }\n\n this.$interval.cancel(polling);\n this.popup.close();\n }\n } catch (error) {\n // Ignore DOMException: Blocked a frame with origin from accessing a cross-origin frame.\n // A hack to get around same-origin security policy errors in IE.\n }\n }, 500);\n });\n }\n\n eventListener(redirectUri): Promise {\n return new Promise((resolve, reject) => {\n this.popup.addEventListener('loadstart', (event) => {\n if (!event.url.includes(redirectUri)) {\n return;\n }\n\n const parser = document.createElement('a');\n parser.href = event.url;\n\n if (parser.search || parser.hash) {\n const query = parseQueryString(parser.search.substring(1).replace(/\\/$/, ''));\n const hash = parseQueryString(parser.hash.substring(1).replace(/[\\/$]/, ''));\n const params = Object.assign({}, query, hash);\n\n if (params.error) {\n reject(new Error(params.error));\n } else {\n resolve(params);\n }\n\n this.popup.close();\n }\n });\n\n this.popup.addEventListener('loaderror', () => {\n reject(new Error('Authorization failed'));\n });\n\n this.popup.addEventListener('exit', () => {\n reject(new Error('The popup window was closed'));\n });\n });\n }\n}\n","import { joinUrl } from './utils';\nimport Config from './config';\nimport Shared from './shared';\nimport OAuth1 from './oauth1';\nimport OAuth2 from './oauth2';\n\nexport default class OAuth {\n static $inject = ['$http', 'SatellizerConfig', 'SatellizerShared', 'SatellizerOAuth1', 'SatellizerOAuth2'];\n \n constructor(private $http: angular.IHttpService,\n private SatellizerConfig: Config,\n private SatellizerShared: Shared,\n private SatellizerOAuth1: OAuth1,\n private SatellizerOAuth2: OAuth2) {\n }\n\n authenticate(name: string, userData: any): Promise {\n return new Promise((resolve, reject) => {\n const provider = this.SatellizerConfig.providers[name];\n const initialize: any = provider.oauthType === '1.0' ? this.SatellizerOAuth1.init(provider, userData) : this.SatellizerOAuth2.init(provider, userData);\n\n return initialize.then((response) => {\n if (provider.url) {\n this.SatellizerShared.setToken(response);\n }\n resolve(response);\n }).catch((error) => {\n reject(error);\n });\n });\n }\n\n unlink(provider: string, httpOptions: any = {}): angular.IHttpPromise {\n httpOptions.url = httpOptions.url ? httpOptions.url : joinUrl(this.SatellizerConfig.baseUrl, this.SatellizerConfig.unlinkUrl);\n httpOptions.data = { provider: provider } || httpOptions.data;\n httpOptions.method = httpOptions.method || 'POST';\n httpOptions.withCredentials = httpOptions.withCredentials || this.SatellizerConfig.withCredentials;\n\n return this.$http(httpOptions);\n }\n}\n","import { joinUrl } from './utils';\nimport Config from './config';\nimport Popup from './popup';\nimport Storage from './storage';\n\nexport interface IOAuth2Options {\n name: string;\n url: string;\n clientId: string;\n authorizationEndpoint: string;\n redirectUri: string;\n scope: string[];\n scopePrefix: string;\n scopeDelimiter: string;\n state?: string|(() => string);\n requiredUrlParams: string[];\n defaultUrlParams: string[];\n responseType: string;\n responseParams: {\n code: string,\n clientId: string,\n redirectUri: string\n };\n oauthType: string;\n popupOptions: { width: number, height: number };\n}\n\nexport default class OAuth2 {\n static $inject = ['$http', '$window', '$timeout', 'SatellizerConfig', 'SatellizerPopup', 'SatellizerStorage'];\n\n static camelCase(name): string {\n return name.replace(/([\\:\\-\\_]+(.))/g, (_, separator, letter, offset) => {\n return offset ? letter.toUpperCase() : letter;\n });\n }\n\n public defaults: IOAuth2Options;\n\n constructor(private $http: angular.IHttpService,\n private $window: angular.IWindowService,\n private $timeout: angular.ITimeoutService,\n private SatellizerConfig: Config,\n private SatellizerPopup: Popup,\n private SatellizerStorage: Storage) {\n this.defaults = {\n name: null,\n url: null,\n clientId: null,\n authorizationEndpoint: null,\n redirectUri: null,\n scope: null,\n scopePrefix: null,\n scopeDelimiter: null,\n state: null,\n requiredUrlParams: null,\n defaultUrlParams: ['response_type', 'client_id', 'redirect_uri'],\n responseType: 'code',\n responseParams: {\n code: 'code',\n clientId: 'clientId',\n redirectUri: 'redirectUri'\n },\n oauthType: '2.0',\n popupOptions: { width: null, height: null }\n };\n }\n\n init(options: IOAuth2Options, userData: any): Promise {\n return new Promise((resolve, reject) => {\n Object.assign(this.defaults, options);\n\n this.$timeout(() => {\n const stateName = this.defaults.name + '_state';\n const { name, state, popupOptions, redirectUri, responseType } = this.defaults;\n\n if (typeof state === 'function') {\n this.SatellizerStorage.set(stateName, state());\n } else if (typeof state === 'string') {\n this.SatellizerStorage.set(stateName, state);\n }\n const url = [this.defaults.authorizationEndpoint, this.buildQueryString()].join('?');\n\n this.SatellizerPopup.open(url, name, popupOptions);\n\n this.SatellizerPopup.polling(redirectUri).then((oauth: any): void|Promise|angular.IHttpPromise => {\n\n if (responseType === 'token' || !url) {\n return resolve(oauth);\n }\n\n if (oauth.state && oauth.state !== this.SatellizerStorage.get(stateName)) {\n return reject(new Error(\n 'The value returned in the state parameter does not match the state value from your original ' +\n 'authorization code request.'\n ));\n }\n\n resolve(this.exchangeForToken(oauth, userData));\n })\n .catch(error => reject(error));\n });\n });\n }\n\n exchangeForToken(oauthData: { code?, state? }, userData: any): angular.IHttpPromise {\n const payload = Object.assign({}, userData);\n\n angular.forEach(this.defaults.responseParams, (value, key) => {\n switch (key) {\n case 'code':\n payload[value] = oauthData.code;\n break;\n case 'clientId':\n payload[value] = this.defaults.clientId;\n break;\n case 'redirectUri':\n payload[value] = this.defaults.redirectUri;\n break;\n default:\n payload[value] = oauthData[key];\n }\n });\n\n if (oauthData.state) {\n payload.state = oauthData.state;\n }\n\n let exchangeForTokenUrl = this.SatellizerConfig.baseUrl ?\n joinUrl(this.SatellizerConfig.baseUrl, this.defaults.url) :\n this.defaults.url;\n\n return this.$http.post(exchangeForTokenUrl, payload, { withCredentials: this.SatellizerConfig.withCredentials });\n }\n\n buildQueryString(): string {\n const keyValuePairs = [];\n const urlParamsCategories = ['defaultUrlParams', 'requiredUrlParams', 'optionalUrlParams'];\n\n angular.forEach(urlParamsCategories, (paramsCategory) => {\n angular.forEach(this.defaults[paramsCategory], (paramName) => {\n const camelizedName = OAuth2.camelCase(paramName);\n let paramValue = angular.isFunction(this.defaults[paramName]) ? this.defaults[paramName]() : this.defaults[camelizedName];\n\n if (paramName === 'redirect_uri' && !paramValue) {\n return;\n }\n if (paramName === 'state') {\n const stateName = this.defaults.name + '_state';\n paramValue = encodeURIComponent(this.SatellizerStorage.get(stateName));\n }\n if (paramName === 'scope' && Array.isArray(paramValue)) {\n paramValue = paramValue.join(this.defaults.scopeDelimiter);\n if (this.defaults.scopePrefix) {\n paramValue = [this.defaults.scopePrefix, paramValue].join(this.defaults.scopeDelimiter);\n }\n }\n\n keyValuePairs.push([paramName, paramValue]);\n });\n });\n\n return keyValuePairs.map(pair => pair.join('=')).join('&');\n }\n}\n","import { joinUrl } from './utils';\nimport Config from './config';\nimport Popup from './popup';\nimport { IOAuth1Options } from './oauth1';\n\nexport interface IOAuth1 {\n init(options: any, data: any): angular.IPromise;\n getRequestToken(): angular.IHttpPromise;\n openPopup(options: IOAuth1Options, response: angular.IHttpPromiseCallbackArg): Promise;\n exchangeForToken(oauthData: any, userData: any): angular.IHttpPromise;\n buildQueryString(obj: any): string;\n}\n\nexport interface IOAuth1Options {\n name: string;\n url: string;\n authorizationEndpoint: string;\n redirectUri: string;\n scope: string[];\n scopePrefix: string;\n scopeDelimiter: string;\n requiredUrlParams: string[];\n defaultUrlParams: string[];\n oauthType: string;\n popupOptions: { width: number, height: number };\n}\n\nexport default class OAuth1 implements IOAuth1 {\n static $inject = ['$http', '$window', 'SatellizerConfig', 'SatellizerPopup'];\n \n private defaults: IOAuth1Options;\n\n constructor(private $http: angular.IHttpService,\n private $window: angular.IWindowService,\n private SatellizerConfig: Config,\n private SatellizerPopup: Popup) {\n this.defaults = {\n name: null,\n url: null,\n authorizationEndpoint: null,\n scope: null,\n scopePrefix: null,\n scopeDelimiter: null,\n redirectUri: null,\n requiredUrlParams: null,\n defaultUrlParams: null,\n oauthType: '1.0',\n popupOptions: { width: null, height: null }\n };\n };\n\n init(options: IOAuth1Options, userData: any): angular.IHttpPromise {\n Object.assign(this.defaults, options);\n\n if (!this.$window['cordova']) {\n this.SatellizerPopup.open('about:blank', options.name, options.popupOptions);\n }\n\n return this.getRequestToken().then((response) => {\n return this.openPopup(options, response).then((popupResponse) => {\n return this.exchangeForToken(popupResponse, userData);\n });\n });\n }\n\n openPopup(options: IOAuth1Options, response: angular.IHttpPromiseCallbackArg): Promise {\n const popupUrl = [options.authorizationEndpoint, this.buildQueryString(response.data)].join('?');\n\n if (this.$window['cordova']) {\n this.SatellizerPopup.open(popupUrl, options.name, options.popupOptions);\n return this.SatellizerPopup.eventListener(this.defaults.redirectUri);\n } else {\n this.SatellizerPopup.popup.location = popupUrl;\n return this.SatellizerPopup.polling(this.defaults.redirectUri);\n }\n }\n\n getRequestToken(): angular.IHttpPromise {\n const url = this.SatellizerConfig.baseUrl ? joinUrl(this.SatellizerConfig.baseUrl, this.defaults.url) : this.defaults.url;\n return this.$http.post(url, this.defaults);\n }\n\n exchangeForToken(oauthData, userData): angular.IHttpPromise {\n const payload = Object.assign({}, userData, oauthData);\n const exchangeForTokenUrl = this.SatellizerConfig.baseUrl ? joinUrl(this.SatellizerConfig.baseUrl, this.defaults.url) : this.defaults.url;\n return this.$http.post(exchangeForTokenUrl, payload, { withCredentials: this.SatellizerConfig.withCredentials });\n }\n\n buildQueryString(obj): string {\n const str = [];\n angular.forEach(obj, function (value, key) {\n str.push(encodeURIComponent(key) + '=' + encodeURIComponent(value));\n });\n return str.join('&');\n }\n}\n","import Config from './config';\n\nexport default class Storage {\n static $inject = ['$window', 'SatellizerConfig'];\n\n private memoryStore: any;\n private storageType: string;\n\n constructor(private $window: angular.IHttpService,\n private SatellizerConfig: Config) {\n this.memoryStore = {};\n }\n\n get(key: string): string {\n try {\n return this.$window[this.SatellizerConfig.storageType].getItem(key);\n } catch (e) {\n return this.memoryStore[key];\n }\n }\n\n set(key: string, value: string): void {\n try {\n this.$window[this.SatellizerConfig.storageType].setItem(key, value);\n } catch (e) {\n this.memoryStore[key] = value;\n }\n }\n\n remove(key: string): void {\n try {\n this.$window[this.SatellizerConfig.storageType].removeItem(key);\n } catch (e) {\n delete this.memoryStore[key];\n }\n }\n}\n","import Config from './config';\nimport Shared from './shared';\nimport Storage from './storage';\n\nexport default class Interceptor implements angular.IHttpInterceptor {\n\n static $inject = ['SatellizerConfig', 'SatellizerShared', 'SatellizerStorage'];\n\n static Factory(SatellizerConfig: Config, SatellizerShared: Shared, SatellizerStorage: Storage): Interceptor {\n return new Interceptor(SatellizerConfig, SatellizerShared, SatellizerStorage);\n }\n\n constructor(private SatellizerConfig: Config,\n private SatellizerShared: Shared,\n private SatellizerStorage: Storage) {\n }\n\n request = (config: angular.IRequestConfig): angular.IRequestConfig => {\n if (config['skipAuthorization']) {\n return config;\n }\n\n if (this.SatellizerShared.isAuthenticated() && this.SatellizerConfig.httpInterceptor()) {\n const tokenName = this.SatellizerConfig.tokenPrefix ?\n [this.SatellizerConfig.tokenPrefix, this.SatellizerConfig.tokenName].join('_') : this.SatellizerConfig.tokenName;\n let token = this.SatellizerStorage.get(tokenName);\n\n if (this.SatellizerConfig.tokenHeader && this.SatellizerConfig.tokenType) {\n token = this.SatellizerConfig.tokenType + ' ' + token;\n }\n\n config.headers[this.SatellizerConfig.tokenHeader] = token;\n }\n\n return config;\n };\n}\n","import Interceptor from './interceptor';\n\nexport default class HttpProviderConfig {\n static $inject = ['$httpProvider'];\n\n constructor(private $httpProvider: angular.IHttpProvider) {\n $httpProvider.interceptors.push(Interceptor.Factory);\n }\n}\n","import Config from './config';\nimport AuthProvider from './authProvider';\nimport Shared from './shared';\nimport Local from './local';\nimport Popup from './popup';\nimport OAuth from './oauth';\nimport OAuth2 from './oauth2';\nimport OAuth1 from './oauth1';\nimport Storage from './storage';\nimport Interceptor from './interceptor';\nimport HttpProviderConfig from './httpProviderConfig';\n\nangular.module('satellizer', [])\n .provider('$auth', ['SatellizerConfig', (SatellizerConfig) => new AuthProvider(SatellizerConfig)])\n .constant('SatellizerConfig', Config.getConstant)\n .service('SatellizerShared', Shared)\n .service('SatellizerLocal', Local)\n .service('SatellizerPopup', Popup)\n .service('SatellizerOAuth', OAuth)\n .service('SatellizerOAuth2', OAuth2)\n .service('SatellizerOAuth1', OAuth1)\n .service('SatellizerStorage', Storage)\n .service('SatellizerInterceptor', Interceptor)\n .config(($httpProvider) => new HttpProviderConfig($httpProvider));\n\nexport default 'satellizer';\n\n"],"names":[],"mappings":";;;;;;;;;;;;IAAe;QAAA;YAKb,YAAO,GAAG,GAAG,CAAC;YACd,aAAQ,GAAG,aAAa,CAAC;YACzB,cAAS,GAAG,cAAc,CAAC;YAC3B,cAAS,GAAG,eAAe,CAAC;YAC5B,cAAS,GAAG,OAAO,CAAC;YACpB,gBAAW,GAAG,YA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.js
+++ b/dist/satellizer.min.js
@@ -1 +1 @@
-(function(global,factory){typeof exports==="object"&&typeof module!=="undefined"?module.exports=factory():typeof define==="function"&&define.amd?define(factory):global.satellizer=factory()})(this,function(){"use strict";var Config=function(){function Config(){this.baseUrl="/";this.loginUrl="/auth/login";this.signupUrl="/auth/signup";this.unlinkUrl="/auth/unlink/";this.tokenName="token";this.tokenPrefix="satellizer";this.tokenHeader="Authorization";this.tokenType="Bearer";this.storageType="localStorage";this.tokenRoot=null;this.withCredentials=false;this.providers={facebook:{name:"facebook",url:"/auth/facebook",authorizationEndpoint:"https://www.facebook.com/v2.5/dialog/oauth",redirectUri:window.location.origin+"/",requiredUrlParams:["display","scope"],scope:["email"],scopeDelimiter:",",display:"popup",oauthType:"2.0",popupOptions:{width:580,height:400}},google:{name:"google",url:"/auth/google",authorizationEndpoint:"https://accounts.google.com/o/oauth2/auth",redirectUri:window.location.origin,requiredUrlParams:["scope"],optionalUrlParams:["display","state"],scope:["profile","email"],scopePrefix:"openid",scopeDelimiter:" ",display:"popup",oauthType:"2.0",popupOptions:{width:452,height:633},state:function(){encodeURIComponent(Math.random().toString(36).substr(2))}},github:{name:"github",url:"/auth/github",authorizationEndpoint:"https://github.com/login/oauth/authorize",redirectUri:window.location.origin,optionalUrlParams:["scope"],scope:["user:email"],scopeDelimiter:" ",oauthType:"2.0",popupOptions:{width:1020,height:618}},instagram:{name:"instagram",url:"/auth/instagram",authorizationEndpoint:"https://api.instagram.com/oauth/authorize",redirectUri:window.location.origin,requiredUrlParams:["scope"],scope:["basic"],scopeDelimiter:"+",oauthType:"2.0"},linkedin:{name:"linkedin",url:"/auth/linkedin",authorizationEndpoint:"https://www.linkedin.com/uas/oauth2/authorization",redirectUri:window.location.origin,requiredUrlParams:["state"],scope:["r_emailaddress"],scopeDelimiter:" ",state:"STATE",oauthType:"2.0",popupOptions:{width:527,height:582}},twitter:{name:"twitter",url:"/auth/twitter",authorizationEndpoint:"https://api.twitter.com/oauth/authenticate",redirectUri:window.location.origin,oauthType:"1.0",popupOptions:{width:495,height:645}},twitch:{name:"twitch",url:"/auth/twitch",authorizationEndpoint:"https://api.twitch.tv/kraken/oauth2/authorize",redirectUri:window.location.origin,requiredUrlParams:["scope"],scope:["user_read"],scopeDelimiter:" ",display:"popup",oauthType:"2.0",popupOptions:{width:500,height:560}},live:{name:"live",url:"/auth/live",authorizationEndpoint:"https://login.live.com/oauth20_authorize.srf",redirectUri:window.location.origin,requiredUrlParams:["display","scope"],scope:["wl.emails"],scopeDelimiter:" ",display:"popup",oauthType:"2.0",popupOptions:{width:500,height:560}},yahoo:{name:"yahoo",url:"/auth/yahoo",authorizationEndpoint:"https://api.login.yahoo.com/oauth2/request_auth",redirectUri:window.location.origin,scope:[],scopeDelimiter:",",oauthType:"2.0",popupOptions:{width:559,height:519}},bitbucket:{name:"bitbucket",url:"/auth/bitbucket",authorizationEndpoint:"https://bitbucket.org/site/oauth2/authorize",redirectUri:window.location.origin+"/",requiredUrlParams:["scope"],scope:["email"],scopeDelimiter:" ",oauthType:"2.0",popupOptions:{width:1028,height:529}}};this.httpInterceptor=function(){return true}}Object.defineProperty(Config,"getConstant",{get:function(){return new Config},enumerable:true,configurable:true});return Config}();var AuthProvider=function(){function AuthProvider(SatellizerConfig){this.SatellizerConfig=SatellizerConfig}Object.defineProperty(AuthProvider.prototype,"baseUrl",{get:function(){return this.SatellizerConfig.baseUrl},set:function(value){this.SatellizerConfig.baseUrl=value},enumerable:true,configurable:true});Object.defineProperty(AuthProvider.prototype,"loginUrl",{get:function(){return this.SatellizerConfig.loginUrl},set:function(value){this.SatellizerConfig.loginUrl=value},enumerable:true,configurable:true});Object.defineProperty(AuthProvider.prototype,"signupUrl",{get:function(){return this.SatellizerConfig.signupUrl},set:function(value){this.SatellizerConfig.signupUrl=value},enumerable:true,configurable:true});Object.defineProperty(AuthProvider.prototype,"unlinkUrl",{get:function(){return this.SatellizerConfig.unlinkUrl},set:function(value){this.SatellizerConfig.unlinkUrl=value},enumerable:true,configurable:true});Object.defineProperty(AuthProvider.prototype,"tokenRoot",{get:function(){return this.SatellizerConfig.tokenRoot},set:function(value){this.SatellizerConfig.tokenRoot=value},enumerable:true,configurable:true});Object.defineProperty(AuthProvider.prototype,"tokenName",{get:function(){return this.SatellizerConfig.tokenName},set:function(value){this.SatellizerConfig.tokenName=value},enumerable:true,configurable:true});Object.defineProperty(AuthProvider.prototype,"tokenPrefix",{get:function(){return this.SatellizerConfig.tokenPrefix},set:function(value){this.SatellizerConfig.tokenPrefix=value},enumerable:true,configurable:true});Object.defineProperty(AuthProvider.prototype,"tokenHeader",{get:function(){return this.SatellizerConfig.tokenHeader},set:function(value){this.SatellizerConfig.tokenHeader=value},enumerable:true,configurable:true});Object.defineProperty(AuthProvider.prototype,"tokenType",{get:function(){return this.SatellizerConfig.tokenType},set:function(value){this.SatellizerConfig.tokenType=value},enumerable:true,configurable:true});Object.defineProperty(AuthProvider.prototype,"withCredentials",{get:function(){return this.SatellizerConfig.withCredentials},set:function(value){this.SatellizerConfig.withCredentials=value},enumerable:true,configurable:true});Object.defineProperty(AuthProvider.prototype,"storageType",{get:function(){return this.SatellizerConfig.storageType},set:function(value){this.SatellizerConfig.storageType=value},enumerable:true,configurable:true});Object.defineProperty(AuthProvider.prototype,"httpInterceptor",{get:function(){return this.SatellizerConfig.httpInterceptor},set:function(value){if(typeof value==="function"){this.SatellizerConfig.httpInterceptor=value}else{this.SatellizerConfig.httpInterceptor=function(){return value}}},enumerable:true,configurable:true});AuthProvider.prototype.facebook=function(options){angular.extend(this.SatellizerConfig.providers.facebook,options)};AuthProvider.prototype.google=function(options){angular.extend(this.SatellizerConfig.providers.google,options)};AuthProvider.prototype.github=function(options){angular.extend(this.SatellizerConfig.providers.github,options)};AuthProvider.prototype.instagram=function(options){angular.extend(this.SatellizerConfig.providers.instagram,options)};AuthProvider.prototype.linkedin=function(options){angular.extend(this.SatellizerConfig.providers.linkedin,options)};AuthProvider.prototype.twitter=function(options){angular.extend(this.SatellizerConfig.providers.twitter,options)};AuthProvider.prototype.twitch=function(options){angular.extend(this.SatellizerConfig.providers.twitch,options)};AuthProvider.prototype.live=function(options){angular.extend(this.SatellizerConfig.providers.live,options)};AuthProvider.prototype.yahoo=function(options){angular.extend(this.SatellizerConfig.providers.yahoo,options)};AuthProvider.prototype.bitbucket=function(options){angular.extend(this.SatellizerConfig.providers.bitbucket,options)};AuthProvider.prototype.oauth1=function(options){this.SatellizerConfig.providers[options.name]=angular.extend(options,{oauthType:"1.0"})};AuthProvider.prototype.oauth2=function(options){this.SatellizerConfig.providers[options.name]=angular.extend(options,{oauthType:"2.0"})};AuthProvider.prototype.$get=function(SatellizerShared,SatellizerLocal,SatellizerOAuth){return{login:function(user,options){return SatellizerLocal.login(user,options)},signup:function(user,options){return SatellizerLocal.signup(user,options)},logout:function(){return SatellizerShared.logout()},authenticate:function(name,data){return SatellizerOAuth.authenticate(name,data)},link:function(name,data){return SatellizerOAuth.authenticate(name,data)},unlink:function(name,options){return SatellizerOAuth.unlink(name,options)},isAuthenticated:function(){return SatellizerShared.isAuthenticated()},getPayload:function(){return SatellizerShared.getPayload()},getToken:function(){return SatellizerShared.getToken()},setToken:function(token){return SatellizerShared.setToken({access_token:token})},removeToken:function(){return SatellizerShared.removeToken()},setStorageType:function(type){return SatellizerShared.setStorageType(type)}}};AuthProvider.$inject=["SatellizerConfig"];return AuthProvider}();function joinUrl(baseUrl,url){if(/^(?:[a-z]+:)?\/\//i.test(url)){return url}var joined=[baseUrl,url].join("/");var normalize=function(str){return str.replace(/[\/]+/g,"/").replace(/\/\?/g,"?").replace(/\/\#/g,"#").replace(/\:\//g,"://")};return normalize(joined)}function getFullUrlPath(location){var isHttps=location.protocol==="https:";return location.protocol+"//"+location.hostname+":"+(location.port||(isHttps?"443":"80"))+(/^\//.test(location.pathname)?location.pathname:"/"+location.pathname)}function parseQueryString(str){var obj={};var key;var value;angular.forEach((str||"").split("&"),function(keyValue){if(keyValue){value=keyValue.split("=");key=decodeURIComponent(value[0]);obj[key]=angular.isDefined(value[1])?decodeURIComponent(value[1]):true}});return obj}function decodeBase64(str){var buffer;if(typeof module!=="undefined"&&module.exports){try{buffer=require("buffer").Buffer}catch(err){}}var fromCharCode=String.fromCharCode;var re_btou=new RegExp(["[À-ß][-¿]","[à-ï][-¿]{2}","[ð-÷][-¿]{3}"].join("|"),"g");var cb_btou=function(cccc){switch(cccc.length){case 4:var cp=(7&cccc.charCodeAt(0))<<18|(63&cccc.charCodeAt(1))<<12|(63&cccc.charCodeAt(2))<<6|63&cccc.charCodeAt(3);var offset=cp-65536;return fromCharCode((offset>>>10)+55296)+fromCharCode((offset&1023)+56320);case 3:return fromCharCode((15&cccc.charCodeAt(0))<<12|(63&cccc.charCodeAt(1))<<6|63&cccc.charCodeAt(2));default:return fromCharCode((31&cccc.charCodeAt(0))<<6|63&cccc.charCodeAt(1))}};var btou=function(b){return b.replace(re_btou,cb_btou)};var _decode=buffer?function(a){return(a.constructor===buffer.constructor?a:new buffer(a,"base64")).toString()}:function(a){return btou(atob(a))};return _decode(String(str).replace(/[-_]/g,function(m0){return m0==="-"?"+":"/"}).replace(/[^A-Za-z0-9\+\/]/g,""))}var Shared=function(){function Shared($q,$window,$log,SatellizerConfig,SatellizerStorage){this.$q=$q;this.$window=$window;this.$log=$log;this.SatellizerConfig=SatellizerConfig;this.SatellizerStorage=SatellizerStorage;var _a=this.SatellizerConfig,tokenName=_a.tokenName,tokenPrefix=_a.tokenPrefix;this.prefixedTokenName=tokenPrefix?[tokenPrefix,tokenName].join("_"):tokenName}Shared.prototype.getToken=function(){return this.SatellizerStorage.get(this.prefixedTokenName)};Shared.prototype.getPayload=function(){var token=this.SatellizerStorage.get(this.prefixedTokenName);if(token&&token.split(".").length===3){try{var base64Url=token.split(".")[1];var base64=base64Url.replace("-","+").replace("_","/");return JSON.parse(decodeBase64(base64))}catch(e){}}};Shared.prototype.setToken=function(response){if(!response){return this.$log.warn("Can't set token without passing a value")}var token;var accessToken=response&&response.access_token;if(accessToken){if(angular.isObject(accessToken)&&angular.isObject(accessToken.data)){response=accessToken}else if(angular.isString(accessToken)){token=accessToken}}if(!token&&response){var tokenRootData=this.SatellizerConfig.tokenRoot&&this.SatellizerConfig.tokenRoot.split(".").reduce(function(o,x){return o[x]},response.data);token=tokenRootData?tokenRootData[this.SatellizerConfig.tokenName]:response.data&&response.data[this.SatellizerConfig.tokenName]}if(!token){var tokenPath=this.SatellizerConfig.tokenRoot?this.SatellizerConfig.tokenRoot+"."+this.SatellizerConfig.tokenName:this.SatellizerConfig.tokenName;return this.$log.warn('Expecting a token named "'+tokenPath)}this.SatellizerStorage.set(this.prefixedTokenName,token)};Shared.prototype.removeToken=function(){this.SatellizerStorage.remove(this.prefixedTokenName)};Shared.prototype.isAuthenticated=function(){var token=this.SatellizerStorage.get(this.prefixedTokenName);if(token){if(token.split(".").length===3){try{var base64Url=token.split(".")[1];var base64=base64Url.replace("-","+").replace("_","/");var exp=JSON.parse(this.$window.atob(base64)).exp;if(exp){return Math.round((new Date).getTime()/1e3)>=exp?false:true}}catch(e){return true}}return true}return false};Shared.prototype.logout=function(){this.SatellizerStorage.remove(this.prefixedTokenName);return this.$q.when()};Shared.prototype.setStorageType=function(type){this.SatellizerConfig.storageType=type};Shared.$inject=["$q","$window","$log","SatellizerConfig","SatellizerStorage"];return Shared}();var Local=function(){function Local($http,SatellizerConfig,SatellizerShared){this.$http=$http;this.SatellizerConfig=SatellizerConfig;this.SatellizerShared=SatellizerShared}Local.prototype.login=function(user,options){var _this=this;if(options===void 0){options={}}options.url=options.url?options.url:joinUrl(this.SatellizerConfig.baseUrl,this.SatellizerConfig.loginUrl);options.data=user||options.data;options.method=options.method||"POST";options.withCredentials=options.withCredentials||this.SatellizerConfig.withCredentials;return this.$http(options).then(function(response){_this.SatellizerShared.setToken(response);return response})};Local.prototype.signup=function(user,options){if(options===void 0){options={}}options.url=options.url?options.url:joinUrl(this.SatellizerConfig.baseUrl,this.SatellizerConfig.signupUrl);options.data=user||options.data;options.method=options.method||"POST";options.withCredentials=options.withCredentials||this.SatellizerConfig.withCredentials;return this.$http(options)};Local.$inject=["$http","SatellizerConfig","SatellizerShared"];return Local}();var Popup=function(){function Popup($interval,$window){this.$interval=$interval;this.$window=$window;this.popup=null;this.url="about:blank";this.defaults={redirectUri:null}}Popup.prototype.stringifyOptions=function(options){var parts=[];angular.forEach(options,function(value,key){parts.push(key+"="+value)});return parts.join(",")};Popup.prototype.open=function(url,name,popupOptions){this.url=url;var width=popupOptions.width||500;var height=popupOptions.height||500;var options=this.stringifyOptions({width:width,height:height,top:this.$window.screenY+(this.$window.outerHeight-height)/2.5,left:this.$window.screenX+(this.$window.outerWidth-width)/2});var popupName=this.$window["cordova"]||this.$window.navigator.userAgent.indexOf("CriOS")>-1?"_blank":name;this.popup=window.open(this.url,popupName,options);if(this.popup&&this.popup.focus){this.popup.focus()}};Popup.prototype.polling=function(redirectUri){var _this=this;return new Promise(function(resolve,reject){var redirectUriParser=document.createElement("a");redirectUriParser.href=redirectUri;var redirectUriPath=getFullUrlPath(redirectUriParser);var polling=_this.$interval(function(){if(!_this.popup||_this.popup.closed||_this.popup.closed===undefined){_this.$interval.cancel(polling);reject(new Error("The popup window was closed"))}try{var popupWindowPath=getFullUrlPath(_this.popup.location);if(popupWindowPath===redirectUriPath){if(_this.popup.location.search||_this.popup.location.hash){var query=parseQueryString(_this.popup.location.search.substring(1).replace(/\/$/,""));var hash=parseQueryString(_this.popup.location.hash.substring(1).replace(/[\/$]/,""));var params=Object.assign({},query,hash);if(params.error){reject(new Error(params.error))}else{resolve(params)}}else{reject(new Error("OAuth redirect has occurred but no query or hash parameters were found. "+"They were either not set during the redirect, or were removed—typically by a "+"routing library—before Satellizer could read it."))}_this.$interval.cancel(polling);_this.popup.close()}}catch(error){}},500)})};Popup.prototype.eventListener=function(redirectUri){var _this=this;return new Promise(function(resolve,reject){_this.popup.addEventListener("loadstart",function(event){if(!event.url.includes(redirectUri)){return}var parser=document.createElement("a");parser.href=event.url;if(parser.search||parser.hash){var query=parseQueryString(parser.search.substring(1).replace(/\/$/,""));var hash=parseQueryString(parser.hash.substring(1).replace(/[\/$]/,""));var params=Object.assign({},query,hash);if(params.error){reject(new Error(params.error))}else{resolve(params)}_this.popup.close()}});_this.popup.addEventListener("loaderror",function(){reject(new Error("Authorization failed"))});_this.popup.addEventListener("exit",function(){reject(new Error("The popup window was closed"))})})};Popup.$inject=["$interval","$window"];return Popup}();var OAuth=function(){function OAuth($http,SatellizerConfig,SatellizerShared,SatellizerOAuth1,SatellizerOAuth2){this.$http=$http;this.SatellizerConfig=SatellizerConfig;this.SatellizerShared=SatellizerShared;this.SatellizerOAuth1=SatellizerOAuth1;this.SatellizerOAuth2=SatellizerOAuth2}OAuth.prototype.authenticate=function(name,userData){var _this=this;return new Promise(function(resolve,reject){var provider=_this.SatellizerConfig.providers[name];var initialize=provider.oauthType==="1.0"?_this.SatellizerOAuth1.init(provider,userData):_this.SatellizerOAuth2.init(provider,userData);return initialize.then(function(response){if(provider.url){_this.SatellizerShared.setToken(response)}resolve(response)}).catch(function(error){reject(error)})})};OAuth.prototype.unlink=function(provider,httpOptions){if(httpOptions===void 0){httpOptions={}}httpOptions.url=httpOptions.url?httpOptions.url:joinUrl(this.SatellizerConfig.baseUrl,this.SatellizerConfig.unlinkUrl);httpOptions.data={provider:provider}||httpOptions.data;httpOptions.method=httpOptions.method||"POST";httpOptions.withCredentials=httpOptions.withCredentials||this.SatellizerConfig.withCredentials;return this.$http(httpOptions)};OAuth.$inject=["$http","SatellizerConfig","SatellizerShared","SatellizerOAuth1","SatellizerOAuth2"];return OAuth}();var OAuth2=function(){function OAuth2($http,$window,$timeout,SatellizerConfig,SatellizerPopup,SatellizerStorage){this.$http=$http;this.$window=$window;this.$timeout=$timeout;this.SatellizerConfig=SatellizerConfig;this.SatellizerPopup=SatellizerPopup;this.SatellizerStorage=SatellizerStorage;this.defaults={name:null,url:null,clientId:null,authorizationEndpoint:null,redirectUri:null,scope:null,scopePrefix:null,scopeDelimiter:null,state:null,requiredUrlParams:null,defaultUrlParams:["response_type","client_id","redirect_uri"],responseType:"code",responseParams:{code:"code",clientId:"clientId",redirectUri:"redirectUri"},oauthType:"2.0",popupOptions:{width:null,height:null}}}OAuth2.camelCase=function(name){return name.replace(/([\:\-\_]+(.))/g,function(_,separator,letter,offset){return offset?letter.toUpperCase():letter})};OAuth2.prototype.init=function(options,userData){var _this=this;return new Promise(function(resolve,reject){Object.assign(_this.defaults,options);_this.$timeout(function(){var url=[_this.defaults.authorizationEndpoint,_this.buildQueryString()].join("?");var stateName=_this.defaults.name+"_state";var _a=_this.defaults,name=_a.name,state=_a.state,popupOptions=_a.popupOptions,redirectUri=_a.redirectUri,responseType=_a.responseType;if(typeof state==="function"){_this.SatellizerStorage.set(stateName,state())}else if(typeof state==="string"){_this.SatellizerStorage.set(stateName,state)}_this.SatellizerPopup.open(url,name,popupOptions);_this.SatellizerPopup.polling(redirectUri).then(function(oauth){if(responseType==="token"||!url){return resolve(oauth)}if(oauth.state&&oauth.state!==_this.SatellizerStorage.get(stateName)){return reject(new Error("The value returned in the state parameter does not match the state value from your original "+"authorization code request."))}resolve(_this.exchangeForToken(oauth,userData))}).catch(function(error){return reject(error)})})})};OAuth2.prototype.exchangeForToken=function(oauthData,userData){var _this=this;var payload=Object.assign({},userData);angular.forEach(this.defaults.responseParams,function(value,key){switch(key){case"code":payload[value]=oauthData.code;break;case"clientId":payload[value]=_this.defaults.clientId;break;case"redirectUri":payload[value]=_this.defaults.redirectUri;break;default:payload[value]=oauthData[key]}});if(oauthData.state){payload.state=oauthData.state}var exchangeForTokenUrl=this.SatellizerConfig.baseUrl?joinUrl(this.SatellizerConfig.baseUrl,this.defaults.url):this.defaults.url;return this.$http.post(exchangeForTokenUrl,payload,{withCredentials:this.SatellizerConfig.withCredentials})};OAuth2.prototype.buildQueryString=function(){var _this=this;var keyValuePairs=[];var urlParamsCategories=["defaultUrlParams","requiredUrlParams","optionalUrlParams"];angular.forEach(urlParamsCategories,function(paramsCategory){angular.forEach(_this.defaults[paramsCategory],function(paramName){var camelizedName=OAuth2.camelCase(paramName);var paramValue=angular.isFunction(_this.defaults[paramName])?_this.defaults[paramName]():_this.defaults[camelizedName];if(paramName==="redirect_uri"&&!paramValue){return}if(paramName==="state"){var stateName=_this.defaults.name+"_state";paramValue=encodeURIComponent(_this.SatellizerStorage.get(stateName))}if(paramName==="scope"&&Array.isArray(paramValue)){paramValue=paramValue.join(_this.defaults.scopeDelimiter);if(_this.defaults.scopePrefix){paramValue=[_this.defaults.scopePrefix,paramValue].join(_this.defaults.scopeDelimiter)}}keyValuePairs.push([paramName,paramValue])})});return keyValuePairs.map(function(pair){return pair.join("=")}).join("&")};OAuth2.$inject=["$http","$window","$timeout","SatellizerConfig","SatellizerPopup","SatellizerStorage"];return OAuth2}();var OAuth1=function(){function OAuth1($http,$window,SatellizerConfig,SatellizerPopup){this.$http=$http;this.$window=$window;this.SatellizerConfig=SatellizerConfig;this.SatellizerPopup=SatellizerPopup;this.defaults={name:null,url:null,authorizationEndpoint:null,scope:null,scopePrefix:null,scopeDelimiter:null,redirectUri:null,requiredUrlParams:null,defaultUrlParams:null,oauthType:"1.0",popupOptions:{width:null,height:null}}}OAuth1.prototype.init=function(options,userData){var _this=this;Object.assign(this.defaults,options);if(!this.$window["cordova"]){this.SatellizerPopup.open("about:blank",options.name,options.popupOptions)}return this.getRequestToken().then(function(response){return _this.openPopup(options,response).then(function(popupResponse){return _this.exchangeForToken(popupResponse,userData)})})};OAuth1.prototype.openPopup=function(options,response){var popupUrl=[options.authorizationEndpoint,this.buildQueryString(response.data)].join("?");if(this.$window["cordova"]){this.SatellizerPopup.open(popupUrl,options.name,options.popupOptions);return this.SatellizerPopup.eventListener(this.defaults.redirectUri)}else{this.SatellizerPopup.popup.location=popupUrl;return this.SatellizerPopup.polling(this.defaults.redirectUri)}};OAuth1.prototype.getRequestToken=function(){var url=this.SatellizerConfig.baseUrl?joinUrl(this.SatellizerConfig.baseUrl,this.defaults.url):this.defaults.url;return this.$http.post(url,this.defaults)};OAuth1.prototype.exchangeForToken=function(oauthData,userData){var payload=Object.assign({},userData,oauthData);var exchangeForTokenUrl=this.SatellizerConfig.baseUrl?joinUrl(this.SatellizerConfig.baseUrl,this.defaults.url):this.defaults.url;return this.$http.post(exchangeForTokenUrl,payload,{withCredentials:this.SatellizerConfig.withCredentials})};OAuth1.prototype.buildQueryString=function(obj){var str=[];angular.forEach(obj,function(value,key){str.push(encodeURIComponent(key)+"="+encodeURIComponent(value))});return str.join("&")};OAuth1.$inject=["$http","$window","SatellizerConfig","SatellizerPopup"];return OAuth1}();var Storage=function(){function Storage($window,SatellizerConfig){this.$window=$window;this.SatellizerConfig=SatellizerConfig;this.memoryStore={};this.storageType=SatellizerConfig.storageType}Storage.prototype.get=function(key){try{return this.$window[this.storageType].getItem(key)}catch(e){return this.memoryStore[key]}};Storage.prototype.set=function(key,value){try{this.$window[this.storageType].setItem(key,value)}catch(e){this.memoryStore[key]=value}};Storage.prototype.remove=function(key){try{this.$window[this.storageType].removeItem(key)}catch(e){delete this.memoryStore[key]}};Storage.$inject=["$window","SatellizerConfig"];return Storage}();var Interceptor=function(){function Interceptor(SatellizerConfig,SatellizerShared,SatellizerStorage){var _this=this;this.SatellizerConfig=SatellizerConfig;this.SatellizerShared=SatellizerShared;this.SatellizerStorage=SatellizerStorage;this.request=function(config){if(config["skipAuthorization"]){return config}if(_this.SatellizerShared.isAuthenticated()&&_this.SatellizerConfig.httpInterceptor()){var tokenName=_this.SatellizerConfig.tokenPrefix?[_this.SatellizerConfig.tokenPrefix,_this.SatellizerConfig.tokenName].join("_"):_this.SatellizerConfig.tokenName;var token=_this.SatellizerStorage.get(tokenName);if(_this.SatellizerConfig.tokenHeader&&_this.SatellizerConfig.tokenType){token=_this.SatellizerConfig.tokenType+" "+token}config.headers[_this.SatellizerConfig.tokenHeader]=token}return config}}Interceptor.Factory=function(SatellizerConfig,SatellizerShared,SatellizerStorage){return new Interceptor(SatellizerConfig,SatellizerShared,SatellizerStorage)};Interceptor.$inject=["SatellizerConfig","SatellizerShared","SatellizerStorage"];return Interceptor}();var HttpProviderConfig=function(){function HttpProviderConfig($httpProvider){this.$httpProvider=$httpProvider;$httpProvider.interceptors.push(Interceptor.Factory)}HttpProviderConfig.$inject=["$httpProvider"];return HttpProviderConfig}();angular.module("satellizer",[]).provider("$auth",["SatellizerConfig",function(SatellizerConfig){return new AuthProvider(SatellizerConfig)}]).constant("SatellizerConfig",Config.getConstant).service("SatellizerShared",Shared).service("SatellizerLocal",Local).service("SatellizerPopup",Popup).service("SatellizerOAuth",OAuth).service("SatellizerOAuth2",OAuth2).service("SatellizerOAuth1",OAuth1).service("SatellizerStorage",Storage).service("SatellizerInterceptor",Interceptor).config(function($httpProvider){return new HttpProviderConfig($httpProvider)});var ng1="satellizer";return ng1});
\ No newline at end of file
+(function(global,factory){typeof exports==="object"&&typeof module!=="undefined"?module.exports=factory():typeof define==="function"&&define.amd?define(factory):global.satellizer=factory()})(this,function(){"use strict";var Config=function(){function Config(){this.baseUrl="/";this.loginUrl="/auth/login";this.signupUrl="/auth/signup";this.unlinkUrl="/auth/unlink/";this.tokenName="token";this.tokenPrefix="satellizer";this.tokenHeader="Authorization";this.tokenType="Bearer";this.storageType="localStorage";this.tokenRoot=null;this.withCredentials=false;this.providers={facebook:{name:"facebook",url:"/auth/facebook",authorizationEndpoint:"https://www.facebook.com/v2.5/dialog/oauth",redirectUri:window.location.origin+"/",requiredUrlParams:["display","scope"],scope:["email"],scopeDelimiter:",",display:"popup",oauthType:"2.0",popupOptions:{width:580,height:400}},google:{name:"google",url:"/auth/google",authorizationEndpoint:"https://accounts.google.com/o/oauth2/auth",redirectUri:window.location.origin,requiredUrlParams:["scope"],optionalUrlParams:["display","state"],scope:["profile","email"],scopePrefix:"openid",scopeDelimiter:" ",display:"popup",oauthType:"2.0",popupOptions:{width:452,height:633},state:function(){return encodeURIComponent(Math.random().toString(36).substr(2))}},github:{name:"github",url:"/auth/github",authorizationEndpoint:"https://github.com/login/oauth/authorize",redirectUri:window.location.origin,optionalUrlParams:["scope"],scope:["user:email"],scopeDelimiter:" ",oauthType:"2.0",popupOptions:{width:1020,height:618}},instagram:{name:"instagram",url:"/auth/instagram",authorizationEndpoint:"https://api.instagram.com/oauth/authorize",redirectUri:window.location.origin,requiredUrlParams:["scope"],scope:["basic"],scopeDelimiter:"+",oauthType:"2.0"},linkedin:{name:"linkedin",url:"/auth/linkedin",authorizationEndpoint:"https://www.linkedin.com/uas/oauth2/authorization",redirectUri:window.location.origin,requiredUrlParams:["state"],scope:["r_emailaddress"],scopeDelimiter:" ",state:"STATE",oauthType:"2.0",popupOptions:{width:527,height:582}},twitter:{name:"twitter",url:"/auth/twitter",authorizationEndpoint:"https://api.twitter.com/oauth/authenticate",redirectUri:window.location.origin,oauthType:"1.0",popupOptions:{width:495,height:645}},twitch:{name:"twitch",url:"/auth/twitch",authorizationEndpoint:"https://api.twitch.tv/kraken/oauth2/authorize",redirectUri:window.location.origin,requiredUrlParams:["scope"],scope:["user_read"],scopeDelimiter:" ",display:"popup",oauthType:"2.0",popupOptions:{width:500,height:560}},live:{name:"live",url:"/auth/live",authorizationEndpoint:"https://login.live.com/oauth20_authorize.srf",redirectUri:window.location.origin,requiredUrlParams:["display","scope"],scope:["wl.emails"],scopeDelimiter:" ",display:"popup",oauthType:"2.0",popupOptions:{width:500,height:560}},yahoo:{name:"yahoo",url:"/auth/yahoo",authorizationEndpoint:"https://api.login.yahoo.com/oauth2/request_auth",redirectUri:window.location.origin,scope:[],scopeDelimiter:",",oauthType:"2.0",popupOptions:{width:559,height:519}},bitbucket:{name:"bitbucket",url:"/auth/bitbucket",authorizationEndpoint:"https://bitbucket.org/site/oauth2/authorize",redirectUri:window.location.origin+"/",requiredUrlParams:["scope"],scope:["email"],scopeDelimiter:" ",oauthType:"2.0",popupOptions:{width:1028,height:529}}};this.httpInterceptor=function(){return true}}Object.defineProperty(Config,"getConstant",{get:function(){return new Config},enumerable:true,configurable:true});return Config}();var AuthProvider=function(){function AuthProvider(SatellizerConfig){this.SatellizerConfig=SatellizerConfig}Object.defineProperty(AuthProvider.prototype,"baseUrl",{get:function(){return this.SatellizerConfig.baseUrl},set:function(value){this.SatellizerConfig.baseUrl=value},enumerable:true,configurable:true});Object.defineProperty(AuthProvider.prototype,"loginUrl",{get:function(){return this.SatellizerConfig.loginUrl},set:function(value){this.SatellizerConfig.loginUrl=value},enumerable:true,configurable:true});Object.defineProperty(AuthProvider.prototype,"signupUrl",{get:function(){return this.SatellizerConfig.signupUrl},set:function(value){this.SatellizerConfig.signupUrl=value},enumerable:true,configurable:true});Object.defineProperty(AuthProvider.prototype,"unlinkUrl",{get:function(){return this.SatellizerConfig.unlinkUrl},set:function(value){this.SatellizerConfig.unlinkUrl=value},enumerable:true,configurable:true});Object.defineProperty(AuthProvider.prototype,"tokenRoot",{get:function(){return this.SatellizerConfig.tokenRoot},set:function(value){this.SatellizerConfig.tokenRoot=value},enumerable:true,configurable:true});Object.defineProperty(AuthProvider.prototype,"tokenName",{get:function(){return this.SatellizerConfig.tokenName},set:function(value){this.SatellizerConfig.tokenName=value},enumerable:true,configurable:true});Object.defineProperty(AuthProvider.prototype,"tokenPrefix",{get:function(){return this.SatellizerConfig.tokenPrefix},set:function(value){this.SatellizerConfig.tokenPrefix=value},enumerable:true,configurable:true});Object.defineProperty(AuthProvider.prototype,"tokenHeader",{get:function(){return this.SatellizerConfig.tokenHeader},set:function(value){this.SatellizerConfig.tokenHeader=value},enumerable:true,configurable:true});Object.defineProperty(AuthProvider.prototype,"tokenType",{get:function(){return this.SatellizerConfig.tokenType},set:function(value){this.SatellizerConfig.tokenType=value},enumerable:true,configurable:true});Object.defineProperty(AuthProvider.prototype,"withCredentials",{get:function(){return this.SatellizerConfig.withCredentials},set:function(value){this.SatellizerConfig.withCredentials=value},enumerable:true,configurable:true});Object.defineProperty(AuthProvider.prototype,"storageType",{get:function(){return this.SatellizerConfig.storageType},set:function(value){this.SatellizerConfig.storageType=value},enumerable:true,configurable:true});Object.defineProperty(AuthProvider.prototype,"httpInterceptor",{get:function(){return this.SatellizerConfig.httpInterceptor},set:function(value){if(typeof value==="function"){this.SatellizerConfig.httpInterceptor=value}else{this.SatellizerConfig.httpInterceptor=function(){return value}}},enumerable:true,configurable:true});AuthProvider.prototype.facebook=function(options){angular.extend(this.SatellizerConfig.providers.facebook,options)};AuthProvider.prototype.google=function(options){angular.extend(this.SatellizerConfig.providers.google,options)};AuthProvider.prototype.github=function(options){angular.extend(this.SatellizerConfig.providers.github,options)};AuthProvider.prototype.instagram=function(options){angular.extend(this.SatellizerConfig.providers.instagram,options)};AuthProvider.prototype.linkedin=function(options){angular.extend(this.SatellizerConfig.providers.linkedin,options)};AuthProvider.prototype.twitter=function(options){angular.extend(this.SatellizerConfig.providers.twitter,options)};AuthProvider.prototype.twitch=function(options){angular.extend(this.SatellizerConfig.providers.twitch,options)};AuthProvider.prototype.live=function(options){angular.extend(this.SatellizerConfig.providers.live,options)};AuthProvider.prototype.yahoo=function(options){angular.extend(this.SatellizerConfig.providers.yahoo,options)};AuthProvider.prototype.bitbucket=function(options){angular.extend(this.SatellizerConfig.providers.bitbucket,options)};AuthProvider.prototype.oauth1=function(options){this.SatellizerConfig.providers[options.name]=angular.extend(options,{oauthType:"1.0"})};AuthProvider.prototype.oauth2=function(options){this.SatellizerConfig.providers[options.name]=angular.extend(options,{oauthType:"2.0"})};AuthProvider.prototype.$get=function(SatellizerShared,SatellizerLocal,SatellizerOAuth){return{login:function(user,options){return SatellizerLocal.login(user,options)},signup:function(user,options){return SatellizerLocal.signup(user,options)},logout:function(){return SatellizerShared.logout()},authenticate:function(name,data){return SatellizerOAuth.authenticate(name,data)},link:function(name,data){return SatellizerOAuth.authenticate(name,data)},unlink:function(name,options){return SatellizerOAuth.unlink(name,options)},isAuthenticated:function(){return SatellizerShared.isAuthenticated()},getPayload:function(){return SatellizerShared.getPayload()},getToken:function(){return SatellizerShared.getToken()},setToken:function(token){return SatellizerShared.setToken({access_token:token})},removeToken:function(){return SatellizerShared.removeToken()},setStorageType:function(type){return SatellizerShared.setStorageType(type)}}};AuthProvider.$inject=["SatellizerConfig"];return AuthProvider}();function joinUrl(baseUrl,url){if(/^(?:[a-z]+:)?\/\//i.test(url)){return url}var joined=[baseUrl,url].join("/");var normalize=function(str){return str.replace(/[\/]+/g,"/").replace(/\/\?/g,"?").replace(/\/\#/g,"#").replace(/\:\//g,"://")};return normalize(joined)}function getFullUrlPath(location){var isHttps=location.protocol==="https:";return location.protocol+"//"+location.hostname+":"+(location.port||(isHttps?"443":"80"))+(/^\//.test(location.pathname)?location.pathname:"/"+location.pathname)}function parseQueryString(str){var obj={};var key;var value;angular.forEach((str||"").split("&"),function(keyValue){if(keyValue){value=keyValue.split("=");key=decodeURIComponent(value[0]);obj[key]=angular.isDefined(value[1])?decodeURIComponent(value[1]):true}});return obj}function decodeBase64(str){var buffer;if(typeof module!=="undefined"&&module.exports){try{buffer=require("buffer").Buffer}catch(err){}}var fromCharCode=String.fromCharCode;var re_btou=new RegExp(["[À-ß][-¿]","[à-ï][-¿]{2}","[ð-÷][-¿]{3}"].join("|"),"g");var cb_btou=function(cccc){switch(cccc.length){case 4:var cp=(7&cccc.charCodeAt(0))<<18|(63&cccc.charCodeAt(1))<<12|(63&cccc.charCodeAt(2))<<6|63&cccc.charCodeAt(3);var offset=cp-65536;return fromCharCode((offset>>>10)+55296)+fromCharCode((offset&1023)+56320);case 3:return fromCharCode((15&cccc.charCodeAt(0))<<12|(63&cccc.charCodeAt(1))<<6|63&cccc.charCodeAt(2));default:return fromCharCode((31&cccc.charCodeAt(0))<<6|63&cccc.charCodeAt(1))}};var btou=function(b){return b.replace(re_btou,cb_btou)};var _decode=buffer?function(a){return(a.constructor===buffer.constructor?a:new buffer(a,"base64")).toString()}:function(a){return btou(atob(a))};return _decode(String(str).replace(/[-_]/g,function(m0){return m0==="-"?"+":"/"}).replace(/[^A-Za-z0-9\+\/]/g,""))}var Shared=function(){function Shared($q,$window,$log,SatellizerConfig,SatellizerStorage){this.$q=$q;this.$window=$window;this.$log=$log;this.SatellizerConfig=SatellizerConfig;this.SatellizerStorage=SatellizerStorage;var _a=this.SatellizerConfig,tokenName=_a.tokenName,tokenPrefix=_a.tokenPrefix;this.prefixedTokenName=tokenPrefix?[tokenPrefix,tokenName].join("_"):tokenName}Shared.prototype.getToken=function(){return this.SatellizerStorage.get(this.prefixedTokenName)};Shared.prototype.getPayload=function(){var token=this.SatellizerStorage.get(this.prefixedTokenName);if(token&&token.split(".").length===3){try{var base64Url=token.split(".")[1];var base64=base64Url.replace("-","+").replace("_","/");return JSON.parse(decodeBase64(base64))}catch(e){}}};Shared.prototype.setToken=function(response){if(!response){return this.$log.warn("Can't set token without passing a value")}var token;var accessToken=response&&response.access_token;if(accessToken){if(angular.isObject(accessToken)&&angular.isObject(accessToken.data)){response=accessToken}else if(angular.isString(accessToken)){token=accessToken}}if(!token&&response){var tokenRootData=this.SatellizerConfig.tokenRoot&&this.SatellizerConfig.tokenRoot.split(".").reduce(function(o,x){return o[x]},response.data);token=tokenRootData?tokenRootData[this.SatellizerConfig.tokenName]:response.data&&response.data[this.SatellizerConfig.tokenName]}if(!token){var tokenPath=this.SatellizerConfig.tokenRoot?this.SatellizerConfig.tokenRoot+"."+this.SatellizerConfig.tokenName:this.SatellizerConfig.tokenName;return this.$log.warn('Expecting a token named "'+tokenPath)}this.SatellizerStorage.set(this.prefixedTokenName,token)};Shared.prototype.removeToken=function(){this.SatellizerStorage.remove(this.prefixedTokenName)};Shared.prototype.isAuthenticated=function(){var token=this.SatellizerStorage.get(this.prefixedTokenName);if(token){if(token.split(".").length===3){try{var base64Url=token.split(".")[1];var base64=base64Url.replace("-","+").replace("_","/");var exp=JSON.parse(this.$window.atob(base64)).exp;if(exp){return Math.round((new Date).getTime()/1e3)>=exp?false:true}}catch(e){return true}}return true}return false};Shared.prototype.logout=function(){this.SatellizerStorage.remove(this.prefixedTokenName);return this.$q.when()};Shared.prototype.setStorageType=function(type){this.SatellizerConfig.storageType=type};Shared.$inject=["$q","$window","$log","SatellizerConfig","SatellizerStorage"];return Shared}();var Local=function(){function Local($http,SatellizerConfig,SatellizerShared){this.$http=$http;this.SatellizerConfig=SatellizerConfig;this.SatellizerShared=SatellizerShared}Local.prototype.login=function(user,options){var _this=this;if(options===void 0){options={}}options.url=options.url?options.url:joinUrl(this.SatellizerConfig.baseUrl,this.SatellizerConfig.loginUrl);options.data=user||options.data;options.method=options.method||"POST";options.withCredentials=options.withCredentials||this.SatellizerConfig.withCredentials;return this.$http(options).then(function(response){_this.SatellizerShared.setToken(response);return response})};Local.prototype.signup=function(user,options){if(options===void 0){options={}}options.url=options.url?options.url:joinUrl(this.SatellizerConfig.baseUrl,this.SatellizerConfig.signupUrl);options.data=user||options.data;options.method=options.method||"POST";options.withCredentials=options.withCredentials||this.SatellizerConfig.withCredentials;return this.$http(options)};Local.$inject=["$http","SatellizerConfig","SatellizerShared"];return Local}();var Popup=function(){function Popup($interval,$window){this.$interval=$interval;this.$window=$window;this.popup=null;this.url="about:blank";this.defaults={redirectUri:null}}Popup.prototype.stringifyOptions=function(options){var parts=[];angular.forEach(options,function(value,key){parts.push(key+"="+value)});return parts.join(",")};Popup.prototype.open=function(url,name,popupOptions){this.url=url;var width=popupOptions.width||500;var height=popupOptions.height||500;var options=this.stringifyOptions({width:width,height:height,top:this.$window.screenY+(this.$window.outerHeight-height)/2.5,left:this.$window.screenX+(this.$window.outerWidth-width)/2});var popupName=this.$window["cordova"]||this.$window.navigator.userAgent.indexOf("CriOS")>-1?"_blank":name;this.popup=window.open(this.url,popupName,options);if(this.popup&&this.popup.focus){this.popup.focus()}};Popup.prototype.polling=function(redirectUri){var _this=this;return new Promise(function(resolve,reject){var redirectUriParser=document.createElement("a");redirectUriParser.href=redirectUri;var redirectUriPath=getFullUrlPath(redirectUriParser);var polling=_this.$interval(function(){if(!_this.popup||_this.popup.closed||_this.popup.closed===undefined){_this.$interval.cancel(polling);reject(new Error("The popup window was closed"))}try{var popupWindowPath=getFullUrlPath(_this.popup.location);if(popupWindowPath===redirectUriPath){if(_this.popup.location.search||_this.popup.location.hash){var query=parseQueryString(_this.popup.location.search.substring(1).replace(/\/$/,""));var hash=parseQueryString(_this.popup.location.hash.substring(1).replace(/[\/$]/,""));var params=Object.assign({},query,hash);if(params.error){reject(new Error(params.error))}else{resolve(params)}}else{reject(new Error("OAuth redirect has occurred but no query or hash parameters were found. "+"They were either not set during the redirect, or were removed—typically by a "+"routing library—before Satellizer could read it."))}_this.$interval.cancel(polling);_this.popup.close()}}catch(error){}},500)})};Popup.prototype.eventListener=function(redirectUri){var _this=this;return new Promise(function(resolve,reject){_this.popup.addEventListener("loadstart",function(event){if(!event.url.includes(redirectUri)){return}var parser=document.createElement("a");parser.href=event.url;if(parser.search||parser.hash){var query=parseQueryString(parser.search.substring(1).replace(/\/$/,""));var hash=parseQueryString(parser.hash.substring(1).replace(/[\/$]/,""));var params=Object.assign({},query,hash);if(params.error){reject(new Error(params.error))}else{resolve(params)}_this.popup.close()}});_this.popup.addEventListener("loaderror",function(){reject(new Error("Authorization failed"))});_this.popup.addEventListener("exit",function(){reject(new Error("The popup window was closed"))})})};Popup.$inject=["$interval","$window"];return Popup}();var OAuth=function(){function OAuth($http,SatellizerConfig,SatellizerShared,SatellizerOAuth1,SatellizerOAuth2){this.$http=$http;this.SatellizerConfig=SatellizerConfig;this.SatellizerShared=SatellizerShared;this.SatellizerOAuth1=SatellizerOAuth1;this.SatellizerOAuth2=SatellizerOAuth2}OAuth.prototype.authenticate=function(name,userData){var _this=this;return new Promise(function(resolve,reject){var provider=_this.SatellizerConfig.providers[name];var initialize=provider.oauthType==="1.0"?_this.SatellizerOAuth1.init(provider,userData):_this.SatellizerOAuth2.init(provider,userData);return initialize.then(function(response){if(provider.url){_this.SatellizerShared.setToken(response)}resolve(response)}).catch(function(error){reject(error)})})};OAuth.prototype.unlink=function(provider,httpOptions){if(httpOptions===void 0){httpOptions={}}httpOptions.url=httpOptions.url?httpOptions.url:joinUrl(this.SatellizerConfig.baseUrl,this.SatellizerConfig.unlinkUrl);httpOptions.data={provider:provider}||httpOptions.data;httpOptions.method=httpOptions.method||"POST";httpOptions.withCredentials=httpOptions.withCredentials||this.SatellizerConfig.withCredentials;return this.$http(httpOptions)};OAuth.$inject=["$http","SatellizerConfig","SatellizerShared","SatellizerOAuth1","SatellizerOAuth2"];return OAuth}();var OAuth2=function(){function OAuth2($http,$window,$timeout,SatellizerConfig,SatellizerPopup,SatellizerStorage){this.$http=$http;this.$window=$window;this.$timeout=$timeout;this.SatellizerConfig=SatellizerConfig;this.SatellizerPopup=SatellizerPopup;this.SatellizerStorage=SatellizerStorage;this.defaults={name:null,url:null,clientId:null,authorizationEndpoint:null,redirectUri:null,scope:null,scopePrefix:null,scopeDelimiter:null,state:null,requiredUrlParams:null,defaultUrlParams:["response_type","client_id","redirect_uri"],responseType:"code",responseParams:{code:"code",clientId:"clientId",redirectUri:"redirectUri"},oauthType:"2.0",popupOptions:{width:null,height:null}}}OAuth2.camelCase=function(name){return name.replace(/([\:\-\_]+(.))/g,function(_,separator,letter,offset){return offset?letter.toUpperCase():letter})};OAuth2.prototype.init=function(options,userData){var _this=this;return new Promise(function(resolve,reject){Object.assign(_this.defaults,options);_this.$timeout(function(){var stateName=_this.defaults.name+"_state";var _a=_this.defaults,name=_a.name,state=_a.state,popupOptions=_a.popupOptions,redirectUri=_a.redirectUri,responseType=_a.responseType;if(typeof state==="function"){_this.SatellizerStorage.set(stateName,state())}else if(typeof state==="string"){_this.SatellizerStorage.set(stateName,state)}var url=[_this.defaults.authorizationEndpoint,_this.buildQueryString()].join("?");_this.SatellizerPopup.open(url,name,popupOptions);_this.SatellizerPopup.polling(redirectUri).then(function(oauth){if(responseType==="token"||!url){return resolve(oauth)}if(oauth.state&&oauth.state!==_this.SatellizerStorage.get(stateName)){return reject(new Error("The value returned in the state parameter does not match the state value from your original "+"authorization code request."))}resolve(_this.exchangeForToken(oauth,userData))}).catch(function(error){return reject(error)})})})};OAuth2.prototype.exchangeForToken=function(oauthData,userData){var _this=this;var payload=Object.assign({},userData);angular.forEach(this.defaults.responseParams,function(value,key){switch(key){case"code":payload[value]=oauthData.code;break;case"clientId":payload[value]=_this.defaults.clientId;break;case"redirectUri":payload[value]=_this.defaults.redirectUri;break;default:payload[value]=oauthData[key]}});if(oauthData.state){payload.state=oauthData.state}var exchangeForTokenUrl=this.SatellizerConfig.baseUrl?joinUrl(this.SatellizerConfig.baseUrl,this.defaults.url):this.defaults.url;return this.$http.post(exchangeForTokenUrl,payload,{withCredentials:this.SatellizerConfig.withCredentials})};OAuth2.prototype.buildQueryString=function(){var _this=this;var keyValuePairs=[];var urlParamsCategories=["defaultUrlParams","requiredUrlParams","optionalUrlParams"];angular.forEach(urlParamsCategories,function(paramsCategory){angular.forEach(_this.defaults[paramsCategory],function(paramName){var camelizedName=OAuth2.camelCase(paramName);var paramValue=angular.isFunction(_this.defaults[paramName])?_this.defaults[paramName]():_this.defaults[camelizedName];if(paramName==="redirect_uri"&&!paramValue){return}if(paramName==="state"){var stateName=_this.defaults.name+"_state";paramValue=encodeURIComponent(_this.SatellizerStorage.get(stateName))}if(paramName==="scope"&&Array.isArray(paramValue)){paramValue=paramValue.join(_this.defaults.scopeDelimiter);if(_this.defaults.scopePrefix){paramValue=[_this.defaults.scopePrefix,paramValue].join(_this.defaults.scopeDelimiter)}}keyValuePairs.push([paramName,paramValue])})});return keyValuePairs.map(function(pair){return pair.join("=")}).join("&")};OAuth2.$inject=["$http","$window","$timeout","SatellizerConfig","SatellizerPopup","SatellizerStorage"];return OAuth2}();var OAuth1=function(){function OAuth1($http,$window,SatellizerConfig,SatellizerPopup){this.$http=$http;this.$window=$window;this.SatellizerConfig=SatellizerConfig;this.SatellizerPopup=SatellizerPopup;this.defaults={name:null,url:null,authorizationEndpoint:null,scope:null,scopePrefix:null,scopeDelimiter:null,redirectUri:null,requiredUrlParams:null,defaultUrlParams:null,oauthType:"1.0",popupOptions:{width:null,height:null}}}OAuth1.prototype.init=function(options,userData){var _this=this;Object.assign(this.defaults,options);if(!this.$window["cordova"]){this.SatellizerPopup.open("about:blank",options.name,options.popupOptions)}return this.getRequestToken().then(function(response){return _this.openPopup(options,response).then(function(popupResponse){return _this.exchangeForToken(popupResponse,userData)})})};OAuth1.prototype.openPopup=function(options,response){var popupUrl=[options.authorizationEndpoint,this.buildQueryString(response.data)].join("?");if(this.$window["cordova"]){this.SatellizerPopup.open(popupUrl,options.name,options.popupOptions);return this.SatellizerPopup.eventListener(this.defaults.redirectUri)}else{this.SatellizerPopup.popup.location=popupUrl;return this.SatellizerPopup.polling(this.defaults.redirectUri)}};OAuth1.prototype.getRequestToken=function(){var url=this.SatellizerConfig.baseUrl?joinUrl(this.SatellizerConfig.baseUrl,this.defaults.url):this.defaults.url;return this.$http.post(url,this.defaults)};OAuth1.prototype.exchangeForToken=function(oauthData,userData){var payload=Object.assign({},userData,oauthData);var exchangeForTokenUrl=this.SatellizerConfig.baseUrl?joinUrl(this.SatellizerConfig.baseUrl,this.defaults.url):this.defaults.url;return this.$http.post(exchangeForTokenUrl,payload,{withCredentials:this.SatellizerConfig.withCredentials})};OAuth1.prototype.buildQueryString=function(obj){var str=[];angular.forEach(obj,function(value,key){str.push(encodeURIComponent(key)+"="+encodeURIComponent(value))});return str.join("&")};OAuth1.$inject=["$http","$window","SatellizerConfig","SatellizerPopup"];return OAuth1}();var Storage=function(){function Storage($window,SatellizerConfig){this.$window=$window;this.SatellizerConfig=SatellizerConfig;this.memoryStore={}}Storage.prototype.get=function(key){try{return this.$window[this.SatellizerConfig.storageType].getItem(key)}catch(e){return this.memoryStore[key]}};Storage.prototype.set=function(key,value){try{this.$window[this.SatellizerConfig.storageType].setItem(key,value)}catch(e){this.memoryStore[key]=value}};Storage.prototype.remove=function(key){try{this.$window[this.SatellizerConfig.storageType].removeItem(key)}catch(e){delete this.memoryStore[key]}};Storage.$inject=["$window","SatellizerConfig"];return Storage}();var Interceptor=function(){function Interceptor(SatellizerConfig,SatellizerShared,SatellizerStorage){var _this=this;this.SatellizerConfig=SatellizerConfig;this.SatellizerShared=SatellizerShared;this.SatellizerStorage=SatellizerStorage;this.request=function(config){if(config["skipAuthorization"]){return config}if(_this.SatellizerShared.isAuthenticated()&&_this.SatellizerConfig.httpInterceptor()){var tokenName=_this.SatellizerConfig.tokenPrefix?[_this.SatellizerConfig.tokenPrefix,_this.SatellizerConfig.tokenName].join("_"):_this.SatellizerConfig.tokenName;var token=_this.SatellizerStorage.get(tokenName);if(_this.SatellizerConfig.tokenHeader&&_this.SatellizerConfig.tokenType){token=_this.SatellizerConfig.tokenType+" "+token}config.headers[_this.SatellizerConfig.tokenHeader]=token}return config}}Interceptor.Factory=function(SatellizerConfig,SatellizerShared,SatellizerStorage){return new Interceptor(SatellizerConfig,SatellizerShared,SatellizerStorage)};Interceptor.$inject=["SatellizerConfig","SatellizerShared","SatellizerStorage"];return Interceptor}();var HttpProviderConfig=function(){function HttpProviderConfig($httpProvider){this.$httpProvider=$httpProvider;$httpProvider.interceptors.push(Interceptor.Factory)}HttpProviderConfig.$inject=["$httpProvider"];return HttpProviderConfig}();angular.module("satellizer",[]).provider("$auth",["SatellizerConfig",function(SatellizerConfig){return new AuthProvider(SatellizerConfig)}]).constant("SatellizerConfig",Config.getConstant).service("SatellizerShared",Shared).service("SatellizerLocal",Local).service("SatellizerPopup",Popup).service("SatellizerOAuth",OAuth).service("SatellizerOAuth2",OAuth2).service("SatellizerOAuth1",OAuth1).service("SatellizerStorage",Storage).service("SatellizerInterceptor",Interceptor).config(function($httpProvider){return new HttpProviderConfig($httpProvider)});var ng1="satellizer";return ng1});
\ No newline at end of file
diff --git a/examples/client/vendor/satellizer.js b/examples/client/vendor/satellizer.js
index 6bfd82c4..0a5e4361 100644
--- a/examples/client/vendor/satellizer.js
+++ b/examples/client/vendor/satellizer.js
@@ -1,5 +1,5 @@
/**
- * Satellizer 0.15.0
+ * Satellizer 0.15.1
* (c) 2016 Sahat Yalkabov
* License: MIT
*/
@@ -49,7 +49,7 @@
display: 'popup',
oauthType: '2.0',
popupOptions: { width: 452, height: 633 },
- state: function () { encodeURIComponent(Math.random().toString(36).substr(2)); }
+ state: function () { return encodeURIComponent(Math.random().toString(36).substr(2)); }
},
github: {
name: 'github',
@@ -677,7 +677,6 @@
return new Promise(function (resolve, reject) {
Object.assign(_this.defaults, options);
_this.$timeout(function () {
- var url = [_this.defaults.authorizationEndpoint, _this.buildQueryString()].join('?');
var stateName = _this.defaults.name + '_state';
var _a = _this.defaults, name = _a.name, state = _a.state, popupOptions = _a.popupOptions, redirectUri = _a.redirectUri, responseType = _a.responseType;
if (typeof state === 'function') {
@@ -686,6 +685,7 @@
else if (typeof state === 'string') {
_this.SatellizerStorage.set(stateName, state);
}
+ var url = [_this.defaults.authorizationEndpoint, _this.buildQueryString()].join('?');
_this.SatellizerPopup.open(url, name, popupOptions);
_this.SatellizerPopup.polling(redirectUri).then(function (oauth) {
if (responseType === 'token' || !url) {
@@ -826,11 +826,10 @@
this.$window = $window;
this.SatellizerConfig = SatellizerConfig;
this.memoryStore = {};
- this.storageType = SatellizerConfig.storageType;
}
Storage.prototype.get = function (key) {
try {
- return this.$window[this.storageType].getItem(key);
+ return this.$window[this.SatellizerConfig.storageType].getItem(key);
}
catch (e) {
return this.memoryStore[key];
@@ -838,7 +837,7 @@
};
Storage.prototype.set = function (key, value) {
try {
- this.$window[this.storageType].setItem(key, value);
+ this.$window[this.SatellizerConfig.storageType].setItem(key, value);
}
catch (e) {
this.memoryStore[key] = value;
@@ -846,7 +845,7 @@
};
Storage.prototype.remove = function (key) {
try {
- this.$window[this.storageType].removeItem(key);
+ this.$window[this.SatellizerConfig.storageType].removeItem(key);
}
catch (e) {
delete this.memoryStore[key];
diff --git a/package.json b/package.json
index cef69a33..b6dffff7 100644
--- a/package.json
+++ b/package.json
@@ -1,7 +1,7 @@
{
"name": "satellizer",
"description": "Token-based AngularJS Authentication",
- "version": "0.15.0",
+ "version": "0.15.1",
"main": "dist/satellizer.js",
"scripts": {
"start": "supervisor ./examples/server/node/server.js",