UNPKG

ng-ebi-authorization

Version:

The ng-ebi-authorization is a simple authentication Angular library that relies on EBI's Authentication and Authorization Profile (AAP) infrastructure. After successful login, a JWT token is stored on the browser (via cookie, local or session storage).

1,121 lines (1,108 loc) 42.3 kB
(function (global, factory) { typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@auth0/angular-jwt'), require('@angular/core'), require('@angular/common/http'), require('rxjs'), require('rxjs/operators')) : typeof define === 'function' && define.amd ? define('ng-ebi-authorization', ['exports', '@auth0/angular-jwt', '@angular/core', '@angular/common/http', 'rxjs', 'rxjs/operators'], factory) : (factory((global['ng-ebi-authorization'] = {}),global.angularJwt,global.ng.core,global.ng.common.http,global.RxJS,global.rxjs.operators)); }(this, (function (exports,angularJwt,core,http,rxjs,operators) { 'use strict'; /** * @fileoverview added by tsickle * @suppress {checkTypes,extraRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * The purpose of this very simple service is to interface between the * AuthService and the specific token manipulation routing of JwtHelperService. * In this way, if in the future we want to replace JwtHelperService by * another service, AuthService doesn't need to be modified, only this service. */ var TokenService = /** @class */ (function () { function TokenService(_jwt) { this._jwt = _jwt; } /** * @return {?} */ TokenService.prototype.getToken = /** * @return {?} */ function () { return this._jwt.tokenGetter(); }; /** * @return {?} */ TokenService.prototype.getTokenExpirationDate = /** * @return {?} */ function () { try { return this._jwt.getTokenExpirationDate(); } catch (error) { return null; } }; /** * @return {?} */ TokenService.prototype.isTokenValid = /** * @return {?} */ function () { try { return !this._jwt.isTokenExpired(); } catch (error) { return false; } }; /** * Get claims from the token. * * @param claim The name of the claim * @param defaultValue The default value returned in case of error * * @returns claim or default value */ /** * Get claims from the token. * * @template T, C * @param {?} claim The name of the claim * @param {?} defaultValue The default value returned in case of error * * @return {?} claim or default value */ TokenService.prototype.getClaim = /** * Get claims from the token. * * @template T, C * @param {?} claim The name of the claim * @param {?} defaultValue The default value returned in case of error * * @return {?} claim or default value */ function (claim, defaultValue) { try { /** @type {?} */ var value = ( /** @type {?} */(this._jwt.decodeToken()[claim])); if (value === undefined) { return defaultValue; } return value; } catch (error) { return defaultValue; } }; TokenService.decorators = [ { type: core.Injectable } ]; /** @nocollapse */ TokenService.ctorParameters = function () { return [ { type: angularJwt.JwtHelperService } ]; }; return TokenService; }()); /** * @fileoverview added by tsickle * @suppress {checkTypes,extraRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** @type {?} */ var AAP_CONFIG = new core.InjectionToken('AAP_CONFIG'); /** * @return {?} */ function getToken() { return localStorage.getItem('id_token') || ''; } /** * @return {?} */ function removeToken() { return localStorage.removeItem('id_token'); } /** * @param {?} newToken * @return {?} */ function updateToken(newToken) { return localStorage.setItem('id_token', newToken); } /** @type {?} */ var DEFAULT_CONF = { aapURL: 'https://api.aai.ebi.ac.uk', tokenGetter: getToken, tokenRemover: removeToken, tokenUpdater: updateToken }; /*! ***************************************************************************** Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, MERCHANTABLITY OR NON-INFRINGEMENT. See the Apache Version 2.0 License for specific language governing permissions and limitations under the License. ***************************************************************************** */ var __assign = function () { __assign = Object.assign || function __assign(t) { for (var s, i = 1, n = arguments.length; i < n; i++) { s = arguments[i]; for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; } return t; }; return __assign.apply(this, arguments); }; function __read(o, n) { var m = typeof Symbol === "function" && o[Symbol.iterator]; if (!m) return o; var i = m.call(o), r, ar = [], e; try { while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value); } catch (error) { e = { error: error }; } finally { try { if (r && !r.done && (m = i["return"])) m.call(i); } finally { if (e) throw e.error; } } return ar; } /** * @fileoverview added by tsickle * @suppress {checkTypes,extraRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ var AuthService = /** @class */ (function () { function AuthService(_rendererFactory, _tokenService, _http, config) { var _this = this; this._rendererFactory = _rendererFactory; this._tokenService = _tokenService; this._http = _http; this.config = config; this._user = new rxjs.BehaviorSubject(null); this._currentState = null; // stores the string token or null otherwise (logout) // stores the string token or null otherwise (logout) this._loginCallbacks = []; this._logoutCallbacks = []; this._timeoutID = null; // This two properties are used for inter-window communication. // It is achieve through the update of the dummy key storage '_commKeyName' this._commKeyName = 'AngularAapAuthUpdated'; this._commKeyUpdater = function () { return localStorage.setItem(_this._commKeyName, '' + new Date().getTime()); }; this._domain = encodeURIComponent(window.location.origin); this._appURL = config.aapURL.replace(/\/$/, ''); this._authURL = this._appURL + "/auth"; this._tokenURL = this._appURL + "/token"; this._storageUpdater = config.tokenUpdater; if (config.tokenRemover) { this._storageRemover = config.tokenRemover; } else { this._storageRemover = function () { return config.tokenUpdater(null); }; } /** @type {?} */ var renderer = this._rendererFactory.createRenderer(null, null); this._unlistenEvents = [ this._listenLoginMessage(renderer), this._listenChangesFromOtherWindows(renderer) ]; this._currentState = null; this._updateUser(); // TODO: experiment with setTimeOut } /** * @return {?} */ AuthService.prototype.ngOnDestroy = /** * @return {?} */ function () { this._unlistenEvents.forEach(function (fn) { return fn(); }); }; /** * @return {?} */ AuthService.prototype.user = /** * @return {?} */ function () { return this._user.asObservable(); }; /** * Functions that opens a window instead of a tab. * * See method _filterLoginOptions regarding security risks of certain * LoginOptions. * * @param loginOptions Options passed as URL parameters to the SSO. * @param width Pixel width of the login window. * @param height Pixel height of the login window. * @param top Position of the top corners. If it is a negative * number it centres the login window on the screen. * @param left Position of the left corners. If it is a negative * number it centres the login window on the screen. */ /** * Functions that opens a window instead of a tab. * * See method _filterLoginOptions regarding security risks of certain * LoginOptions. * * @param {?=} options * @param {?=} width Pixel width of the login window. * @param {?=} height Pixel height of the login window. * @param {?=} left Position of the left corners. If it is a negative * number it centres the login window on the screen. * @param {?=} top Position of the top corners. If it is a negative * number it centres the login window on the screen. * @return {?} */ AuthService.prototype.openLoginWindow = /** * Functions that opens a window instead of a tab. * * See method _filterLoginOptions regarding security risks of certain * LoginOptions. * * @param {?=} options * @param {?=} width Pixel width of the login window. * @param {?=} height Pixel height of the login window. * @param {?=} left Position of the left corners. If it is a negative * number it centres the login window on the screen. * @param {?=} top Position of the top corners. If it is a negative * number it centres the login window on the screen. * @return {?} */ function (options, width, height, left, top) { if (width === void 0) { width = 650; } if (height === void 0) { height = 1000; } if (left === void 0) { left = -1; } if (top === void 0) { top = -1; } if (left < 0) { /** @type {?} */ var screenWidth = screen.width; if (screenWidth > width) { left = Math.round((screenWidth - width) / 2); } } if (top < 0) { /** @type {?} */ var screenHeight = screen.height; if (screenHeight > height) { top = Math.round((screenHeight - height) / 2); } } /** @type {?} */ var windowOptions = [ "width=" + width, "height=" + height, "left=" + left, "top=" + top, 'personalbar=no', 'toolbar=no', 'scrollbars=yes', 'resizable=yes', 'directories=no', 'location=no', 'menubar=no', 'titlebar=no', 'toolbar=no' ]; /** @type {?} */ var loginWindow = window.open(this.getSSOURL(options), 'Sign in to Elixir', windowOptions.join(',')); if (loginWindow) { loginWindow.focus(); } }; /** * @deprecated use openLoginWindow method instead (top and left arguments are inverted in the new method) * since version 1.0.0-beta.5. * windowOpen will be deleted in version 1.0.0 */ /** * @deprecated use openLoginWindow method instead (top and left arguments are inverted in the new method) * since version 1.0.0-beta.5. * windowOpen will be deleted in version 1.0.0 * @param {?=} options * @param {?=} width * @param {?=} height * @param {?=} top * @param {?=} left * @return {?} */ AuthService.prototype.windowOpen = /** * @deprecated use openLoginWindow method instead (top and left arguments are inverted in the new method) * since version 1.0.0-beta.5. * windowOpen will be deleted in version 1.0.0 * @param {?=} options * @param {?=} width * @param {?=} height * @param {?=} top * @param {?=} left * @return {?} */ function (options, width, height, top, left) { if (width === void 0) { width = 650; } if (height === void 0) { height = 1000; } if (top === void 0) { top = -1; } if (left === void 0) { left = -1; } this._deprecationWarning('windowOpen', 'openLoginWindow'); this.openLoginWindow(options, width, height, left, top); }; /** * Functions that opens a tab (in modern browser). * * See method _filterLoginOptions regarding security risks of certain * LoginOptions. * * @param loginOptions Options passed as URL parameters to the SSO. */ /** * Functions that opens a tab (in modern browser). * * See method _filterLoginOptions regarding security risks of certain * LoginOptions. * * @param {?=} options * @return {?} */ AuthService.prototype.openLoginTab = /** * Functions that opens a tab (in modern browser). * * See method _filterLoginOptions regarding security risks of certain * LoginOptions. * * @param {?=} options * @return {?} */ function (options) { /** @type {?} */ var loginWindow = window.open(this.getSSOURL(options), 'Sign in to Elixir'); if (loginWindow) { loginWindow.focus(); } }; /** * @deprecated use openLoginTab method instead * since version 1.0.0-beta.5. * tabOpen will be deleted in version 1.0.0 */ /** * @deprecated use openLoginTab method instead * since version 1.0.0-beta.5. * tabOpen will be deleted in version 1.0.0 * @param {?=} options * @return {?} */ AuthService.prototype.tabOpen = /** * @deprecated use openLoginTab method instead * since version 1.0.0-beta.5. * tabOpen will be deleted in version 1.0.0 * @param {?=} options * @return {?} */ function (options) { this._deprecationWarning('tabOpen', 'openLoginTab'); this.openLoginTab(options); }; /** * Produces a URL that allows logging into the single sign on (SSO) page. * The URL cans be opened in a new tab using target="_blank", * or in a new window using window.open(). * * See method _filterLoginOptions regarding security risks of certain * LoginOptions. * * @param loginOptions Options passed as URL parameters to the SSO. * * @returns The SSO URL. * */ /** * Produces a URL that allows logging into the single sign on (SSO) page. * The URL cans be opened in a new tab using target="_blank", * or in a new window using window.open(). * * See method _filterLoginOptions regarding security risks of certain * LoginOptions. * * @param {?=} options * @return {?} The SSO URL. * */ AuthService.prototype.getSSOURL = /** * Produces a URL that allows logging into the single sign on (SSO) page. * The URL cans be opened in a new tab using target="_blank", * or in a new window using window.open(). * * See method _filterLoginOptions regarding security risks of certain * LoginOptions. * * @param {?=} options * @return {?} The SSO URL. * */ function (options) { /** @type {?} */ var fragments = this._formatFragments(__assign({ 'from': this._domain }, options)); return this._appURL + "/sso" + fragments; }; /** * Functions that logs out the user. * It triggers the logout callbacks. * It is an arrow function (lambda) because in that way it has a reference * to 'this' when used in setTimeout call. */ /** * Functions that logs out the user. * It triggers the logout callbacks. * It is an arrow function (lambda) because in that way it has a reference * to 'this' when used in setTimeout call. * @return {?} */ AuthService.prototype.logOut = /** * Functions that logs out the user. * It triggers the logout callbacks. * It is an arrow function (lambda) because in that way it has a reference * to 'this' when used in setTimeout call. * @return {?} */ function () { this._storageRemover(); this._updateUser(); // Triggers updating other windows this._commKeyUpdater(); }; /** * Create AAP account * * @returns uid of the new user */ /** * Create AAP account * * @param {?} newUser * @return {?} uid of the new user */ AuthService.prototype.createAAPaccount = /** * Create AAP account * * @param {?} newUser * @return {?} uid of the new user */ function (newUser) { return this._http.post(this._authURL, newUser, { responseType: 'text' }); }; /** * Login directly through the AAP * * See method _filterLoginOptions regarding security risks of certain * LoginOptions. * * @returns true if the user successfully login, otherwise false */ /** * Login directly through the AAP * * See method _filterLoginOptions regarding security risks of certain * LoginOptions. * * @param {?} user * @param {?=} options * @return {?} true if the user successfully login, otherwise false */ AuthService.prototype.loginAAP = /** * Login directly through the AAP * * See method _filterLoginOptions regarding security risks of certain * LoginOptions. * * @param {?} user * @param {?=} options * @return {?} true if the user successfully login, otherwise false */ function (user, options) { var _this = this; /** @type {?} */ var fragments = this._formatFragments(options); return this._http.get("" + this._authURL + fragments, { headers: this._createAuthHeader(user), responseType: 'text' }).pipe(operators.tap(function (token) { _this._storageRemover(); _this._storageUpdater(token); _this._updateUser(); // Triggers updating other windows _this._commKeyUpdater(); }), operators.map(Boolean)); }; /** * Change password AAP account * * @returns true when password is successfully changed */ /** * Change password AAP account * * @param {?} __0 * @return {?} true when password is successfully changed */ AuthService.prototype.changePasswordAAP = /** * Change password AAP account * * @param {?} __0 * @return {?} true when password is successfully changed */ function (_a) { var username = _a.username, oldPassword = _a.oldPassword, newPassword = _a.newPassword; return this._http.patch(this._authURL, { username: username, password: newPassword }, { headers: this._createAuthHeader({ username: username, password: oldPassword }) }).pipe(operators.map(function (response) { return true; }) // response is empty, but if it reaches this point the request has successfully completed ); }; /** * Add a callback to the LogIn event. * * @param callback The Function called when the login event is triggered and the * JWT token is received and accepted. * * @returns The event registration id (necessary to unregister the event). */ /** * Add a callback to the LogIn event. * * @param {?} callback The Function called when the login event is triggered and the * JWT token is received and accepted. * * @return {?} The event registration id (necessary to unregister the event). */ AuthService.prototype.addLogInEventListener = /** * Add a callback to the LogIn event. * * @param {?} callback The Function called when the login event is triggered and the * JWT token is received and accepted. * * @return {?} The event registration id (necessary to unregister the event). */ function (callback) { return this._loginCallbacks.push(callback); }; /** * Remove a callback from the LogIn event. * * @param id The id given when event listener was added. * * @returns true when remove successfully, false otherwise. */ /** * Remove a callback from the LogIn event. * * @param {?} id The id given when event listener was added. * * @return {?} true when remove successfully, false otherwise. */ AuthService.prototype.removeLogInEventListener = /** * Remove a callback from the LogIn event. * * @param {?} id The id given when event listener was added. * * @return {?} true when remove successfully, false otherwise. */ function (id) { return delete this._loginCallbacks[id - 1]; }; /** * Add a callback to the LogOut event. * * @param callback The Function called when the logout event is triggered and the * JWT token is received and accepted. * * @returns The registration id (necessary to unregister the event). */ /** * Add a callback to the LogOut event. * * @param {?} callback The Function called when the logout event is triggered and the * JWT token is received and accepted. * * @return {?} The registration id (necessary to unregister the event). */ AuthService.prototype.addLogOutEventListener = /** * Add a callback to the LogOut event. * * @param {?} callback The Function called when the logout event is triggered and the * JWT token is received and accepted. * * @return {?} The registration id (necessary to unregister the event). */ function (callback) { return this._logoutCallbacks.push(callback); }; /** * Remove a callback from the LogOut event. * * @param id The id given when event listener was added. * * @returns true when remove successfully, false otherwise. */ /** * Remove a callback from the LogOut event. * * @param {?} id The id given when event listener was added. * * @return {?} true when remove successfully, false otherwise. */ AuthService.prototype.removeLogOutEventListener = /** * Remove a callback from the LogOut event. * * @param {?} id The id given when event listener was added. * * @return {?} true when remove successfully, false otherwise. */ function (id) { return delete this._logoutCallbacks[id - 1]; }; /** * Refresh token * * @returns true when token is successfully refreshed */ /** * Refresh token * * @return {?} true when token is successfully refreshed */ AuthService.prototype.refresh = /** * Refresh token * * @return {?} true when token is successfully refreshed */ function () { var _this = this; return this._http.get(this._tokenURL, { responseType: 'text' }).pipe(operators.tap(function (token) { _this._storageRemover(); _this._storageUpdater(token); _this._updateUser(); // Triggers updating other windows _this._commKeyUpdater(); }), operators.map(Boolean)); }; /** * Format and filter fragment options * * @params options * * @returns fragment string */ /** * Format and filter fragment options * * \@params options * * @private * @param {?=} options * @return {?} fragment string */ AuthService.prototype._formatFragments = /** * Format and filter fragment options * * \@params options * * @private * @param {?=} options * @return {?} fragment string */ function (options) { if (options) { this._filterLoginOptions(options); return '?' + Object.entries(options) .map(function (_a) { var _b = __read(_a, 2), key = _b[0], value = _b[1]; return key + "=" + value; }).join('&'); } return ''; }; /** * Filters options that are unsecure. * * See the advance options that can be requested through the options parameter: * https://api.aai.ebi.ac.uk/docs/authentication/authentication.index.html#_common_attributes * * The time to live paramenter (ttl) default value is 60 minutes. It is a * big security risk to request longer ttl. If a third party gets hold of * such token, means that they could use it for a day, week, year * (essentially, like having the username/password). * * @param loginOptions Options passed as URL parameters to the SSO. * * */ /** * Filters options that are unsecure. * * See the advance options that can be requested through the options parameter: * https://api.aai.ebi.ac.uk/docs/authentication/authentication.index.html#_common_attributes * * The time to live paramenter (ttl) default value is 60 minutes. It is a * big security risk to request longer ttl. If a third party gets hold of * such token, means that they could use it for a day, week, year * (essentially, like having the username/password). * * @private * @param {?} options * @return {?} */ AuthService.prototype._filterLoginOptions = /** * Filters options that are unsecure. * * See the advance options that can be requested through the options parameter: * https://api.aai.ebi.ac.uk/docs/authentication/authentication.index.html#_common_attributes * * The time to live paramenter (ttl) default value is 60 minutes. It is a * big security risk to request longer ttl. If a third party gets hold of * such token, means that they could use it for a day, week, year * (essentially, like having the username/password). * * @private * @param {?} options * @return {?} */ function (options) { if (Object.keys(options).indexOf('ttl') > -1) { /** @type {?} */ var ttl = +options['ttl']; /** @type {?} */ var softLimit = 60; /** @type {?} */ var hardLimit = 60 * 24; if (ttl > hardLimit) { throw (new Error("Login requested with an expiration longer than " + hardLimit + " minutes! This is not allowed.")); } if (ttl > softLimit) { window.console.warn("Login requested with an expiration longer than " + softLimit + " minutes!"); } } }; /** * Creates Authorization header * * @param object with username and password. * * @returns New authorization header */ /** * Creates Authorization header * * @private * @param {?} __0 * @return {?} New authorization header */ AuthService.prototype._createAuthHeader = /** * Creates Authorization header * * @private * @param {?} __0 * @return {?} New authorization header */ function (_a) { var username = _a.username, password = _a.password; /** @type {?} */ var authToken = btoa(username + ":" + password); return new http.HttpHeaders({ 'Authorization': "Basic " + authToken }); }; /** * Listen for login messages from other windows. * These messages contain the tokens from the AAP. * If a token is received then the callbacks are triggered. */ /** * Listen for login messages from other windows. * These messages contain the tokens from the AAP. * If a token is received then the callbacks are triggered. * @private * @param {?} renderer * @return {?} */ AuthService.prototype._listenLoginMessage = /** * Listen for login messages from other windows. * These messages contain the tokens from the AAP. * If a token is received then the callbacks are triggered. * @private * @param {?} renderer * @return {?} */ function (renderer) { var _this = this; return renderer.listen('window', 'message', function (event) { if (!_this._messageIsAcceptable(event)) { return; } _this._storageUpdater(event.data); // I don't know how to type guard event.source // This doesn't work // if (event.source instanceof Window) { if (event.source) { (( /** @type {?} */(event.source))).close(); } _this._updateUser(); // Triggers updating other windows _this._commKeyUpdater(); }); }; /** Listen to changes in the token from *other* windows. * * For inter-window communication messages are transmitted trough changes * on a dummy storage key property: '_commKeyName'. * * Notice that changes in the '_commKeyName' produced by this class doesn't * trigger this event. */ /** * Listen to changes in the token from *other* windows. * * For inter-window communication messages are transmitted trough changes * on a dummy storage key property: '_commKeyName'. * * Notice that changes in the '_commKeyName' produced by this class doesn't * trigger this event. * @private * @param {?} renderer * @return {?} */ AuthService.prototype._listenChangesFromOtherWindows = /** * Listen to changes in the token from *other* windows. * * For inter-window communication messages are transmitted trough changes * on a dummy storage key property: '_commKeyName'. * * Notice that changes in the '_commKeyName' produced by this class doesn't * trigger this event. * @private * @param {?} renderer * @return {?} */ function (renderer) { var _this = this; return renderer.listen('window', 'storage', function (event) { if (event.key === _this._commKeyName) { _this._updateUser(); } }); }; /** * Check if the message is coming from the same domain we use to generate * the SSO URL, otherwise it's iffy and shouldn't trust it. */ /** * Check if the message is coming from the same domain we use to generate * the SSO URL, otherwise it's iffy and shouldn't trust it. * @private * @param {?} event * @return {?} */ AuthService.prototype._messageIsAcceptable = /** * Check if the message is coming from the same domain we use to generate * the SSO URL, otherwise it's iffy and shouldn't trust it. * @private * @param {?} event * @return {?} */ function (event) { return event.origin === this._appURL; }; /** * @private * @return {?} */ AuthService.prototype._updateUser = /** * @private * @return {?} */ function () { var _this = this; if (this._timeoutID) { window.clearTimeout(this._timeoutID); } if (this._tokenService.isTokenValid()) { /** @type {?} */ var token = ( /** @type {?} */(this._tokenService.getToken())); this._user.next({ uid: this._getClaim('sub'), name: this._getClaim('name'), nickname: this._getClaim('nickname'), email: this._getClaim('email'), token: token }); if (this._currentState === null) { // this._loginCallbacks is an empty list when first called from the constructor. // Latter it could be filled as clients of the library call `this.addLogInEventListener(myfunction)` this._loginCallbacks.forEach(function (callback) { return callback(); }); } // Schedule future logout event base on token expiration /** @type {?} */ var expireDate = ( /** @type {?} */(this._tokenService.getTokenExpirationDate())); // Coercing dates to numbers with the unary operator '+' /** @type {?} */ var delay = +expireDate - +new Date(); this._timeoutID = window.setTimeout(function () { return _this.logOut(); }, delay); if (this._currentState !== token) { this._currentState = token; } } else { this._storageRemover(); // Cleanup possible left behind token if (this._currentState !== null) { // this._logoutCallbacks is an empty list when first called from the constructor. // Latter it could be filled as clients of the library call `this.addLogOutEventListener(myfunction)` this._logoutCallbacks.forEach(function (callback) { return callback(); }); this._user.next(null); } this._currentState = null; } }; /** * @private * @param {?} claim * @return {?} */ AuthService.prototype._getClaim = /** * @private * @param {?} claim * @return {?} */ function (claim) { return this._tokenService.getClaim(claim, ''); }; /** * @private * @param {?} oldMethod * @param {?} newMethod * @return {?} */ AuthService.prototype._deprecationWarning = /** * @private * @param {?} oldMethod * @param {?} newMethod * @return {?} */ function (oldMethod, newMethod) { window.console.warn("Method '" + oldMethod + "' has been deprecated, please use '" + newMethod + "' method instead"); }; AuthService.decorators = [ { type: core.Injectable } ]; /** @nocollapse */ AuthService.ctorParameters = function () { return [ { type: core.RendererFactory2 }, { type: TokenService }, { type: http.HttpClient }, { type: undefined, decorators: [{ type: core.Inject, args: [AAP_CONFIG,] }] } ]; }; return AuthService; }()); /** * @fileoverview added by tsickle * @suppress {checkTypes,extraRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ var AuthModule = /** @class */ (function () { function AuthModule(parentModule) { if (parentModule) { throw new Error('AuthModule is already loaded. It should only be imported in your application\'s main module.'); } } /** * @param {?=} options * @return {?} */ AuthModule.forRoot = /** * @param {?=} options * @return {?} */ function (options) { return { ngModule: AuthModule, providers: [ TokenService, { provide: AAP_CONFIG, useValue: options ? options : DEFAULT_CONF }, AuthService ] }; }; AuthModule.decorators = [ { type: core.NgModule, args: [{},] } ]; /** @nocollapse */ AuthModule.ctorParameters = function () { return [ { type: AuthModule, decorators: [{ type: core.Optional }, { type: core.SkipSelf }] } ]; }; return AuthModule; }()); /** * @fileoverview added by tsickle * @suppress {checkTypes,extraRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * @fileoverview added by tsickle * @suppress {checkTypes,extraRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ exports.AuthModule = AuthModule; exports.AuthService = AuthService; exports.TokenService = TokenService; exports.ɵb = AAP_CONFIG; exports.ɵf = DEFAULT_CONF; exports.ɵc = getToken; exports.ɵd = removeToken; exports.ɵe = updateToken; Object.defineProperty(exports, '__esModule', { value: true }); }))); //# sourceMappingURL=ng-ebi-authorization.umd.js.map