{"version":3,"file":"TokenCache.js","sources":["../../src/cache/TokenCache.ts"],"sourcesContent":["/*\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { AccessTokenEntity, ICrypto, IdTokenEntity, Logger, ScopeSet, Authority, AuthorityOptions, ExternalTokenResponse, AccountEntity, AuthToken, RefreshTokenEntity , AuthorityType, CacheRecord, AuthenticationResult, Constants } from \"@azure/msal-common\";\nimport { BrowserConfiguration } from \"../config/Configuration\";\nimport { SilentRequest } from \"../request/SilentRequest\";\nimport { BrowserCacheManager } from \"./BrowserCacheManager\";\nimport { ITokenCache } from \"./ITokenCache\";\nimport { BrowserAuthError } from \"../error/BrowserAuthError\";\n\nexport type LoadTokenOptions = {\n clientInfo?: string,\n expiresOn?: number,\n extendedExpiresOn?: number\n};\n\n/**\n * Token cache manager\n */\nexport class TokenCache implements ITokenCache {\n // Flag to indicate if in browser environment\n public isBrowserEnvironment: boolean;\n // Input configuration by developer/user\n protected config: BrowserConfiguration;\n // Browser cache storage\n private storage: BrowserCacheManager;\n // Logger\n private logger: Logger;\n // Crypto class\n private cryptoObj: ICrypto;\n\n constructor(configuration: BrowserConfiguration, storage: BrowserCacheManager, logger: Logger, cryptoObj: ICrypto) {\n this.isBrowserEnvironment = typeof window !== \"undefined\";\n this.config = configuration;\n this.storage = storage;\n this.logger = logger;\n this.cryptoObj = cryptoObj;\n }\n\n // Move getAllAccounts here and cache utility APIs\n\n /**\n * API to load tokens to msal-browser cache.\n * @param request\n * @param response\n * @param options\n * @returns `AuthenticationResult` for the response that was loaded.\n */\n loadExternalTokens(request: SilentRequest, response: ExternalTokenResponse, options: LoadTokenOptions): AuthenticationResult {\n this.logger.info(\"TokenCache - loadExternalTokens called\");\n\n if (!response.id_token) {\n throw BrowserAuthError.createUnableToLoadTokenError(\"Please ensure server response includes id token.\");\n }\n\n const idToken = new AuthToken(response.id_token, this.cryptoObj);\n\n let cacheRecord: CacheRecord | undefined;\n let authority: Authority | undefined;\n\n if (request.account) {\n const cacheRecordAccount = this.loadAccount(idToken, request.account.environment, undefined, undefined, request.account.homeAccountId);\n cacheRecord = new CacheRecord(\n cacheRecordAccount,\n this.loadIdToken(idToken, cacheRecordAccount.homeAccountId, request.account.environment, request.account.tenantId),\n this.loadAccessToken(request, response, cacheRecordAccount.homeAccountId, request.account.environment, request.account.tenantId, options),\n this.loadRefreshToken(request, response, cacheRecordAccount.homeAccountId, request.account.environment)\n );\n } else if (request.authority) {\n\n const authorityUrl = Authority.generateAuthority(request.authority, request.azureCloudOptions);\n const authorityOptions: AuthorityOptions = {\n protocolMode: this.config.auth.protocolMode,\n knownAuthorities: this.config.auth.knownAuthorities,\n cloudDiscoveryMetadata: this.config.auth.cloudDiscoveryMetadata,\n authorityMetadata: this.config.auth.authorityMetadata,\n skipAuthorityMetadataCache: this.config.auth.skipAuthorityMetadataCache,\n };\n authority = new Authority(authorityUrl, this.config.system.networkClient, this.storage, authorityOptions, this.logger);\n\n // \"clientInfo\" from options takes precedence over \"clientInfo\" in response\n if (options.clientInfo) {\n this.logger.trace(\"TokenCache - homeAccountId from options\");\n const cacheRecordAccount = this.loadAccount(idToken, authority.hostnameAndPort, options.clientInfo, authority.authorityType);\n cacheRecord = new CacheRecord(\n cacheRecordAccount,\n this.loadIdToken(idToken, cacheRecordAccount.homeAccountId, authority.hostnameAndPort, authority.tenant),\n this.loadAccessToken(request, response, cacheRecordAccount.homeAccountId, authority.hostnameAndPort, authority.tenant, options),\n this.loadRefreshToken(request, response, cacheRecordAccount.homeAccountId, authority.hostnameAndPort)\n );\n } else if (response.client_info) {\n this.logger.trace(\"TokenCache - homeAccountId from response\");\n const cacheRecordAccount = this.loadAccount(idToken, authority.hostnameAndPort, response.client_info, authority.authorityType);\n cacheRecord = new CacheRecord(\n cacheRecordAccount,\n this.loadIdToken(idToken, cacheRecordAccount.homeAccountId, authority.hostnameAndPort, authority.tenant),\n this.loadAccessToken(request, response, cacheRecordAccount.homeAccountId, authority.hostnameAndPort, authority.tenant, options),\n this.loadRefreshToken(request, response, cacheRecordAccount.homeAccountId, authority.hostnameAndPort)\n );\n } else {\n throw BrowserAuthError.createUnableToLoadTokenError(\"Please provide clientInfo in the response or options.\");\n }\n } else {\n throw BrowserAuthError.createUnableToLoadTokenError(\"Please provide a request with an account or a request with authority.\");\n }\n\n return this.generateAuthenticationResult(request, idToken, cacheRecord, authority);\n }\n\n /**\n * Helper function to load account to msal-browser cache\n * @param idToken\n * @param environment\n * @param clientInfo\n * @param authorityType\n * @param requestHomeAccountId\n * @returns `AccountEntity`\n */\n private loadAccount(idToken: AuthToken, environment: string, clientInfo?: string, authorityType?: AuthorityType, requestHomeAccountId?: string): AccountEntity {\n\n let homeAccountId;\n if (requestHomeAccountId) {\n homeAccountId = requestHomeAccountId;\n } else if (authorityType !== undefined && clientInfo) {\n homeAccountId = AccountEntity.generateHomeAccountId(clientInfo, authorityType, this.logger, this.cryptoObj, idToken);\n }\n\n if (!homeAccountId) {\n throw BrowserAuthError.createUnableToLoadTokenError(\"Unexpected missing homeAccountId\");\n }\n\n const accountEntity = clientInfo ?\n AccountEntity.createAccount(clientInfo, homeAccountId, idToken, undefined, undefined, undefined, environment) :\n AccountEntity.createGenericAccount(homeAccountId, idToken, undefined, undefined, undefined, environment);\n\n if (this.isBrowserEnvironment) {\n this.logger.verbose(\"TokenCache - loading account\");\n\n this.storage.setAccount(accountEntity);\n return accountEntity;\n } else {\n throw BrowserAuthError.createUnableToLoadTokenError(\"loadExternalTokens is designed to work in browser environments only.\");\n }\n }\n\n /**\n * Helper function to load id tokens to msal-browser cache\n * @param idToken\n * @param homeAccountId\n * @param environment\n * @param tenantId\n * @returns `IdTokenEntity`\n */\n private loadIdToken(idToken: AuthToken, homeAccountId: string, environment: string, tenantId: string): IdTokenEntity {\n\n const idTokenEntity = IdTokenEntity.createIdTokenEntity(homeAccountId, environment, idToken.rawToken, this.config.auth.clientId, tenantId);\n\n if (this.isBrowserEnvironment) {\n this.logger.verbose(\"TokenCache - loading id token\");\n this.storage.setIdTokenCredential(idTokenEntity);\n return idTokenEntity;\n } else {\n throw BrowserAuthError.createUnableToLoadTokenError(\"loadExternalTokens is designed to work in browser environments only.\");\n }\n }\n\n /**\n * Helper function to load access tokens to msal-browser cache\n * @param request\n * @param response\n * @param homeAccountId\n * @param environment\n * @param tenantId\n * @returns `AccessTokenEntity`\n */\n private loadAccessToken(request: SilentRequest, response: ExternalTokenResponse, homeAccountId: string, environment: string, tenantId: string, options: LoadTokenOptions): AccessTokenEntity | null {\n\n if (!response.access_token) {\n this.logger.verbose(\"TokenCache - No access token provided for caching\");\n return null;\n }\n\n if (!response.expires_in) {\n throw BrowserAuthError.createUnableToLoadTokenError(\"Please ensure server response includes expires_in value.\");\n }\n\n if (!options.extendedExpiresOn) {\n throw BrowserAuthError.createUnableToLoadTokenError(\"Please provide an extendedExpiresOn value in the options.\");\n }\n\n const scopes = new ScopeSet(request.scopes).printScopes();\n const expiresOn = options.expiresOn || (response.expires_in + new Date().getTime() / 1000);\n const extendedExpiresOn = options.extendedExpiresOn;\n\n const accessTokenEntity = AccessTokenEntity.createAccessTokenEntity(homeAccountId, environment, response.access_token, this.config.auth.clientId, tenantId, scopes, expiresOn, extendedExpiresOn, this.cryptoObj);\n\n if (this.isBrowserEnvironment) {\n this.logger.verbose(\"TokenCache - loading access token\");\n this.storage.setAccessTokenCredential(accessTokenEntity);\n return accessTokenEntity;\n } else {\n throw BrowserAuthError.createUnableToLoadTokenError(\"loadExternalTokens is designed to work in browser environments only.\");\n }\n }\n\n /**\n * Helper function to load refresh tokens to msal-browser cache\n * @param request\n * @param response\n * @param homeAccountId\n * @param environment\n * @returns `RefreshTokenEntity`\n */\n private loadRefreshToken(request: SilentRequest, response: ExternalTokenResponse, homeAccountId: string, environment: string): RefreshTokenEntity | null {\n\n if (!response.refresh_token) {\n this.logger.verbose(\"TokenCache - No refresh token provided for caching\");\n return null;\n }\n\n const refreshTokenEntity = RefreshTokenEntity.createRefreshTokenEntity(homeAccountId, environment, response.refresh_token, this.config.auth.clientId);\n\n if (this.isBrowserEnvironment) {\n this.logger.verbose(\"TokenCache - loading refresh token\");\n this.storage.setRefreshTokenCredential(refreshTokenEntity);\n return refreshTokenEntity;\n } else {\n throw BrowserAuthError.createUnableToLoadTokenError(\"loadExternalTokens is designed to work in browser environments only.\");\n }\n }\n\n /**\n * Helper function to generate an `AuthenticationResult` for the result.\n * @param request\n * @param idTokenObj\n * @param cacheRecord\n * @param authority\n * @returns `AuthenticationResult`\n */\n private generateAuthenticationResult(\n request: SilentRequest,\n idTokenObj: AuthToken,\n cacheRecord?: CacheRecord,\n authority?: Authority,\n ): AuthenticationResult {\n let accessToken: string = Constants.EMPTY_STRING;\n let responseScopes: Array = [];\n let expiresOn: Date | null = null;\n let extExpiresOn: Date | undefined;\n\n if (cacheRecord?.accessToken) {\n accessToken = cacheRecord.accessToken.secret;\n responseScopes = ScopeSet.fromString(cacheRecord.accessToken.target).asArray();\n expiresOn = new Date(Number(cacheRecord.accessToken.expiresOn) * 1000);\n extExpiresOn = new Date(Number(cacheRecord.accessToken.extendedExpiresOn) * 1000);\n }\n\n const uid = idTokenObj?.claims.oid || idTokenObj?.claims.sub || Constants.EMPTY_STRING;\n const tid = idTokenObj?.claims.tid || Constants.EMPTY_STRING;\n\n return {\n authority: authority ? authority.canonicalAuthority : Constants.EMPTY_STRING,\n uniqueId: uid,\n tenantId: tid,\n scopes: responseScopes,\n account: cacheRecord?.account ? cacheRecord.account.getAccountInfo() : null,\n idToken: idTokenObj ? idTokenObj.rawToken : Constants.EMPTY_STRING,\n idTokenClaims: idTokenObj ? idTokenObj.claims : {},\n accessToken: accessToken,\n fromCache: true,\n expiresOn: expiresOn,\n correlationId: request.correlationId || Constants.EMPTY_STRING,\n requestId: Constants.EMPTY_STRING,\n extExpiresOn: extExpiresOn,\n familyId: Constants.EMPTY_STRING,\n tokenType: cacheRecord?.accessToken?.tokenType || Constants.EMPTY_STRING,\n state: Constants.EMPTY_STRING,\n cloudGraphHostName: cacheRecord?.account?.cloudGraphHostName || Constants.EMPTY_STRING,\n msGraphHost: cacheRecord?.account?.msGraphHost || Constants.EMPTY_STRING,\n code: undefined,\n fromNativeBroker: false\n };\n }\n}\n\n"],"names":[],"mappings":";;;;;AAAA;;;;AAkBA;;;;IAeI,oBAAY,aAAmC,EAAE,OAA4B,EAAE,MAAc,EAAE,SAAkB;QAC7G,IAAI,CAAC,oBAAoB,GAAG,OAAO,MAAM,KAAK,WAAW,CAAC;QAC1D,IAAI,CAAC,MAAM,GAAG,aAAa,CAAC;QAC5B,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;KAC9B;;;;;;;;;IAWD,uCAAkB,GAAlB,UAAmB,OAAsB,EAAE,QAA+B,EAAE,OAAyB;QACjG,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,wCAAwC,CAAC,CAAC;QAE3D,IAAI,CAAC,QAAQ,CAAC,QAAQ,EAAE;YACpB,MAAM,gBAAgB,CAAC,4BAA4B,CAAC,kDAAkD,CAAC,CAAC;SAC3G;QAED,IAAM,OAAO,GAAG,IAAI,SAAS,CAAC,QAAQ,CAAC,QAAQ,EAAE,IAAI,CAAC,SAAS,CAAC,CAAC;QAEjE,IAAI,WAAoC,CAAC;QACzC,IAAI,SAAgC,CAAC;QAErC,IAAI,OAAO,CAAC,OAAO,EAAE;YACjB,IAAM,kBAAkB,GAAG,IAAI,CAAC,WAAW,CAAC,OAAO,EAAE,OAAO,CAAC,OAAO,CAAC,WAAW,EAAE,SAAS,EAAE,SAAS,EAAE,OAAO,CAAC,OAAO,CAAC,aAAa,CAAC,CAAC;YACvI,WAAW,GAAG,IAAI,WAAW,CACzB,kBAAkB,EAClB,IAAI,CAAC,WAAW,CAAC,OAAO,EAAE,kBAAkB,CAAC,aAAa,EAAE,OAAO,CAAC,OAAO,CAAC,WAAW,EAAE,OAAO,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