{"version":3,"file":"AccountEntity.js","sources":["../../../src/cache/entities/AccountEntity.ts"],"sourcesContent":["/*\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport {\n Separators,\n CacheAccountType,\n CacheType,\n Constants,\n} from \"../../utils/Constants\";\nimport { Authority } from \"../../authority/Authority\";\nimport { AuthToken } from \"../../account/AuthToken\";\nimport { ICrypto } from \"../../crypto/ICrypto\";\nimport { buildClientInfo } from \"../../account/ClientInfo\";\nimport { StringUtils } from \"../../utils/StringUtils\";\nimport { AccountInfo } from \"../../account/AccountInfo\";\nimport { ClientAuthError } from \"../../error/ClientAuthError\";\nimport { AuthorityType } from \"../../authority/AuthorityType\";\nimport { Logger } from \"../../logger/Logger\";\nimport { TokenClaims } from \"../../account/TokenClaims\";\n\n/**\n * Type that defines required and optional parameters for an Account field (based on universal cache schema implemented by all MSALs).\n *\n * Key : Value Schema\n *\n * Key: --\n *\n * Value Schema:\n * {\n * homeAccountId: home account identifier for the auth scheme,\n * environment: entity that issued the token, represented as a full host\n * realm: Full tenant or organizational identifier that the account belongs to\n * localAccountId: Original tenant-specific accountID, usually used for legacy cases\n * username: primary username that represents the user, usually corresponds to preferred_username in the v2 endpt\n * authorityType: Accounts authority type as a string\n * name: Full name for the account, including given name and family name,\n * clientInfo: Full base64 encoded client info received from ESTS\n * lastModificationTime: last time this entity was modified in the cache\n * lastModificationApp:\n * idTokenClaims: Object containing claims parsed from ID token\n * nativeAccountId: Account identifier on the native device\n * }\n */\nexport class AccountEntity {\n homeAccountId: string;\n environment: string;\n realm: string;\n localAccountId: string;\n username: string;\n authorityType: string;\n name?: string;\n clientInfo?: string;\n lastModificationTime?: string;\n lastModificationApp?: string;\n cloudGraphHostName?: string;\n msGraphHost?: string;\n idTokenClaims?: TokenClaims;\n nativeAccountId?: string;\n\n /**\n * Generate Account Id key component as per the schema: -\n */\n generateAccountId(): string {\n const accountId: Array = [this.homeAccountId, this.environment];\n return accountId.join(Separators.CACHE_KEY_SEPARATOR).toLowerCase();\n }\n\n /**\n * Generate Account Cache Key as per the schema: --\n */\n generateAccountKey(): string {\n return AccountEntity.generateAccountCacheKey({\n homeAccountId: this.homeAccountId,\n environment: this.environment,\n tenantId: this.realm,\n username: this.username,\n localAccountId: this.localAccountId\n });\n }\n\n /**\n * returns the type of the cache (in this case account)\n */\n generateType(): number {\n switch (this.authorityType) {\n case CacheAccountType.ADFS_ACCOUNT_TYPE:\n return CacheType.ADFS;\n case CacheAccountType.MSAV1_ACCOUNT_TYPE:\n return CacheType.MSA;\n case CacheAccountType.MSSTS_ACCOUNT_TYPE:\n return CacheType.MSSTS;\n case CacheAccountType.GENERIC_ACCOUNT_TYPE:\n return CacheType.GENERIC;\n default: {\n throw ClientAuthError.createUnexpectedAccountTypeError();\n }\n }\n }\n\n /**\n * Returns the AccountInfo interface for this account.\n */\n getAccountInfo(): AccountInfo {\n return {\n homeAccountId: this.homeAccountId,\n environment: this.environment,\n tenantId: this.realm,\n username: this.username,\n localAccountId: this.localAccountId,\n name: this.name,\n idTokenClaims: this.idTokenClaims,\n nativeAccountId: this.nativeAccountId\n };\n }\n\n /**\n * Generates account key from interface\n * @param accountInterface\n */\n static generateAccountCacheKey(accountInterface: AccountInfo): string {\n const accountKey = [\n accountInterface.homeAccountId,\n accountInterface.environment || Constants.EMPTY_STRING,\n accountInterface.tenantId || Constants.EMPTY_STRING,\n ];\n\n return accountKey.join(Separators.CACHE_KEY_SEPARATOR).toLowerCase();\n }\n\n /**\n * Build Account cache from IdToken, clientInfo and authority/policy. Associated with AAD.\n * @param clientInfo\n * @param authority\n * @param idToken\n * @param policy\n */\n static createAccount(\n clientInfo: string,\n homeAccountId: string,\n idToken: AuthToken,\n authority?: Authority,\n cloudGraphHostName?: string,\n msGraphHost?: string,\n environment?: string,\n nativeAccountId?: string\n ): AccountEntity {\n const account: AccountEntity = new AccountEntity();\n\n account.authorityType = CacheAccountType.MSSTS_ACCOUNT_TYPE;\n account.clientInfo = clientInfo;\n account.homeAccountId = homeAccountId;\n account.nativeAccountId = nativeAccountId;\n\n const env = environment || (authority && authority.getPreferredCache());\n\n if (!env) {\n throw ClientAuthError.createInvalidCacheEnvironmentError();\n }\n\n account.environment = env;\n // non AAD scenarios can have empty realm\n account.realm = idToken?.claims?.tid || Constants.EMPTY_STRING;\n\n if (idToken) {\n account.idTokenClaims = idToken.claims;\n\n // How do you account for MSA CID here?\n account.localAccountId = idToken?.claims?.oid || idToken?.claims?.sub || Constants.EMPTY_STRING;\n\n /*\n * In B2C scenarios the emails claim is used instead of preferred_username and it is an array.\n * In most cases it will contain a single email. This field should not be relied upon if a custom \n * policy is configured to return more than 1 email.\n */\n const preferredUsername = idToken?.claims?.preferred_username;\n const email = (idToken?.claims?.emails) ? idToken.claims.emails[0] : null;\n \n account.username = preferredUsername || email || Constants.EMPTY_STRING;\n account.name = idToken?.claims?.name;\n }\n\n account.cloudGraphHostName = cloudGraphHostName;\n account.msGraphHost = msGraphHost;\n\n return account;\n }\n\n /**\n * Builds non-AAD/ADFS account.\n * @param authority\n * @param idToken\n */\n static createGenericAccount(\n homeAccountId: string,\n idToken: AuthToken,\n authority?: Authority,\n cloudGraphHostName?: string,\n msGraphHost?: string,\n environment?: string\n ): AccountEntity {\n const account: AccountEntity = new AccountEntity();\n\n account.authorityType = (\n authority &&\n authority.authorityType === AuthorityType.Adfs\n ) ? CacheAccountType.ADFS_ACCOUNT_TYPE : CacheAccountType.GENERIC_ACCOUNT_TYPE;\n \n account.homeAccountId = homeAccountId;\n // non AAD scenarios can have empty realm\n account.realm = Constants.EMPTY_STRING;\n\n const env = environment || authority && authority.getPreferredCache();\n\n if (!env) {\n throw ClientAuthError.createInvalidCacheEnvironmentError();\n }\n\n if (idToken) {\n // How do you account for MSA CID here?\n account.localAccountId = idToken?.claims?.oid || idToken?.claims?.sub || Constants.EMPTY_STRING;\n // upn claim for most ADFS scenarios\n account.username = idToken?.claims?.upn || Constants.EMPTY_STRING;\n account.name = idToken?.claims?.name || Constants.EMPTY_STRING;\n account.idTokenClaims = idToken?.claims;\n }\n\n account.environment = env;\n\n account.cloudGraphHostName = cloudGraphHostName;\n account.msGraphHost = msGraphHost;\n\n /*\n * add uniqueName to claims\n * account.name = idToken.claims.uniqueName;\n */\n\n return account;\n }\n\n /**\n * Generate HomeAccountId from server response\n * @param serverClientInfo\n * @param authType\n */\n static generateHomeAccountId(\n serverClientInfo: string,\n authType: AuthorityType,\n logger: Logger,\n cryptoObj: ICrypto,\n idToken?: AuthToken\n ): string {\n\n const accountId = idToken?.claims?.sub ? idToken.claims.sub : Constants.EMPTY_STRING;\n\n // since ADFS does not have tid and does not set client_info\n if (authType === AuthorityType.Adfs || authType === AuthorityType.Dsts) {\n return accountId;\n }\n\n // for cases where there is clientInfo\n if (serverClientInfo) {\n try {\n const clientInfo = buildClientInfo(serverClientInfo, cryptoObj);\n if (!StringUtils.isEmpty(clientInfo.uid) && !StringUtils.isEmpty(clientInfo.utid)) {\n return `${clientInfo.uid}${Separators.CLIENT_INFO_SEPARATOR}${clientInfo.utid}`;\n }\n } catch (e) {}\n }\n\n // default to \"sub\" claim\n logger.verbose(\"No client info in response\");\n return accountId;\n }\n\n /**\n * Validates an entity: checks for all expected params\n * @param entity\n */\n static isAccountEntity(entity: object): boolean {\n\n if (!entity) {\n return false;\n }\n\n return (\n entity.hasOwnProperty(\"homeAccountId\") &&\n entity.hasOwnProperty(\"environment\") &&\n entity.hasOwnProperty(\"realm\") &&\n entity.hasOwnProperty(\"localAccountId\") &&\n entity.hasOwnProperty(\"username\") &&\n entity.hasOwnProperty(\"authorityType\")\n );\n }\n\n /**\n * Helper function to determine whether 2 accountInfo objects represent the same account\n * @param accountA\n * @param accountB\n * @param compareClaims - If set to true idTokenClaims will also be compared to determine account equality\n */\n static accountInfoIsEqual(accountA: AccountInfo | null, accountB: AccountInfo | null, compareClaims?: boolean): boolean {\n if (!accountA || !accountB) {\n return false;\n }\n\n let claimsMatch = true; // default to true so as to not fail comparison below if compareClaims: false\n if (compareClaims) {\n const accountAClaims = (accountA.idTokenClaims || {}) as TokenClaims;\n const accountBClaims = (accountB.idTokenClaims || {}) as TokenClaims;\n\n // issued at timestamp and nonce are expected to change each time a new id token is acquired\n claimsMatch = (accountAClaims.iat === accountBClaims.iat) &&\n (accountAClaims.nonce === accountBClaims.nonce);\n }\n\n return (accountA.homeAccountId === accountB.homeAccountId) &&\n (accountA.localAccountId === accountB.localAccountId) &&\n (accountA.username === accountB.username) &&\n (accountA.tenantId === accountB.tenantId) &&\n (accountA.environment === accountB.environment) &&\n (accountA.nativeAccountId === accountB.nativeAccountId) &&\n claimsMatch;\n }\n}\n"],"names":[],"mappings":";;;;;;;;AAAA;;;AAGG;AAmBH;;;;;;;;;;;;;;;;;;;;;;AAsBG;AACH,IAAA,aAAA,kBAAA,YAAA;AAAA,IAAA,SAAA,aAAA,GAAA;KAwRC;AAxQG;;AAEG;AACH,IAAA,aAAA,CAAA,SAAA,CAAA,iBAAiB,GAAjB,YAAA;QACI,IAAM,SAAS,GAAkB,CAAC,IAAI,CAAC,aAAa,EAAE,IAAI,CAAC,WAAW,CAAC,CAAC;QACxE,OAAO,SAAS,CAAC,IAAI,CAAC,UAAU,CAAC,mBAAmB,CAAC,CAAC,WAAW,EAAE,CAAC;KACvE,CAAA;AAED;;AAEG;AACH,IAAA,aAAA,CAAA,SAAA,CAAA,kBAAkB,GAAlB,YAAA;QACI,OAAO,aAAa,CAAC,uBAAuB,CAAC;YACzC,aAAa,EAAE,IAAI,CAAC,aAAa;YACjC,WAAW,EAAE,IAAI,CAAC,WAAW;YAC7B,QAAQ,EAAE,IAAI,CAAC,KAAK;YACpB,QAAQ,EAAE,IAAI,CAAC,QAAQ;YACvB,cAAc,EAAE,IAAI,CAAC,cAAc;AACtC,SAAA,CAAC,CAAC;KACN,CAAA;AAED;;AAEG;AACH,IAAA,aAAA,CAAA,SAAA,CAAA,YAAY,GAAZ,YAAA;QACI,QAAQ,IAAI,CAAC,aAAa;YACtB,KAAK,gBA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