diff --git a/.gitignore b/.gitignore index 6f889bf06b..dcc8013c90 100644 --- a/.gitignore +++ b/.gitignore @@ -255,5 +255,4 @@ paket-files/ lib/*.js lib/*.js.map #tests/unit/*.js # TODO add these once the unit tests are in TS -#tests/unit/*.js.map -out \ No newline at end of file +#tests/unit/*.js.map \ No newline at end of file diff --git a/lib/AccessTokenCacheItem.ts b/lib/AccessTokenCacheItem.ts index 3208c8c588..4ac359ae74 100644 --- a/lib/AccessTokenCacheItem.ts +++ b/lib/AccessTokenCacheItem.ts @@ -1,6 +1,3 @@ -/// -/// - namespace MSAL { export class AccessTokenCacheItem { key: AccessTokenKey; @@ -10,4 +7,5 @@ namespace MSAL { this.value = value; } } -} \ No newline at end of file +} + diff --git a/lib/AccessTokenKey.ts b/lib/AccessTokenKey.ts index 56d1e38e7e..7acfccfd53 100644 --- a/lib/AccessTokenKey.ts +++ b/lib/AccessTokenKey.ts @@ -2,14 +2,14 @@ namespace MSAL { export class AccessTokenKey { authority: string; clientId: string; - user: User; + userIdentifier: string; Scopes: string; - constructor(authority: string, clientId: string, user: User, scopes: string) { + constructor(authority: string, clientId: string, scopes: string, userIdentifier: string) { this.authority = authority; this.clientId = clientId; this.Scopes = scopes; - this.user = user; + this.userIdentifier = userIdentifier; } } -} \ No newline at end of file +} diff --git a/lib/AccessTokenValue.ts b/lib/AccessTokenValue.ts index 338e10776d..f9e143c6fe 100644 --- a/lib/AccessTokenValue.ts +++ b/lib/AccessTokenValue.ts @@ -7,4 +7,4 @@ namespace MSAL { this.ExpiresIn = expiresIn; } } -} \ No newline at end of file +} diff --git a/lib/AuthenticationRequestParameters.ts b/lib/AuthenticationRequestParameters.ts index 7f6fa5f0f3..256ae02848 100644 --- a/lib/AuthenticationRequestParameters.ts +++ b/lib/AuthenticationRequestParameters.ts @@ -1,4 +1,10 @@ namespace MSAL { + + export enum ResponseTypes { + id_token, + token + } + export class AuthenticationRequestParameters { authority: string; clientId: string; @@ -23,19 +29,20 @@ namespace MSAL { this.redirectUri = redirectUri; // randomly generated values if (responseType !== "token") { - this.nonce = Utils.Guid(); + this.nonce = Utils.CreateNewGuid(); } - this.correlationId = Utils.Guid(); - this.state = Utils.Guid(); - this.nonce = Utils.Guid(); + this.correlationId = Utils.CreateNewGuid(); + this.state = Utils.CreateNewGuid(); + this.nonce = Utils.CreateNewGuid(); // telemetry information this.xClientSku = "Js"; this.xClientVer = Utils.GetLibraryVersion(); } CreateNavigateUrl(scopes: Array): string { - if (!scopes) + if (!scopes) { scopes = [this.clientId]; + } let requestUrl = ""; let str: Array = []; str.push('?response_type=' + this.responseType); @@ -76,4 +83,4 @@ namespace MSAL { return scopeList; } } -} \ No newline at end of file +} diff --git a/lib/Constants.ts b/lib/Constants.ts index 35af2f3cea..06d9f72ab3 100644 --- a/lib/Constants.ts +++ b/lib/Constants.ts @@ -5,19 +5,19 @@ namespace MSAL { static get accessToken(): string { return "access_token"; } static get expiresIn(): string { return "expires_in"; } static get sessionState(): string { return "session_state"; } - static get tokenKeys(): string { return "adal.token.keys"; } - static get accessTokenKey(): string { return "adal.access.token.key"; } - static get expirationKey(): string { return "adal.expiration.key"; } - static get stateLogin(): string { return "adal.state.login"; } - static get stateAcquireToken(): string { return "adal.state.acquireToken"; } - static get stateRenew(): string { return "adal.state.renew"; } - static get nonceIdToken(): string { return "adal.nonce.idtoken"; } - static get userName(): string { return "adal.username"; } - static get idTokenKey(): string { return "adal.idtoken"; } - static get error(): string { return "adal.error"; } - static get loginRequest(): string { return "adal.login.request"; } - static get loginError(): string { return "adal.login.error"; } - static get renewStatus(): string { return "adal.token.renew.status"; } + static get tokenKeys(): string { return "msal.token.keys"; } + static get accessTokenKey(): string { return "msal.access.token.key"; } + static get expirationKey(): string { return "msal.expiration.key"; } + static get stateLogin(): string { return "msal.state.login"; } + static get stateAcquireToken(): string { return "msal.state.acquireToken"; } + static get stateRenew(): string { return "msal.state.renew"; } + static get nonceIdToken(): string { return "msal.nonce.idtoken"; } + static get userName(): string { return "msal.username"; } + static get idTokenKey(): string { return "msal.idtoken"; } + static get error(): string { return "msal.error"; } + static get loginRequest(): string { return "msal.login.request"; } + static get loginError(): string { return "msal.login.error"; } + static get renewStatus(): string { return "msal.token.renew.status"; } static get resourceDelimeter(): string { return "|"; } private static _loadFrameTimeout: number = 6000; static get loadFrameTimeout(): number { @@ -43,4 +43,4 @@ namespace MSAL { static get renewToken(): string { return "renewToken"; } static get unknown(): string { return "UNKNOWN"; } } -} \ No newline at end of file +} diff --git a/lib/Logger.ts b/lib/Logger.ts index 6bfc22960a..e9110eba5e 100644 --- a/lib/Logger.ts +++ b/lib/Logger.ts @@ -1,47 +1,106 @@ namespace MSAL { - export enum LoggingLevel { - ERROR, - WARN, - INFO, - VERBOSE + + export interface ILoggerCallback { + (level: LogLevel, message: string,containsPii:boolean): void; + } + + export enum LogLevel { + Error, + Warning, + Info, + Verbose } - export class Logger { - static log(level: number, message: string, error: string): void { - if (level <= Logging._logLevel) { - var timestamp = new Date().toUTCString(); - var formattedMessage = ''; - if (Logging._correlationId) - formattedMessage = timestamp + ':' + Logging._correlationId + '-' + this.libVersion() + '-' + LoggingLevel[level] + ' ' + message; - else - formattedMessage = timestamp + ':' + this.libVersion() + '-' + LoggingLevel[level] + ' ' + message; - if (error) { - formattedMessage += '\nstack:\n' + error; - } - - if (Logging._loginCallback) - Logging._loginCallback(formattedMessage); + export class Logger {// Singleton Class + private static _instance: Logger; + private _correlationId: string; + get correlationId(): string { return this._correlationId; } + set correlationId(correlationId: string) { + this._correlationId = correlationId; + }; + private _level: LogLevel = LogLevel.Info; + get level(): LogLevel { return this._level; } + set level(logLevel: LogLevel) { + if (LogLevel[logLevel]) { + this._level = logLevel; + } + else throw new Error("Provide a valid value for level. Possibles range for logLevel is 0-3"); + }; + + private _piiLoggingEnabled: boolean = false; + get piiLoggingEnabled(): boolean { return this._piiLoggingEnabled; } + set piiLoggingEnabled(piiLoggingEnabled: boolean) { + this._piiLoggingEnabled = piiLoggingEnabled; + }; + + private _localCallback: ILoggerCallback; + get localCallback(): ILoggerCallback { return this._localCallback; } + set localCallback(localCallback: ILoggerCallback) { + if (this.localCallback) { + throw new Error("MSAL logging callback can only be set once per process and should never change once set."); + } + this._localCallback = localCallback; + }; + + constructor(correlationId: string) { + if (Logger._instance) { + return Logger._instance; + } + this._correlationId = correlationId; + Logger._instance = this; + } + + private LogMessage(logMessage: string, logLevel: LogLevel, containsPii: boolean) { + if ((logLevel > this.level) || (!this.piiLoggingEnabled && containsPii)) { + return; } + var timestamp = new Date().toUTCString(); + var log: string = ''; + if (!Utils.isEmpty(this.correlationId)) { + log = timestamp + ':' + this._correlationId + '-' + Utils.GetLibraryVersion() + '-' + LogLevel[logLevel] + ' ' + logMessage; + } + else { + log = timestamp + ':' + Utils.GetLibraryVersion() + '-' + LogLevel[logLevel] + ' ' + logMessage; + } + this.executeCallback(logLevel, log, containsPii); + } + + executeCallback(level: LogLevel, message: string, containsPii: boolean) { + if (this.localCallback) { + this.localCallback(level, message, containsPii); + } + } + + error(message: string): void { + this.LogMessage(message, LogLevel.Error, false); + } + + errorPii(message: string): void { + this.LogMessage(message, LogLevel.Error, true); + } + + warning(message: string): void { + this.LogMessage(message, LogLevel.Warning, false); } - static error(message: string, error: string): void { - this.log(LoggingLevel.ERROR, message, error); + warningPii(message: string): void { + this.LogMessage(message, LogLevel.Warning, true); } - static warn(message: string): void { - this.log(LoggingLevel.WARN, message, null); + info(message: string): void { + this.LogMessage(message, LogLevel.Info, false); } - static info(message: string): void { - this.log(LoggingLevel.INFO, message, null); + infoPii(message: string): void { + this.LogMessage(message, LogLevel.Info, true); } - static verbose(message: string): void { - this.log(LoggingLevel.VERBOSE, message, null); + verbose(message: string): void { + this.LogMessage(message, LogLevel.Verbose, false); } - static libVersion(): string { - return '1.0.0'; + verbosePii(message: string): void { + this.LogMessage(message, LogLevel.Verbose, true); } } -} \ No newline at end of file +} diff --git a/lib/Logging.ts b/lib/Logging.ts deleted file mode 100644 index c2d38212b4..0000000000 --- a/lib/Logging.ts +++ /dev/null @@ -1,12 +0,0 @@ -namespace MSAL { - export class Logging { - static _logLevel: number = 0; - static _loginCallback: Function = null; - static _correlationId: string = null; - static initialize(logLevel: number, loginCallback: Function, correlationId?: string) { - this._logLevel = logLevel; - this._loginCallback = loginCallback; - this._correlationId = correlationId; - } - } -} \ No newline at end of file diff --git a/lib/RequestContext.ts b/lib/RequestContext.ts new file mode 100644 index 0000000000..dfed39e62b --- /dev/null +++ b/lib/RequestContext.ts @@ -0,0 +1,19 @@ +namespace MSAL {// Singleton Class + export class RequestContext { + private static _instance: RequestContext; + private _correlationId: string; + get correlationId(): string { return this._correlationId;} + private _logger: Logger; + get logger(): Logger { return this._logger; } + + constructor(correlationId: string) { + if (RequestContext._instance) { + return RequestContext._instance; + } + + this._logger = new Logger(correlationId); + this._correlationId = this._logger.correlationId; + RequestContext._instance = this; + } + } +} diff --git a/lib/RequestInfo.ts b/lib/RequestInfo.ts index 3ea0705182..eff3f71da4 100644 --- a/lib/RequestInfo.ts +++ b/lib/RequestInfo.ts @@ -5,7 +5,6 @@ namespace MSAL { stateMatch: boolean; stateResponse: string; requestType: string; - constructor() { this.valid = false; this.parameters = {}; @@ -14,4 +13,4 @@ namespace MSAL { this.requestType = 'unknown'; } } -} \ No newline at end of file +} diff --git a/lib/ResponseTypes.ts b/lib/ResponseTypes.ts deleted file mode 100644 index 6f1ee4bb28..0000000000 --- a/lib/ResponseTypes.ts +++ /dev/null @@ -1,6 +0,0 @@ -namespace MSAL { - export enum ResponseTypes { - id_token, - token - } -} \ No newline at end of file diff --git a/lib/Storage.ts b/lib/Storage.ts index 6e9a3c8d6f..d4ab3696f0 100644 --- a/lib/Storage.ts +++ b/lib/Storage.ts @@ -1,13 +1,18 @@ namespace MSAL { - export class Storage { + export class Storage {// Singleton + private static _instance: Storage; private _localStorageSupported: boolean; private _sessionStorageSupported: boolean; private _cacheLocation: string; constructor(cacheLocation: string) { + if (Storage._instance) { + return Storage._instance; + } this._cacheLocation = cacheLocation; this._localStorageSupported = typeof window[this._cacheLocation] != "undefined" && window[this._cacheLocation] != null; this._sessionStorageSupported = typeof window[cacheLocation] != "undefined" && window[cacheLocation] != null; + Storage._instance = this; if (!this._localStorageSupported && !this._sessionStorageSupported) throw new Error('localStorage and sessionStorage not supported'); } @@ -65,4 +70,4 @@ namespace MSAL { return results; } } -} \ No newline at end of file +} diff --git a/lib/User.ts b/lib/User.ts index fec68213df..809c00b4b6 100644 --- a/lib/User.ts +++ b/lib/User.ts @@ -1,6 +1,6 @@ namespace MSAL { - export class User { + export interface User { username: string; profile: any; } -} \ No newline at end of file +} diff --git a/lib/UserAgentApplication.ts b/lib/UserAgentApplication.ts index 37b612f514..2311cbafe9 100644 --- a/lib/UserAgentApplication.ts +++ b/lib/UserAgentApplication.ts @@ -1,12 +1,17 @@ -/// - namespace MSAL { + export class UserAgentApplication { + private _cacheLocations = { localStorage: 'localStorage', sessionStorage: 'sessionStorage' }; + private _cacheLocation: string = 'sessionStorage'; + get cacheLocation() { + return this._cacheLocation; + } + set cacheLocation(cache: string) { this._cacheLocation = cache; if (this._cacheLocations[cache]) @@ -14,32 +19,33 @@ namespace MSAL { else throw new Error('Cache Location is not valid. Provided value:' + this._cacheLocation + '.Possible values are: ' + this._cacheLocations.localStorage + ', ' + this._cacheLocations.sessionStorage); } - get cacheLocation() { - return this._cacheLocation; - } + private _interactionModes = { popUp: 'popUp', redirect: 'redirect' } + private _interactionMode: string = 'redirect'; + get interactionMode() { + return this._interactionMode; + } + set interactionMode(mode: string) { if (this._interactionModes[mode]) this._interactionMode = this._interactionModes[mode]; else throw new Error('Interantion mode is not valid. Provided value:' + this._interactionMode + '.Possible values are: ' + this._interactionModes.redirect + ',' + this._interactionModes.popUp); } - get interactionMode() { - return this._interactionMode; - } + + private _requestContext: RequestContext; private _loginInProgress: boolean; private _acquireTokenInProgress: boolean; private _checkSessionIframe: HTMLIFrameElement; private _renewStates: Array; private _activeRenewals: Object; - private _sessionState: string; private _clockSkew: number = 300; private _cacheStorage: Storage; - private _userCallback: Function = null; + private _userCallback: (errorDesc: string, token: string, error: string) => void = null; user: User; clientId: string; authority: string = "https://login.microsoftonline.com/common"; @@ -49,7 +55,7 @@ namespace MSAL { // validatAuthority: boolean = true; This will be implemented after the build. Only scenarios that will be affected are the ones where the authority is dynamically discovered. navigateToLoginRequestUrl: boolean = true; - constructor(clientId: string, authority?: string, userCallback?: Function) { + constructor(clientId: string, authority: string, userCallback: (errorDesc: string, token: string, error: string) => void) { this.clientId = clientId; if (authority) this.authority = authority; @@ -62,7 +68,8 @@ namespace MSAL { this._renewStates = []; this._checkSessionIframe = null; this._activeRenewals = {}; - this._cacheStorage = new Storage(this._cacheLocation); + this._cacheStorage = new Storage(this._cacheLocation);//cache keys msal + this._requestContext = new RequestContext(''); window.MSAL = this; window.callBackMappedToRenewStates = {}; window.callBacksMappedToRenewStates = {}; @@ -77,6 +84,7 @@ namespace MSAL { if (this._loginInProgress) { return; } + let authenticationRequest: AuthenticationRequestParameters = new AuthenticationRequestParameters(this.authority, this.clientId, null, ResponseTypes[ResponseTypes.id_token], this.redirectUri); this._cacheStorage.saveItem(Constants.loginRequest, window.location.href); this._cacheStorage.saveItem(Constants.loginError, ''); @@ -102,14 +110,16 @@ namespace MSAL { if (popupWindow == null) { instance._loginInProgress = false; instance._acquireTokenInProgress = false - Logger.warn('Popup Window is null. This can happen if you are using IE'); + this._requestContext.logger.info('Popup Window is null. This can happen if you are using IE'); this._cacheStorage.saveItem(Constants.error, 'Error opening popup'); this._cacheStorage.saveItem(Constants.errorDescription, 'Popup Window is null. This can happen if you are using IE'); this._cacheStorage.saveItem(Constants.loginError, 'Popup Window is null. This can happen if you are using IE'); - if (callback) + if (callback) { callback(this._cacheStorage.getItem(Constants.loginError), null, null); + } return; } + var self = this; var pollTimer = window.setInterval(function () { if (!popupWindow || popupWindow.closed || popupWindow.closed === undefined) { @@ -123,28 +133,49 @@ namespace MSAL { window.clearInterval(pollTimer); instance._loginInProgress = false; instance._acquireTokenInProgress = false; - Logger.info("Closing popup window"); + self._requestContext.logger.info("Closing popup window"); popupWindow.close(); } } catch (e) { //Cross Domain url check error. Will be thrown until AAD redirects the user back to the app's root page with the token. No need to log or throw this error as it will create unnecessary traffic. } }, interval); + } logout(): void { - this._cacheStorage.clear(); + this.clearCache(); this.user = null; var logout = ''; if (this.postLogoutredirectUri) { logout = 'post_logout_redirect_uri=' + encodeURIComponent(this.postLogoutredirectUri); } + let urlNavigate: string = this.authority + '/oauth2/v2.0/logout?' + logout; if (urlNavigate) { window.location.replace(urlNavigate); } } + private clearCache(): void { + this._cacheStorage.saveItem(Constants.sessionState, ''); + this._cacheStorage.saveItem(Constants.stateLogin, ''); + this._renewStates = []; + this._cacheStorage.saveItem(Constants.idTokenKey, ''); + this._cacheStorage.saveItem(Constants.error, ''); + this._cacheStorage.saveItem(Constants.errorDescription, ''); + var keys = this._cacheStorage.getItem(Constants.tokenKeys); + if (!Utils.isEmpty(keys)) { + let keysArray:Array = keys.split(Constants.resourceDelimeter); + for (var i = 0; i < keysArray.length-1; i++) { + this._cacheStorage.saveItem(Constants.accessTokenKey + keysArray[i], ''); + this._cacheStorage.saveItem(Constants.expirationKey + keysArray[i], '0'); + } + } + + this._cacheStorage.saveItem(Constants.tokenKeys, ''); + } + private openPopup(urlNavigate: string, title: string, popUpWidth: number, popUpHeight: number) { try { /** @@ -166,9 +197,10 @@ namespace MSAL { if (popupWindow.focus) { popupWindow.focus(); } + return popupWindow; } catch (e) { - Logger.warn('error opening popup, ' + e.message); + this._requestContext.logger.error('error opening popup ' + e.message); this._loginInProgress = false; return null; } @@ -188,9 +220,8 @@ namespace MSAL { throw new Error('API does not accept offline_access as a user-provided scope'); } if (scopes.indexOf(this.clientId) > -1) { - if (scopes.length > 1) { + if (scopes.length > 1) throw new Error('Client Id can only be provided as a single scope'); - } } } @@ -199,6 +230,7 @@ namespace MSAL { if (!window.callBacksMappedToRenewStates[expectedState]) { window.callBacksMappedToRenewStates[expectedState] = []; } + var self = this; window.callBacksMappedToRenewStates[expectedState].push(callback); if (!window.callBackMappedToRenewStates[expectedState]) { @@ -209,7 +241,7 @@ namespace MSAL { window.callBacksMappedToRenewStates[expectedState][i](errorDesc, token, error); } catch (error) { - Logger.warn(error); + self._requestContext.logger.warning(error); } } window.callBacksMappedToRenewStates[expectedState] = null; @@ -223,11 +255,10 @@ namespace MSAL { let accessTokenItems: Array = []; // Array to store multiple accessTokens for the same set of scopes for (let i = 0; i < accessTokenCacheItems.length; i++) { let accessTokenCacheItem = accessTokenCacheItems[i]; - if (accessTokenCacheItem.key.user.profile.oid === this.user.profile.oid) { + if (accessTokenCacheItem.key.userIdentifier === this.user.profile.oid) { let cachedScopes = accessTokenCacheItem.key.Scopes.split(' '); - if (Utils.containsScope(cachedScopes, scopes)) { + if (Utils.containsScope(cachedScopes, scopes)) accessTokenItems.push(accessTokenCacheItem); - } } } if (accessTokenItems.length === 0 || accessTokenCacheItems.length > 1) @@ -237,10 +268,10 @@ namespace MSAL { var expired: number = Number(accessTokenCacheItem.value.ExpiresIn); // If expiration is within offset, it will force renew var offset = this._clockSkew || 300; - if (expired && (expired > Utils.now() + offset)) { + if (expired && (expired > Utils.now() + offset)) return accessTokenCacheItem.value.AccessToken; - } else { - this._cacheStorage.removeItem(JSON.stringify(accessTokenItems[0])); + else { + this._cacheStorage.removeItem(JSON.stringify(accessTokenItems[0].key)); return null; } } @@ -255,6 +286,7 @@ namespace MSAL { else { urlNavigate += '&login_hint=' + encodeURIComponent(this.user.profile.preferred_username); } + // don't add domain_hint twice if user provided it in the extraQueryParameter value if (!this.urlContainsQueryStringParameter('domain_hint', urlNavigate) && this.user.profile.hasOwnProperty('tid')) { if (this.user.profile.tid === '9188040d-6c67-4c5b-b112-36a304b66dad') { @@ -265,6 +297,7 @@ namespace MSAL { } } } + return urlNavigate; } @@ -274,18 +307,19 @@ namespace MSAL { return regex.test(url); } - acquireToken(scopes: Array, callback: Function): void; - acquireToken(scopes: Array, callback: Function, loginHint: string): void; - acquireToken(scopes: Array, callback: Function, loginHint: string, extraQueryParameters: string): void; + acquireToken(scopes: Array, callback: (errorDesc: string, token: string, error: string) => void): void; + acquireToken(scopes: Array, callback: (errorDesc: string, token: string, error: string) => void, loginHint: string): void; + acquireToken(scopes: Array, callback: (errorDesc: string, token: string, error: string) => void, loginHint: string, extraQueryParameters: string): void; - acquireToken(scopes: Array, callback: Function, loginHint?: string, extraQueryParameters?: string): void { + acquireToken(scopes: Array, callback: (errorDesc: string, token: string, error: string) => void, loginHint?: string, extraQueryParameters?: string): void { if (this._acquireTokenInProgress) { return; } + this.validateInputScope(scopes); let scope: string = scopes.join(' '); if (!this.user) { - callback('user login is required', null); + callback('user login is required', null,null); return; } this._acquireTokenInProgress = true; @@ -298,6 +332,7 @@ namespace MSAL { urlNavigate = this.addHintParameters(urlNavigate, loginHint); else urlNavigate = this.addHintParameters(urlNavigate); + if (this._interactionMode === this._interactionModes.popUp) { this._renewStates.push(authenticationRequest.state); this.registerCallback(authenticationRequest.state, scope, callback); @@ -312,19 +347,21 @@ namespace MSAL { } } - acquireTokenSilent(scopes: Array, callback: Function): void { + acquireTokenSilent(scopes: Array, callback: (errorDesc:string,token:string,error:string)=> void): void { this.validateInputScope(scopes); var token = this.getCachedToken(scopes); let scope: string = scopes.join(' '); if (token) { - Logger.info('Token is already in cache for scope:' + scope); - callback(null, token); + this._requestContext.logger.warning('Token is already in cache for scope:' + scope); + callback(null, token,null); return; } + if (!this.user) { - callback('user login is required', null); + callback('user login is required', null,null); return; } + // refresh attept with iframe //Already renewing for this scope, callback when we get the token. if (this._activeRenewals[scope]) { @@ -335,10 +372,10 @@ namespace MSAL { if (!Utils.isEmpty(scope) && scope.indexOf(this.clientId) > -1) { // App uses idToken to send to api endpoints // Default scope is tracked as clientId to store this token - Logger.verbose('renewing idToken'); + this._requestContext.logger.verbose('renewing idToken'); this.renewIdToken(scopes, callback); } else { - Logger.verbose('renewing accesstoken'); + this._requestContext.logger.verbose('renewing accesstoken'); this.renewToken(scopes, callback); } } @@ -346,19 +383,17 @@ namespace MSAL { private loadFrameTimeout(urlNavigate: string, frameName: string, scope: string): void { //set iframe session to pending - Logger.verbose('Set loading state to pending for: ' + scope); + this._requestContext.logger.verbose('Set loading state to pending for: ' + scope); this._cacheStorage.saveItem(Constants.renewStatus + scope, Constants.tokenRenewStatusInProgress); this.loadFrame(urlNavigate, frameName); var self = this; setTimeout(function () { if (self._cacheStorage.getItem(Constants.renewStatus + scope) === Constants.tokenRenewStatusInProgress) { // fail the iframe session if it's in pending state - Logger.verbose('Loading frame has timed out after: ' + (Constants.loadFrameTimeout / 1000) + ' seconds for scope ' + scope); + this._requestContext.logger.verbose('Loading frame has timed out after: ' + (Constants.loadFrameTimeout / 1000) + ' seconds for scope ' + scope); var expectedState = self._activeRenewals[scope]; - if (expectedState && window.callBackMappedToRenewStates[expectedState]) { + if (expectedState && window.callBackMappedToRenewStates[expectedState]) window.callBackMappedToRenewStates[expectedState]('Token renewal operation failed due to timeout', null); - } - self._cacheStorage.saveItem(Constants.renewStatus + scope, Constants.tokenRenewStatusCancelled); } }, Constants.loadFrameTimeout); @@ -368,7 +403,7 @@ namespace MSAL { // This trick overcomes iframe navigation in IE // IE does not load the page consistently in iframe var self = this; - Logger.info('LoadFrame: ' + frameName); + this._requestContext.logger.info('LoadFrame: ' + frameName); var frameCheck = frameName; setTimeout(function () { var frameHandle = self.addAdalFrame(frameCheck); @@ -376,6 +411,7 @@ namespace MSAL { frameHandle.src = urlNavigate; self.loadFrame(urlNavigate, frameCheck); } + }, 500); } @@ -383,7 +419,8 @@ namespace MSAL { if (typeof iframeId === 'undefined') { return; } - Logger.info('Add adal frame to document:' + iframeId); + + this._requestContext.logger.info('Add msal frame to document:' + iframeId); var adalFrame = document.getElementById(iframeId); if (!adalFrame) { if (document.createElement && document.documentElement && @@ -395,45 +432,48 @@ namespace MSAL { ifr.style.width = ifr.style.height = '0px'; adalFrame = document.getElementsByTagName('body')[0].appendChild(ifr); } + else if (document.body && document.body.insertAdjacentHTML) { document.body.insertAdjacentHTML('beforeEnd', ''); } + if (window.frames && window.frames[iframeId]) { adalFrame = window.frames[iframeId]; } } + return adalFrame; } private renewToken(scopes: Array, callback: Function): void { var scope = scopes.join(' '); - Logger.verbose('renewToken is called for scope:' + scope); + this._requestContext.logger.verbose('renewToken is called for scope:' + scope); var frameHandle = this.addAdalFrame('adalRenewFrame' + scope); let authenticationRequest: AuthenticationRequestParameters = new AuthenticationRequestParameters(this.authority, this.clientId, scopes, ResponseTypes[ResponseTypes.token], this.redirectUri); authenticationRequest.state = authenticationRequest.state + '|' + scope; // renew happens in iframe, so it keeps javascript context this._renewStates.push(authenticationRequest.state); - Logger.verbose('Renew token Expected state: ' + authenticationRequest.state); + this._requestContext.logger.verbose('Renew token Expected state: ' + authenticationRequest.state); let urlNavigate: string = authenticationRequest.CreateNavigateUrl(scopes) + '&prompt=none'; urlNavigate = this.addHintParameters(urlNavigate); this.registerCallback(authenticationRequest.state, scope, callback); - Logger.verbose('Navigate to:' + urlNavigate); + this._requestContext.logger.verbose('Navigate to:' + urlNavigate); frameHandle.src = 'about:blank'; this.loadFrameTimeout(urlNavigate, 'adalRenewFrame' + scope, scope); } private renewIdToken(scopes: Array, callback: Function): void { - Logger.info('renewidToken is called'); + this._requestContext.logger.info('renewidToken is called'); let frameHandle = this.addAdalFrame('adalIdTokenFrame'); let authenticationRequest: AuthenticationRequestParameters = new AuthenticationRequestParameters(this.authority, this.clientId, scopes, ResponseTypes[ResponseTypes.id_token], this.redirectUri); authenticationRequest.state = authenticationRequest.state + '|' + this.clientId; this._cacheStorage.saveItem(Constants.nonceIdToken, authenticationRequest.nonce); - Logger.verbose('Renew Idtoken Expected state: ' + authenticationRequest.state); + this._requestContext.logger.verbose('Renew Idtoken Expected state: ' + authenticationRequest.state); let urlNavigate = authenticationRequest.CreateNavigateUrl(scopes) + '&prompt=none'; urlNavigate = this.addHintParameters(urlNavigate); this._renewStates.push(authenticationRequest.state); this.registerCallback(authenticationRequest.state, this.clientId, callback); - Logger.verbose('Navigate to:' + urlNavigate); + this._requestContext.logger.verbose('Navigate to:' + urlNavigate); frameHandle.src = 'about:blank'; this.loadFrameTimeout(urlNavigate, 'adalIdTokenFrame', this.clientId); } @@ -448,44 +488,50 @@ namespace MSAL { if (this.user) { return this.user; } + // frame is used to get idToken var idToken = this._cacheStorage.getItem(Constants.idTokenKey); if (!Utils.isEmpty(idToken)) { this.user = this.createUser(idToken); return this.user; } + return null; }; handleAuthenticationResponse(hash: string): void { - if (hash == null) + if (hash == null) { hash = window.location.hash; + } if (this.isCallback(hash)) { let requestInfo: RequestInfo = this.getRequestInfo(hash); - Logger.info('Returned from redirect url'); + this._requestContext.logger.info('Returned from redirect url'); this.saveTokenFromHash(requestInfo); let token: string = null, callback: Function = null; if ((requestInfo.requestType === Constants.renewToken) && window.parent) { if (window.parent !== window) - Logger.verbose('Window is in iframe, acquiring token silently'); + this._requestContext.logger.verbose('Window is in iframe, acquiring token silently'); else - Logger.verbose('acquiring token interactive in progress'); - if (window.parent.callBackMappedToRenewStates[requestInfo.stateResponse]) { + this._requestContext.logger.verbose('acquiring token interactive in progress'); + if (window.parent.callBackMappedToRenewStates[requestInfo.stateResponse]) callback = window.parent.callBackMappedToRenewStates[requestInfo.stateResponse]; - } else callback = this._userCallback; token = requestInfo.parameters[Constants.accessToken] || requestInfo.parameters[Constants.idToken]; - } else if (requestInfo.requestType === Constants.login) { + } + + else if (requestInfo.requestType === Constants.login) { callback = this._userCallback; token = requestInfo.parameters[Constants.idToken]; } + try { if (callback) callback(this._cacheStorage.getItem(Constants.errorDescription), token, this._cacheStorage.getItem(Constants.error)); } catch (err) { - Logger.error('Error occurred in user defined callback function', err) + this._requestContext.logger.error('Error occurred in user defined callback function: ' + err) } + if (this._interactionMode !== this._interactionModes.popUp) { window.location.hash = ''; if (this.navigateToLoginRequestUrl && window.location.href.replace('#', '') !== this._cacheStorage.getItem(Constants.loginRequest)) @@ -502,48 +548,50 @@ namespace MSAL { let accessTokenCacheItems: Array = this._cacheStorage.getAllAccessTokens(this.clientId, this.authority); for (let i = 0; i < accessTokenCacheItems.length; i++) { let accessTokenCacheItem = accessTokenCacheItems[i]; - if (accessTokenCacheItem.key.user.profile.oid === this.user.profile.oid) { + if (accessTokenCacheItem.key.userIdentifier === this.user.profile.oid) { var cachedScopes = accessTokenCacheItem.key.Scopes.split(' '); - if (Utils.isIntersectingScopes(cachedScopes, consentedScopes)) { - this._cacheStorage.removeItem(JSON.stringify(accessTokenCacheItem)); - } + if (Utils.isIntersectingScopes(cachedScopes, consentedScopes)) + this._cacheStorage.removeItem(JSON.stringify(accessTokenCacheItem.key)); } + } - let accessTokenKey = new AccessTokenKey(this.authority, this.clientId, this.user, scopes); + + let accessTokenKey = new AccessTokenKey(this.authority, this.clientId, scopes, this.user.profile.oid); let accessTokenValue = new AccessTokenValue(requestInfo.parameters[Constants.accessToken], Utils.expiresIn(requestInfo.parameters[Constants.expiresIn]).toString()); this._cacheStorage.saveItem(JSON.stringify(accessTokenKey), JSON.stringify(accessTokenValue)); } } private saveTokenFromHash(requestInfo: RequestInfo): void { - Logger.info('State status:' + requestInfo.stateMatch + '; Request type:' + requestInfo.requestType); + this._requestContext.logger.info('State status:' + requestInfo.stateMatch + '; Request type:' + requestInfo.requestType); this._cacheStorage.saveItem(Constants.error, ''); this._cacheStorage.saveItem(Constants.errorDescription, ''); var scope = this.getScopeFromState(requestInfo.stateResponse); // Record error if (requestInfo.parameters.hasOwnProperty(Constants.errorDescription)) { - Logger.info('Error :' + requestInfo.parameters[Constants.error] + '; Error description:' + requestInfo.parameters[Constants.errorDescription]); + this._requestContext.logger.info('Error :' + requestInfo.parameters[Constants.error] + '; Error description:' + requestInfo.parameters[Constants.errorDescription]); this._cacheStorage.saveItem(Constants.error, requestInfo.parameters["error"]); this._cacheStorage.saveItem(Constants.errorDescription, requestInfo.parameters[Constants.errorDescription]); if (requestInfo.requestType === Constants.login) { this._loginInProgress = false; this._cacheStorage.saveItem(Constants.loginError, requestInfo.parameters["errorDescription"]); } + } else { // It must verify the state from redirect if (requestInfo.stateMatch) { // record tokens to storage if exists - Logger.info('State is right'); - if (requestInfo.parameters.hasOwnProperty(Constants.sessionState)) { + this._requestContext.logger.info('State is right'); + if (requestInfo.parameters.hasOwnProperty(Constants.sessionState)) this._cacheStorage.saveItem(Constants.sessionState, requestInfo.parameters[Constants.sessionState]); - } var keys: string; if (requestInfo.parameters.hasOwnProperty(Constants.accessToken)) { - Logger.info('Fragment has access token'); + this._requestContext.logger.info('Fragment has access token'); this.saveAccessToken(requestInfo); } + if (requestInfo.parameters.hasOwnProperty(Constants.idToken)) { - Logger.info('Fragment has id token'); + this._requestContext.logger.info('Fragment has id token'); this._loginInProgress = false; this.user = this.createUser(requestInfo.parameters[Constants.idToken]); if (this.user && this.user.profile) { @@ -566,12 +614,16 @@ namespace MSAL { this._cacheStorage.saveItem(Constants.error, 'invalid idToken'); this._cacheStorage.saveItem(Constants.errorDescription, 'Invalid idToken. idToken: ' + requestInfo.parameters[Constants.idToken]); } + } + } else { this._cacheStorage.saveItem(Constants.error, 'Invalid_state'); this._cacheStorage.saveItem(Constants.errorDescription, 'Invalid_state. state: ' + requestInfo.stateResponse); } + } + this._cacheStorage.saveItem(Constants.renewStatus + scope, Constants.tokenRenewStatusCompleted); }; @@ -607,11 +659,10 @@ namespace MSAL { requestInfo.valid = true; // which call var stateResponse = ''; - if (parameters.hasOwnProperty('state')) { + if (parameters.hasOwnProperty('state')) stateResponse = parameters.state; - } else { + else return requestInfo; - } requestInfo.stateResponse = stateResponse; // async calls can fire iframe and login request at the same time if developer does not use the API as expected // incoming callback needs to be looked up to find the request type @@ -620,11 +671,13 @@ namespace MSAL { requestInfo.stateMatch = true; return requestInfo; } + else if (stateResponse === this._cacheStorage.getItem(Constants.stateAcquireToken)) { requestInfo.requestType = Constants.renewToken; requestInfo.stateMatch = true; return requestInfo; } + // external api requests may have many renewtoken requests for different resource if (!requestInfo.stateMatch && window.parent && window.parent.MSAL) { var clientApplication = window.parent.MSAL; @@ -639,7 +692,6 @@ namespace MSAL { } } } - return requestInfo; }; @@ -667,10 +719,16 @@ namespace MSAL { } else if (parsedJson.hasOwnProperty('email')) { user.username = parsedJson.email; } + } else { + this._requestContext.logger.warning('IdToken has invalid aud field'); } + } + return user; }; + } -} \ No newline at end of file + +} diff --git a/lib/Utils.ts b/lib/Utils.ts index 8560f636aa..221abf3642 100644 --- a/lib/Utils.ts +++ b/lib/Utils.ts @@ -1,4 +1,5 @@ namespace MSAL { + export class Utils { static expiresIn(expires: string): number { @@ -25,13 +26,13 @@ namespace MSAL { var base64IdToken = decodedToken.JWSPayload; var base64Decoded = this.base64DecodeStringUrlSafe(base64IdToken); if (!base64Decoded) { - Logger.info('The returned id_token could not be base64 url safe decoded.'); + //this._requestContext.logger.info('The returned id_token could not be base64 url safe decoded.'); return null; } // ECMA script has JSON built-in support return JSON.parse(base64Decoded); } catch (err) { - Logger.error('The returned id_token could not be decoded', err); + //this._requestContext.logger.error('The returned id_token could not be decoded' + err); } return null; @@ -95,7 +96,7 @@ namespace MSAL { var idTokenPartsRegex = /^([^\.\s]*)\.([^\.\s]+)\.([^\.\s]*)$/; var matches = idTokenPartsRegex.exec(jwtToken); if (!matches || matches.length < 4) { - Logger.warn('The returned id_token is not parseable.'); + //this._requestContext.logger.warn('The returned id_token is not parseable.'); return null; } var crackedToken = { @@ -149,7 +150,7 @@ namespace MSAL { return "0.1"; } - static Guid(): string { + static CreateNewGuid(): string { // RFC4122: The version 4 UUID is meant for generating UUIDs from truly-random or // pseudo-random numbers. // The algorithm is as follows: @@ -217,5 +218,7 @@ namespace MSAL { return guidResponse; } }; + } -} \ No newline at end of file + +} diff --git a/lib/Window.ts b/lib/Window.ts index 6834e0e382..a99ceb30b8 100644 --- a/lib/Window.ts +++ b/lib/Window.ts @@ -1,7 +1,5 @@ -namespace MSAL { - export interface Window { - MSAL: Object, - callBackMappedToRenewStates: Object; - callBacksMappedToRenewStates: Object; - } -} \ No newline at end of file +interface Window { + MSAL: Object, + callBackMappedToRenewStates: Object; + callBacksMappedToRenewStates: Object; +} diff --git a/lib/msaljs.js.map b/lib/msaljs.js.map deleted file mode 100644 index 48284bcd87..0000000000 --- a/lib/msaljs.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"msaljs.js","sourceRoot":"","sources":["msaljs.ts"],"names":[],"mappings":"AAMA,IAAU,IAAI,CAsrCb;AAtrCD,WAAU,IAAI,EAAC,CAAC;IAEZ,IAAK,aAGJ;IAHD,WAAK,aAAa;QACd,yDAAQ,CAAA;QACR,mDAAK,CAAA;IACT,CAAC,EAHI,aAAa,KAAb,aAAa,QAGjB;IAED,IAAK,YAKJ;IALD,WAAK,YAAY;QACb,iDAAK,CAAA;QACL,+CAAI,CAAA;QACJ,+CAAI,CAAA;QACJ,qDAAO,CAAA;IACX,CAAC,EALI,YAAY,KAAZ,YAAY,QAKhB;IAED;QAAA;QASA,CAAC;QALU,kBAAU,GAAjB,UAAkB,QAAgB,EAAE,aAAuB,EAAE,aAAsB;YAC/E,IAAI,CAAC,SAAS,GAAG,QAAQ,CAAC;YAC1B,IAAI,CAAC,cAAc,GAAG,aAAa,CAAC;YACpC,IAAI,CAAC,cAAc,GAAG,aAAa,CAAC;QACxC,CAAC;QAPM,iBAAS,GAAW,CAAC,CAAC;QACtB,sBAAc,GAAa,IAAI,CAAC;QAChC,sBAAc,GAAW,IAAI,CAAC;QAMzC,cAAC;IAAD,CAAC,AATD,IASC;IATY,YAAO,UASnB,CAAA;IAED;QAAA;QA2CA,CAAC;QA1CG,sBAAW,6BAAgB;iBAA3B,cAAwC,MAAM,CAAC,mBAAmB,CAAC,CAAC,CAAC;;;WAAA;QACrE,sBAAW,oBAAO;iBAAlB,cAA+B,MAAM,CAAC,UAAU,CAAC,CAAC,CAAC;;;WAAA;QACnD,sBAAW,wBAAW;iBAAtB,cAAmC,MAAM,CAAC,cAAc,CAAC,CAAC,CAAC;;;WAAA;QAC3D,sBAAW,sBAAS;iBAApB,cA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GAAW,EAAE,CAAC;gBAC9B,GAAG,CAAC,CAAC,IAAI,CAAC,GAAW,CAAC,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,EAAE,EAAE,CAAC;oBAClC,EAAE,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,KAAK,GAAG,IAAI,UAAU,CAAC,CAAC,CAAC,KAAK,GAAG,CAAC,CAAC,CAAC;wBAEjD,CAAC,GAAG,IAAI,CAAC,MAAM,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC;oBAC/B,CAAC;oBACD,EAAE,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,KAAK,GAAG,CAAC,CAAC,CAAC;wBACxB,YAAY,IAAI,GAAG,CAAC,CAAC,CAAC,CAAC;oBAC3B,CAAC;oBAAC,IAAI,CAAC,EAAE,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,KAAK,GAAG,CAAC,CAAC,CAAC;wBAE/B,CAAC,IAAI,GAAG,CAAC;wBACT,CAAC,IAAI,GAAG,CAAC;wBACT,YAAY,IAAI,GAAG,CAAC,CAAC,CAAC,CAAC;oBAC3B,CAAC;oBAAC,IAAI,CAAC,CAAC;wBACJ,YAAY,IAAI,UAAU,CAAC,CAAC,CAAC,CAAC;oBAClC,CAAC;gBACL,CAAC;gBACD,MAAM,CAAC,YAAY,CAAC;YACxB,CAAC;QACL,CAAC;;QACL,YAAC;IAAD,CAAC,AA1ND,IA0NC;AACL,CAAC,EAtrCS,IAAI,KAAJ,IAAI,QAsrCb"} \ No newline at end of file diff --git a/lib/msaljs.ts b/lib/msaljs.ts deleted file mode 100644 index 7ef050359d..0000000000 --- a/lib/msaljs.ts +++ /dev/null @@ -1,1213 +0,0 @@ -interface Window { - MSAL: Object, - callBackMappedToRenewStates: Object; - callBacksMappedToRenewStates: Object; -} - -namespace MSAL_DELETE_ME { // TODO: I left this file here so that Rohit has an easier time merging his changes. Please delete in next PR. - - enum ResponseTypes { - id_token, - token - } - - enum LoggingLevel { - ERROR, - WARN, - INFO, - VERBOSE - } - - export class Logging { - static _logLevel: number = 0; - static _loginCallback: Function = null; - static _correlationId: string = null; - static initialize(logLevel: number, loginCallback: Function, correlationId?: string) { - this._logLevel = logLevel; - this._loginCallback = loginCallback; - this._correlationId = correlationId; - } - } - - export class Constants { - static get errorDescription(): string { return "error_description"; } - static get idToken(): string { return "id_token"; } - static get accessToken(): string { return "access_token"; } - static get expiresIn(): string { return "expires_in"; } - static get sessionState(): string { return "session_state"; } - static get tokenKeys(): string { return "adal.token.keys"; } - static get accessTokenKey(): string { return "adal.access.token.key"; } - static get expirationKey(): string { return "adal.expiration.key"; } - static get stateLogin(): string { return "adal.state.login"; } - static get stateAcquireToken(): string { return "adal.state.acquireToken"; } - static get stateRenew(): string { return "adal.state.renew"; } - static get nonceIdToken(): string { return "adal.nonce.idtoken"; } - static get userName(): string { return "adal.username"; } - static get idTokenKey(): string { return "adal.idtoken"; } - static get error(): string { return "adal.error"; } - static get loginRequest(): string { return "adal.login.request"; } - static get loginError(): string { return "adal.login.error"; } - static get renewStatus(): string { return "adal.token.renew.status"; } - static get resourceDelimeter(): string { return "|"; } - private static _loadFrameTimeout: number = 6000; - static get loadFrameTimeout(): number { - return this._loadFrameTimeout; - }; - static set loadFrameTimeout(timeout: number) { - this._loadFrameTimeout = timeout; - }; - static get tokenRenewStatusCancelled(): string { return "Canceled"; } - static get tokenRenewStatusCompleted(): string { return "Completed"; } - static get tokenRenewStatusInProgress(): string { return "In Progress"; } - private static _popUpWidth: number = 483; - static get popUpWidth(): number { return this._popUpWidth; } - static set popUpWidth(width: number) { - this._popUpWidth = width; - }; - private static _popUpHeight: number = 600; - static get popUpHeight(): number { return this._popUpHeight; } - static set popUpHeight(height: number) { - this._popUpHeight = height; - }; - static get login(): string { return "LOGIN"; } - static get renewToken(): string { return "renewToken"; } - static get unknown(): string { return "UNKNOWN"; } - } - - export class UserAgentApplication { - - private _cacheLocations = { - localStorage: 'localStorage', - sessionStorage: 'sessionStorage' - }; - private _cacheLocation: string = 'sessionStorage'; - set cacheLocation(cache: string) { - this._cacheLocation = cache; - if (this._cacheLocations[cache]) - this._cacheStorage = new Storage(this._cacheLocations[cache]); - else - throw new Error('Cache Location is not valid. Provided value:' + this._cacheLocation + '.Possible values are: ' + this._cacheLocations.localStorage + ', ' + this._cacheLocations.sessionStorage); - } - get cacheLocation() { - return this._cacheLocation; - } - private _interactionModes = { - popUp: 'popUp', - redirect: 'redirect' - } - private _interactionMode: string = 'redirect'; - set interactionMode(mode: string) { - if (this._interactionModes[mode]) - this._interactionMode = this._interactionModes[mode]; - else - throw new Error('Interantion mode is not valid. Provided value:' + this._interactionMode + '.Possible values are: ' + this._interactionModes.redirect + ',' + this._interactionModes.popUp); - } - get interactionMode() { - return this._interactionMode; - } - private _loginInProgress: boolean; - private _acquireTokenInProgress: boolean; - private _checkSessionIframe: HTMLIFrameElement; - private _renewStates: Array; - private _activeRenewals: Object; - private _sessionState: string; - private _clockSkew: number = 300; - private _cacheStorage: Storage; - private _userCallback: Function = null; - user: User; - clientId: string; - authority: string = "https://login.microsoftonline.com/common"; - redirectUri: string; - postLogoutredirectUri: string; - correlationId: string; - // validatAuthority: boolean = true; This will be implemented after the build. Only scenarios that will be affected are the ones where the authority is dynamically discovered. - navigateToLoginRequestUrl: boolean = true; - - constructor(clientId: string, authority?: string, userCallback?: Function) { - this.clientId = clientId; - if (authority) - this.authority = authority; - if (userCallback) - this._userCallback = userCallback; - this.redirectUri = window.location.href.split("?")[0].split("#")[0]; - this.postLogoutredirectUri = this.redirectUri; - this._loginInProgress = false; - this._acquireTokenInProgress = false; - this._renewStates = []; - this._checkSessionIframe = null; - this._activeRenewals = {}; - this._cacheStorage = new Storage(this._cacheLocation); - window.MSAL = this; - window.callBackMappedToRenewStates = {}; - window.callBacksMappedToRenewStates = {}; - } - - login(): void { - /* - 1. Create navigate url - 2. saves value in cache - 3. redirect user to AAD - */ - if (this._loginInProgress) { - return; - } - let authenticationRequest: AuthenticationRequestParameters = new AuthenticationRequestParameters(this.authority, this.clientId, null, ResponseTypes[ResponseTypes.id_token], this.redirectUri); - this._cacheStorage.saveItem(Constants.loginRequest, window.location.href); - this._cacheStorage.saveItem(Constants.loginError, ''); - this._cacheStorage.saveItem(Constants.stateLogin, authenticationRequest.state); - this._cacheStorage.saveItem(Constants.nonceIdToken, authenticationRequest.nonce); - this._cacheStorage.saveItem(Constants.error, ''); - this._cacheStorage.saveItem(Constants.errorDescription, ''); - let urlNavigate: string = authenticationRequest.CreateNavigateUrl(null); - this._loginInProgress = true; - if (this._interactionMode === this._interactionModes.popUp) { - this.openConsentWindow(urlNavigate, 'login', 20, this, this._userCallback); - return; - } - else { - if (urlNavigate) { - window.location.replace(urlNavigate); - } - } - } - - private openConsentWindow(urlNavigate: string, title: string, interval: number, instance: this, callback: Function): void { - let popupWindow = this.openPopup(urlNavigate, title, Constants.popUpWidth, Constants.popUpHeight); - if (popupWindow == null) { - instance._loginInProgress = false; - instance._acquireTokenInProgress = false - Logger.warn('Popup Window is null. This can happen if you are using IE'); - this._cacheStorage.saveItem(Constants.error, 'Error opening popup'); - this._cacheStorage.saveItem(Constants.errorDescription, 'Popup Window is null. This can happen if you are using IE'); - this._cacheStorage.saveItem(Constants.loginError, 'Popup Window is null. This can happen if you are using IE'); - if (callback) - callback(this._cacheStorage.getItem(Constants.loginError), null, null); - return; - } - var self = this; - var pollTimer = window.setInterval(function () { - if (!popupWindow || popupWindow.closed || popupWindow.closed === undefined) { - instance._loginInProgress = false; - instance._acquireTokenInProgress = false - window.clearInterval(pollTimer); - } - try { - if (popupWindow.location.href.indexOf(self.redirectUri) != -1) { - self.handleAuthenticationResponse(popupWindow.location.hash); - window.clearInterval(pollTimer); - instance._loginInProgress = false; - instance._acquireTokenInProgress = false; - Logger.info("Closing popup window"); - popupWindow.close(); - } - } catch (e) { - //Cross Domain url check error. Will be thrown until AAD redirects the user back to the app's root page with the token. No need to log or throw this error as it will create unnecessary traffic. - } - }, interval); - } - - logout(): void { - this._cacheStorage.clear(); - this.user = null; - var logout = ''; - if (this.postLogoutredirectUri) { - logout = 'post_logout_redirect_uri=' + encodeURIComponent(this.postLogoutredirectUri); - } - let urlNavigate: string = this.authority + '/oauth2/v2.0/logout?' + logout; - if (urlNavigate) { - window.location.replace(urlNavigate); - } - } - - private openPopup(urlNavigate: string, title: string, popUpWidth: number, popUpHeight: number) { - try { - /** - * adding winLeft and winTop to account for dual monitor - * using screenLeft and screenTop for IE8 and earlier - */ - let winLeft = window.screenLeft ? window.screenLeft : window.screenX; - let winTop = window.screenTop ? window.screenTop : window.screenY; - /** - * window.innerWidth displays browser window's height and width excluding toolbars - * using document.documentElement.clientWidth for IE8 and earlier - */ - let width = window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth; - let height = window.innerHeight || document.documentElement.clientHeight || document.body.clientHeight; - let left = ((width / 2) - (popUpWidth / 2)) + winLeft; - let top = ((height / 2) - (popUpHeight / 2)) + winTop; - - let popupWindow = window.open(urlNavigate, title, 'width=' + popUpWidth + ', height=' + popUpHeight + ', top=' + top + ', left=' + left); - if (popupWindow.focus) { - popupWindow.focus(); - } - return popupWindow; - } catch (e) { - Logger.warn('error opening popup, ' + e.message); - this._loginInProgress = false; - return null; - } - } - - private validateInputScope(scopes: Array): void { - if (!scopes || scopes.length < 1) { - return; - } - if (!Array.isArray(scopes)) { - throw new Error('API does not accept non-array scopes'); - } - if (scopes.indexOf('openid') > -1) { - throw new Error('API does not accept openid as a user-provided scope'); - } - if (scopes.indexOf('offline_access') > -1) { - throw new Error('API does not accept offline_access as a user-provided scope'); - } - if (scopes.indexOf(this.clientId) > -1) { - if (scopes.length > 1) { - throw new Error('Client Id can only be provided as a single scope'); - } - } - } - - private registerCallback(expectedState: string, scope: string, callback: Function): void { - this._activeRenewals[scope] = expectedState; - if (!window.callBacksMappedToRenewStates[expectedState]) { - window.callBacksMappedToRenewStates[expectedState] = []; - } - var self = this; - window.callBacksMappedToRenewStates[expectedState].push(callback); - if (!window.callBackMappedToRenewStates[expectedState]) { - window.callBackMappedToRenewStates[expectedState] = function (errorDesc: string, token: string, error: string) { - self._activeRenewals[scope] = null; - for (var i = 0; i < window.callBacksMappedToRenewStates[expectedState].length; ++i) { - try { - window.callBacksMappedToRenewStates[expectedState][i](errorDesc, token, error); - } - catch (error) { - Logger.warn(error); - } - } - window.callBacksMappedToRenewStates[expectedState] = null; - window.callBackMappedToRenewStates[expectedState] = null; - }; - } - } - - private getCachedToken(scopes: Array): string { - let accessTokenCacheItems = this._cacheStorage.getAllAccessTokens(this.clientId, this.authority); - let accessTokenItems: Array = []; // Array to store multiple accessTokens for the same set of scopes - for (let i = 0; i < accessTokenCacheItems.length; i++) { - let accessTokenCacheItem = accessTokenCacheItems[i]; - if (accessTokenCacheItem.key.user.profile.oid === this.user.profile.oid) { - let cachedScopes = accessTokenCacheItem.key.Scopes.split(' '); - if (Utils.containsScope(cachedScopes, scopes)) { - accessTokenItems.push(accessTokenCacheItem); - } - } - } - if (accessTokenItems.length === 0 || accessTokenCacheItems.length > 1) - return null; //access token not found - else { - let accessTokenCacheItem = accessTokenItems[0]; - var expired: number = Number(accessTokenCacheItem.value.ExpiresIn); - // If expiration is within offset, it will force renew - var offset = this._clockSkew || 300; - if (expired && (expired > Utils.now() + offset)) { - return accessTokenCacheItem.value.AccessToken; - } else { - this._cacheStorage.removeItem(JSON.stringify(accessTokenItems[0])); - return null; - } - } - } - - private addHintParameters(urlNavigate: string, loginHint?: string): string { - if (this.user && this.user.profile && this.user.profile.hasOwnProperty('preferred_username')) { - // add login_hint - if (loginHint) { - urlNavigate += '&login_hint=' + encodeURIComponent(loginHint); - } - else { - urlNavigate += '&login_hint=' + encodeURIComponent(this.user.profile.preferred_username); - } - // don't add domain_hint twice if user provided it in the extraQueryParameter value - if (!this.urlContainsQueryStringParameter('domain_hint', urlNavigate) && this.user.profile.hasOwnProperty('tid')) { - if (this.user.profile.tid === '9188040d-6c67-4c5b-b112-36a304b66dad') { - urlNavigate += '&domain_hint=' + encodeURIComponent("consumers"); - } - else { - urlNavigate += '&domain_hint=' + encodeURIComponent("organizations"); - } - } - } - return urlNavigate; - } - - private urlContainsQueryStringParameter(name: string, url: string): boolean { - // regex to detect pattern of a ? or & followed by the name parameter and an equals character - var regex = new RegExp("[\\?&]" + name + "="); - return regex.test(url); - } - - acquireToken(scopes: Array, callback: Function): void; - acquireToken(scopes: Array, callback: Function, loginHint: string): void; - acquireToken(scopes: Array, callback: Function, loginHint: string, extraQueryParameters: string): void; - - acquireToken(scopes: Array, callback: Function, loginHint?: string, extraQueryParameters?: string): void { - if (this._acquireTokenInProgress) { - return; - } - this.validateInputScope(scopes); - let scope: string = scopes.join(' '); - if (!this.user) { - callback('user login is required', null); - return; - } - this._acquireTokenInProgress = true; - let authenticationRequest: AuthenticationRequestParameters = new AuthenticationRequestParameters(this.authority, this.clientId, scopes, ResponseTypes[ResponseTypes.token], this.redirectUri); - authenticationRequest.state = authenticationRequest.state + '|' + scope; - if (extraQueryParameters) - authenticationRequest.extraQueryParameters = extraQueryParameters; - let urlNavigate: string = authenticationRequest.CreateNavigateUrl(scopes); - if (loginHint) - urlNavigate = this.addHintParameters(urlNavigate, loginHint); - else - urlNavigate = this.addHintParameters(urlNavigate); - if (this._interactionMode === this._interactionModes.popUp) { - this._renewStates.push(authenticationRequest.state); - this.registerCallback(authenticationRequest.state, scope, callback); - this.openConsentWindow(urlNavigate, 'acquireToken', 1, this, callback); - return; - } - else { - if (urlNavigate) { - this._cacheStorage.saveItem(Constants.stateAcquireToken, authenticationRequest.state); - window.location.replace(urlNavigate); - } - } - - } - - acquireTokenSilent(scopes: Array, callback: Function): void { - this.validateInputScope(scopes); - var token = this.getCachedToken(scopes); - let scope: string = scopes.join(' '); - if (token) { - Logger.info('Token is already in cache for scope:' + scope); - callback(null, token); - return; - } - if (!this.user) { - callback('user login is required', null); - return; - } - // refresh attept with iframe - //Already renewing for this scope, callback when we get the token. - if (this._activeRenewals[scope]) { - //Active renewals contains the state for each renewal. - this.registerCallback(this._activeRenewals[scope], scope, callback); - } - else { - if (!Utils.isEmpty(scope) && scope.indexOf(this.clientId) > -1) { - // App uses idToken to send to api endpoints - // Default scope is tracked as clientId to store this token - Logger.verbose('renewing idToken'); - this.renewIdToken(scopes, callback); - } else { - Logger.verbose('renewing accesstoken'); - this.renewToken(scopes, callback); - } - } - } - - private loadFrameTimeout(urlNavigate: string, frameName: string, scope: string): void { - //set iframe session to pending - Logger.verbose('Set loading state to pending for: ' + scope); - this._cacheStorage.saveItem(Constants.renewStatus + scope, Constants.tokenRenewStatusInProgress); - this.loadFrame(urlNavigate, frameName); - var self = this; - setTimeout(function () { - if (self._cacheStorage.getItem(Constants.renewStatus + scope) === Constants.tokenRenewStatusInProgress) { - // fail the iframe session if it's in pending state - Logger.verbose('Loading frame has timed out after: ' + (Constants.loadFrameTimeout / 1000) + ' seconds for scope ' + scope); - var expectedState = self._activeRenewals[scope]; - if (expectedState && window.callBackMappedToRenewStates[expectedState]) { - window.callBackMappedToRenewStates[expectedState]('Token renewal operation failed due to timeout', null); - } - - self._cacheStorage.saveItem(Constants.renewStatus + scope, Constants.tokenRenewStatusCancelled); - } - }, Constants.loadFrameTimeout); - } - - private loadFrame(urlNavigate: string, frameName: string): void { - // This trick overcomes iframe navigation in IE - // IE does not load the page consistently in iframe - var self = this; - Logger.info('LoadFrame: ' + frameName); - var frameCheck = frameName; - setTimeout(function () { - var frameHandle = self.addAdalFrame(frameCheck); - if (frameHandle.src === '' || frameHandle.src === 'about:blank') { - frameHandle.src = urlNavigate; - self.loadFrame(urlNavigate, frameCheck); - } - }, 500); - } - - private addAdalFrame(iframeId: string): HTMLIFrameElement { - if (typeof iframeId === 'undefined') { - return; - } - Logger.info('Add adal frame to document:' + iframeId); - var adalFrame = document.getElementById(iframeId); - if (!adalFrame) { - if (document.createElement && document.documentElement && - (window.navigator.userAgent.indexOf('MSIE 5.0') === -1)) { - var ifr = document.createElement('iframe'); - ifr.setAttribute('id', iframeId); - ifr.style.visibility = 'hidden'; - ifr.style.position = 'absolute'; - ifr.style.width = ifr.style.height = '0px'; - adalFrame = document.getElementsByTagName('body')[0].appendChild(ifr); - } - else if (document.body && document.body.insertAdjacentHTML) { - document.body.insertAdjacentHTML('beforeEnd', ''); - } - if (window.frames && window.frames[iframeId]) { - adalFrame = window.frames[iframeId]; - } - } - return adalFrame; - } - - private renewToken(scopes: Array, callback: Function): void { - var scope = scopes.join(' '); - Logger.verbose('renewToken is called for scope:' + scope); - var frameHandle = this.addAdalFrame('adalRenewFrame' + scope); - let authenticationRequest: AuthenticationRequestParameters = new AuthenticationRequestParameters(this.authority, this.clientId, scopes, ResponseTypes[ResponseTypes.token], this.redirectUri); - authenticationRequest.state = authenticationRequest.state + '|' + scope; - // renew happens in iframe, so it keeps javascript context - this._renewStates.push(authenticationRequest.state); - Logger.verbose('Renew token Expected state: ' + authenticationRequest.state); - let urlNavigate: string = authenticationRequest.CreateNavigateUrl(scopes) + '&prompt=none'; - urlNavigate = this.addHintParameters(urlNavigate); - this.registerCallback(authenticationRequest.state, scope, callback); - Logger.verbose('Navigate to:' + urlNavigate); - frameHandle.src = 'about:blank'; - this.loadFrameTimeout(urlNavigate, 'adalRenewFrame' + scope, scope); - } - - private renewIdToken(scopes: Array, callback: Function): void { - Logger.info('renewidToken is called'); - let frameHandle = this.addAdalFrame('adalIdTokenFrame'); - let authenticationRequest: AuthenticationRequestParameters = new AuthenticationRequestParameters(this.authority, this.clientId, scopes, ResponseTypes[ResponseTypes.id_token], this.redirectUri); - authenticationRequest.state = authenticationRequest.state + '|' + this.clientId; - this._cacheStorage.saveItem(Constants.nonceIdToken, authenticationRequest.nonce); - Logger.verbose('Renew Idtoken Expected state: ' + authenticationRequest.state); - let urlNavigate = authenticationRequest.CreateNavigateUrl(scopes) + '&prompt=none'; - urlNavigate = this.addHintParameters(urlNavigate); - this._renewStates.push(authenticationRequest.state); - this.registerCallback(authenticationRequest.state, this.clientId, callback); - Logger.verbose('Navigate to:' + urlNavigate); - frameHandle.src = 'about:blank'; - this.loadFrameTimeout(urlNavigate, 'adalIdTokenFrame', this.clientId); - } - - private hasScope(key: string): boolean { - var keys = this._cacheStorage.getItem(Constants.tokenKeys); - return keys && !Utils.isEmpty(keys) && (keys.indexOf(key + Constants.resourceDelimeter) > -1); - }; - - getUser(): User { - // idToken is first call - if (this.user) { - return this.user; - } - // frame is used to get idToken - var idToken = this._cacheStorage.getItem(Constants.idTokenKey); - if (!Utils.isEmpty(idToken)) { - this.user = this.createUser(idToken); - return this.user; - } - return null; - }; - - handleAuthenticationResponse(hash: string): void { - if (hash == null) - hash = window.location.hash; - if (this.isCallback(hash)) { - let requestInfo: RequestInfo = this.getRequestInfo(hash); - Logger.info('Returned from redirect url'); - this.saveTokenFromHash(requestInfo); - let token: string = null, callback: Function = null; - if ((requestInfo.requestType === Constants.renewToken) && window.parent) { - if (window.parent !== window) - Logger.verbose('Window is in iframe, acquiring token silently'); - else - Logger.verbose('acquiring token interactive in progress'); - if (window.parent.callBackMappedToRenewStates[requestInfo.stateResponse]) { - callback = window.parent.callBackMappedToRenewStates[requestInfo.stateResponse]; - } - else - callback = this._userCallback; - token = requestInfo.parameters[Constants.accessToken] || requestInfo.parameters[Constants.idToken]; - } else if (requestInfo.requestType === Constants.login) { - callback = this._userCallback; - token = requestInfo.parameters[Constants.idToken]; - } - try { - if (callback) - callback(this._cacheStorage.getItem(Constants.errorDescription), token, this._cacheStorage.getItem(Constants.error)); - } catch (err) { - Logger.error('Error occurred in user defined callback function', err) - } - if (this._interactionMode !== this._interactionModes.popUp) { - window.location.hash = ''; - if (this.navigateToLoginRequestUrl && window.location.href.replace('#', '') !== this._cacheStorage.getItem(Constants.loginRequest)) - window.location.href = this._cacheStorage.getItem(Constants.loginRequest); - } - } - } - - private saveAccessToken(requestInfo: RequestInfo): void { - if (requestInfo.parameters.hasOwnProperty('scope')) { - this.user = this.getUser(); - let scopes = requestInfo.parameters['scope']; - let consentedScopes = scopes.split(' '); - let accessTokenCacheItems: Array = this._cacheStorage.getAllAccessTokens(this.clientId, this.authority); - for (let i = 0; i < accessTokenCacheItems.length; i++) { - let accessTokenCacheItem = accessTokenCacheItems[i]; - if (accessTokenCacheItem.key.user.profile.oid === this.user.profile.oid) { - var cachedScopes = accessTokenCacheItem.key.Scopes.split(' '); - if (Utils.isIntersectingScopes(cachedScopes, consentedScopes)) { - this._cacheStorage.removeItem(JSON.stringify(accessTokenCacheItem)); - } - } - } - let accessTokenKey = new AccessTokenKey(this.authority, this.clientId, this.user, scopes); - let accessTokenValue = new AccessTokenValue(requestInfo.parameters[Constants.accessToken], Utils.expiresIn(requestInfo.parameters[Constants.expiresIn]).toString()); - this._cacheStorage.saveItem(JSON.stringify(accessTokenKey), JSON.stringify(accessTokenValue)); - } - } - - private saveTokenFromHash(requestInfo: RequestInfo): void { - Logger.info('State status:' + requestInfo.stateMatch + '; Request type:' + requestInfo.requestType); - this._cacheStorage.saveItem(Constants.error, ''); - this._cacheStorage.saveItem(Constants.errorDescription, ''); - var scope = this.getScopeFromState(requestInfo.stateResponse); - // Record error - if (requestInfo.parameters.hasOwnProperty(Constants.errorDescription)) { - Logger.info('Error :' + requestInfo.parameters[Constants.error] + '; Error description:' + requestInfo.parameters[Constants.errorDescription]); - this._cacheStorage.saveItem(Constants.error, requestInfo.parameters["error"]); - this._cacheStorage.saveItem(Constants.errorDescription, requestInfo.parameters[Constants.errorDescription]); - if (requestInfo.requestType === Constants.login) { - this._loginInProgress = false; - this._cacheStorage.saveItem(Constants.loginError, requestInfo.parameters["errorDescription"]); - } - } else { - // It must verify the state from redirect - if (requestInfo.stateMatch) { - // record tokens to storage if exists - Logger.info('State is right'); - if (requestInfo.parameters.hasOwnProperty(Constants.sessionState)) { - this._cacheStorage.saveItem(Constants.sessionState, requestInfo.parameters[Constants.sessionState]); - } - var keys: string; - if (requestInfo.parameters.hasOwnProperty(Constants.accessToken)) { - Logger.info('Fragment has access token'); - this.saveAccessToken(requestInfo); - } - if (requestInfo.parameters.hasOwnProperty(Constants.idToken)) { - Logger.info('Fragment has id token'); - this._loginInProgress = false; - this.user = this.createUser(requestInfo.parameters[Constants.idToken]); - if (this.user && this.user.profile) { - if (this.user.profile.nonce !== this._cacheStorage.getItem(Constants.nonceIdToken)) { - this.user = null; - this._cacheStorage.saveItem(Constants.loginError, 'Nonce Mismatch.Expected: ' + this._cacheStorage.getItem(Constants.nonceIdToken) + ',' + 'Actual: ' + this.user.profile.nonce); - } else { - this._cacheStorage.saveItem(Constants.idTokenKey, requestInfo.parameters[Constants.idToken]); - // Save idToken as access token for app itself - scope = this.clientId; - if (!this.hasScope(scope)) { - keys = this._cacheStorage.getItem(Constants.tokenKeys) || ''; - this._cacheStorage.saveItem(Constants.tokenKeys, keys + scope + Constants.resourceDelimeter); - } - this._cacheStorage.saveItem(Constants.accessTokenKey + scope, requestInfo.parameters[Constants.idToken]); - this._cacheStorage.saveItem(Constants.expirationKey + scope, this.user.profile.exp); - } - } - else { - this._cacheStorage.saveItem(Constants.error, 'invalid idToken'); - this._cacheStorage.saveItem(Constants.errorDescription, 'Invalid idToken. idToken: ' + requestInfo.parameters[Constants.idToken]); - } - } - } else { - this._cacheStorage.saveItem(Constants.error, 'Invalid_state'); - this._cacheStorage.saveItem(Constants.errorDescription, 'Invalid_state. state: ' + requestInfo.stateResponse); - } - } - this._cacheStorage.saveItem(Constants.renewStatus + scope, Constants.tokenRenewStatusCompleted); - }; - - isCallback(hash: string): boolean { - hash = this.getHash(hash); - var parameters = Utils.deserialize(hash); - return ( - parameters.hasOwnProperty(Constants.errorDescription) || - parameters.hasOwnProperty(Constants.accessToken) || - parameters.hasOwnProperty(Constants.idToken) - ); - } - - private getHash(hash: string): string { - if (hash.indexOf('#/') > -1) { - hash = hash.substring(hash.indexOf('#/') + 2); - } else if (hash.indexOf('#') > -1) { - hash = hash.substring(1); - } - - return hash; - }; - - private getRequestInfo(hash: string): RequestInfo { - hash = this.getHash(hash); - let parameters = Utils.deserialize(hash); - let requestInfo: RequestInfo = new RequestInfo(); - if (parameters) { - requestInfo.parameters = parameters; - if (parameters.hasOwnProperty(Constants.errorDescription) || - parameters.hasOwnProperty(Constants.accessToken) || - parameters.hasOwnProperty(Constants.idToken)) { - requestInfo.valid = true; - // which call - var stateResponse = ''; - if (parameters.hasOwnProperty('state')) { - stateResponse = parameters.state; - } else { - return requestInfo; - } - requestInfo.stateResponse = stateResponse; - // async calls can fire iframe and login request at the same time if developer does not use the API as expected - // incoming callback needs to be looked up to find the request type - if (stateResponse === this._cacheStorage.getItem(Constants.stateLogin)) { - requestInfo.requestType = Constants.login; - requestInfo.stateMatch = true; - return requestInfo; - } - else if (stateResponse === this._cacheStorage.getItem(Constants.stateAcquireToken)) { - requestInfo.requestType = Constants.renewToken; - requestInfo.stateMatch = true; - return requestInfo; - } - // external api requests may have many renewtoken requests for different resource - if (!requestInfo.stateMatch && window.parent && window.parent.MSAL) { - var clientApplication = window.parent.MSAL; - var statesInParentContext: Array = clientApplication._renewStates; - for (var i = 0; i < statesInParentContext.length; i++) { - if (statesInParentContext[i] === requestInfo.stateResponse) { - requestInfo.requestType = Constants.renewToken; - requestInfo.stateMatch = true; - break; - } - } - } - } - } - - return requestInfo; - }; - - private getScopeFromState(state: string): string { - if (state) { - var splitIndex = state.indexOf('|'); - if (splitIndex > -1 && splitIndex + 1 < state.length) { - return state.substring(splitIndex + 1); - } - } - return ''; - }; - - private createUser(idToken: string): User { - var user: User; - var parsedJson = Utils.extractIdToken(idToken); - if (parsedJson && parsedJson.hasOwnProperty('aud')) { - if (parsedJson.aud.toLowerCase() === this.clientId.toLowerCase()) { - user = { - username: '', - profile: parsedJson - }; - if (parsedJson.hasOwnProperty('preferred_username')) { - user.username = parsedJson.preferred_username; - } else if (parsedJson.hasOwnProperty('email')) { - user.username = parsedJson.email; - } - } else { - } - } - return user; - }; - - } - - class User { - username: string; - profile: any; - } - - class RequestInfo { - valid: boolean; - parameters: Object; - stateMatch: boolean; - stateResponse: string; - requestType: string; - - constructor() { - this.valid = false; - this.parameters = {}; - this.stateMatch = false; - this.stateResponse = ''; - this.requestType = 'unknown'; - } - } - - class AccessTokenCacheItem { - key: AccessTokenKey; - value: AccessTokenValue; - constructor(key: AccessTokenKey, value: AccessTokenValue) { - this.key = key; - this.value = value; - } - } - - class AccessTokenValue { - AccessToken: string; - ExpiresIn: string; - constructor(accessToken: string, expiresIn: string) { - this.AccessToken = accessToken; - this.ExpiresIn = expiresIn; - } - } - - class AccessTokenKey { - authority: string; - clientId: string; - user: User; - Scopes: string; - - constructor(authority: string, clientId: string, user: User, scopes: string) { - this.authority = authority; - this.clientId = clientId; - this.Scopes = scopes; - this.user = user; - } - } - - class AuthenticationRequestParameters { - authority: string; - clientId: string; - nonce: string; - state: string; - correlationId: string; - xClientVer: string; - xClientSku: string; - scopes: Array; - responseType: string; - promptValue: string; - extraQueryParameters: string; - loginHint: string; - domainHint: string; - redirectUri: string; - - constructor(authority: string, clientId: string, scope: Array, responseType: string, redirectUri: string) { - this.authority = authority; - this.clientId = clientId; - this.scopes = scope; - this.responseType = responseType; - this.redirectUri = redirectUri; - // randomly generated values - if (responseType !== "token") { - this.nonce = Utils.Guid(); - } - this.correlationId = Utils.Guid(); - this.state = Utils.Guid(); - this.nonce = Utils.Guid(); - // telemetry information - this.xClientSku = "Js"; - this.xClientVer = Utils.GetLibraryVersion(); - } - - CreateNavigateUrl(scopes: Array): string { - if (!scopes) - scopes = [this.clientId]; - let requestUrl = ""; - let str: Array = []; - str.push('?response_type=' + this.responseType); - if (this.responseType === ResponseTypes[ResponseTypes.id_token]) { - if (scopes.indexOf(this.clientId) > -1) { - this.translateclientIdUsedInScope(scopes); - } - } - str.push('scope=' + encodeURIComponent(this.parseScope(scopes))); - str.push('client_id=' + encodeURIComponent(this.clientId)); - str.push('redirect_uri=' + encodeURIComponent(this.redirectUri)); - str.push('state=' + encodeURIComponent(this.state)); - str.push('nonce=' + encodeURIComponent(this.nonce)); - if (this.extraQueryParameters) { - str.push(this.extraQueryParameters); - } - str.push('client-request-id=' + encodeURIComponent(this.correlationId)); - requestUrl = this.authority + '/oauth2/v2.0/authorize' + str.join('&') + "&x-client-SKU=" + this.xClientSku + "&x-client-Ver=" + this.xClientVer; - return requestUrl; - } - - translateclientIdUsedInScope(scopes: Array): void { - var clientIdIndex = scopes.indexOf(this.clientId); - if (clientIdIndex >= 0) { - scopes.splice(clientIdIndex, 1); - scopes.push('openid'); - scopes.push('profile'); - } - } - - parseScope(scopes: Array): string { - var scopeList = ''; - if (scopes) { - for (var i = 0; i < scopes.length; ++i) { - scopeList += (i !== scopes.length - 1) ? scopes[i] + ' ' : scopes[i]; - } - } - return scopeList; - } - } - - class Storage { - - private _localStorageSupported: boolean; - private _sessionStorageSupported: boolean; - private _cacheLocation: string; - - constructor(cacheLocation: string) { - this._cacheLocation = cacheLocation; - this._localStorageSupported = typeof window[this._cacheLocation] != "undefined" && window[this._cacheLocation] != null; - this._sessionStorageSupported = typeof window[cacheLocation] != "undefined" && window[cacheLocation] != null; - if (!this._localStorageSupported && !this._sessionStorageSupported) - throw new Error('localStorage and sessionStorage not supported'); - } - - // add value to storage - saveItem(key: string, value: string): void { - if (window[this._cacheLocation]) - window[this._cacheLocation].setItem(key, value); - else - throw new Error('localStorage and sessionStorage are not supported'); - } - - // get one item by key from storage - getItem(key: string): string { - if (window[this._cacheLocation]) - return window[this._cacheLocation].getItem(key); - else - throw new Error('localStorage and sessionStorage are not supported'); - } - - // remove value from storage - removeItem(key: string): void { - if (window[this._cacheLocation]) - return window[this._cacheLocation].removeItem(key); - else - throw new Error('localStorage and sessionStorage are not supported'); - } - - // clear storage (remove all items from it) - clear(): void { - if (window[this._cacheLocation]) - return window[this._cacheLocation].clear(); - else - throw new Error('localStorage and sessionStorage are not supported'); - } - - getAllAccessTokens(clientId: string, authority: string): Array { - let key: string; - let results: Array = []; - let accessTokenCacheItem: AccessTokenCacheItem; - let storage = window[this._cacheLocation]; - if (storage) { - for (key in storage) { - if (storage.hasOwnProperty(key)) { - if (key.match(clientId) && key.match(authority)) { - let value = this.getItem(key); - accessTokenCacheItem = new AccessTokenCacheItem(JSON.parse(key), JSON.parse(value)); - results.push(accessTokenCacheItem); - } - } - } - } - else - throw new Error('localStorage and sessionStorage are not supported'); - return results; - } - - } - - - class Logger { - - static log(level: number, message: string, error: string): void { - if (level <= Logging._logLevel) { - var timestamp = new Date().toUTCString(); - var formattedMessage = ''; - if (Logging._correlationId) - formattedMessage = timestamp + ':' + Logging._correlationId + '-' + this.libVersion() + '-' + LoggingLevel[level] + ' ' + message; - else - formattedMessage = timestamp + ':' + this.libVersion() + '-' + LoggingLevel[level] + ' ' + message; - if (error) { - formattedMessage += '\nstack:\n' + error; - } - - if (Logging._loginCallback) - Logging._loginCallback(formattedMessage); - } - } - - static error(message: string, error: string): void { - this.log(LoggingLevel.ERROR, message, error); - } - - static warn(message: string): void { - this.log(LoggingLevel.WARN, message, null); - } - - static info(message: string): void { - this.log(LoggingLevel.INFO, message, null); - } - - static verbose(message: string): void { - this.log(LoggingLevel.VERBOSE, message, null); - } - - static libVersion(): string { - return '1.0.0'; - } - } - - class Utils { - - static expiresIn(expires: string): number { - // if AAD did not send "expires_in" property, use default expiration of 3599 seconds, for some reason AAD sends 3599 as "expires_in" value instead of 3600 - if (!expires) expires = '3599'; - return this.now() + parseInt(expires, 10); - }; - - static now(): number { - return Math.round(new Date().getTime() / 1000.0); - }; - - static isEmpty(str: string): boolean { - return (typeof str === 'undefined' || !str || 0 === str.length); - }; - - static extractIdToken(encodedIdToken: string): any { - // id token will be decoded to get the username - var decodedToken = this.decodeJwt(encodedIdToken); - if (!decodedToken) { - return null; - } - try { - var base64IdToken = decodedToken.JWSPayload; - var base64Decoded = this.base64DecodeStringUrlSafe(base64IdToken); - if (!base64Decoded) { - Logger.info('The returned id_token could not be base64 url safe decoded.'); - return null; - } - // ECMA script has JSON built-in support - return JSON.parse(base64Decoded); - } catch (err) { - Logger.error('The returned id_token could not be decoded', err); - } - - return null; - }; - - static base64DecodeStringUrlSafe(base64IdToken: string): string { - // html5 should support atob function for decoding - base64IdToken = base64IdToken.replace(/-/g, '+').replace(/_/g, '/'); - if (window.atob) { - return decodeURIComponent(window.atob(base64IdToken)); // jshint ignore:line - } - else { - return decodeURIComponent(this.decode(base64IdToken)); - } - }; - - static decode(base64IdToken: string): string { - var codes = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/='; - base64IdToken = String(base64IdToken).replace(/=+$/, ''); - var length = base64IdToken.length; - if (length % 4 === 1) { - throw new Error('The token to be decoded is not correctly encoded.'); - } - let h1: number, h2: number, h3: number, h4: number, bits: number, c1: number, c2: number, c3: number, decoded = ''; - for (var i = 0; i < length; i += 4) { - //Every 4 base64 encoded character will be converted to 3 byte string, which is 24 bits - // then 6 bits per base64 encoded character - h1 = codes.indexOf(base64IdToken.charAt(i)); - h2 = codes.indexOf(base64IdToken.charAt(i + 1)); - h3 = codes.indexOf(base64IdToken.charAt(i + 2)); - h4 = codes.indexOf(base64IdToken.charAt(i + 3)); - // For padding, if last two are '=' - if (i + 2 === length - 1) { - bits = h1 << 18 | h2 << 12 | h3 << 6; - c1 = bits >> 16 & 255; - c2 = bits >> 8 & 255; - decoded += String.fromCharCode(c1, c2); - break; - } - // if last one is '=' - else if (i + 1 === length - 1) { - bits = h1 << 18 | h2 << 12 - c1 = bits >> 16 & 255; - decoded += String.fromCharCode(c1); - break; - } - bits = h1 << 18 | h2 << 12 | h3 << 6 | h4; - // then convert to 3 byte chars - c1 = bits >> 16 & 255; - c2 = bits >> 8 & 255; - c3 = bits & 255; - decoded += String.fromCharCode(c1, c2, c3); - } - return decoded; - }; - - static decodeJwt(jwtToken: string): any { - if (this.isEmpty(jwtToken)) { - return null; - }; - var idTokenPartsRegex = /^([^\.\s]*)\.([^\.\s]+)\.([^\.\s]*)$/; - var matches = idTokenPartsRegex.exec(jwtToken); - if (!matches || matches.length < 4) { - Logger.warn('The returned id_token is not parseable.'); - return null; - } - var crackedToken = { - header: matches[1], - JWSPayload: matches[2], - JWSSig: matches[3] - }; - return crackedToken; - }; - - - static deserialize(query: string): any { - let match: Array, - pl = /\+/g, // Regex for replacing addition symbol with a space - search = /([^&=]+)=([^&]*)/g, - decode = function (s: string) { - return decodeURIComponent(s.replace(pl, ' ')); - }, - obj = {}; - match = search.exec(query); - while (match) { - obj[decode(match[1])] = decode(match[2]); - match = search.exec(query); - } - return obj; - }; - - static isIntersectingScopes(cachedScopes: Array, scopes: Array): boolean { - for (let i = 0; i < scopes.length; i++) { - if (cachedScopes.indexOf(scopes[i]) > -1) - return true; - } - return false; - } - - static containsScope(cachedScopes: Array, scopes: Array): boolean { - return scopes.every(function (value) { - return cachedScopes.indexOf(value) >= 0; - }); - } - - static DecimalToHex(num: number): string { - var hex: string = num.toString(16); - while (hex.length < 2) { - hex = '0' + hex; - } - return hex; - } - - static GetLibraryVersion(): string { - return "0.1"; - } - - static Guid(): string { - // RFC4122: The version 4 UUID is meant for generating UUIDs from truly-random or - // pseudo-random numbers. - // The algorithm is as follows: - // Set the two most significant bits (bits 6 and 7) of the - // clock_seq_hi_and_reserved to zero and one, respectively. - // Set the four most significant bits (bits 12 through 15) of the - // time_hi_and_version field to the 4-bit version number from - // Section 4.1.3. Version4 - // Set all the other bits to randomly (or pseudo-randomly) chosen - // values. - // UUID = time-low "-" time-mid "-"time-high-and-version "-"clock-seq-reserved and low(2hexOctet)"-" node - // time-low = 4hexOctet - // time-mid = 2hexOctet - // time-high-and-version = 2hexOctet - // clock-seq-and-reserved = hexOctet: - // clock-seq-low = hexOctet - // node = 6hexOctet - // Format: xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx - // y could be 1000, 1001, 1010, 1011 since most significant two bits needs to be 10 - // y values are 8, 9, A, B - - var cryptoObj: Crypto = window.crypto; // for IE 11 - if (cryptoObj && cryptoObj.getRandomValues) { - var buffer: Uint8Array = new Uint8Array(16); - cryptoObj.getRandomValues(buffer); - - //buffer[6] and buffer[7] represents the time_hi_and_version field. We will set the four most significant bits (4 through 7) of buffer[6] to represent decimal number 4 (UUID version number). - buffer[6] |= 0x40; //buffer[6] | 01000000 will set the 6 bit to 1. - buffer[6] &= 0x4f; //buffer[6] & 01001111 will set the 4, 5, and 7 bit to 0 such that bits 4-7 == 0100 = "4". - - //buffer[8] represents the clock_seq_hi_and_reserved field. We will set the two most significant bits (6 and 7) of the clock_seq_hi_and_reserved to zero and one, respectively. - buffer[8] |= 0x80; //buffer[8] | 10000000 will set the 7 bit to 1. - buffer[8] &= 0xbf; //buffer[8] & 10111111 will set the 6 bit to 0. - - return this.DecimalToHex(buffer[0]) + this.DecimalToHex(buffer[1]) - + this.DecimalToHex(buffer[2]) + this.DecimalToHex(buffer[3]) - + '-' + this.DecimalToHex(buffer[4]) + this.DecimalToHex(buffer[5]) - + '-' + this.DecimalToHex(buffer[6]) + this.DecimalToHex(buffer[7]) - + '-' + this.DecimalToHex(buffer[8]) + this.DecimalToHex(buffer[9]) - + '-' + this.DecimalToHex(buffer[10]) + this.DecimalToHex(buffer[11]) - + this.DecimalToHex(buffer[12]) + this.DecimalToHex(buffer[13]) - + this.DecimalToHex(buffer[14]) + this.DecimalToHex(buffer[15]); - } - else { - var guidHolder: string = 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'; - var hex: string = '0123456789abcdef'; - var r: number = 0; - var guidResponse: string = ""; - for (var i: number = 0; i < 36; i++) { - if (guidHolder[i] !== '-' && guidHolder[i] !== '4') { - // each x and y needs to be random - r = Math.random() * 16 | 0; - } - if (guidHolder[i] === 'x') { - guidResponse += hex[r]; - } else if (guidHolder[i] === 'y') { - // clock-seq-and-reserved first hex is filtered and remaining hex values are random - r &= 0x3; // bit and with 0011 to set pos 2 to zero ?0?? - r |= 0x8; // set pos 3 to 1 as 1??? - guidResponse += hex[r]; - } else { - guidResponse += guidHolder[i]; - } - } - return guidResponse; - } - }; - } -} \ No newline at end of file diff --git a/lib/msaljs.js b/out/msal.js similarity index 50% rename from lib/msaljs.js rename to out/msal.js index 311d430f10..7b7c34f23a 100644 --- a/lib/msaljs.js +++ b/out/msal.js @@ -1,197 +1,340 @@ var MSAL; (function (MSAL) { - var ResponseTypes; + class AccessTokenCacheItem { + constructor(key, value) { + this.key = key; + this.value = value; + } + } + MSAL.AccessTokenCacheItem = AccessTokenCacheItem; +})(MSAL || (MSAL = {})); +var MSAL; +(function (MSAL) { + class AccessTokenKey { + constructor(authority, clientId, scopes, userIdentifier) { + this.authority = authority; + this.clientId = clientId; + this.Scopes = scopes; + this.userIdentifier = userIdentifier; + } + } + MSAL.AccessTokenKey = AccessTokenKey; +})(MSAL || (MSAL = {})); +var MSAL; +(function (MSAL) { + class AccessTokenValue { + constructor(accessToken, expiresIn) { + this.AccessToken = accessToken; + this.ExpiresIn = expiresIn; + } + } + MSAL.AccessTokenValue = AccessTokenValue; +})(MSAL || (MSAL = {})); +var MSAL; +(function (MSAL) { (function (ResponseTypes) { ResponseTypes[ResponseTypes["id_token"] = 0] = "id_token"; ResponseTypes[ResponseTypes["token"] = 1] = "token"; - })(ResponseTypes || (ResponseTypes = {})); - var LoggingLevel; - (function (LoggingLevel) { - LoggingLevel[LoggingLevel["ERROR"] = 0] = "ERROR"; - LoggingLevel[LoggingLevel["WARN"] = 1] = "WARN"; - LoggingLevel[LoggingLevel["INFO"] = 2] = "INFO"; - LoggingLevel[LoggingLevel["VERBOSE"] = 3] = "VERBOSE"; - })(LoggingLevel || (LoggingLevel = {})); - var Logging = (function () { - function Logging() { - } - Logging.initialize = function (logLevel, loginCallback, correlationId) { - this._logLevel = logLevel; - this._loginCallback = loginCallback; - this._correlationId = correlationId; - }; - Logging._logLevel = 0; - Logging._loginCallback = null; - Logging._correlationId = null; - return Logging; - }()); - MSAL.Logging = Logging; - var Constants = (function () { - function Constants() { - } - Object.defineProperty(Constants, "errorDescription", { - get: function () { return "error_description"; }, - enumerable: true, - configurable: true - }); - Object.defineProperty(Constants, "idToken", { - get: function () { return "id_token"; }, - enumerable: true, - configurable: true - }); - Object.defineProperty(Constants, "accessToken", { - get: function () { return "access_token"; }, - enumerable: true, - configurable: true - }); - Object.defineProperty(Constants, "expiresIn", { - get: function () { return "expires_in"; }, - enumerable: true, - configurable: true - }); - Object.defineProperty(Constants, "sessionState", { - get: function () { return "session_state"; }, - enumerable: true, - configurable: true - }); - Object.defineProperty(Constants, "tokenKeys", { - get: function () { return "adal.token.keys"; }, - enumerable: true, - configurable: true - }); - Object.defineProperty(Constants, "accessTokenKey", { - get: function () { return "adal.access.token.key"; }, - enumerable: true, - configurable: true - }); - Object.defineProperty(Constants, "expirationKey", { - get: function () { return "adal.expiration.key"; }, - enumerable: true, - configurable: true - }); - Object.defineProperty(Constants, "stateLogin", { - get: function () { return "adal.state.login"; }, - enumerable: true, - configurable: true - }); - Object.defineProperty(Constants, "stateAcquireToken", { - get: function () { return "adal.state.acquireToken"; }, - enumerable: true, - configurable: true - }); - Object.defineProperty(Constants, "stateRenew", { - get: function () { return "adal.state.renew"; }, - enumerable: true, - configurable: true - }); - Object.defineProperty(Constants, "nonceIdToken", { - get: function () { return "adal.nonce.idtoken"; }, - enumerable: true, - configurable: true - }); - Object.defineProperty(Constants, "userName", { - get: function () { return "adal.username"; }, - enumerable: true, - configurable: true - }); - Object.defineProperty(Constants, "idTokenKey", { - get: function () { return "adal.idtoken"; }, - enumerable: true, - configurable: true - }); - Object.defineProperty(Constants, "error", { - get: function () { return "adal.error"; }, - enumerable: true, - configurable: true - }); - Object.defineProperty(Constants, "loginRequest", { - get: function () { return "adal.login.request"; }, - enumerable: true, - configurable: true - }); - Object.defineProperty(Constants, "loginError", { - get: function () { return "adal.login.error"; }, - enumerable: true, - configurable: true - }); - Object.defineProperty(Constants, "renewStatus", { - get: function () { return "adal.token.renew.status"; }, - enumerable: true, - configurable: true - }); - Object.defineProperty(Constants, "resourceDelimeter", { - get: function () { return "|"; }, - enumerable: true, - configurable: true - }); - Object.defineProperty(Constants, "loadFrameTimeout", { - get: function () { - return this._loadFrameTimeout; - }, - set: function (timeout) { - this._loadFrameTimeout = timeout; - }, - enumerable: true, - configurable: true - }); + })(MSAL.ResponseTypes || (MSAL.ResponseTypes = {})); + var ResponseTypes = MSAL.ResponseTypes; + class AuthenticationRequestParameters { + constructor(authority, clientId, scope, responseType, redirectUri) { + this.authority = authority; + this.clientId = clientId; + this.scopes = scope; + this.responseType = responseType; + this.redirectUri = redirectUri; + if (responseType !== "token") { + this.nonce = MSAL.Utils.CreateNewGuid(); + } + this.correlationId = MSAL.Utils.CreateNewGuid(); + this.state = MSAL.Utils.CreateNewGuid(); + this.nonce = MSAL.Utils.CreateNewGuid(); + this.xClientSku = "Js"; + this.xClientVer = MSAL.Utils.GetLibraryVersion(); + } + CreateNavigateUrl(scopes) { + if (!scopes) { + scopes = [this.clientId]; + } + let requestUrl = ""; + let str = []; + str.push('?response_type=' + this.responseType); + if (this.responseType === ResponseTypes[ResponseTypes.id_token]) { + if (scopes.indexOf(this.clientId) > -1) { + this.translateclientIdUsedInScope(scopes); + } + } + str.push('scope=' + encodeURIComponent(this.parseScope(scopes))); + str.push('client_id=' + encodeURIComponent(this.clientId)); + str.push('redirect_uri=' + encodeURIComponent(this.redirectUri)); + str.push('state=' + encodeURIComponent(this.state)); + str.push('nonce=' + encodeURIComponent(this.nonce)); + if (this.extraQueryParameters) { + str.push(this.extraQueryParameters); + } + str.push('client-request-id=' + encodeURIComponent(this.correlationId)); + requestUrl = this.authority + '/oauth2/v2.0/authorize' + str.join('&') + "&x-client-SKU=" + this.xClientSku + "&x-client-Ver=" + this.xClientVer; + return requestUrl; + } + translateclientIdUsedInScope(scopes) { + var clientIdIndex = scopes.indexOf(this.clientId); + if (clientIdIndex >= 0) { + scopes.splice(clientIdIndex, 1); + scopes.push('openid'); + scopes.push('profile'); + } + } + parseScope(scopes) { + var scopeList = ''; + if (scopes) { + for (var i = 0; i < scopes.length; ++i) { + scopeList += (i !== scopes.length - 1) ? scopes[i] + ' ' : scopes[i]; + } + } + return scopeList; + } + } + MSAL.AuthenticationRequestParameters = AuthenticationRequestParameters; +})(MSAL || (MSAL = {})); +var MSAL; +(function (MSAL) { + class Constants { + static get errorDescription() { return "error_description"; } + static get idToken() { return "id_token"; } + static get accessToken() { return "access_token"; } + static get expiresIn() { return "expires_in"; } + static get sessionState() { return "session_state"; } + static get tokenKeys() { return "msal.token.keys"; } + static get accessTokenKey() { return "msal.access.token.key"; } + static get expirationKey() { return "msal.expiration.key"; } + static get stateLogin() { return "msal.state.login"; } + static get stateAcquireToken() { return "msal.state.acquireToken"; } + static get stateRenew() { return "msal.state.renew"; } + static get nonceIdToken() { return "msal.nonce.idtoken"; } + static get userName() { return "msal.username"; } + static get idTokenKey() { return "msal.idtoken"; } + static get error() { return "msal.error"; } + static get loginRequest() { return "msal.login.request"; } + static get loginError() { return "msal.login.error"; } + static get renewStatus() { return "msal.token.renew.status"; } + static get resourceDelimeter() { return "|"; } + static get loadFrameTimeout() { + return this._loadFrameTimeout; + } ; + static set loadFrameTimeout(timeout) { + this._loadFrameTimeout = timeout; + } ; - Object.defineProperty(Constants, "tokenRenewStatusCancelled", { - get: function () { return "Canceled"; }, - enumerable: true, - configurable: true - }); - Object.defineProperty(Constants, "tokenRenewStatusCompleted", { - get: function () { return "Completed"; }, - enumerable: true, - configurable: true - }); - Object.defineProperty(Constants, "tokenRenewStatusInProgress", { - get: function () { return "In Progress"; }, - enumerable: true, - configurable: true - }); - Object.defineProperty(Constants, "popUpWidth", { - get: function () { return this._popUpWidth; }, - set: function (width) { - this._popUpWidth = width; - }, - enumerable: true, - configurable: true - }); + static get tokenRenewStatusCancelled() { return "Canceled"; } + static get tokenRenewStatusCompleted() { return "Completed"; } + static get tokenRenewStatusInProgress() { return "In Progress"; } + static get popUpWidth() { return this._popUpWidth; } + static set popUpWidth(width) { + this._popUpWidth = width; + } ; - Object.defineProperty(Constants, "popUpHeight", { - get: function () { return this._popUpHeight; }, - set: function (height) { - this._popUpHeight = height; - }, - enumerable: true, - configurable: true - }); + static get popUpHeight() { return this._popUpHeight; } + static set popUpHeight(height) { + this._popUpHeight = height; + } ; - Object.defineProperty(Constants, "login", { - get: function () { return "LOGIN"; }, - enumerable: true, - configurable: true - }); - Object.defineProperty(Constants, "renewToken", { - get: function () { return "renewToken"; }, - enumerable: true, - configurable: true - }); - Object.defineProperty(Constants, "unknown", { - get: function () { return "UNKNOWN"; }, - enumerable: true, - configurable: true - }); - Constants._loadFrameTimeout = 6000; - Constants._popUpWidth = 483; - Constants._popUpHeight = 600; - return Constants; - }()); + static get login() { return "LOGIN"; } + static get renewToken() { return "renewToken"; } + static get unknown() { return "UNKNOWN"; } + } + Constants._loadFrameTimeout = 6000; + Constants._popUpWidth = 483; + Constants._popUpHeight = 600; MSAL.Constants = Constants; - var UserAgentApplication = (function () { - function UserAgentApplication(clientId, authority, userCallback) { +})(MSAL || (MSAL = {})); +var MSAL; +(function (MSAL) { + (function (LogLevel) { + LogLevel[LogLevel["Error"] = 0] = "Error"; + LogLevel[LogLevel["Warning"] = 1] = "Warning"; + LogLevel[LogLevel["Info"] = 2] = "Info"; + LogLevel[LogLevel["Verbose"] = 3] = "Verbose"; + })(MSAL.LogLevel || (MSAL.LogLevel = {})); + var LogLevel = MSAL.LogLevel; + class Logger { + constructor(correlationId) { + this._level = LogLevel.Info; + this._piiLoggingEnabled = false; + if (Logger._instance) { + return Logger._instance; + } + this._correlationId = correlationId; + Logger._instance = this; + } + get correlationId() { return this._correlationId; } + set correlationId(correlationId) { + this._correlationId = correlationId; + } + ; + get level() { return this._level; } + set level(logLevel) { + if (LogLevel[logLevel]) { + this._level = logLevel; + } + else + throw new Error("Provide a valid value for level. Possibles range for logLevel is 0-3"); + } + ; + get piiLoggingEnabled() { return this._piiLoggingEnabled; } + set piiLoggingEnabled(piiLoggingEnabled) { + this._piiLoggingEnabled = piiLoggingEnabled; + } + ; + get localCallback() { return this._localCallback; } + set localCallback(localCallback) { + if (this.localCallback) { + throw new Error("MSAL logging callback can only be set once per process and should never change once set."); + } + this._localCallback = localCallback; + } + ; + LogMessage(logMessage, logLevel, containsPii) { + if ((logLevel > this.level) || (!this.piiLoggingEnabled && containsPii)) { + return; + } + var timestamp = new Date().toUTCString(); + var log = ''; + if (!MSAL.Utils.isEmpty(this.correlationId)) { + log = timestamp + ':' + this._correlationId + '-' + MSAL.Utils.GetLibraryVersion() + '-' + LogLevel[logLevel] + ' ' + logMessage; + } + else { + log = timestamp + ':' + MSAL.Utils.GetLibraryVersion() + '-' + LogLevel[logLevel] + ' ' + logMessage; + } + this.executeCallback(logLevel, log, containsPii); + } + executeCallback(level, message, containsPii) { + if (this.localCallback) { + this.localCallback(level, message, containsPii); + } + } + error(message) { + this.LogMessage(message, LogLevel.Error, false); + } + errorPii(message) { + this.LogMessage(message, LogLevel.Error, true); + } + warning(message) { + this.LogMessage(message, LogLevel.Warning, false); + } + warningPii(message) { + this.LogMessage(message, LogLevel.Warning, true); + } + info(message) { + this.LogMessage(message, LogLevel.Info, false); + } + infoPii(message) { + this.LogMessage(message, LogLevel.Info, true); + } + verbose(message) { + this.LogMessage(message, LogLevel.Verbose, false); + } + verbosePii(message) { + this.LogMessage(message, LogLevel.Verbose, true); + } + } + MSAL.Logger = Logger; +})(MSAL || (MSAL = {})); +var MSAL; +(function (MSAL) { + class RequestContext { + constructor(correlationId) { + if (RequestContext._instance) { + return RequestContext._instance; + } + this._logger = new MSAL.Logger(correlationId); + this._correlationId = this._logger.correlationId; + RequestContext._instance = this; + } + get correlationId() { return this._correlationId; } + get logger() { return this._logger; } + } + MSAL.RequestContext = RequestContext; +})(MSAL || (MSAL = {})); +var MSAL; +(function (MSAL) { + class RequestInfo { + constructor() { + this.valid = false; + this.parameters = {}; + this.stateMatch = false; + this.stateResponse = ''; + this.requestType = 'unknown'; + } + } + MSAL.RequestInfo = RequestInfo; +})(MSAL || (MSAL = {})); +var MSAL; +(function (MSAL) { + class Storage { + constructor(cacheLocation) { + if (Storage._instance) { + return Storage._instance; + } + this._cacheLocation = cacheLocation; + this._localStorageSupported = typeof window[this._cacheLocation] != "undefined" && window[this._cacheLocation] != null; + this._sessionStorageSupported = typeof window[cacheLocation] != "undefined" && window[cacheLocation] != null; + Storage._instance = this; + if (!this._localStorageSupported && !this._sessionStorageSupported) + throw new Error('localStorage and sessionStorage not supported'); + } + saveItem(key, value) { + if (window[this._cacheLocation]) + window[this._cacheLocation].setItem(key, value); + else + throw new Error('localStorage and sessionStorage are not supported'); + } + getItem(key) { + if (window[this._cacheLocation]) + return window[this._cacheLocation].getItem(key); + else + throw new Error('localStorage and sessionStorage are not supported'); + } + removeItem(key) { + if (window[this._cacheLocation]) + return window[this._cacheLocation].removeItem(key); + else + throw new Error('localStorage and sessionStorage are not supported'); + } + clear() { + if (window[this._cacheLocation]) + return window[this._cacheLocation].clear(); + else + throw new Error('localStorage and sessionStorage are not supported'); + } + getAllAccessTokens(clientId, authority) { + let key; + let results = []; + let accessTokenCacheItem; + let storage = window[this._cacheLocation]; + if (storage) { + for (key in storage) { + if (storage.hasOwnProperty(key)) { + if (key.match(clientId) && key.match(authority)) { + let value = this.getItem(key); + accessTokenCacheItem = new MSAL.AccessTokenCacheItem(JSON.parse(key), JSON.parse(value)); + results.push(accessTokenCacheItem); + } + } + } + } + else + throw new Error('localStorage and sessionStorage are not supported'); + return results; + } + } + MSAL.Storage = Storage; +})(MSAL || (MSAL = {})); +var MSAL; +(function (MSAL) { + class UserAgentApplication { + constructor(clientId, authority, userCallback) { this._cacheLocations = { localStorage: 'localStorage', sessionStorage: 'sessionStorage' @@ -218,50 +361,43 @@ var MSAL; this._renewStates = []; this._checkSessionIframe = null; this._activeRenewals = {}; - this._cacheStorage = new Storage(this._cacheLocation); + this._cacheStorage = new MSAL.Storage(this._cacheLocation); + this._requestContext = new MSAL.RequestContext(''); window.MSAL = this; window.callBackMappedToRenewStates = {}; window.callBacksMappedToRenewStates = {}; } - Object.defineProperty(UserAgentApplication.prototype, "cacheLocation", { - get: function () { - return this._cacheLocation; - }, - set: function (cache) { - this._cacheLocation = cache; - if (this._cacheLocations[cache]) - this._cacheStorage = new Storage(this._cacheLocations[cache]); - else - throw new Error('Cache Location is not valid. Provided value:' + this._cacheLocation + '.Possible values are: ' + this._cacheLocations.localStorage + ', ' + this._cacheLocations.sessionStorage); - }, - enumerable: true, - configurable: true - }); - Object.defineProperty(UserAgentApplication.prototype, "interactionMode", { - get: function () { - return this._interactionMode; - }, - set: function (mode) { - if (this._interactionModes[mode]) - this._interactionMode = this._interactionModes[mode]; - else - throw new Error('Interantion mode is not valid. Provided value:' + this._interactionMode + '.Possible values are: ' + this._interactionModes.redirect + ',' + this._interactionModes.popUp); - }, - enumerable: true, - configurable: true - }); - UserAgentApplication.prototype.login = function () { + get cacheLocation() { + return this._cacheLocation; + } + set cacheLocation(cache) { + this._cacheLocation = cache; + if (this._cacheLocations[cache]) + this._cacheStorage = new MSAL.Storage(this._cacheLocations[cache]); + else + throw new Error('Cache Location is not valid. Provided value:' + this._cacheLocation + '.Possible values are: ' + this._cacheLocations.localStorage + ', ' + this._cacheLocations.sessionStorage); + } + get interactionMode() { + return this._interactionMode; + } + set interactionMode(mode) { + if (this._interactionModes[mode]) + this._interactionMode = this._interactionModes[mode]; + else + throw new Error('Interantion mode is not valid. Provided value:' + this._interactionMode + '.Possible values are: ' + this._interactionModes.redirect + ',' + this._interactionModes.popUp); + } + login() { if (this._loginInProgress) { return; } - var authenticationRequest = new AuthenticationRequestParameters(this.authority, this.clientId, null, ResponseTypes[ResponseTypes.id_token], this.redirectUri); - this._cacheStorage.saveItem(Constants.loginRequest, window.location.href); - this._cacheStorage.saveItem(Constants.loginError, ''); - this._cacheStorage.saveItem(Constants.stateLogin, authenticationRequest.state); - this._cacheStorage.saveItem(Constants.nonceIdToken, authenticationRequest.nonce); - this._cacheStorage.saveItem(Constants.error, ''); - this._cacheStorage.saveItem(Constants.errorDescription, ''); - var urlNavigate = authenticationRequest.CreateNavigateUrl(null); + let authenticationRequest = new MSAL.AuthenticationRequestParameters(this.authority, this.clientId, null, MSAL.ResponseTypes[MSAL.ResponseTypes.id_token], this.redirectUri); + this._cacheStorage.saveItem(MSAL.Constants.loginRequest, window.location.href); + this._cacheStorage.saveItem(MSAL.Constants.loginError, ''); + this._cacheStorage.saveItem(MSAL.Constants.stateLogin, authenticationRequest.state); + this._cacheStorage.saveItem(MSAL.Constants.nonceIdToken, authenticationRequest.nonce); + this._cacheStorage.saveItem(MSAL.Constants.error, ''); + this._cacheStorage.saveItem(MSAL.Constants.errorDescription, ''); + let urlNavigate = authenticationRequest.CreateNavigateUrl(null); this._loginInProgress = true; if (this._interactionMode === this._interactionModes.popUp) { this.openConsentWindow(urlNavigate, 'login', 20, this, this._userCallback); @@ -272,18 +408,19 @@ var MSAL; window.location.replace(urlNavigate); } } - }; - UserAgentApplication.prototype.openConsentWindow = function (urlNavigate, title, interval, instance, callback) { - var popupWindow = this.openPopup(urlNavigate, title, Constants.popUpWidth, Constants.popUpHeight); + } + openConsentWindow(urlNavigate, title, interval, instance, callback) { + let popupWindow = this.openPopup(urlNavigate, title, MSAL.Constants.popUpWidth, MSAL.Constants.popUpHeight); if (popupWindow == null) { instance._loginInProgress = false; instance._acquireTokenInProgress = false; - Logger.warn('Popup Window is null. This can happen if you are using IE'); - this._cacheStorage.saveItem(Constants.error, 'Error opening popup'); - this._cacheStorage.saveItem(Constants.errorDescription, 'Popup Window is null. This can happen if you are using IE'); - this._cacheStorage.saveItem(Constants.loginError, 'Popup Window is null. This can happen if you are using IE'); - if (callback) - callback(this._cacheStorage.getItem(Constants.loginError), null, null); + this._requestContext.logger.info('Popup Window is null. This can happen if you are using IE'); + this._cacheStorage.saveItem(MSAL.Constants.error, 'Error opening popup'); + this._cacheStorage.saveItem(MSAL.Constants.errorDescription, 'Popup Window is null. This can happen if you are using IE'); + this._cacheStorage.saveItem(MSAL.Constants.loginError, 'Popup Window is null. This can happen if you are using IE'); + if (callback) { + callback(this._cacheStorage.getItem(MSAL.Constants.loginError), null, null); + } return; } var self = this; @@ -299,47 +436,64 @@ var MSAL; window.clearInterval(pollTimer); instance._loginInProgress = false; instance._acquireTokenInProgress = false; - Logger.info("Closing popup window"); + self._requestContext.logger.info("Closing popup window"); popupWindow.close(); } } catch (e) { } }, interval); - }; - UserAgentApplication.prototype.logout = function () { - this._cacheStorage.clear(); + } + logout() { + this.clearCache(); this.user = null; var logout = ''; if (this.postLogoutredirectUri) { logout = 'post_logout_redirect_uri=' + encodeURIComponent(this.postLogoutredirectUri); } - var urlNavigate = this.authority + '/oauth2/v2.0/logout?' + logout; + let urlNavigate = this.authority + '/oauth2/v2.0/logout?' + logout; if (urlNavigate) { window.location.replace(urlNavigate); } - }; - UserAgentApplication.prototype.openPopup = function (urlNavigate, title, popUpWidth, popUpHeight) { + } + clearCache() { + this._cacheStorage.saveItem(MSAL.Constants.sessionState, ''); + this._cacheStorage.saveItem(MSAL.Constants.stateLogin, ''); + this._renewStates = []; + this._cacheStorage.saveItem(MSAL.Constants.idTokenKey, ''); + this._cacheStorage.saveItem(MSAL.Constants.error, ''); + this._cacheStorage.saveItem(MSAL.Constants.errorDescription, ''); + var keys = this._cacheStorage.getItem(MSAL.Constants.tokenKeys); + if (!MSAL.Utils.isEmpty(keys)) { + let keysArray = keys.split(MSAL.Constants.resourceDelimeter); + for (var i = 0; i < keysArray.length - 1; i++) { + this._cacheStorage.saveItem(MSAL.Constants.accessTokenKey + keysArray[i], ''); + this._cacheStorage.saveItem(MSAL.Constants.expirationKey + keysArray[i], '0'); + } + } + this._cacheStorage.saveItem(MSAL.Constants.tokenKeys, ''); + } + openPopup(urlNavigate, title, popUpWidth, popUpHeight) { try { - var winLeft = window.screenLeft ? window.screenLeft : window.screenX; - var winTop = window.screenTop ? window.screenTop : window.screenY; - var width = window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth; - var height = window.innerHeight || document.documentElement.clientHeight || document.body.clientHeight; - var left = ((width / 2) - (popUpWidth / 2)) + winLeft; - var top_1 = ((height / 2) - (popUpHeight / 2)) + winTop; - var popupWindow = window.open(urlNavigate, title, 'width=' + popUpWidth + ', height=' + popUpHeight + ', top=' + top_1 + ', left=' + left); + let winLeft = window.screenLeft ? window.screenLeft : window.screenX; + let winTop = window.screenTop ? window.screenTop : window.screenY; + let width = window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth; + let height = window.innerHeight || document.documentElement.clientHeight || document.body.clientHeight; + let left = ((width / 2) - (popUpWidth / 2)) + winLeft; + let top = ((height / 2) - (popUpHeight / 2)) + winTop; + let popupWindow = window.open(urlNavigate, title, 'width=' + popUpWidth + ', height=' + popUpHeight + ', top=' + top + ', left=' + left); if (popupWindow.focus) { popupWindow.focus(); } return popupWindow; } catch (e) { - Logger.warn('error opening popup, ' + e.message); + this._requestContext.logger.error('error opening popup ' + e.message); this._loginInProgress = false; return null; } - }; - UserAgentApplication.prototype.validateInputScope = function (scopes) { + } + validateInputScope(scopes) { if (!scopes || scopes.length < 1) { return; } @@ -353,12 +507,11 @@ var MSAL; throw new Error('API does not accept offline_access as a user-provided scope'); } if (scopes.indexOf(this.clientId) > -1) { - if (scopes.length > 1) { + if (scopes.length > 1) throw new Error('Client Id can only be provided as a single scope'); - } } - }; - UserAgentApplication.prototype.registerCallback = function (expectedState, scope, callback) { + } + registerCallback(expectedState, scope, callback) { this._activeRenewals[scope] = expectedState; if (!window.callBacksMappedToRenewStates[expectedState]) { window.callBacksMappedToRenewStates[expectedState] = []; @@ -373,42 +526,40 @@ var MSAL; window.callBacksMappedToRenewStates[expectedState][i](errorDesc, token, error); } catch (error) { - Logger.warn(error); + self._requestContext.logger.warning(error); } } window.callBacksMappedToRenewStates[expectedState] = null; window.callBackMappedToRenewStates[expectedState] = null; }; } - }; - UserAgentApplication.prototype.getCachedToken = function (scopes) { - var accessTokenCacheItems = this._cacheStorage.getAllAccessTokens(this.clientId, this.authority); - var accessTokenItems = []; - for (var i = 0; i < accessTokenCacheItems.length; i++) { - var accessTokenCacheItem = accessTokenCacheItems[i]; - if (accessTokenCacheItem.key.user.profile.oid === this.user.profile.oid) { - var cachedScopes = accessTokenCacheItem.key.Scopes.split(' '); - if (Utils.containsScope(cachedScopes, scopes)) { + } + getCachedToken(scopes) { + let accessTokenCacheItems = this._cacheStorage.getAllAccessTokens(this.clientId, this.authority); + let accessTokenItems = []; + for (let i = 0; i < accessTokenCacheItems.length; i++) { + let accessTokenCacheItem = accessTokenCacheItems[i]; + if (accessTokenCacheItem.key.userIdentifier === this.user.profile.oid) { + let cachedScopes = accessTokenCacheItem.key.Scopes.split(' '); + if (MSAL.Utils.containsScope(cachedScopes, scopes)) accessTokenItems.push(accessTokenCacheItem); - } } } if (accessTokenItems.length === 0 || accessTokenCacheItems.length > 1) return null; else { - var accessTokenCacheItem = accessTokenItems[0]; + let accessTokenCacheItem = accessTokenItems[0]; var expired = Number(accessTokenCacheItem.value.ExpiresIn); var offset = this._clockSkew || 300; - if (expired && (expired > Utils.now() + offset)) { + if (expired && (expired > MSAL.Utils.now() + offset)) return accessTokenCacheItem.value.AccessToken; - } else { - this._cacheStorage.removeItem(JSON.stringify(accessTokenItems[0])); + this._cacheStorage.removeItem(JSON.stringify(accessTokenItems[0].key)); return null; } } - }; - UserAgentApplication.prototype.addHintParameters = function (urlNavigate, loginHint) { + } + addHintParameters(urlNavigate, loginHint) { if (this.user && this.user.profile && this.user.profile.hasOwnProperty('preferred_username')) { if (loginHint) { urlNavigate += '&login_hint=' + encodeURIComponent(loginHint); @@ -426,27 +577,27 @@ var MSAL; } } return urlNavigate; - }; - UserAgentApplication.prototype.urlContainsQueryStringParameter = function (name, url) { + } + urlContainsQueryStringParameter(name, url) { var regex = new RegExp("[\\?&]" + name + "="); return regex.test(url); - }; - UserAgentApplication.prototype.acquireToken = function (scopes, callback, loginHint, extraQueryParameters) { + } + acquireToken(scopes, callback, loginHint, extraQueryParameters) { if (this._acquireTokenInProgress) { return; } this.validateInputScope(scopes); - var scope = scopes.join(' '); + let scope = scopes.join(' '); if (!this.user) { - callback('user login is required', null); + callback('user login is required', null, null); return; } this._acquireTokenInProgress = true; - var authenticationRequest = new AuthenticationRequestParameters(this.authority, this.clientId, scopes, ResponseTypes[ResponseTypes.token], this.redirectUri); + let authenticationRequest = new MSAL.AuthenticationRequestParameters(this.authority, this.clientId, scopes, MSAL.ResponseTypes[MSAL.ResponseTypes.token], this.redirectUri); authenticationRequest.state = authenticationRequest.state + '|' + scope; if (extraQueryParameters) authenticationRequest.extraQueryParameters = extraQueryParameters; - var urlNavigate = authenticationRequest.CreateNavigateUrl(scopes); + let urlNavigate = authenticationRequest.CreateNavigateUrl(scopes); if (loginHint) urlNavigate = this.addHintParameters(urlNavigate, loginHint); else @@ -459,57 +610,56 @@ var MSAL; } else { if (urlNavigate) { - this._cacheStorage.saveItem(Constants.stateAcquireToken, authenticationRequest.state); + this._cacheStorage.saveItem(MSAL.Constants.stateAcquireToken, authenticationRequest.state); window.location.replace(urlNavigate); } } - }; - UserAgentApplication.prototype.acquireTokenSilent = function (scopes, callback) { + } + acquireTokenSilent(scopes, callback) { this.validateInputScope(scopes); var token = this.getCachedToken(scopes); - var scope = scopes.join(' '); + let scope = scopes.join(' '); if (token) { - Logger.info('Token is already in cache for scope:' + scope); - callback(null, token); + this._requestContext.logger.warning('Token is already in cache for scope:' + scope); + callback(null, token, null); return; } if (!this.user) { - callback('user login is required', null); + callback('user login is required', null, null); return; } if (this._activeRenewals[scope]) { this.registerCallback(this._activeRenewals[scope], scope, callback); } else { - if (!Utils.isEmpty(scope) && scope.indexOf(this.clientId) > -1) { - Logger.verbose('renewing idToken'); + if (!MSAL.Utils.isEmpty(scope) && scope.indexOf(this.clientId) > -1) { + this._requestContext.logger.verbose('renewing idToken'); this.renewIdToken(scopes, callback); } else { - Logger.verbose('renewing accesstoken'); + this._requestContext.logger.verbose('renewing accesstoken'); this.renewToken(scopes, callback); } } - }; - UserAgentApplication.prototype.loadFrameTimeout = function (urlNavigate, frameName, scope) { - Logger.verbose('Set loading state to pending for: ' + scope); - this._cacheStorage.saveItem(Constants.renewStatus + scope, Constants.tokenRenewStatusInProgress); + } + loadFrameTimeout(urlNavigate, frameName, scope) { + this._requestContext.logger.verbose('Set loading state to pending for: ' + scope); + this._cacheStorage.saveItem(MSAL.Constants.renewStatus + scope, MSAL.Constants.tokenRenewStatusInProgress); this.loadFrame(urlNavigate, frameName); var self = this; setTimeout(function () { - if (self._cacheStorage.getItem(Constants.renewStatus + scope) === Constants.tokenRenewStatusInProgress) { - Logger.verbose('Loading frame has timed out after: ' + (Constants.loadFrameTimeout / 1000) + ' seconds for scope ' + scope); + if (self._cacheStorage.getItem(MSAL.Constants.renewStatus + scope) === MSAL.Constants.tokenRenewStatusInProgress) { + this._requestContext.logger.verbose('Loading frame has timed out after: ' + (MSAL.Constants.loadFrameTimeout / 1000) + ' seconds for scope ' + scope); var expectedState = self._activeRenewals[scope]; - if (expectedState && window.callBackMappedToRenewStates[expectedState]) { + if (expectedState && window.callBackMappedToRenewStates[expectedState]) window.callBackMappedToRenewStates[expectedState]('Token renewal operation failed due to timeout', null); - } - self._cacheStorage.saveItem(Constants.renewStatus + scope, Constants.tokenRenewStatusCancelled); + self._cacheStorage.saveItem(MSAL.Constants.renewStatus + scope, MSAL.Constants.tokenRenewStatusCancelled); } - }, Constants.loadFrameTimeout); - }; - UserAgentApplication.prototype.loadFrame = function (urlNavigate, frameName) { + }, MSAL.Constants.loadFrameTimeout); + } + loadFrame(urlNavigate, frameName) { var self = this; - Logger.info('LoadFrame: ' + frameName); + this._requestContext.logger.info('LoadFrame: ' + frameName); var frameCheck = frameName; setTimeout(function () { var frameHandle = self.addAdalFrame(frameCheck); @@ -518,12 +668,12 @@ var MSAL; self.loadFrame(urlNavigate, frameCheck); } }, 500); - }; - UserAgentApplication.prototype.addAdalFrame = function (iframeId) { + } + addAdalFrame(iframeId) { if (typeof iframeId === 'undefined') { return; } - Logger.info('Add adal frame to document:' + iframeId); + this._requestContext.logger.info('Add msal frame to document:' + iframeId); var adalFrame = document.getElementById(iframeId); if (!adalFrame) { if (document.createElement && document.documentElement && @@ -543,179 +693,177 @@ var MSAL; } } return adalFrame; - }; - UserAgentApplication.prototype.renewToken = function (scopes, callback) { + } + renewToken(scopes, callback) { var scope = scopes.join(' '); - Logger.verbose('renewToken is called for scope:' + scope); + this._requestContext.logger.verbose('renewToken is called for scope:' + scope); var frameHandle = this.addAdalFrame('adalRenewFrame' + scope); - var authenticationRequest = new AuthenticationRequestParameters(this.authority, this.clientId, scopes, ResponseTypes[ResponseTypes.token], this.redirectUri); + let authenticationRequest = new MSAL.AuthenticationRequestParameters(this.authority, this.clientId, scopes, MSAL.ResponseTypes[MSAL.ResponseTypes.token], this.redirectUri); authenticationRequest.state = authenticationRequest.state + '|' + scope; this._renewStates.push(authenticationRequest.state); - Logger.verbose('Renew token Expected state: ' + authenticationRequest.state); - var urlNavigate = authenticationRequest.CreateNavigateUrl(scopes) + '&prompt=none'; + this._requestContext.logger.verbose('Renew token Expected state: ' + authenticationRequest.state); + let urlNavigate = authenticationRequest.CreateNavigateUrl(scopes) + '&prompt=none'; urlNavigate = this.addHintParameters(urlNavigate); this.registerCallback(authenticationRequest.state, scope, callback); - Logger.verbose('Navigate to:' + urlNavigate); + this._requestContext.logger.verbose('Navigate to:' + urlNavigate); frameHandle.src = 'about:blank'; this.loadFrameTimeout(urlNavigate, 'adalRenewFrame' + scope, scope); - }; - UserAgentApplication.prototype.renewIdToken = function (scopes, callback) { - Logger.info('renewidToken is called'); - var frameHandle = this.addAdalFrame('adalIdTokenFrame'); - var authenticationRequest = new AuthenticationRequestParameters(this.authority, this.clientId, scopes, ResponseTypes[ResponseTypes.id_token], this.redirectUri); + } + renewIdToken(scopes, callback) { + this._requestContext.logger.info('renewidToken is called'); + let frameHandle = this.addAdalFrame('adalIdTokenFrame'); + let authenticationRequest = new MSAL.AuthenticationRequestParameters(this.authority, this.clientId, scopes, MSAL.ResponseTypes[MSAL.ResponseTypes.id_token], this.redirectUri); authenticationRequest.state = authenticationRequest.state + '|' + this.clientId; - this._cacheStorage.saveItem(Constants.nonceIdToken, authenticationRequest.nonce); - Logger.verbose('Renew Idtoken Expected state: ' + authenticationRequest.state); - var urlNavigate = authenticationRequest.CreateNavigateUrl(scopes) + '&prompt=none'; + this._cacheStorage.saveItem(MSAL.Constants.nonceIdToken, authenticationRequest.nonce); + this._requestContext.logger.verbose('Renew Idtoken Expected state: ' + authenticationRequest.state); + let urlNavigate = authenticationRequest.CreateNavigateUrl(scopes) + '&prompt=none'; urlNavigate = this.addHintParameters(urlNavigate); this._renewStates.push(authenticationRequest.state); this.registerCallback(authenticationRequest.state, this.clientId, callback); - Logger.verbose('Navigate to:' + urlNavigate); + this._requestContext.logger.verbose('Navigate to:' + urlNavigate); frameHandle.src = 'about:blank'; this.loadFrameTimeout(urlNavigate, 'adalIdTokenFrame', this.clientId); - }; - UserAgentApplication.prototype.hasScope = function (key) { - var keys = this._cacheStorage.getItem(Constants.tokenKeys); - return keys && !Utils.isEmpty(keys) && (keys.indexOf(key + Constants.resourceDelimeter) > -1); - }; + } + hasScope(key) { + var keys = this._cacheStorage.getItem(MSAL.Constants.tokenKeys); + return keys && !MSAL.Utils.isEmpty(keys) && (keys.indexOf(key + MSAL.Constants.resourceDelimeter) > -1); + } ; - UserAgentApplication.prototype.getUser = function () { + getUser() { if (this.user) { return this.user; } - var idToken = this._cacheStorage.getItem(Constants.idTokenKey); - if (!Utils.isEmpty(idToken)) { + var idToken = this._cacheStorage.getItem(MSAL.Constants.idTokenKey); + if (!MSAL.Utils.isEmpty(idToken)) { this.user = this.createUser(idToken); return this.user; } return null; - }; + } ; - UserAgentApplication.prototype.handleAuthenticationResponse = function (hash) { - if (hash == null) + handleAuthenticationResponse(hash) { + if (hash == null) { hash = window.location.hash; + } if (this.isCallback(hash)) { - var requestInfo = this.getRequestInfo(hash); - Logger.info('Returned from redirect url'); + let requestInfo = this.getRequestInfo(hash); + this._requestContext.logger.info('Returned from redirect url'); this.saveTokenFromHash(requestInfo); - var token = null, callback = null; - if ((requestInfo.requestType === Constants.renewToken) && window.parent) { + let token = null, callback = null; + if ((requestInfo.requestType === MSAL.Constants.renewToken) && window.parent) { if (window.parent !== window) - Logger.verbose('Window is in iframe, acquiring token silently'); + this._requestContext.logger.verbose('Window is in iframe, acquiring token silently'); else - Logger.verbose('acquiring token interactive in progress'); - if (window.parent.callBackMappedToRenewStates[requestInfo.stateResponse]) { + this._requestContext.logger.verbose('acquiring token interactive in progress'); + if (window.parent.callBackMappedToRenewStates[requestInfo.stateResponse]) callback = window.parent.callBackMappedToRenewStates[requestInfo.stateResponse]; - } else callback = this._userCallback; - token = requestInfo.parameters[Constants.accessToken] || requestInfo.parameters[Constants.idToken]; + token = requestInfo.parameters[MSAL.Constants.accessToken] || requestInfo.parameters[MSAL.Constants.idToken]; } - else if (requestInfo.requestType === Constants.login) { + else if (requestInfo.requestType === MSAL.Constants.login) { callback = this._userCallback; - token = requestInfo.parameters[Constants.idToken]; + token = requestInfo.parameters[MSAL.Constants.idToken]; } try { if (callback) - callback(this._cacheStorage.getItem(Constants.errorDescription), token, this._cacheStorage.getItem(Constants.error)); + callback(this._cacheStorage.getItem(MSAL.Constants.errorDescription), token, this._cacheStorage.getItem(MSAL.Constants.error)); } catch (err) { - Logger.error('Error occurred in user defined callback function', err); + this._requestContext.logger.error('Error occurred in user defined callback function: ' + err); } if (this._interactionMode !== this._interactionModes.popUp) { window.location.hash = ''; - if (this.navigateToLoginRequestUrl && window.location.href.replace('#', '') !== this._cacheStorage.getItem(Constants.loginRequest)) - window.location.href = this._cacheStorage.getItem(Constants.loginRequest); + if (this.navigateToLoginRequestUrl && window.location.href.replace('#', '') !== this._cacheStorage.getItem(MSAL.Constants.loginRequest)) + window.location.href = this._cacheStorage.getItem(MSAL.Constants.loginRequest); } } - }; - UserAgentApplication.prototype.saveAccessToken = function (requestInfo) { + } + saveAccessToken(requestInfo) { if (requestInfo.parameters.hasOwnProperty('scope')) { this.user = this.getUser(); - var scopes = requestInfo.parameters['scope']; - var consentedScopes = scopes.split(' '); - var accessTokenCacheItems = this._cacheStorage.getAllAccessTokens(this.clientId, this.authority); - for (var i = 0; i < accessTokenCacheItems.length; i++) { - var accessTokenCacheItem = accessTokenCacheItems[i]; - if (accessTokenCacheItem.key.user.profile.oid === this.user.profile.oid) { + let scopes = requestInfo.parameters['scope']; + let consentedScopes = scopes.split(' '); + let accessTokenCacheItems = this._cacheStorage.getAllAccessTokens(this.clientId, this.authority); + for (let i = 0; i < accessTokenCacheItems.length; i++) { + let accessTokenCacheItem = accessTokenCacheItems[i]; + if (accessTokenCacheItem.key.userIdentifier === this.user.profile.oid) { var cachedScopes = accessTokenCacheItem.key.Scopes.split(' '); - if (Utils.isIntersectingScopes(cachedScopes, consentedScopes)) { - this._cacheStorage.removeItem(JSON.stringify(accessTokenCacheItem)); - } + if (MSAL.Utils.isIntersectingScopes(cachedScopes, consentedScopes)) + this._cacheStorage.removeItem(JSON.stringify(accessTokenCacheItem.key)); } } - var accessTokenKey = new AccessTokenKey(this.authority, this.clientId, this.user, scopes); - var accessTokenValue = new AccessTokenValue(requestInfo.parameters[Constants.accessToken], Utils.expiresIn(requestInfo.parameters[Constants.expiresIn]).toString()); + let accessTokenKey = new MSAL.AccessTokenKey(this.authority, this.clientId, scopes, this.user.profile.oid); + let accessTokenValue = new MSAL.AccessTokenValue(requestInfo.parameters[MSAL.Constants.accessToken], MSAL.Utils.expiresIn(requestInfo.parameters[MSAL.Constants.expiresIn]).toString()); this._cacheStorage.saveItem(JSON.stringify(accessTokenKey), JSON.stringify(accessTokenValue)); } - }; - UserAgentApplication.prototype.saveTokenFromHash = function (requestInfo) { - Logger.info('State status:' + requestInfo.stateMatch + '; Request type:' + requestInfo.requestType); - this._cacheStorage.saveItem(Constants.error, ''); - this._cacheStorage.saveItem(Constants.errorDescription, ''); + } + saveTokenFromHash(requestInfo) { + this._requestContext.logger.info('State status:' + requestInfo.stateMatch + '; Request type:' + requestInfo.requestType); + this._cacheStorage.saveItem(MSAL.Constants.error, ''); + this._cacheStorage.saveItem(MSAL.Constants.errorDescription, ''); var scope = this.getScopeFromState(requestInfo.stateResponse); - if (requestInfo.parameters.hasOwnProperty(Constants.errorDescription)) { - Logger.info('Error :' + requestInfo.parameters[Constants.error] + '; Error description:' + requestInfo.parameters[Constants.errorDescription]); - this._cacheStorage.saveItem(Constants.error, requestInfo.parameters["error"]); - this._cacheStorage.saveItem(Constants.errorDescription, requestInfo.parameters[Constants.errorDescription]); - if (requestInfo.requestType === Constants.login) { + if (requestInfo.parameters.hasOwnProperty(MSAL.Constants.errorDescription)) { + this._requestContext.logger.info('Error :' + requestInfo.parameters[MSAL.Constants.error] + '; Error description:' + requestInfo.parameters[MSAL.Constants.errorDescription]); + this._cacheStorage.saveItem(MSAL.Constants.error, requestInfo.parameters["error"]); + this._cacheStorage.saveItem(MSAL.Constants.errorDescription, requestInfo.parameters[MSAL.Constants.errorDescription]); + if (requestInfo.requestType === MSAL.Constants.login) { this._loginInProgress = false; - this._cacheStorage.saveItem(Constants.loginError, requestInfo.parameters["errorDescription"]); + this._cacheStorage.saveItem(MSAL.Constants.loginError, requestInfo.parameters["errorDescription"]); } } else { if (requestInfo.stateMatch) { - Logger.info('State is right'); - if (requestInfo.parameters.hasOwnProperty(Constants.sessionState)) { - this._cacheStorage.saveItem(Constants.sessionState, requestInfo.parameters[Constants.sessionState]); - } + this._requestContext.logger.info('State is right'); + if (requestInfo.parameters.hasOwnProperty(MSAL.Constants.sessionState)) + this._cacheStorage.saveItem(MSAL.Constants.sessionState, requestInfo.parameters[MSAL.Constants.sessionState]); var keys; - if (requestInfo.parameters.hasOwnProperty(Constants.accessToken)) { - Logger.info('Fragment has access token'); + if (requestInfo.parameters.hasOwnProperty(MSAL.Constants.accessToken)) { + this._requestContext.logger.info('Fragment has access token'); this.saveAccessToken(requestInfo); } - if (requestInfo.parameters.hasOwnProperty(Constants.idToken)) { - Logger.info('Fragment has id token'); + if (requestInfo.parameters.hasOwnProperty(MSAL.Constants.idToken)) { + this._requestContext.logger.info('Fragment has id token'); this._loginInProgress = false; - this.user = this.createUser(requestInfo.parameters[Constants.idToken]); + this.user = this.createUser(requestInfo.parameters[MSAL.Constants.idToken]); if (this.user && this.user.profile) { - if (this.user.profile.nonce !== this._cacheStorage.getItem(Constants.nonceIdToken)) { + if (this.user.profile.nonce !== this._cacheStorage.getItem(MSAL.Constants.nonceIdToken)) { this.user = null; - this._cacheStorage.saveItem(Constants.loginError, 'Nonce Mismatch.Expected: ' + this._cacheStorage.getItem(Constants.nonceIdToken) + ',' + 'Actual: ' + this.user.profile.nonce); + this._cacheStorage.saveItem(MSAL.Constants.loginError, 'Nonce Mismatch.Expected: ' + this._cacheStorage.getItem(MSAL.Constants.nonceIdToken) + ',' + 'Actual: ' + this.user.profile.nonce); } else { - this._cacheStorage.saveItem(Constants.idTokenKey, requestInfo.parameters[Constants.idToken]); + this._cacheStorage.saveItem(MSAL.Constants.idTokenKey, requestInfo.parameters[MSAL.Constants.idToken]); scope = this.clientId; if (!this.hasScope(scope)) { - keys = this._cacheStorage.getItem(Constants.tokenKeys) || ''; - this._cacheStorage.saveItem(Constants.tokenKeys, keys + scope + Constants.resourceDelimeter); + keys = this._cacheStorage.getItem(MSAL.Constants.tokenKeys) || ''; + this._cacheStorage.saveItem(MSAL.Constants.tokenKeys, keys + scope + MSAL.Constants.resourceDelimeter); } - this._cacheStorage.saveItem(Constants.accessTokenKey + scope, requestInfo.parameters[Constants.idToken]); - this._cacheStorage.saveItem(Constants.expirationKey + scope, this.user.profile.exp); + this._cacheStorage.saveItem(MSAL.Constants.accessTokenKey + scope, requestInfo.parameters[MSAL.Constants.idToken]); + this._cacheStorage.saveItem(MSAL.Constants.expirationKey + scope, this.user.profile.exp); } } else { - this._cacheStorage.saveItem(Constants.error, 'invalid idToken'); - this._cacheStorage.saveItem(Constants.errorDescription, 'Invalid idToken. idToken: ' + requestInfo.parameters[Constants.idToken]); + this._cacheStorage.saveItem(MSAL.Constants.error, 'invalid idToken'); + this._cacheStorage.saveItem(MSAL.Constants.errorDescription, 'Invalid idToken. idToken: ' + requestInfo.parameters[MSAL.Constants.idToken]); } } } else { - this._cacheStorage.saveItem(Constants.error, 'Invalid_state'); - this._cacheStorage.saveItem(Constants.errorDescription, 'Invalid_state. state: ' + requestInfo.stateResponse); + this._cacheStorage.saveItem(MSAL.Constants.error, 'Invalid_state'); + this._cacheStorage.saveItem(MSAL.Constants.errorDescription, 'Invalid_state. state: ' + requestInfo.stateResponse); } } - this._cacheStorage.saveItem(Constants.renewStatus + scope, Constants.tokenRenewStatusCompleted); - }; + this._cacheStorage.saveItem(MSAL.Constants.renewStatus + scope, MSAL.Constants.tokenRenewStatusCompleted); + } ; - UserAgentApplication.prototype.isCallback = function (hash) { + isCallback(hash) { hash = this.getHash(hash); - var parameters = Utils.deserialize(hash); - return (parameters.hasOwnProperty(Constants.errorDescription) || - parameters.hasOwnProperty(Constants.accessToken) || - parameters.hasOwnProperty(Constants.idToken)); - }; - UserAgentApplication.prototype.getHash = function (hash) { + var parameters = MSAL.Utils.deserialize(hash); + return (parameters.hasOwnProperty(MSAL.Constants.errorDescription) || + parameters.hasOwnProperty(MSAL.Constants.accessToken) || + parameters.hasOwnProperty(MSAL.Constants.idToken)); + } + getHash(hash) { if (hash.indexOf('#/') > -1) { hash = hash.substring(hash.indexOf('#/') + 2); } @@ -723,33 +871,31 @@ var MSAL; hash = hash.substring(1); } return hash; - }; + } ; - UserAgentApplication.prototype.getRequestInfo = function (hash) { + getRequestInfo(hash) { hash = this.getHash(hash); - var parameters = Utils.deserialize(hash); - var requestInfo = new RequestInfo(); + let parameters = MSAL.Utils.deserialize(hash); + let requestInfo = new MSAL.RequestInfo(); if (parameters) { requestInfo.parameters = parameters; - if (parameters.hasOwnProperty(Constants.errorDescription) || - parameters.hasOwnProperty(Constants.accessToken) || - parameters.hasOwnProperty(Constants.idToken)) { + if (parameters.hasOwnProperty(MSAL.Constants.errorDescription) || + parameters.hasOwnProperty(MSAL.Constants.accessToken) || + parameters.hasOwnProperty(MSAL.Constants.idToken)) { requestInfo.valid = true; var stateResponse = ''; - if (parameters.hasOwnProperty('state')) { + if (parameters.hasOwnProperty('state')) stateResponse = parameters.state; - } - else { + else return requestInfo; - } requestInfo.stateResponse = stateResponse; - if (stateResponse === this._cacheStorage.getItem(Constants.stateLogin)) { - requestInfo.requestType = Constants.login; + if (stateResponse === this._cacheStorage.getItem(MSAL.Constants.stateLogin)) { + requestInfo.requestType = MSAL.Constants.login; requestInfo.stateMatch = true; return requestInfo; } - else if (stateResponse === this._cacheStorage.getItem(Constants.stateAcquireToken)) { - requestInfo.requestType = Constants.renewToken; + else if (stateResponse === this._cacheStorage.getItem(MSAL.Constants.stateAcquireToken)) { + requestInfo.requestType = MSAL.Constants.renewToken; requestInfo.stateMatch = true; return requestInfo; } @@ -758,7 +904,7 @@ var MSAL; var statesInParentContext = clientApplication._renewStates; for (var i = 0; i < statesInParentContext.length; i++) { if (statesInParentContext[i] === requestInfo.stateResponse) { - requestInfo.requestType = Constants.renewToken; + requestInfo.requestType = MSAL.Constants.renewToken; requestInfo.stateMatch = true; break; } @@ -767,9 +913,9 @@ var MSAL; } } return requestInfo; - }; + } ; - UserAgentApplication.prototype.getScopeFromState = function (state) { + getScopeFromState(state) { if (state) { var splitIndex = state.indexOf('|'); if (splitIndex > -1 && splitIndex + 1 < state.length) { @@ -777,11 +923,11 @@ var MSAL; } } return ''; - }; + } ; - UserAgentApplication.prototype.createUser = function (idToken) { + createUser(idToken) { var user; - var parsedJson = Utils.extractIdToken(idToken); + var parsedJson = MSAL.Utils.extractIdToken(idToken); if (parsedJson && parsedJson.hasOwnProperty('aud')) { if (parsedJson.aud.toLowerCase() === this.clientId.toLowerCase()) { user = { @@ -796,217 +942,33 @@ var MSAL; } } else { + this._requestContext.logger.warning('IdToken has invalid aud field'); } } return user; - }; + } ; - return UserAgentApplication; - }()); + } MSAL.UserAgentApplication = UserAgentApplication; - var User = (function () { - function User() { - } - return User; - }()); - var RequestInfo = (function () { - function RequestInfo() { - this.valid = false; - this.parameters = {}; - this.stateMatch = false; - this.stateResponse = ''; - this.requestType = 'unknown'; - } - return RequestInfo; - }()); - var AccessTokenCacheItem = (function () { - function AccessTokenCacheItem(key, value) { - this.key = key; - this.value = value; - } - return AccessTokenCacheItem; - }()); - var AccessTokenValue = (function () { - function AccessTokenValue(accessToken, expiresIn) { - this.AccessToken = accessToken; - this.ExpiresIn = expiresIn; - } - return AccessTokenValue; - }()); - var AccessTokenKey = (function () { - function AccessTokenKey(authority, clientId, user, scopes) { - this.authority = authority; - this.clientId = clientId; - this.Scopes = scopes; - this.user = user; - } - return AccessTokenKey; - }()); - var AuthenticationRequestParameters = (function () { - function AuthenticationRequestParameters(authority, clientId, scope, responseType, redirectUri) { - this.authority = authority; - this.clientId = clientId; - this.scopes = scope; - this.responseType = responseType; - this.redirectUri = redirectUri; - if (responseType !== "token") { - this.nonce = Utils.Guid(); - } - this.correlationId = Utils.Guid(); - this.state = Utils.Guid(); - this.nonce = Utils.Guid(); - this.xClientSku = "Js"; - this.xClientVer = Utils.GetLibraryVersion(); - } - AuthenticationRequestParameters.prototype.CreateNavigateUrl = function (scopes) { - if (!scopes) - scopes = [this.clientId]; - var requestUrl = ""; - var str = []; - str.push('?response_type=' + this.responseType); - if (this.responseType === ResponseTypes[ResponseTypes.id_token]) { - if (scopes.indexOf(this.clientId) > -1) { - this.translateclientIdUsedInScope(scopes); - } - } - str.push('scope=' + encodeURIComponent(this.parseScope(scopes))); - str.push('client_id=' + encodeURIComponent(this.clientId)); - str.push('redirect_uri=' + encodeURIComponent(this.redirectUri)); - str.push('state=' + encodeURIComponent(this.state)); - str.push('nonce=' + encodeURIComponent(this.nonce)); - if (this.extraQueryParameters) { - str.push(this.extraQueryParameters); - } - str.push('client-request-id=' + encodeURIComponent(this.correlationId)); - requestUrl = this.authority + '/oauth2/v2.0/authorize' + str.join('&') + "&x-client-SKU=" + this.xClientSku + "&x-client-Ver=" + this.xClientVer; - return requestUrl; - }; - AuthenticationRequestParameters.prototype.translateclientIdUsedInScope = function (scopes) { - var clientIdIndex = scopes.indexOf(this.clientId); - if (clientIdIndex >= 0) { - scopes.splice(clientIdIndex, 1); - scopes.push('openid'); - scopes.push('profile'); - } - }; - AuthenticationRequestParameters.prototype.parseScope = function (scopes) { - var scopeList = ''; - if (scopes) { - for (var i = 0; i < scopes.length; ++i) { - scopeList += (i !== scopes.length - 1) ? scopes[i] + ' ' : scopes[i]; - } - } - return scopeList; - }; - return AuthenticationRequestParameters; - }()); - var Storage = (function () { - function Storage(cacheLocation) { - this._cacheLocation = cacheLocation; - this._localStorageSupported = typeof window[this._cacheLocation] != "undefined" && window[this._cacheLocation] != null; - this._sessionStorageSupported = typeof window[cacheLocation] != "undefined" && window[cacheLocation] != null; - if (!this._localStorageSupported && !this._sessionStorageSupported) - throw new Error('localStorage and sessionStorage not supported'); - } - Storage.prototype.saveItem = function (key, value) { - if (window[this._cacheLocation]) - window[this._cacheLocation].setItem(key, value); - else - throw new Error('localStorage and sessionStorage are not supported'); - }; - Storage.prototype.getItem = function (key) { - if (window[this._cacheLocation]) - return window[this._cacheLocation].getItem(key); - else - throw new Error('localStorage and sessionStorage are not supported'); - }; - Storage.prototype.removeItem = function (key) { - if (window[this._cacheLocation]) - return window[this._cacheLocation].removeItem(key); - else - throw new Error('localStorage and sessionStorage are not supported'); - }; - Storage.prototype.clear = function () { - if (window[this._cacheLocation]) - return window[this._cacheLocation].clear(); - else - throw new Error('localStorage and sessionStorage are not supported'); - }; - Storage.prototype.getAllAccessTokens = function (clientId, authority) { - var key; - var results = []; - var accessTokenCacheItem; - var storage = window[this._cacheLocation]; - if (storage) { - for (key in storage) { - if (storage.hasOwnProperty(key)) { - if (key.match(clientId) && key.match(authority)) { - var value = this.getItem(key); - accessTokenCacheItem = new AccessTokenCacheItem(JSON.parse(key), JSON.parse(value)); - results.push(accessTokenCacheItem); - } - } - } - } - else - throw new Error('localStorage and sessionStorage are not supported'); - return results; - }; - return Storage; - }()); - var Logger = (function () { - function Logger() { - } - Logger.log = function (level, message, error) { - if (level <= Logging._logLevel) { - var timestamp = new Date().toUTCString(); - var formattedMessage = ''; - if (Logging._correlationId) - formattedMessage = timestamp + ':' + Logging._correlationId + '-' + this.libVersion() + '-' + LoggingLevel[level] + ' ' + message; - else - formattedMessage = timestamp + ':' + this.libVersion() + '-' + LoggingLevel[level] + ' ' + message; - if (error) { - formattedMessage += '\nstack:\n' + error; - } - if (Logging._loginCallback) - Logging._loginCallback(formattedMessage); - } - }; - Logger.error = function (message, error) { - this.log(LoggingLevel.ERROR, message, error); - }; - Logger.warn = function (message) { - this.log(LoggingLevel.WARN, message, null); - }; - Logger.info = function (message) { - this.log(LoggingLevel.INFO, message, null); - }; - Logger.verbose = function (message) { - this.log(LoggingLevel.VERBOSE, message, null); - }; - Logger.libVersion = function () { - return '1.0.0'; - }; - return Logger; - }()); - var Utils = (function () { - function Utils() { - } - Utils.expiresIn = function (expires) { +})(MSAL || (MSAL = {})); +var MSAL; +(function (MSAL) { + class Utils { + static expiresIn(expires) { if (!expires) expires = '3599'; return this.now() + parseInt(expires, 10); - }; + } ; - Utils.now = function () { + static now() { return Math.round(new Date().getTime() / 1000.0); - }; + } ; - Utils.isEmpty = function (str) { + static isEmpty(str) { return (typeof str === 'undefined' || !str || 0 === str.length); - }; + } ; - Utils.extractIdToken = function (encodedIdToken) { + static extractIdToken(encodedIdToken) { var decodedToken = this.decodeJwt(encodedIdToken); if (!decodedToken) { return null; @@ -1015,18 +977,16 @@ var MSAL; var base64IdToken = decodedToken.JWSPayload; var base64Decoded = this.base64DecodeStringUrlSafe(base64IdToken); if (!base64Decoded) { - Logger.info('The returned id_token could not be base64 url safe decoded.'); return null; } return JSON.parse(base64Decoded); } catch (err) { - Logger.error('The returned id_token could not be decoded', err); } return null; - }; + } ; - Utils.base64DecodeStringUrlSafe = function (base64IdToken) { + static base64DecodeStringUrlSafe(base64IdToken) { base64IdToken = base64IdToken.replace(/-/g, '+').replace(/_/g, '/'); if (window.atob) { return decodeURIComponent(window.atob(base64IdToken)); @@ -1034,16 +994,16 @@ var MSAL; else { return decodeURIComponent(this.decode(base64IdToken)); } - }; + } ; - Utils.decode = function (base64IdToken) { + static decode(base64IdToken) { var codes = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/='; base64IdToken = String(base64IdToken).replace(/=+$/, ''); var length = base64IdToken.length; if (length % 4 === 1) { throw new Error('The token to be decoded is not correctly encoded.'); } - var h1, h2, h3, h4, bits, c1, c2, c3, decoded = ''; + let h1, h2, h3, h4, bits, c1, c2, c3, decoded = ''; for (var i = 0; i < length; i += 4) { h1 = codes.indexOf(base64IdToken.charAt(i)); h2 = codes.indexOf(base64IdToken.charAt(i + 1)); @@ -1069,9 +1029,9 @@ var MSAL; decoded += String.fromCharCode(c1, c2, c3); } return decoded; - }; + } ; - Utils.decodeJwt = function (jwtToken) { + static decodeJwt(jwtToken) { if (this.isEmpty(jwtToken)) { return null; } @@ -1079,7 +1039,6 @@ var MSAL; var idTokenPartsRegex = /^([^\.\s]*)\.([^\.\s]+)\.([^\.\s]*)$/; var matches = idTokenPartsRegex.exec(jwtToken); if (!matches || matches.length < 4) { - Logger.warn('The returned id_token is not parseable.'); return null; } var crackedToken = { @@ -1088,10 +1047,10 @@ var MSAL; JWSSig: matches[3] }; return crackedToken; - }; + } ; - Utils.deserialize = function (query) { - var match, pl = /\+/g, search = /([^&=]+)=([^&]*)/g, decode = function (s) { + static deserialize(query) { + let match, pl = /\+/g, search = /([^&=]+)=([^&]*)/g, decode = function (s) { return decodeURIComponent(s.replace(pl, ' ')); }, obj = {}; match = search.exec(query); @@ -1100,31 +1059,31 @@ var MSAL; match = search.exec(query); } return obj; - }; + } ; - Utils.isIntersectingScopes = function (cachedScopes, scopes) { - for (var i = 0; i < scopes.length; i++) { + static isIntersectingScopes(cachedScopes, scopes) { + for (let i = 0; i < scopes.length; i++) { if (cachedScopes.indexOf(scopes[i]) > -1) return true; } return false; - }; - Utils.containsScope = function (cachedScopes, scopes) { + } + static containsScope(cachedScopes, scopes) { return scopes.every(function (value) { return cachedScopes.indexOf(value) >= 0; }); - }; - Utils.DecimalToHex = function (num) { + } + static DecimalToHex(num) { var hex = num.toString(16); while (hex.length < 2) { hex = '0' + hex; } return hex; - }; - Utils.GetLibraryVersion = function () { + } + static GetLibraryVersion() { return "0.1"; - }; - Utils.Guid = function () { + } + static CreateNewGuid() { var cryptoObj = window.crypto; if (cryptoObj && cryptoObj.getRandomValues) { var buffer = new Uint8Array(16); @@ -1165,9 +1124,9 @@ var MSAL; } return guidResponse; } - }; + } ; - return Utils; - }()); + } + MSAL.Utils = Utils; })(MSAL || (MSAL = {})); -//# sourceMappingURL=msaljs.js.map \ No newline at end of file +//# sourceMappingURL=msal.js.map \ No newline at end of file diff --git a/out/msal.js.map b/out/msal.js.map new file mode 100644 index 0000000000..6eb4964bd0 --- /dev/null +++ b/out/msal.js.map @@ -0,0 +1 @@ +{"version":3,"file":"msal.js","sourceRoot":"","sources":["../lib/AccessTokenCacheItem.ts","../lib/AccessTokenKey.ts","../lib/AccessTokenValue.ts","../lib/AuthenticationRequestParameters.ts","../lib/Constants.ts","../lib/Logger.ts","../lib/RequestContext.ts","../lib/RequestInfo.ts","../lib/Storage.ts","../lib/User.ts","../lib/UserAgentApplication.ts","../lib/Utils.ts","../lib/Window.ts"],"names":[],"mappings":"AAAA,IAAU,IAAI,CASb;AATD,WAAU,IAAI,EAAC,CAAC;IACZ;QAGI,YAAY,GAAmB,EAAE,KAAuB;YACpD,IAAI,CAAC,GAAG,GAAG,GAAG,CAAC;YACf,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;QACvB,CAAC;IACL,CAAC;IAPY,yBAAoB,uBAOhC,CAAA;AACL,CAAC,EATS,IAAI,KAAJ,IAAI,QASb;ACTD,IAAU,IAAI,CAcb;AAdD,WAAU,IAAI,EAAC,CAAC;IACZ;QAMI,YAAY,SAAiB,EAAE,QAAgB,EAAE,MAAc,EAAE,cAAsB;YACnF,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;YAC3B,IAAI,CAAC,QAAQ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C,EAAE,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,KAAK,GAAG,CAAC,CAAC,CAAC;wBAE/B,CAAC,IAAI,GAAG,CAAC;wBACT,CAAC,IAAI,GAAG,CAAC;wBACT,YAAY,IAAI,GAAG,CAAC,CAAC,CAAC,CAAC;oBAC3B,CAAC;oBAAC,IAAI,CAAC,CAAC;wBACJ,YAAY,IAAI,UAAU,CAAC,CAAC,CAAC,CAAC;oBAClC,CAAC;gBACL,CAAC;gBACD,MAAM,CAAC,YAAY,CAAC;YACxB,CAAC;QACL,CAAC;;IAEL,CAAC;IA3NY,UAAK,QA2NjB,CAAA;AAEL,CAAC,EA/NS,IAAI,KAAJ,IAAI,QA+Nb"} \ No newline at end of file diff --git a/tsconfig.json b/tsconfig.json index b074435518..360695aab3 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,7 +1,10 @@ { "compileOnSave": true, "compilerOptions": { - "target": "es5", + "suppressImplicitAnyIndexErrors": true, + "noImplicitAny": true, + "noEmitOnError": true, + "target": "es6", "module": "system", "removeComments": true, "preserveConstEnums": true,