{"version":3,"file":"index.cjs.js","sources":["../src/utils/Constants.ts","../src/error/AuthError.ts","../src/crypto/ICrypto.ts","../src/error/ClientAuthError.ts","../src/utils/StringUtils.ts","../src/logger/Logger.ts","../src/packageMetadata.ts","../src/authority/AuthorityOptions.ts","../src/cache/entities/CredentialEntity.ts","../src/error/ClientConfigurationError.ts","../src/request/ScopeSet.ts","../src/account/ClientInfo.ts","../src/authority/AuthorityType.ts","../src/cache/entities/AccountEntity.ts","../src/account/AuthToken.ts","../src/cache/CacheManager.ts","../src/config/ClientConfiguration.ts","../src/error/ServerError.ts","../src/network/ThrottlingUtils.ts","../src/network/NetworkManager.ts","../src/account/CcsCredential.ts","../src/client/BaseClient.ts","../src/request/RequestValidator.ts","../src/request/RequestParameterBuilder.ts","../src/cache/entities/IdTokenEntity.ts","../src/utils/TimeUtils.ts","../src/cache/entities/AccessTokenEntity.ts","../src/cache/entities/RefreshTokenEntity.ts","../src/error/InteractionRequiredAuthError.ts","../src/cache/entities/CacheRecord.ts","../src/utils/ProtocolUtils.ts","../src/url/UrlString.ts","../src/crypto/PopTokenGenerator.ts","../src/cache/entities/AppMetadataEntity.ts","../src/cache/persistence/TokenCacheContext.ts","../src/response/ResponseHandler.ts","../src/client/AuthorizationCodeClient.ts","../src/client/DeviceCodeClient.ts","../src/telemetry/performance/PerformanceEvent.ts","../src/client/RefreshTokenClient.ts","../src/client/ClientCredentialClient.ts","../src/client/OnBehalfOfClient.ts","../src/client/SilentFlowClient.ts","../src/client/UsernamePasswordClient.ts","../src/authority/OpenIdConfigResponse.ts","../src/authority/AuthorityMetadata.ts","../src/authority/ProtocolMode.ts","../src/cache/entities/AuthorityMetadataEntity.ts","../src/authority/CloudInstanceDiscoveryResponse.ts","../src/authority/CloudInstanceDiscoveryErrorResponse.ts","../src/authority/RegionDiscovery.ts","../src/authority/Authority.ts","../src/authority/AuthorityFactory.ts","../src/cache/entities/ServerTelemetryEntity.ts","../src/cache/entities/ThrottlingEntity.ts","../src/network/INetworkModule.ts","../src/error/JoseHeaderError.ts","../src/crypto/JoseHeader.ts","../src/request/AuthenticationHeaderParser.ts","../src/telemetry/server/ServerTelemetryManager.ts","../src/telemetry/performance/PerformanceClient.ts","../src/telemetry/performance/StubPerformanceClient.ts"],"sourcesContent":["/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License.\r\n */\r\n\r\nexport const Constants = {\r\n LIBRARY_NAME: \"MSAL.JS\",\r\n SKU: \"msal.js.common\",\r\n // Prefix for all library cache entries\r\n CACHE_PREFIX: \"msal\",\r\n // default authority\r\n DEFAULT_AUTHORITY: \"https://login.microsoftonline.com/common/\",\r\n DEFAULT_AUTHORITY_HOST: \"login.microsoftonline.com\",\r\n DEFAULT_COMMON_TENANT: \"common\",\r\n // ADFS String\r\n ADFS: \"adfs\",\r\n DSTS: \"dstsv2\",\r\n // Default AAD Instance Discovery Endpoint\r\n AAD_INSTANCE_DISCOVERY_ENDPT: \"https://login.microsoftonline.com/common/discovery/instance?api-version=1.1&authorization_endpoint=\",\r\n // Resource delimiter - used for certain cache entries\r\n RESOURCE_DELIM: \"|\",\r\n // Placeholder for non-existent account ids/objects\r\n NO_ACCOUNT: \"NO_ACCOUNT\",\r\n // Claims\r\n CLAIMS: \"claims\",\r\n // Consumer UTID\r\n CONSUMER_UTID: \"9188040d-6c67-4c5b-b112-36a304b66dad\",\r\n // Default scopes\r\n OPENID_SCOPE: \"openid\",\r\n PROFILE_SCOPE: \"profile\",\r\n OFFLINE_ACCESS_SCOPE: \"offline_access\",\r\n EMAIL_SCOPE: \"email\",\r\n // Default response type for authorization code flow\r\n CODE_RESPONSE_TYPE: \"code\",\r\n CODE_GRANT_TYPE: \"authorization_code\",\r\n RT_GRANT_TYPE: \"refresh_token\",\r\n FRAGMENT_RESPONSE_MODE: \"fragment\",\r\n S256_CODE_CHALLENGE_METHOD: \"S256\",\r\n URL_FORM_CONTENT_TYPE: \"application/x-www-form-urlencoded;charset=utf-8\",\r\n AUTHORIZATION_PENDING: \"authorization_pending\",\r\n NOT_DEFINED: \"not_defined\",\r\n EMPTY_STRING: \"\",\r\n NOT_APPLICABLE: \"N/A\",\r\n FORWARD_SLASH: \"/\",\r\n IMDS_ENDPOINT: \"http://169.254.169.254/metadata/instance/compute/location\",\r\n IMDS_VERSION: \"2020-06-01\",\r\n IMDS_TIMEOUT: 2000,\r\n AZURE_REGION_AUTO_DISCOVER_FLAG: \"TryAutoDetect\",\r\n REGIONAL_AUTH_PUBLIC_CLOUD_SUFFIX: \"login.microsoft.com\",\r\n REGIONAL_AUTH_NON_MSI_QUERY_STRING: \"allowestsrnonmsi=true\",\r\n KNOWN_PUBLIC_CLOUDS: [\"login.microsoftonline.com\", \"login.windows.net\", \"login.microsoft.com\", \"sts.windows.net\"],\r\n TOKEN_RESPONSE_TYPE: \"token\",\r\n ID_TOKEN_RESPONSE_TYPE: \"id_token\",\r\n SHR_NONCE_VALIDITY: 240,\r\n INVALID_INSTANCE: \"invalid_instance\",\r\n};\r\n\r\nexport const OIDC_DEFAULT_SCOPES = [\r\n Constants.OPENID_SCOPE,\r\n Constants.PROFILE_SCOPE,\r\n Constants.OFFLINE_ACCESS_SCOPE\r\n];\r\n\r\nexport const OIDC_SCOPES = [\r\n ...OIDC_DEFAULT_SCOPES,\r\n Constants.EMAIL_SCOPE\r\n];\r\n\r\n/**\r\n * Request header names\r\n */\r\nexport enum HeaderNames {\r\n CONTENT_TYPE = \"Content-Type\",\r\n RETRY_AFTER = \"Retry-After\",\r\n CCS_HEADER = \"X-AnchorMailbox\",\r\n WWWAuthenticate = \"WWW-Authenticate\",\r\n AuthenticationInfo = \"Authentication-Info\",\r\n X_MS_REQUEST_ID = \"x-ms-request-id\",\r\n X_MS_HTTP_VERSION= \"x-ms-httpver\"\r\n}\r\n\r\n/**\r\n * Persistent cache keys MSAL which stay while user is logged in.\r\n */\r\nexport enum PersistentCacheKeys {\r\n ID_TOKEN = \"idtoken\",\r\n CLIENT_INFO = \"client.info\",\r\n ADAL_ID_TOKEN = \"adal.idtoken\",\r\n ERROR = \"error\",\r\n ERROR_DESC = \"error.description\",\r\n ACTIVE_ACCOUNT = \"active-account\", // Legacy active-account cache key, use new key instead\r\n ACTIVE_ACCOUNT_FILTERS = \"active-account-filters\" // new cache entry for active_account for a more robust version for browser\r\n}\r\n\r\n/**\r\n * String constants related to AAD Authority\r\n */\r\nexport enum AADAuthorityConstants {\r\n COMMON = \"common\",\r\n ORGANIZATIONS = \"organizations\",\r\n CONSUMERS = \"consumers\"\r\n}\r\n\r\n/**\r\n * Keys in the hashParams sent by AAD Server\r\n */\r\nexport enum AADServerParamKeys {\r\n CLIENT_ID = \"client_id\",\r\n REDIRECT_URI = \"redirect_uri\",\r\n RESPONSE_TYPE = \"response_type\",\r\n RESPONSE_MODE = \"response_mode\",\r\n GRANT_TYPE = \"grant_type\",\r\n CLAIMS = \"claims\",\r\n SCOPE = \"scope\",\r\n ERROR = \"error\",\r\n ERROR_DESCRIPTION = \"error_description\",\r\n ACCESS_TOKEN = \"access_token\",\r\n ID_TOKEN = \"id_token\",\r\n REFRESH_TOKEN = \"refresh_token\",\r\n EXPIRES_IN = \"expires_in\",\r\n STATE = \"state\",\r\n NONCE = \"nonce\",\r\n PROMPT = \"prompt\",\r\n SESSION_STATE = \"session_state\",\r\n CLIENT_INFO = \"client_info\",\r\n CODE = \"code\",\r\n CODE_CHALLENGE = \"code_challenge\",\r\n CODE_CHALLENGE_METHOD = \"code_challenge_method\",\r\n CODE_VERIFIER = \"code_verifier\",\r\n CLIENT_REQUEST_ID = \"client-request-id\",\r\n X_CLIENT_SKU = \"x-client-SKU\",\r\n X_CLIENT_VER = \"x-client-VER\",\r\n X_CLIENT_OS = \"x-client-OS\",\r\n X_CLIENT_CPU = \"x-client-CPU\",\r\n X_CLIENT_CURR_TELEM = \"x-client-current-telemetry\",\r\n X_CLIENT_LAST_TELEM = \"x-client-last-telemetry\",\r\n X_MS_LIB_CAPABILITY = \"x-ms-lib-capability\",\r\n X_APP_NAME = \"x-app-name\",\r\n X_APP_VER = \"x-app-ver\",\r\n POST_LOGOUT_URI = \"post_logout_redirect_uri\",\r\n ID_TOKEN_HINT = \"id_token_hint\",\r\n DEVICE_CODE = \"device_code\",\r\n CLIENT_SECRET = \"client_secret\",\r\n CLIENT_ASSERTION = \"client_assertion\",\r\n CLIENT_ASSERTION_TYPE = \"client_assertion_type\",\r\n TOKEN_TYPE = \"token_type\",\r\n REQ_CNF = \"req_cnf\",\r\n OBO_ASSERTION = \"assertion\",\r\n REQUESTED_TOKEN_USE = \"requested_token_use\",\r\n ON_BEHALF_OF = \"on_behalf_of\",\r\n FOCI = \"foci\",\r\n CCS_HEADER = \"X-AnchorMailbox\",\r\n RETURN_SPA_CODE = \"return_spa_code\",\r\n NATIVE_BROKER = \"nativebroker\",\r\n LOGOUT_HINT = \"logout_hint\"\r\n}\r\n\r\n/**\r\n * Claims request keys\r\n */\r\nexport enum ClaimsRequestKeys {\r\n ACCESS_TOKEN = \"access_token\",\r\n XMS_CC = \"xms_cc\"\r\n}\r\n\r\n/**\r\n * we considered making this \"enum\" in the request instead of string, however it looks like the allowed list of\r\n * prompt values kept changing over past couple of years. There are some undocumented prompt values for some\r\n * internal partners too, hence the choice of generic \"string\" type instead of the \"enum\"\r\n */\r\nexport const PromptValue = {\r\n LOGIN: \"login\",\r\n SELECT_ACCOUNT: \"select_account\",\r\n CONSENT: \"consent\",\r\n NONE: \"none\",\r\n CREATE: \"create\",\r\n NO_SESSION: \"no_session\"\r\n};\r\n\r\n/**\r\n * SSO Types - generated to populate hints\r\n */\r\nexport enum SSOTypes {\r\n ACCOUNT = \"account\",\r\n SID = \"sid\",\r\n LOGIN_HINT = \"login_hint\",\r\n ID_TOKEN = \"id_token\",\r\n DOMAIN_HINT = \"domain_hint\",\r\n ORGANIZATIONS = \"organizations\",\r\n CONSUMERS = \"consumers\",\r\n ACCOUNT_ID = \"accountIdentifier\",\r\n HOMEACCOUNT_ID = \"homeAccountIdentifier\"\r\n}\r\n\r\n/**\r\n * Disallowed extra query parameters.\r\n */\r\nexport const BlacklistedEQParams = [\r\n SSOTypes.SID,\r\n SSOTypes.LOGIN_HINT\r\n];\r\n\r\n/**\r\n * allowed values for codeVerifier\r\n */\r\nexport const CodeChallengeMethodValues = {\r\n PLAIN: \"plain\",\r\n S256: \"S256\"\r\n};\r\n\r\n/**\r\n * The method used to encode the code verifier for the code challenge parameter. can be one\r\n * of plain or s256. if excluded, code challenge is assumed to be plaintext. for more\r\n * information, see the pkce rcf: https://tools.ietf.org/html/rfc7636\r\n */\r\nexport const CodeChallengeMethodValuesArray: string[] = [\r\n CodeChallengeMethodValues.PLAIN,\r\n CodeChallengeMethodValues.S256\r\n];\r\n\r\n/**\r\n * allowed values for response_mode\r\n */\r\nexport enum ResponseMode {\r\n QUERY = \"query\",\r\n FRAGMENT = \"fragment\",\r\n FORM_POST = \"form_post\"\r\n}\r\n\r\n/**\r\n * allowed grant_type\r\n */\r\nexport enum GrantType {\r\n IMPLICIT_GRANT = \"implicit\",\r\n AUTHORIZATION_CODE_GRANT = \"authorization_code\",\r\n CLIENT_CREDENTIALS_GRANT = \"client_credentials\",\r\n RESOURCE_OWNER_PASSWORD_GRANT = \"password\",\r\n REFRESH_TOKEN_GRANT = \"refresh_token\",\r\n DEVICE_CODE_GRANT = \"device_code\",\r\n JWT_BEARER = \"urn:ietf:params:oauth:grant-type:jwt-bearer\"\r\n}\r\n\r\n/**\r\n * Account types in Cache\r\n */\r\nexport enum CacheAccountType {\r\n MSSTS_ACCOUNT_TYPE = \"MSSTS\",\r\n ADFS_ACCOUNT_TYPE = \"ADFS\",\r\n MSAV1_ACCOUNT_TYPE = \"MSA\",\r\n GENERIC_ACCOUNT_TYPE = \"Generic\" // NTLM, Kerberos, FBA, Basic etc\r\n}\r\n\r\n/**\r\n * Separators used in cache\r\n */\r\nexport enum Separators {\r\n CACHE_KEY_SEPARATOR = \"-\",\r\n CLIENT_INFO_SEPARATOR = \".\"\r\n}\r\n\r\n/**\r\n * Credential Type stored in the cache\r\n */\r\nexport enum CredentialType {\r\n ID_TOKEN = \"IdToken\",\r\n ACCESS_TOKEN = \"AccessToken\",\r\n ACCESS_TOKEN_WITH_AUTH_SCHEME = \"AccessToken_With_AuthScheme\",\r\n REFRESH_TOKEN = \"RefreshToken\",\r\n}\r\n\r\n/**\r\n * Credential Type stored in the cache\r\n */\r\nexport enum CacheSchemaType {\r\n ACCOUNT = \"Account\",\r\n CREDENTIAL = \"Credential\",\r\n ID_TOKEN = \"IdToken\",\r\n ACCESS_TOKEN = \"AccessToken\",\r\n REFRESH_TOKEN = \"RefreshToken\",\r\n APP_METADATA = \"AppMetadata\",\r\n TEMPORARY = \"TempCache\",\r\n TELEMETRY = \"Telemetry\",\r\n UNDEFINED = \"Undefined\",\r\n THROTTLING = \"Throttling\"\r\n}\r\n\r\n/**\r\n * Combine all cache types\r\n */\r\nexport enum CacheType {\r\n ADFS = 1001,\r\n MSA = 1002,\r\n MSSTS = 1003,\r\n GENERIC = 1004,\r\n ACCESS_TOKEN = 2001,\r\n REFRESH_TOKEN = 2002,\r\n ID_TOKEN = 2003,\r\n APP_METADATA = 3001,\r\n UNDEFINED = 9999\r\n}\r\n\r\n/**\r\n * More Cache related constants\r\n */\r\nexport const APP_METADATA = \"appmetadata\";\r\nexport const CLIENT_INFO = \"client_info\";\r\nexport const THE_FAMILY_ID = \"1\";\r\n\r\nexport const AUTHORITY_METADATA_CONSTANTS = {\r\n CACHE_KEY: \"authority-metadata\",\r\n REFRESH_TIME_SECONDS: 3600 * 24 // 24 Hours\r\n};\r\n\r\nexport enum AuthorityMetadataSource {\r\n CONFIG = \"config\",\r\n CACHE = \"cache\",\r\n NETWORK = \"network\",\r\n HARDCODED_VALUES= \"hardcoded_values\",\r\n}\r\n\r\nexport const SERVER_TELEM_CONSTANTS = {\r\n SCHEMA_VERSION: 5,\r\n MAX_CUR_HEADER_BYTES: 80, // ESTS limit is 100B, set to 80 to provide a 20B buffer\r\n MAX_LAST_HEADER_BYTES: 330, // ESTS limit is 350B, set to 330 to provide a 20B buffer,\r\n MAX_CACHED_ERRORS: 50, // Limit the number of errors that can be stored to prevent uncontrolled size gains\r\n CACHE_KEY: \"server-telemetry\",\r\n CATEGORY_SEPARATOR: \"|\",\r\n VALUE_SEPARATOR: \",\",\r\n OVERFLOW_TRUE: \"1\",\r\n OVERFLOW_FALSE: \"0\",\r\n UNKNOWN_ERROR: \"unknown_error\"\r\n};\r\n\r\n/**\r\n * Type of the authentication request\r\n */\r\nexport enum AuthenticationScheme {\r\n BEARER = \"Bearer\",\r\n POP = \"pop\",\r\n SSH = \"ssh-cert\"\r\n}\r\n\r\n/**\r\n * Constants related to throttling\r\n */\r\nexport const ThrottlingConstants = {\r\n // Default time to throttle RequestThumbprint in seconds\r\n DEFAULT_THROTTLE_TIME_SECONDS: 60,\r\n // Default maximum time to throttle in seconds, overrides what the server sends back\r\n DEFAULT_MAX_THROTTLE_TIME_SECONDS: 3600,\r\n // Prefix for storing throttling entries\r\n THROTTLING_PREFIX: \"throttling\",\r\n // Value assigned to the x-ms-lib-capability header to indicate to the server the library supports throttling\r\n X_MS_LIB_CAPABILITY_VALUE: \"retry-after, h429\"\r\n};\r\n\r\nexport const Errors = {\r\n INVALID_GRANT_ERROR: \"invalid_grant\",\r\n CLIENT_MISMATCH_ERROR: \"client_mismatch\",\r\n};\r\n\r\n/**\r\n * Password grant parameters\r\n */\r\nexport enum PasswordGrantConstants {\r\n username = \"username\",\r\n password = \"password\"\r\n}\r\n\r\n/**\r\n * Response codes\r\n */\r\nexport enum ResponseCodes {\r\n httpSuccess = 200,\r\n httpBadRequest = 400\r\n}\r\n\r\n/**\r\n * Region Discovery Sources\r\n */\r\nexport enum RegionDiscoverySources {\r\n FAILED_AUTO_DETECTION = \"1\",\r\n INTERNAL_CACHE = \"2\",\r\n ENVIRONMENT_VARIABLE = \"3\",\r\n IMDS = \"4\",\r\n}\r\n\r\n/**\r\n * Region Discovery Outcomes\r\n */\r\nexport enum RegionDiscoveryOutcomes {\r\n CONFIGURED_MATCHES_DETECTED = \"1\",\r\n CONFIGURED_NO_AUTO_DETECTION = \"2\",\r\n CONFIGURED_NOT_DETECTED = \"3\",\r\n AUTO_DETECTION_REQUESTED_SUCCESSFUL = \"4\",\r\n AUTO_DETECTION_REQUESTED_FAILED = \"5\"\r\n}\r\n\r\nexport enum CacheOutcome {\r\n NO_CACHE_HIT = \"0\",\r\n FORCE_REFRESH = \"1\",\r\n NO_CACHED_ACCESS_TOKEN = \"2\",\r\n CACHED_ACCESS_TOKEN_EXPIRED = \"3\",\r\n REFRESH_CACHED_ACCESS_TOKEN = \"4\"\r\n}\r\n\r\nexport enum JsonTypes {\r\n Jwt = \"JWT\",\r\n Jwk = \"JWK\"\r\n}\r\n\r\nexport const ONE_DAY_IN_MS = 86400000;\r\n","/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License.\r\n */\r\n\r\nimport { Constants } from \"../utils/Constants\";\r\n\r\n/**\r\n * AuthErrorMessage class containing string constants used by error codes and messages.\r\n */\r\nexport const AuthErrorMessage = {\r\n unexpectedError: {\r\n code: \"unexpected_error\",\r\n desc: \"Unexpected error in authentication.\"\r\n },\r\n postRequestFailed: {\r\n code: \"post_request_failed\",\r\n desc: \"Post request failed from the network, could be a 4xx/5xx or a network unavailability. Please check the exact error code for details.\"\r\n }\r\n};\r\n\r\n/**\r\n * General error class thrown by the MSAL.js library.\r\n */\r\nexport class AuthError extends Error {\r\n\r\n /**\r\n * Short string denoting error\r\n */\r\n errorCode: string;\r\n\r\n /**\r\n * Detailed description of error\r\n */\r\n errorMessage: string;\r\n\r\n /**\r\n * Describes the subclass of an error\r\n */\r\n subError: string;\r\n\r\n /**\r\n * CorrelationId associated with the error\r\n */\r\n correlationId: string;\r\n\r\n constructor(errorCode?: string, errorMessage?: string, suberror?: string) {\r\n const errorString = errorMessage ? `${errorCode}: ${errorMessage}` : errorCode;\r\n super(errorString);\r\n Object.setPrototypeOf(this, AuthError.prototype);\r\n\r\n this.errorCode = errorCode || Constants.EMPTY_STRING;\r\n this.errorMessage = errorMessage || Constants.EMPTY_STRING;\r\n this.subError = suberror || Constants.EMPTY_STRING;\r\n this.name = \"AuthError\";\r\n }\r\n\r\n setCorrelationId(correlationId: string): void {\r\n this.correlationId = correlationId;\r\n }\r\n\r\n /**\r\n * Creates an error that is thrown when something unexpected happens in the library.\r\n * @param errDesc\r\n */\r\n static createUnexpectedError(errDesc: string): AuthError {\r\n return new AuthError(AuthErrorMessage.unexpectedError.code, `${AuthErrorMessage.unexpectedError.desc}: ${errDesc}`);\r\n }\r\n\r\n /**\r\n * Creates an error for post request failures.\r\n * @param errDesc \r\n * @returns \r\n */\r\n static createPostRequestFailed(errDesc: string): AuthError {\r\n return new AuthError(AuthErrorMessage.postRequestFailed.code, `${AuthErrorMessage.postRequestFailed.desc}: ${errDesc}`);\r\n }\r\n}\r\n","/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License.\r\n */\r\n\r\nimport { AuthError } from \"../error/AuthError\";\r\nimport { BaseAuthRequest } from \"../request/BaseAuthRequest\";\r\nimport { SignedHttpRequest } from \"./SignedHttpRequest\";\r\n\r\n/**\r\n * The PkceCodes type describes the structure\r\n * of objects that contain PKCE code\r\n * challenge and verifier pairs\r\n */\r\nexport type PkceCodes = {\r\n verifier: string,\r\n challenge: string\r\n};\r\n\r\nexport type SignedHttpRequestParameters = Pick & {\r\n correlationId?: string\r\n};\r\n\r\n/**\r\n * Interface for crypto functions used by library\r\n */\r\nexport interface ICrypto {\r\n /**\r\n * Creates a guid randomly.\r\n */\r\n createNewGuid(): string;\r\n /**\r\n * base64 Encode string\r\n * @param input \r\n */\r\n base64Encode(input: string): string;\r\n /**\r\n * base64 decode string\r\n * @param input \r\n */\r\n base64Decode(input: string): string;\r\n /**\r\n * Generate PKCE codes for OAuth. See RFC here: https://tools.ietf.org/html/rfc7636\r\n */\r\n generatePkceCodes(): Promise;\r\n /**\r\n * Generates an JWK RSA S256 Thumbprint\r\n * @param request\r\n */\r\n getPublicKeyThumbprint(request: SignedHttpRequestParameters): Promise;\r\n /**\r\n * Removes cryptographic keypair from key store matching the keyId passed in\r\n * @param kid \r\n */\r\n removeTokenBindingKey(kid: string): Promise;\r\n /**\r\n * Removes all cryptographic keys from IndexedDB storage\r\n */\r\n clearKeystore(): Promise;\r\n /** \r\n * Returns a signed proof-of-possession token with a given acces token that contains a cnf claim with the required kid.\r\n * @param accessToken \r\n */\r\n signJwt(payload: SignedHttpRequest, kid: string, correlationId?: string): Promise;\r\n /**\r\n * Returns the SHA-256 hash of an input string\r\n * @param plainText\r\n */\r\n hashString(plainText: string): Promise;\r\n}\r\n\r\nexport const DEFAULT_CRYPTO_IMPLEMENTATION: ICrypto = {\r\n createNewGuid: (): string => {\r\n const notImplErr = \"Crypto interface - createNewGuid() has not been implemented\";\r\n throw AuthError.createUnexpectedError(notImplErr);\r\n },\r\n base64Decode: (): string => {\r\n const notImplErr = \"Crypto interface - base64Decode() has not been implemented\";\r\n throw AuthError.createUnexpectedError(notImplErr);\r\n },\r\n base64Encode: (): string => {\r\n const notImplErr = \"Crypto interface - base64Encode() has not been implemented\";\r\n throw AuthError.createUnexpectedError(notImplErr);\r\n },\r\n async generatePkceCodes(): Promise {\r\n const notImplErr = \"Crypto interface - generatePkceCodes() has not been implemented\";\r\n throw AuthError.createUnexpectedError(notImplErr);\r\n },\r\n async getPublicKeyThumbprint(): Promise {\r\n const notImplErr = \"Crypto interface - getPublicKeyThumbprint() has not been implemented\";\r\n throw AuthError.createUnexpectedError(notImplErr);\r\n },\r\n async removeTokenBindingKey(): Promise {\r\n const notImplErr = \"Crypto interface - removeTokenBindingKey() has not been implemented\";\r\n throw AuthError.createUnexpectedError(notImplErr);\r\n },\r\n async clearKeystore(): Promise {\r\n const notImplErr = \"Crypto interface - clearKeystore() has not been implemented\";\r\n throw AuthError.createUnexpectedError(notImplErr);\r\n },\r\n async signJwt(): Promise {\r\n const notImplErr = \"Crypto interface - signJwt() has not been implemented\";\r\n throw AuthError.createUnexpectedError(notImplErr);\r\n },\r\n async hashString(): Promise {\r\n const notImplErr = \"Crypto interface - hashString() has not been implemented\";\r\n throw AuthError.createUnexpectedError(notImplErr);\r\n }\r\n};\r\n","/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License.\r\n */\r\n\r\nimport { AuthError } from \"./AuthError\";\r\n\r\n/**\r\n * ClientAuthErrorMessage class containing string constants used by error codes and messages.\r\n */\r\nexport const ClientAuthErrorMessage = {\r\n clientInfoDecodingError: {\r\n code: \"client_info_decoding_error\",\r\n desc: \"The client info could not be parsed/decoded correctly. Please review the trace to determine the root cause.\"\r\n },\r\n clientInfoEmptyError: {\r\n code: \"client_info_empty_error\",\r\n desc: \"The client info was empty. Please review the trace to determine the root cause.\"\r\n },\r\n tokenParsingError: {\r\n code: \"token_parsing_error\",\r\n desc: \"Token cannot be parsed. Please review stack trace to determine root cause.\"\r\n },\r\n nullOrEmptyToken: {\r\n code: \"null_or_empty_token\",\r\n desc: \"The token is null or empty. Please review the trace to determine the root cause.\"\r\n },\r\n endpointResolutionError: {\r\n code: \"endpoints_resolution_error\",\r\n desc: \"Error: could not resolve endpoints. Please check network and try again.\"\r\n },\r\n networkError: {\r\n code: \"network_error\",\r\n desc: \"Network request failed. Please check network trace to determine root cause.\"\r\n },\r\n unableToGetOpenidConfigError: {\r\n code: \"openid_config_error\",\r\n desc: \"Could not retrieve endpoints. Check your authority and verify the .well-known/openid-configuration endpoint returns the required endpoints.\"\r\n },\r\n hashNotDeserialized: {\r\n code: \"hash_not_deserialized\",\r\n desc: \"The hash parameters could not be deserialized. Please review the trace to determine the root cause.\"\r\n },\r\n blankGuidGenerated: {\r\n code: \"blank_guid_generated\",\r\n desc: \"The guid generated was blank. Please review the trace to determine the root cause.\"\r\n },\r\n invalidStateError: {\r\n code: \"invalid_state\",\r\n desc: \"State was not the expected format. Please check the logs to determine whether the request was sent using ProtocolUtils.setRequestState().\"\r\n },\r\n stateMismatchError: {\r\n code: \"state_mismatch\",\r\n desc: \"State mismatch error. Please check your network. Continued requests may cause cache overflow.\"\r\n },\r\n stateNotFoundError: {\r\n code: \"state_not_found\",\r\n desc: \"State not found\"\r\n },\r\n nonceMismatchError: {\r\n code: \"nonce_mismatch\",\r\n desc: \"Nonce mismatch error. This may be caused by a race condition in concurrent requests.\"\r\n },\r\n nonceNotFoundError: {\r\n code: \"nonce_not_found\",\r\n desc: \"nonce not found\"\r\n },\r\n authTimeNotFoundError: {\r\n code: \"auth_time_not_found\",\r\n desc: \"Max Age was requested and the ID token is missing the auth_time variable.\" +\r\n \" auth_time is an optional claim and is not enabled by default - it must be enabled.\" +\r\n \" See https://aka.ms/msaljs/optional-claims for more information.\"\r\n },\r\n maxAgeTranspiredError: {\r\n code: \"max_age_transpired\",\r\n desc: \"Max Age is set to 0, or too much time has elapsed since the last end-user authentication.\"\r\n },\r\n noTokensFoundError: {\r\n code: \"no_tokens_found\",\r\n desc: \"No tokens were found for the given scopes, and no authorization code was passed to acquireToken. You must retrieve an authorization code before making a call to acquireToken().\"\r\n },\r\n multipleMatchingTokens: {\r\n code: \"multiple_matching_tokens\",\r\n desc: \"The cache contains multiple tokens satisfying the requirements. \" +\r\n \"Call AcquireToken again providing more requirements such as authority or account.\"\r\n },\r\n multipleMatchingAccounts: {\r\n code: \"multiple_matching_accounts\",\r\n desc: \"The cache contains multiple accounts satisfying the given parameters. Please pass more info to obtain the correct account\"\r\n },\r\n multipleMatchingAppMetadata: {\r\n code: \"multiple_matching_appMetadata\",\r\n desc: \"The cache contains multiple appMetadata satisfying the given parameters. Please pass more info to obtain the correct appMetadata\"\r\n },\r\n tokenRequestCannotBeMade: {\r\n code: \"request_cannot_be_made\",\r\n desc: \"Token request cannot be made without authorization code or refresh token.\"\r\n },\r\n appendEmptyScopeError: {\r\n code: \"cannot_append_empty_scope\",\r\n desc: \"Cannot append null or empty scope to ScopeSet. Please check the stack trace for more info.\"\r\n },\r\n removeEmptyScopeError: {\r\n code: \"cannot_remove_empty_scope\",\r\n desc: \"Cannot remove null or empty scope from ScopeSet. Please check the stack trace for more info.\"\r\n },\r\n appendScopeSetError: {\r\n code: \"cannot_append_scopeset\",\r\n desc: \"Cannot append ScopeSet due to error.\"\r\n },\r\n emptyInputScopeSetError: {\r\n code: \"empty_input_scopeset\",\r\n desc: \"Empty input ScopeSet cannot be processed.\"\r\n },\r\n DeviceCodePollingCancelled: {\r\n code: \"device_code_polling_cancelled\",\r\n desc: \"Caller has cancelled token endpoint polling during device code flow by setting DeviceCodeRequest.cancel = true.\"\r\n },\r\n DeviceCodeExpired: {\r\n code: \"device_code_expired\",\r\n desc: \"Device code is expired.\"\r\n },\r\n DeviceCodeUnknownError: {\r\n code: \"device_code_unknown_error\",\r\n desc: \"Device code stopped polling for unknown reasons.\"\r\n },\r\n NoAccountInSilentRequest: {\r\n code: \"no_account_in_silent_request\",\r\n desc: \"Please pass an account object, silent flow is not supported without account information\"\r\n },\r\n invalidCacheRecord: {\r\n code: \"invalid_cache_record\",\r\n desc: \"Cache record object was null or undefined.\"\r\n },\r\n invalidCacheEnvironment: {\r\n code: \"invalid_cache_environment\",\r\n desc: \"Invalid environment when attempting to create cache entry\"\r\n },\r\n noAccountFound: {\r\n code: \"no_account_found\",\r\n desc: \"No account found in cache for given key.\"\r\n },\r\n CachePluginError: {\r\n code: \"no cache plugin set on CacheManager\",\r\n desc: \"ICachePlugin needs to be set before using readFromStorage or writeFromStorage\"\r\n },\r\n noCryptoObj: {\r\n code: \"no_crypto_object\",\r\n desc: \"No crypto object detected. This is required for the following operation: \"\r\n },\r\n invalidCacheType: {\r\n code: \"invalid_cache_type\",\r\n desc: \"Invalid cache type\"\r\n },\r\n unexpectedAccountType: {\r\n code: \"unexpected_account_type\",\r\n desc: \"Unexpected account type.\"\r\n },\r\n unexpectedCredentialType: {\r\n code: \"unexpected_credential_type\",\r\n desc: \"Unexpected credential type.\"\r\n },\r\n invalidAssertion: {\r\n code: \"invalid_assertion\",\r\n desc: \"Client assertion must meet requirements described in https://tools.ietf.org/html/rfc7515\"\r\n },\r\n invalidClientCredential: {\r\n code: \"invalid_client_credential\",\r\n desc: \"Client credential (secret, certificate, or assertion) must not be empty when creating a confidential client. An application should at most have one credential\"\r\n },\r\n tokenRefreshRequired: {\r\n code: \"token_refresh_required\",\r\n desc: \"Cannot return token from cache because it must be refreshed. This may be due to one of the following reasons: forceRefresh parameter is set to true, claims have been requested, there is no cached access token or it is expired.\"\r\n },\r\n userTimeoutReached: {\r\n code: \"user_timeout_reached\",\r\n desc: \"User defined timeout for device code polling reached\",\r\n },\r\n tokenClaimsRequired: {\r\n code: \"token_claims_cnf_required_for_signedjwt\",\r\n desc: \"Cannot generate a POP jwt if the token_claims are not populated\"\r\n },\r\n noAuthorizationCodeFromServer: {\r\n code: \"authorization_code_missing_from_server_response\",\r\n desc: \"Server response does not contain an authorization code to proceed\"\r\n },\r\n noAzureRegionDetected: {\r\n code: \"no_azure_region_detected\",\r\n desc: \"No azure region was detected and no fallback was made available\"\r\n },\r\n accessTokenEntityNullError: {\r\n code: \"access_token_entity_null\",\r\n desc: \"Access token entity is null, please check logs and cache to ensure a valid access token is present.\"\r\n },\r\n bindingKeyNotRemovedError: {\r\n code: \"binding_key_not_removed\",\r\n desc: \"Could not remove the credential's binding key from storage.\"\r\n },\r\n logoutNotSupported: {\r\n code: \"end_session_endpoint_not_supported\",\r\n desc: \"Provided authority does not support logout.\"\r\n },\r\n keyIdMissing: {\r\n code: \"key_id_missing\",\r\n desc: \"A keyId value is missing from the requested bound token's cache record and is required to match the token to it's stored binding key.\"\r\n }\r\n};\r\n\r\n/**\r\n * Error thrown when there is an error in the client code running on the browser.\r\n */\r\nexport class ClientAuthError extends AuthError {\r\n\r\n constructor(errorCode: string, errorMessage?: string) {\r\n super(errorCode, errorMessage);\r\n this.name = \"ClientAuthError\";\r\n\r\n Object.setPrototypeOf(this, ClientAuthError.prototype);\r\n }\r\n\r\n /**\r\n * Creates an error thrown when client info object doesn't decode correctly.\r\n * @param caughtError\r\n */\r\n static createClientInfoDecodingError(caughtError: string): ClientAuthError {\r\n return new ClientAuthError(ClientAuthErrorMessage.clientInfoDecodingError.code,\r\n `${ClientAuthErrorMessage.clientInfoDecodingError.desc} Failed with error: ${caughtError}`);\r\n }\r\n\r\n /**\r\n * Creates an error thrown if the client info is empty.\r\n * @param rawClientInfo\r\n */\r\n static createClientInfoEmptyError(): ClientAuthError {\r\n return new ClientAuthError(ClientAuthErrorMessage.clientInfoEmptyError.code,\r\n `${ClientAuthErrorMessage.clientInfoEmptyError.desc}`);\r\n }\r\n\r\n /**\r\n * Creates an error thrown when the id token extraction errors out.\r\n * @param err\r\n */\r\n static createTokenParsingError(caughtExtractionError: string): ClientAuthError {\r\n return new ClientAuthError(ClientAuthErrorMessage.tokenParsingError.code,\r\n `${ClientAuthErrorMessage.tokenParsingError.desc} Failed with error: ${caughtExtractionError}`);\r\n }\r\n\r\n /**\r\n * Creates an error thrown when the id token string is null or empty.\r\n * @param invalidRawTokenString\r\n */\r\n static createTokenNullOrEmptyError(invalidRawTokenString: string): ClientAuthError {\r\n return new ClientAuthError(ClientAuthErrorMessage.nullOrEmptyToken.code,\r\n `${ClientAuthErrorMessage.nullOrEmptyToken.desc} Raw Token Value: ${invalidRawTokenString}`);\r\n }\r\n\r\n /**\r\n * Creates an error thrown when the endpoint discovery doesn't complete correctly.\r\n */\r\n static createEndpointDiscoveryIncompleteError(errDetail: string): ClientAuthError {\r\n return new ClientAuthError(ClientAuthErrorMessage.endpointResolutionError.code,\r\n `${ClientAuthErrorMessage.endpointResolutionError.desc} Detail: ${errDetail}`);\r\n }\r\n\r\n /**\r\n * Creates an error thrown when the fetch client throws\r\n */\r\n static createNetworkError(endpoint: string, errDetail: string): ClientAuthError {\r\n return new ClientAuthError(ClientAuthErrorMessage.networkError.code,\r\n `${ClientAuthErrorMessage.networkError.desc} | Fetch client threw: ${errDetail} | Attempted to reach: ${endpoint.split(\"?\")[0]}`);\r\n }\r\n\r\n /**\r\n * Creates an error thrown when the openid-configuration endpoint cannot be reached or does not contain the required data\r\n */\r\n static createUnableToGetOpenidConfigError(errDetail: string): ClientAuthError {\r\n return new ClientAuthError(ClientAuthErrorMessage.unableToGetOpenidConfigError.code,\r\n `${ClientAuthErrorMessage.unableToGetOpenidConfigError.desc} Attempted to retrieve endpoints from: ${errDetail}`);\r\n }\r\n\r\n /**\r\n * Creates an error thrown when the hash cannot be deserialized.\r\n * @param hashParamObj\r\n */\r\n static createHashNotDeserializedError(hashParamObj: string): ClientAuthError {\r\n return new ClientAuthError(ClientAuthErrorMessage.hashNotDeserialized.code,\r\n `${ClientAuthErrorMessage.hashNotDeserialized.desc} Given Object: ${hashParamObj}`);\r\n }\r\n\r\n /**\r\n * Creates an error thrown when the state cannot be parsed.\r\n * @param invalidState\r\n */\r\n static createInvalidStateError(invalidState: string, errorString?: string): ClientAuthError {\r\n return new ClientAuthError(ClientAuthErrorMessage.invalidStateError.code,\r\n `${ClientAuthErrorMessage.invalidStateError.desc} Invalid State: ${invalidState}, Root Err: ${errorString}`);\r\n }\r\n\r\n /**\r\n * Creates an error thrown when two states do not match.\r\n */\r\n static createStateMismatchError(): ClientAuthError {\r\n return new ClientAuthError(ClientAuthErrorMessage.stateMismatchError.code,\r\n ClientAuthErrorMessage.stateMismatchError.desc);\r\n }\r\n\r\n /**\r\n * Creates an error thrown when the state is not present\r\n * @param missingState\r\n */\r\n static createStateNotFoundError(missingState: string): ClientAuthError {\r\n return new ClientAuthError(ClientAuthErrorMessage.stateNotFoundError.code,\r\n `${ClientAuthErrorMessage.stateNotFoundError.desc}: ${missingState}`);\r\n }\r\n\r\n /**\r\n * Creates an error thrown when the nonce does not match.\r\n */\r\n static createNonceMismatchError(): ClientAuthError {\r\n return new ClientAuthError(ClientAuthErrorMessage.nonceMismatchError.code,\r\n ClientAuthErrorMessage.nonceMismatchError.desc);\r\n }\r\n\r\n /**\r\n * Creates an error thrown when max_age was provided in the request, but auth_time is not in the token claims\r\n * @param missingNonce\r\n */\r\n static createAuthTimeNotFoundError(): ClientAuthError {\r\n return new ClientAuthError(ClientAuthErrorMessage.authTimeNotFoundError.code,\r\n ClientAuthErrorMessage.authTimeNotFoundError.desc);\r\n }\r\n\r\n /**\r\n * Creates an error thrown when too much time has elapsed since the last end-user authentication\r\n */\r\n static createMaxAgeTranspiredError(): ClientAuthError {\r\n return new ClientAuthError(ClientAuthErrorMessage.maxAgeTranspiredError.code,\r\n ClientAuthErrorMessage.maxAgeTranspiredError.desc);\r\n }\r\n\r\n /**\r\n * Creates an error thrown when the mnonce is not present\r\n * @param missingNonce\r\n */\r\n static createNonceNotFoundError(missingNonce: string): ClientAuthError {\r\n return new ClientAuthError(ClientAuthErrorMessage.nonceNotFoundError.code,\r\n `${ClientAuthErrorMessage.nonceNotFoundError.desc}: ${missingNonce}`);\r\n }\r\n\r\n /**\r\n * Throws error when multiple tokens are in cache.\r\n */\r\n static createMultipleMatchingTokensInCacheError(): ClientAuthError {\r\n return new ClientAuthError(ClientAuthErrorMessage.multipleMatchingTokens.code,\r\n `${ClientAuthErrorMessage.multipleMatchingTokens.desc}.`);\r\n }\r\n\r\n /**\r\n * Throws error when multiple accounts are in cache for the given params\r\n */\r\n static createMultipleMatchingAccountsInCacheError(): ClientAuthError {\r\n return new ClientAuthError(ClientAuthErrorMessage.multipleMatchingAccounts.code,\r\n ClientAuthErrorMessage.multipleMatchingAccounts.desc);\r\n }\r\n\r\n /**\r\n * Throws error when multiple appMetada are in cache for the given clientId.\r\n */\r\n static createMultipleMatchingAppMetadataInCacheError(): ClientAuthError {\r\n return new ClientAuthError(ClientAuthErrorMessage.multipleMatchingAppMetadata.code,\r\n ClientAuthErrorMessage.multipleMatchingAppMetadata.desc);\r\n }\r\n\r\n /**\r\n * Throws error when no auth code or refresh token is given to ServerTokenRequestParameters.\r\n */\r\n static createTokenRequestCannotBeMadeError(): ClientAuthError {\r\n return new ClientAuthError(ClientAuthErrorMessage.tokenRequestCannotBeMade.code, ClientAuthErrorMessage.tokenRequestCannotBeMade.desc);\r\n }\r\n\r\n /**\r\n * Throws error when attempting to append a null, undefined or empty scope to a set\r\n * @param givenScope\r\n */\r\n static createAppendEmptyScopeToSetError(givenScope: string): ClientAuthError {\r\n return new ClientAuthError(ClientAuthErrorMessage.appendEmptyScopeError.code, `${ClientAuthErrorMessage.appendEmptyScopeError.desc} Given Scope: ${givenScope}`);\r\n }\r\n\r\n /**\r\n * Throws error when attempting to append a null, undefined or empty scope to a set\r\n * @param givenScope\r\n */\r\n static createRemoveEmptyScopeFromSetError(givenScope: string): ClientAuthError {\r\n return new ClientAuthError(ClientAuthErrorMessage.removeEmptyScopeError.code, `${ClientAuthErrorMessage.removeEmptyScopeError.desc} Given Scope: ${givenScope}`);\r\n }\r\n\r\n /**\r\n * Throws error when attempting to append null or empty ScopeSet.\r\n * @param appendError\r\n */\r\n static createAppendScopeSetError(appendError: string): ClientAuthError {\r\n return new ClientAuthError(ClientAuthErrorMessage.appendScopeSetError.code, `${ClientAuthErrorMessage.appendScopeSetError.desc} Detail Error: ${appendError}`);\r\n }\r\n\r\n /**\r\n * Throws error if ScopeSet is null or undefined.\r\n * @param givenScopeSet\r\n */\r\n static createEmptyInputScopeSetError(): ClientAuthError {\r\n return new ClientAuthError(ClientAuthErrorMessage.emptyInputScopeSetError.code, `${ClientAuthErrorMessage.emptyInputScopeSetError.desc}`);\r\n }\r\n\r\n /**\r\n * Throws error if user sets CancellationToken.cancel = true during polling of token endpoint during device code flow\r\n */\r\n static createDeviceCodeCancelledError(): ClientAuthError {\r\n return new ClientAuthError(ClientAuthErrorMessage.DeviceCodePollingCancelled.code, `${ClientAuthErrorMessage.DeviceCodePollingCancelled.desc}`);\r\n }\r\n\r\n /**\r\n * Throws error if device code is expired\r\n */\r\n static createDeviceCodeExpiredError(): ClientAuthError {\r\n return new ClientAuthError(ClientAuthErrorMessage.DeviceCodeExpired.code, `${ClientAuthErrorMessage.DeviceCodeExpired.desc}`);\r\n }\r\n\r\n /**\r\n * Throws error if device code is expired\r\n */\r\n static createDeviceCodeUnknownError(): ClientAuthError {\r\n return new ClientAuthError(ClientAuthErrorMessage.DeviceCodeUnknownError.code, `${ClientAuthErrorMessage.DeviceCodeUnknownError.desc}`);\r\n }\r\n\r\n /**\r\n * Throws error when silent requests are made without an account object\r\n */\r\n static createNoAccountInSilentRequestError(): ClientAuthError {\r\n return new ClientAuthError(ClientAuthErrorMessage.NoAccountInSilentRequest.code, `${ClientAuthErrorMessage.NoAccountInSilentRequest.desc}`);\r\n }\r\n\r\n /**\r\n * Throws error when cache record is null or undefined.\r\n */\r\n static createNullOrUndefinedCacheRecord(): ClientAuthError {\r\n return new ClientAuthError(ClientAuthErrorMessage.invalidCacheRecord.code, ClientAuthErrorMessage.invalidCacheRecord.desc);\r\n }\r\n\r\n /**\r\n * Throws error when provided environment is not part of the CloudDiscoveryMetadata object\r\n */\r\n static createInvalidCacheEnvironmentError(): ClientAuthError {\r\n return new ClientAuthError(ClientAuthErrorMessage.invalidCacheEnvironment.code, ClientAuthErrorMessage.invalidCacheEnvironment.desc);\r\n }\r\n\r\n /**\r\n * Throws error when account is not found in cache.\r\n */\r\n static createNoAccountFoundError(): ClientAuthError {\r\n return new ClientAuthError(ClientAuthErrorMessage.noAccountFound.code, ClientAuthErrorMessage.noAccountFound.desc);\r\n }\r\n\r\n /**\r\n * Throws error if ICachePlugin not set on CacheManager.\r\n */\r\n static createCachePluginError(): ClientAuthError {\r\n return new ClientAuthError(ClientAuthErrorMessage.CachePluginError.code, `${ClientAuthErrorMessage.CachePluginError.desc}`);\r\n }\r\n\r\n /**\r\n * Throws error if crypto object not found.\r\n * @param operationName\r\n */\r\n static createNoCryptoObjectError(operationName: string): ClientAuthError {\r\n return new ClientAuthError(ClientAuthErrorMessage.noCryptoObj.code, `${ClientAuthErrorMessage.noCryptoObj.desc}${operationName}`);\r\n }\r\n\r\n /**\r\n * Throws error if cache type is invalid.\r\n */\r\n static createInvalidCacheTypeError(): ClientAuthError {\r\n return new ClientAuthError(ClientAuthErrorMessage.invalidCacheType.code, `${ClientAuthErrorMessage.invalidCacheType.desc}`);\r\n }\r\n\r\n /**\r\n * Throws error if unexpected account type.\r\n */\r\n static createUnexpectedAccountTypeError(): ClientAuthError {\r\n return new ClientAuthError(ClientAuthErrorMessage.unexpectedAccountType.code, `${ClientAuthErrorMessage.unexpectedAccountType.desc}`);\r\n }\r\n\r\n /**\r\n * Throws error if unexpected credential type.\r\n */\r\n static createUnexpectedCredentialTypeError(): ClientAuthError {\r\n return new ClientAuthError(ClientAuthErrorMessage.unexpectedCredentialType.code, `${ClientAuthErrorMessage.unexpectedCredentialType.desc}`);\r\n }\r\n\r\n /**\r\n * Throws error if client assertion is not valid.\r\n */\r\n static createInvalidAssertionError(): ClientAuthError {\r\n return new ClientAuthError(ClientAuthErrorMessage.invalidAssertion.code, `${ClientAuthErrorMessage.invalidAssertion.desc}`);\r\n }\r\n\r\n /**\r\n * Throws error if client assertion is not valid.\r\n */\r\n static createInvalidCredentialError(): ClientAuthError {\r\n return new ClientAuthError(ClientAuthErrorMessage.invalidClientCredential.code, `${ClientAuthErrorMessage.invalidClientCredential.desc}`);\r\n }\r\n\r\n /**\r\n * Throws error if token cannot be retrieved from cache due to refresh being required.\r\n */\r\n static createRefreshRequiredError(): ClientAuthError {\r\n return new ClientAuthError(ClientAuthErrorMessage.tokenRefreshRequired.code, ClientAuthErrorMessage.tokenRefreshRequired.desc);\r\n }\r\n\r\n /**\r\n * Throws error if the user defined timeout is reached.\r\n */\r\n static createUserTimeoutReachedError(): ClientAuthError {\r\n return new ClientAuthError(ClientAuthErrorMessage.userTimeoutReached.code, ClientAuthErrorMessage.userTimeoutReached.desc);\r\n }\r\n\r\n /*\r\n * Throws error if token claims are not populated for a signed jwt generation\r\n */\r\n static createTokenClaimsRequiredError(): ClientAuthError {\r\n return new ClientAuthError(ClientAuthErrorMessage.tokenClaimsRequired.code, ClientAuthErrorMessage.tokenClaimsRequired.desc);\r\n }\r\n\r\n /**\r\n * Throws error when the authorization code is missing from the server response\r\n */\r\n static createNoAuthCodeInServerResponseError(): ClientAuthError {\r\n return new ClientAuthError(ClientAuthErrorMessage.noAuthorizationCodeFromServer.code, ClientAuthErrorMessage.noAuthorizationCodeFromServer.desc);\r\n }\r\n\r\n static createBindingKeyNotRemovedError(): ClientAuthError {\r\n return new ClientAuthError(ClientAuthErrorMessage.bindingKeyNotRemovedError.code, ClientAuthErrorMessage.bindingKeyNotRemovedError.desc);\r\n }\r\n\r\n /**\r\n * Thrown when logout is attempted for an authority that doesnt have an end_session_endpoint\r\n */\r\n static createLogoutNotSupportedError(): ClientAuthError {\r\n return new ClientAuthError(ClientAuthErrorMessage.logoutNotSupported.code, ClientAuthErrorMessage.logoutNotSupported.desc);\r\n }\r\n\r\n /**\r\n * Create an error when kid attribute is missing from a PoP token's cache record\r\n */\r\n static createKeyIdMissingError(): ClientAuthError {\r\n return new ClientAuthError(ClientAuthErrorMessage.keyIdMissing.code, ClientAuthErrorMessage.keyIdMissing.desc);\r\n }\r\n}\r\n","/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License.\r\n */\r\n\r\nimport { DecodedAuthToken } from \"../account/DecodedAuthToken\";\r\nimport { ClientAuthError } from \"../error/ClientAuthError\";\r\n\r\n/**\r\n * @hidden\r\n */\r\nexport class StringUtils {\r\n\r\n /**\r\n * decode a JWT\r\n *\r\n * @param authToken\r\n */\r\n static decodeAuthToken(authToken: string): DecodedAuthToken {\r\n if (StringUtils.isEmpty(authToken)) {\r\n throw ClientAuthError.createTokenNullOrEmptyError(authToken);\r\n }\r\n const tokenPartsRegex = /^([^\\.\\s]*)\\.([^\\.\\s]+)\\.([^\\.\\s]*)$/;\r\n const matches = tokenPartsRegex.exec(authToken);\r\n if (!matches || matches.length < 4) {\r\n throw ClientAuthError.createTokenParsingError(`Given token is malformed: ${JSON.stringify(authToken)}`);\r\n }\r\n const crackedToken: DecodedAuthToken = {\r\n header: matches[1],\r\n JWSPayload: matches[2],\r\n JWSSig: matches[3]\r\n };\r\n return crackedToken;\r\n }\r\n\r\n /**\r\n * Check if a string is empty.\r\n *\r\n * @param str\r\n */\r\n static isEmpty(str?: string): boolean {\r\n return (typeof str === \"undefined\" || !str || 0 === str.length);\r\n }\r\n\r\n /**\r\n * Check if stringified object is empty\r\n * @param strObj \r\n */\r\n static isEmptyObj(strObj?: string): boolean {\r\n if (strObj && !StringUtils.isEmpty(strObj)) {\r\n try {\r\n const obj = JSON.parse(strObj);\r\n return Object.keys(obj).length === 0;\r\n } catch (e) {}\r\n }\r\n return true;\r\n }\r\n\r\n static startsWith(str: string, search: string): boolean {\r\n return str.indexOf(search) === 0;\r\n }\r\n\r\n static endsWith(str: string, search: string): boolean {\r\n return (str.length >= search.length) && (str.lastIndexOf(search) === (str.length - search.length));\r\n }\r\n\r\n /**\r\n * Parses string into an object.\r\n *\r\n * @param query\r\n */\r\n static queryStringToObject(query: string): T {\r\n const obj: {} = {};\r\n const params = query.split(\"&\");\r\n const decode = (s: string) => decodeURIComponent(s.replace(/\\+/g, \" \"));\r\n params.forEach((pair) => {\r\n if (pair.trim()) {\r\n const [key, value] = pair.split(/=(.+)/g, 2); // Split on the first occurence of the '=' character\r\n if (key && value) {\r\n obj[decode(key)] = decode(value);\r\n }\r\n }\r\n });\r\n return obj as T;\r\n }\r\n\r\n /**\r\n * Trims entries in an array.\r\n *\r\n * @param arr\r\n */\r\n static trimArrayEntries(arr: Array): Array {\r\n return arr.map(entry => entry.trim());\r\n }\r\n\r\n /**\r\n * Removes empty strings from array\r\n * @param arr\r\n */\r\n static removeEmptyStringsFromArray(arr: Array): Array {\r\n return arr.filter(entry => {\r\n return !StringUtils.isEmpty(entry);\r\n });\r\n }\r\n\r\n /**\r\n * Attempts to parse a string into JSON\r\n * @param str\r\n */\r\n static jsonParseHelper(str: string): T | null {\r\n try {\r\n return JSON.parse(str) as T;\r\n } catch (e) {\r\n return null;\r\n }\r\n }\r\n\r\n /**\r\n * Tests if a given string matches a given pattern, with support for wildcards and queries.\r\n * @param pattern Wildcard pattern to string match. Supports \"*\" for wildcards and \"?\" for queries\r\n * @param input String to match against\r\n */\r\n static matchPattern(pattern: string, input: string): boolean {\r\n /**\r\n * Wildcard support: https://stackoverflow.com/a/3117248/4888559\r\n * Queries: replaces \"?\" in string with escaped \"\\?\" for regex test\r\n */\r\n const regex: RegExp = new RegExp(pattern.replace(/\\\\/g, \"\\\\\\\\\").replace(/\\*/g, \"[^ ]*\").replace(/\\?/g, \"\\\\\\?\")); // eslint-disable-line security/detect-non-literal-regexp\r\n\r\n return regex.test(input);\r\n }\r\n}\r\n","/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License.\r\n */\r\n\r\nimport { StringUtils } from \"../utils/StringUtils\";\r\nimport { LoggerOptions } from \"../config/ClientConfiguration\";\r\nimport { Constants } from \"../utils/Constants\";\r\n\r\n/**\r\n * Options for logger messages.\r\n */\r\nexport type LoggerMessageOptions = {\r\n logLevel: LogLevel,\r\n containsPii?: boolean,\r\n context?: string,\r\n correlationId?: string\r\n};\r\n\r\n/**\r\n * Log message level.\r\n */\r\nexport enum LogLevel {\r\n Error,\r\n Warning,\r\n Info,\r\n Verbose,\r\n Trace\r\n}\r\n\r\n/**\r\n * Callback to send the messages to.\r\n */\r\nexport interface ILoggerCallback {\r\n (level: LogLevel, message: string, containsPii: boolean): void;\r\n}\r\n\r\n/**\r\n * Class which facilitates logging of messages to a specific place.\r\n */\r\nexport class Logger {\r\n\r\n // Correlation ID for request, usually set by user.\r\n private correlationId: string;\r\n\r\n // Current log level, defaults to info.\r\n private level: LogLevel = LogLevel.Info;\r\n\r\n // Boolean describing whether PII logging is allowed.\r\n private piiLoggingEnabled: boolean;\r\n\r\n // Callback to send messages to.\r\n private localCallback: ILoggerCallback;\r\n\r\n // Package name implementing this logger\r\n private packageName: string;\r\n\r\n // Package version implementing this logger\r\n private packageVersion: string;\r\n\r\n constructor(loggerOptions: LoggerOptions, packageName?: string, packageVersion?: string) {\r\n const defaultLoggerCallback = () => {\r\n return;\r\n };\r\n const setLoggerOptions = loggerOptions || Logger.createDefaultLoggerOptions();\r\n this.localCallback = setLoggerOptions.loggerCallback || defaultLoggerCallback;\r\n this.piiLoggingEnabled = setLoggerOptions.piiLoggingEnabled || false;\r\n this.level = typeof(setLoggerOptions.logLevel) === \"number\" ? setLoggerOptions.logLevel : LogLevel.Info;\r\n this.correlationId = setLoggerOptions.correlationId || Constants.EMPTY_STRING;\r\n this.packageName = packageName || Constants.EMPTY_STRING;\r\n this.packageVersion = packageVersion || Constants.EMPTY_STRING;\r\n }\r\n \r\n private static createDefaultLoggerOptions(): LoggerOptions {\r\n return {\r\n loggerCallback: () => {\r\n // allow users to not set loggerCallback\r\n },\r\n piiLoggingEnabled: false,\r\n logLevel: LogLevel.Info\r\n };\r\n }\r\n\r\n /**\r\n * Create new Logger with existing configurations.\r\n */\r\n public clone(packageName: string, packageVersion: string, correlationId?: string): Logger {\r\n return new Logger({loggerCallback: this.localCallback, piiLoggingEnabled: this.piiLoggingEnabled, logLevel: this.level, correlationId: correlationId || this.correlationId}, packageName, packageVersion);\r\n }\r\n\r\n /**\r\n * Log message with required options.\r\n */\r\n private logMessage(logMessage: string, options: LoggerMessageOptions): void {\r\n if ((options.logLevel > this.level) || (!this.piiLoggingEnabled && options.containsPii)) {\r\n return;\r\n }\r\n const timestamp = new Date().toUTCString();\r\n\r\n // Add correlationId to logs if set, correlationId provided on log messages take precedence\r\n let logHeader: string;\r\n if (!StringUtils.isEmpty(options.correlationId)) {\r\n logHeader = `[${timestamp}] : [${options.correlationId}]`;\r\n } else if (!StringUtils.isEmpty(this.correlationId)) {\r\n logHeader = `[${timestamp}] : [${this.correlationId}]`;\r\n } else {\r\n logHeader = `[${timestamp}]`;\r\n }\r\n\r\n const log = `${logHeader} : ${this.packageName}@${this.packageVersion} : ${LogLevel[options.logLevel]} - ${logMessage}`;\r\n // debug(`msal:${LogLevel[options.logLevel]}${options.containsPii ? \"-Pii\": Constants.EMPTY_STRING}${options.context ? `:${options.context}` : Constants.EMPTY_STRING}`)(logMessage);\r\n this.executeCallback(options.logLevel, log, options.containsPii || false);\r\n }\r\n\r\n /**\r\n * Execute callback with message.\r\n */\r\n executeCallback(level: LogLevel, message: string, containsPii: boolean): void {\r\n if (this.localCallback) {\r\n this.localCallback(level, message, containsPii);\r\n }\r\n }\r\n\r\n /**\r\n * Logs error messages.\r\n */\r\n error(message: string, correlationId?: string): void {\r\n this.logMessage(message, {\r\n logLevel: LogLevel.Error,\r\n containsPii: false,\r\n correlationId: correlationId || Constants.EMPTY_STRING\r\n });\r\n }\r\n\r\n /**\r\n * Logs error messages with PII.\r\n */\r\n errorPii(message: string, correlationId?: string): void {\r\n this.logMessage(message, {\r\n logLevel: LogLevel.Error,\r\n containsPii: true,\r\n correlationId: correlationId || Constants.EMPTY_STRING\r\n });\r\n }\r\n\r\n /**\r\n * Logs warning messages.\r\n */\r\n warning(message: string, correlationId?: string): void {\r\n this.logMessage(message, {\r\n logLevel: LogLevel.Warning,\r\n containsPii: false,\r\n correlationId: correlationId || Constants.EMPTY_STRING\r\n });\r\n }\r\n\r\n /**\r\n * Logs warning messages with PII.\r\n */\r\n warningPii(message: string, correlationId?: string): void {\r\n this.logMessage(message, {\r\n logLevel: LogLevel.Warning,\r\n containsPii: true,\r\n correlationId: correlationId || Constants.EMPTY_STRING\r\n });\r\n }\r\n\r\n /**\r\n * Logs info messages.\r\n */\r\n info(message: string, correlationId?: string): void {\r\n this.logMessage(message, {\r\n logLevel: LogLevel.Info,\r\n containsPii: false,\r\n correlationId: correlationId || Constants.EMPTY_STRING\r\n });\r\n }\r\n\r\n /**\r\n * Logs info messages with PII.\r\n */\r\n infoPii(message: string, correlationId?: string): void {\r\n this.logMessage(message, {\r\n logLevel: LogLevel.Info,\r\n containsPii: true,\r\n correlationId: correlationId || Constants.EMPTY_STRING\r\n });\r\n }\r\n\r\n /**\r\n * Logs verbose messages.\r\n */\r\n verbose(message: string, correlationId?: string): void {\r\n this.logMessage(message, {\r\n logLevel: LogLevel.Verbose,\r\n containsPii: false,\r\n correlationId: correlationId || Constants.EMPTY_STRING\r\n });\r\n }\r\n\r\n /**\r\n * Logs verbose messages with PII.\r\n */\r\n verbosePii(message: string, correlationId?: string): void {\r\n this.logMessage(message, {\r\n logLevel: LogLevel.Verbose,\r\n containsPii: true,\r\n correlationId: correlationId || Constants.EMPTY_STRING\r\n });\r\n }\r\n\r\n /**\r\n * Logs trace messages.\r\n */\r\n trace(message: string, correlationId?: string): void {\r\n this.logMessage(message, {\r\n logLevel: LogLevel.Trace,\r\n containsPii: false,\r\n correlationId: correlationId || Constants.EMPTY_STRING\r\n });\r\n }\r\n\r\n /**\r\n * Logs trace messages with PII.\r\n */\r\n tracePii(message: string, correlationId?: string): void {\r\n this.logMessage(message, {\r\n logLevel: LogLevel.Trace,\r\n containsPii: true,\r\n correlationId: correlationId || Constants.EMPTY_STRING\r\n });\r\n }\r\n\r\n /**\r\n * Returns whether PII Logging is enabled or not.\r\n */\r\n isPiiLoggingEnabled(): boolean {\r\n return this.piiLoggingEnabled || false;\r\n }\r\n}\r\n","/* eslint-disable header/header */\nexport const name = \"@azure/msal-common\";\nexport const version = \"9.1.1\";\n","/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License.\r\n */\r\n\r\nimport { ProtocolMode } from \"./ProtocolMode\";\r\nimport { AzureRegionConfiguration } from \"./AzureRegionConfiguration\";\r\n\r\nexport type AuthorityOptions = {\r\n protocolMode: ProtocolMode;\r\n knownAuthorities: Array;\r\n cloudDiscoveryMetadata: string;\r\n authorityMetadata: string;\r\n skipAuthorityMetadataCache?: boolean;\r\n azureRegionConfiguration?: AzureRegionConfiguration;\r\n};\r\n\r\nexport enum AzureCloudInstance {\r\n // AzureCloudInstance is not specified.\r\n None,\r\n\r\n // Microsoft Azure public cloud\r\n AzurePublic = \"https://login.microsoftonline.com\",\r\n\r\n // Microsoft PPE\r\n AzurePpe = \"https://login.windows-ppe.net\",\r\n\r\n // Microsoft Chinese national cloud\r\n AzureChina = \"https://login.chinacloudapi.cn\",\r\n\r\n // Microsoft German national cloud (\"Black Forest\")\r\n AzureGermany = \"https://login.microsoftonline.de\",\r\n\r\n // US Government cloud\r\n AzureUsGovernment = \"https://login.microsoftonline.us\",\r\n}\r\n","/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License.\r\n */\r\n\r\nimport { Separators, CredentialType, CacheType, Constants, AuthenticationScheme } from \"../../utils/Constants\";\r\nimport { ClientAuthError } from \"../../error/ClientAuthError\";\r\n\r\n/**\r\n * Base type for credentials to be stored in the cache: eg: ACCESS_TOKEN, ID_TOKEN etc\r\n *\r\n * Key:Value Schema:\r\n *\r\n * Key: -------\r\n *\r\n * Value Schema:\r\n * {\r\n * homeAccountId: home account identifier for the auth scheme,\r\n * environment: entity that issued the token, represented as a full host\r\n * credentialType: Type of credential as a string, can be one of the following: RefreshToken, AccessToken, IdToken, Password, Cookie, Certificate, Other\r\n * clientId: client ID of the application\r\n * secret: Actual credential as a string\r\n * familyId: Family ID identifier, usually only used for refresh tokens\r\n * realm: Full tenant or organizational identifier that the account belongs to\r\n * target: Permissions that are included in the token, or for refresh tokens, the resource identifier.\r\n * tokenType: Matches the authentication scheme for which the token was issued (i.e. Bearer or pop)\r\n * requestedClaimsHash: Matches the SHA 256 hash of the claims object included in the token request\r\n * userAssertionHash: Matches the SHA 256 hash of the obo_assertion for the OBO flow\r\n * }\r\n */\r\nexport class CredentialEntity {\r\n homeAccountId: string;\r\n environment: string;\r\n credentialType: CredentialType;\r\n clientId: string;\r\n secret: string;\r\n familyId?: string;\r\n realm?: string;\r\n target?: string;\r\n userAssertionHash?: string;\r\n tokenType?: AuthenticationScheme;\r\n keyId?: string;\r\n requestedClaimsHash?: string;\r\n\r\n /**\r\n * Generate Account Id key component as per the schema: -\r\n */\r\n generateAccountId(): string {\r\n return CredentialEntity.generateAccountIdForCacheKey(this.homeAccountId, this.environment);\r\n }\r\n\r\n /**\r\n * Generate Credential Id key component as per the schema: --\r\n */\r\n generateCredentialId(): string {\r\n return CredentialEntity.generateCredentialIdForCacheKey(\r\n this.credentialType,\r\n this.clientId,\r\n this.realm,\r\n this.familyId\r\n );\r\n }\r\n\r\n /**\r\n * Generate target key component as per schema: \r\n */\r\n generateTarget(): string {\r\n return CredentialEntity.generateTargetForCacheKey(this.target);\r\n }\r\n\r\n /**\r\n * generates credential key\r\n */\r\n generateCredentialKey(): string {\r\n return CredentialEntity.generateCredentialCacheKey(\r\n this.homeAccountId,\r\n this.environment,\r\n this.credentialType,\r\n this.clientId,\r\n this.realm,\r\n this.target,\r\n this.familyId,\r\n this.tokenType,\r\n this.requestedClaimsHash,\r\n );\r\n }\r\n\r\n /**\r\n * returns the type of the cache (in this case credential)\r\n */\r\n generateType(): number {\r\n switch (this.credentialType) {\r\n case CredentialType.ID_TOKEN:\r\n return CacheType.ID_TOKEN;\r\n case CredentialType.ACCESS_TOKEN:\r\n case CredentialType.ACCESS_TOKEN_WITH_AUTH_SCHEME:\r\n return CacheType.ACCESS_TOKEN;\r\n case CredentialType.REFRESH_TOKEN:\r\n return CacheType.REFRESH_TOKEN;\r\n default: {\r\n throw ClientAuthError.createUnexpectedCredentialTypeError();\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * helper function to return `CredentialType`\r\n * @param key\r\n */\r\n static getCredentialType(key: string): string {\r\n const separator = Separators.CACHE_KEY_SEPARATOR;\r\n // Match host names like \"login.microsoftonline.com\", \"https://accounts.google.com:4000\", etc.\r\n const domainRe = \"(https?:\\\\/\\\\/)?([\\\\w-]+\\\\.)*([\\\\w-]{1,63})(\\\\.(\\\\w{2,63}))(\\\\:[0-9]{4,5})?\";\r\n\r\n for (const credKey of Object.keys(CredentialType)) {\r\n const credVal = CredentialType[credKey].toLowerCase();\r\n // Verify credential type is preceded by a valid host name (environment)\r\n if (key.toLowerCase().search(`${separator}${domainRe}${separator}${credVal}${separator}`) !== -1) {\r\n return CredentialType[credKey];\r\n }\r\n }\r\n\r\n return Constants.NOT_DEFINED;\r\n }\r\n\r\n /**\r\n * generates credential key\r\n * -\\-----\r\n */\r\n static generateCredentialCacheKey(\r\n homeAccountId: string,\r\n environment: string,\r\n credentialType: CredentialType,\r\n clientId: string,\r\n realm?: string,\r\n target?: string,\r\n familyId?: string,\r\n tokenType?: AuthenticationScheme,\r\n requestedClaimsHash?: string\r\n ): string {\r\n const credentialKey = [\r\n this.generateAccountIdForCacheKey(homeAccountId, environment),\r\n this.generateCredentialIdForCacheKey(credentialType, clientId, realm, familyId),\r\n this.generateTargetForCacheKey(target),\r\n this.generateClaimsHashForCacheKey(requestedClaimsHash),\r\n this.generateSchemeForCacheKey(tokenType)\r\n ];\r\n\r\n return credentialKey.join(Separators.CACHE_KEY_SEPARATOR).toLowerCase();\r\n }\r\n\r\n /**\r\n * generates Account Id for keys\r\n * @param homeAccountId\r\n * @param environment\r\n */\r\n private static generateAccountIdForCacheKey(\r\n homeAccountId: string,\r\n environment: string\r\n ): string {\r\n const accountId: Array = [homeAccountId, environment];\r\n return accountId.join(Separators.CACHE_KEY_SEPARATOR).toLowerCase();\r\n }\r\n\r\n /**\r\n * Generates Credential Id for keys\r\n * @param credentialType\r\n * @param realm\r\n * @param clientId\r\n * @param familyId\r\n */\r\n private static generateCredentialIdForCacheKey(\r\n credentialType: CredentialType,\r\n clientId: string,\r\n realm?: string,\r\n familyId?: string\r\n ): string {\r\n const clientOrFamilyId =\r\n credentialType === CredentialType.REFRESH_TOKEN\r\n ? familyId || clientId\r\n : clientId;\r\n const credentialId: Array = [\r\n credentialType,\r\n clientOrFamilyId,\r\n realm || Constants.EMPTY_STRING,\r\n ];\r\n\r\n return credentialId.join(Separators.CACHE_KEY_SEPARATOR).toLowerCase();\r\n }\r\n\r\n /**\r\n * Generate target key component as per schema: \r\n */\r\n private static generateTargetForCacheKey(scopes?: string): string {\r\n return (scopes || Constants.EMPTY_STRING).toLowerCase();\r\n }\r\n\r\n /**\r\n * Generate requested claims key component as per schema: \r\n */\r\n private static generateClaimsHashForCacheKey(requestedClaimsHash?: string): string {\r\n return(requestedClaimsHash || Constants.EMPTY_STRING).toLowerCase();\r\n }\r\n\r\n /**\r\n * Generate scheme key componenet as per schema: \r\n */\r\n private static generateSchemeForCacheKey(tokenType?: string): string {\r\n /*\r\n * PoP Tokens and SSH certs include scheme in cache key\r\n * Cast to lowercase to handle \"bearer\" from ADFS\r\n */\r\n return (tokenType && tokenType.toLowerCase() !== AuthenticationScheme.BEARER.toLowerCase()) ? tokenType.toLowerCase() : Constants.EMPTY_STRING;\r\n }\r\n}\r\n","/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License.\r\n */\r\n\r\nimport { ClientAuthError } from \"./ClientAuthError\";\r\n\r\n/**\r\n * ClientConfigurationErrorMessage class containing string constants used by error codes and messages.\r\n */\r\nexport const ClientConfigurationErrorMessage = {\r\n redirectUriNotSet: {\r\n code: \"redirect_uri_empty\",\r\n desc: \"A redirect URI is required for all calls, and none has been set.\"\r\n },\r\n postLogoutUriNotSet: {\r\n code: \"post_logout_uri_empty\",\r\n desc: \"A post logout redirect has not been set.\"\r\n },\r\n claimsRequestParsingError: {\r\n code: \"claims_request_parsing_error\",\r\n desc: \"Could not parse the given claims request object.\"\r\n },\r\n authorityUriInsecure: {\r\n code: \"authority_uri_insecure\",\r\n desc: \"Authority URIs must use https. Please see here for valid authority configuration options: https://docs.microsoft.com/en-us/azure/active-directory/develop/msal-js-initializing-client-applications#configuration-options\"\r\n },\r\n urlParseError: {\r\n code: \"url_parse_error\",\r\n desc: \"URL could not be parsed into appropriate segments.\"\r\n },\r\n urlEmptyError: {\r\n code: \"empty_url_error\",\r\n desc: \"URL was empty or null.\"\r\n },\r\n emptyScopesError: {\r\n code: \"empty_input_scopes_error\",\r\n desc: \"Scopes cannot be passed as null, undefined or empty array because they are required to obtain an access token.\"\r\n },\r\n nonArrayScopesError: {\r\n code: \"nonarray_input_scopes_error\",\r\n desc: \"Scopes cannot be passed as non-array.\"\r\n },\r\n clientIdSingleScopeError: {\r\n code: \"clientid_input_scopes_error\",\r\n desc: \"Client ID can only be provided as a single scope.\"\r\n },\r\n invalidPrompt: {\r\n code: \"invalid_prompt_value\",\r\n desc: \"Supported prompt values are 'login', 'select_account', 'consent', 'create', 'none' and 'no_session'. Please see here for valid configuration options: https://azuread.github.io/microsoft-authentication-library-for-js/ref/modules/_azure_msal_common.html#commonauthorizationurlrequest\",\r\n },\r\n invalidClaimsRequest: {\r\n code: \"invalid_claims\",\r\n desc: \"Given claims parameter must be a stringified JSON object.\"\r\n },\r\n tokenRequestEmptyError: {\r\n code: \"token_request_empty\",\r\n desc: \"Token request was empty and not found in cache.\"\r\n },\r\n logoutRequestEmptyError: {\r\n code: \"logout_request_empty\",\r\n desc: \"The logout request was null or undefined.\"\r\n },\r\n invalidCodeChallengeMethod: {\r\n code: \"invalid_code_challenge_method\",\r\n desc: \"code_challenge_method passed is invalid. Valid values are \\\"plain\\\" and \\\"S256\\\".\"\r\n },\r\n invalidCodeChallengeParams: {\r\n code: \"pkce_params_missing\",\r\n desc: \"Both params: code_challenge and code_challenge_method are to be passed if to be sent in the request\"\r\n },\r\n invalidCloudDiscoveryMetadata: {\r\n code: \"invalid_cloud_discovery_metadata\",\r\n desc: \"Invalid cloudDiscoveryMetadata provided. Must be a stringified JSON object containing tenant_discovery_endpoint and metadata fields\"\r\n },\r\n invalidAuthorityMetadata: {\r\n code: \"invalid_authority_metadata\",\r\n desc: \"Invalid authorityMetadata provided. Must by a stringified JSON object containing authorization_endpoint, token_endpoint, issuer fields.\"\r\n },\r\n untrustedAuthority: {\r\n code: \"untrusted_authority\",\r\n desc: \"The provided authority is not a trusted authority. Please include this authority in the knownAuthorities config parameter.\"\r\n },\r\n invalidAzureCloudInstance: {\r\n code: \"invalid_azure_cloud_instance\",\r\n desc: \"Invalid AzureCloudInstance provided. Please refer MSAL JS docs: aks.ms/msaljs/azure_cloud_instance for valid values\"\r\n },\r\n missingSshJwk: {\r\n code: \"missing_ssh_jwk\",\r\n desc: \"Missing sshJwk in SSH certificate request. A stringified JSON Web Key is required when using the SSH authentication scheme.\"\r\n },\r\n missingSshKid: {\r\n code: \"missing_ssh_kid\",\r\n desc: \"Missing sshKid in SSH certificate request. A string that uniquely identifies the public SSH key is required when using the SSH authentication scheme.\"\r\n },\r\n missingNonceAuthenticationHeader: {\r\n code: \"missing_nonce_authentication_header\",\r\n desc: \"Unable to find an authentication header containing server nonce. Either the Authentication-Info or WWW-Authenticate headers must be present in order to obtain a server nonce.\"\r\n },\r\n invalidAuthenticationHeader: {\r\n code: \"invalid_authentication_header\",\r\n desc: \"Invalid authentication header provided\"\r\n }\r\n};\r\n\r\n/**\r\n * Error thrown when there is an error in configuration of the MSAL.js library.\r\n */\r\nexport class ClientConfigurationError extends ClientAuthError {\r\n\r\n constructor(errorCode: string, errorMessage?: string) {\r\n super(errorCode, errorMessage);\r\n this.name = \"ClientConfigurationError\";\r\n Object.setPrototypeOf(this, ClientConfigurationError.prototype);\r\n }\r\n\r\n /**\r\n * Creates an error thrown when the redirect uri is empty (not set by caller)\r\n */\r\n static createRedirectUriEmptyError(): ClientConfigurationError {\r\n return new ClientConfigurationError(ClientConfigurationErrorMessage.redirectUriNotSet.code,\r\n ClientConfigurationErrorMessage.redirectUriNotSet.desc);\r\n }\r\n\r\n /**\r\n * Creates an error thrown when the post-logout redirect uri is empty (not set by caller)\r\n */\r\n static createPostLogoutRedirectUriEmptyError(): ClientConfigurationError {\r\n return new ClientConfigurationError(ClientConfigurationErrorMessage.postLogoutUriNotSet.code,\r\n ClientConfigurationErrorMessage.postLogoutUriNotSet.desc);\r\n }\r\n\r\n /**\r\n * Creates an error thrown when the claims request could not be successfully parsed\r\n */\r\n static createClaimsRequestParsingError(claimsRequestParseError: string): ClientConfigurationError {\r\n return new ClientConfigurationError(ClientConfigurationErrorMessage.claimsRequestParsingError.code,\r\n `${ClientConfigurationErrorMessage.claimsRequestParsingError.desc} Given value: ${claimsRequestParseError}`);\r\n }\r\n\r\n /**\r\n * Creates an error thrown if authority uri is given an insecure protocol.\r\n * @param urlString\r\n */\r\n static createInsecureAuthorityUriError(urlString: string): ClientConfigurationError {\r\n return new ClientConfigurationError(ClientConfigurationErrorMessage.authorityUriInsecure.code,\r\n `${ClientConfigurationErrorMessage.authorityUriInsecure.desc} Given URI: ${urlString}`);\r\n }\r\n\r\n /**\r\n * Creates an error thrown if URL string does not parse into separate segments.\r\n * @param urlString\r\n */\r\n static createUrlParseError(urlParseError: string): ClientConfigurationError {\r\n return new ClientConfigurationError(ClientConfigurationErrorMessage.urlParseError.code,\r\n `${ClientConfigurationErrorMessage.urlParseError.desc} Given Error: ${urlParseError}`);\r\n }\r\n\r\n /**\r\n * Creates an error thrown if URL string is empty or null.\r\n * @param urlString\r\n */\r\n static createUrlEmptyError(): ClientConfigurationError {\r\n return new ClientConfigurationError(ClientConfigurationErrorMessage.urlEmptyError.code,\r\n ClientConfigurationErrorMessage.urlEmptyError.desc);\r\n }\r\n\r\n /**\r\n * Error thrown when scopes are empty.\r\n * @param scopesValue\r\n */\r\n static createEmptyScopesArrayError(): ClientConfigurationError {\r\n return new ClientConfigurationError(ClientConfigurationErrorMessage.emptyScopesError.code,\r\n `${ClientConfigurationErrorMessage.emptyScopesError.desc}`);\r\n }\r\n\r\n /**\r\n * Error thrown when client id scope is not provided as single scope.\r\n * @param inputScopes\r\n */\r\n static createClientIdSingleScopeError(inputScopes: Array): ClientConfigurationError {\r\n return new ClientConfigurationError(ClientConfigurationErrorMessage.clientIdSingleScopeError.code,\r\n `${ClientConfigurationErrorMessage.clientIdSingleScopeError.desc} Given Scopes: ${inputScopes}`);\r\n }\r\n\r\n /**\r\n * Error thrown when prompt is not an allowed type.\r\n * @param promptValue\r\n */\r\n static createInvalidPromptError(promptValue: string): ClientConfigurationError {\r\n return new ClientConfigurationError(ClientConfigurationErrorMessage.invalidPrompt.code,\r\n `${ClientConfigurationErrorMessage.invalidPrompt.desc} Given value: ${promptValue}`);\r\n }\r\n\r\n /**\r\n * Creates error thrown when claims parameter is not a stringified JSON object\r\n */\r\n static createInvalidClaimsRequestError(): ClientConfigurationError {\r\n return new ClientConfigurationError(ClientConfigurationErrorMessage.invalidClaimsRequest.code,\r\n ClientConfigurationErrorMessage.invalidClaimsRequest.desc);\r\n }\r\n\r\n /**\r\n * Throws error when token request is empty and nothing cached in storage.\r\n */\r\n static createEmptyLogoutRequestError(): ClientConfigurationError {\r\n return new ClientConfigurationError(\r\n ClientConfigurationErrorMessage.logoutRequestEmptyError.code,\r\n ClientConfigurationErrorMessage.logoutRequestEmptyError.desc\r\n );\r\n }\r\n\r\n /**\r\n * Throws error when token request is empty and nothing cached in storage.\r\n */\r\n static createEmptyTokenRequestError(): ClientConfigurationError {\r\n return new ClientConfigurationError(\r\n ClientConfigurationErrorMessage.tokenRequestEmptyError.code,\r\n ClientConfigurationErrorMessage.tokenRequestEmptyError.desc\r\n );\r\n }\r\n\r\n /**\r\n * Throws error when an invalid code_challenge_method is passed by the user\r\n */\r\n static createInvalidCodeChallengeMethodError(): ClientConfigurationError {\r\n return new ClientConfigurationError(\r\n ClientConfigurationErrorMessage.invalidCodeChallengeMethod.code,\r\n ClientConfigurationErrorMessage.invalidCodeChallengeMethod.desc\r\n );\r\n }\r\n\r\n /**\r\n * Throws error when both params: code_challenge and code_challenge_method are not passed together\r\n */\r\n static createInvalidCodeChallengeParamsError(): ClientConfigurationError {\r\n return new ClientConfigurationError(\r\n ClientConfigurationErrorMessage.invalidCodeChallengeParams.code,\r\n ClientConfigurationErrorMessage.invalidCodeChallengeParams.desc\r\n );\r\n }\r\n\r\n /**\r\n * Throws an error when the user passes invalid cloudDiscoveryMetadata\r\n */\r\n static createInvalidCloudDiscoveryMetadataError(): ClientConfigurationError {\r\n return new ClientConfigurationError(ClientConfigurationErrorMessage.invalidCloudDiscoveryMetadata.code,\r\n ClientConfigurationErrorMessage.invalidCloudDiscoveryMetadata.desc);\r\n }\r\n\r\n /**\r\n * Throws an error when the user passes invalid cloudDiscoveryMetadata\r\n */\r\n static createInvalidAuthorityMetadataError(): ClientConfigurationError {\r\n return new ClientConfigurationError(ClientConfigurationErrorMessage.invalidAuthorityMetadata.code,\r\n ClientConfigurationErrorMessage.invalidAuthorityMetadata.desc);\r\n }\r\n\r\n /**\r\n * Throws error when provided authority is not a member of the trusted host list\r\n */\r\n static createUntrustedAuthorityError(): ClientConfigurationError {\r\n return new ClientConfigurationError(ClientConfigurationErrorMessage.untrustedAuthority.code,\r\n ClientConfigurationErrorMessage.untrustedAuthority.desc);\r\n }\r\n\r\n /**\r\n * Throws error when the AzureCloudInstance is set to an invalid value\r\n */\r\n static createInvalidAzureCloudInstanceError(): ClientConfigurationError {\r\n return new ClientConfigurationError(ClientConfigurationErrorMessage.invalidAzureCloudInstance.code,\r\n ClientConfigurationErrorMessage.invalidAzureCloudInstance.desc);\r\n }\r\n\r\n /**\r\n * Throws an error when the authentication scheme is set to SSH but the SSH public key is omitted from the request\r\n */\r\n static createMissingSshJwkError(): ClientConfigurationError {\r\n return new ClientConfigurationError(ClientConfigurationErrorMessage.missingSshJwk.code,\r\n ClientConfigurationErrorMessage.missingSshJwk.desc);\r\n }\r\n\r\n /**\r\n * Throws an error when the authentication scheme is set to SSH but the SSH public key ID is omitted from the request\r\n */\r\n static createMissingSshKidError(): ClientConfigurationError {\r\n return new ClientConfigurationError(ClientConfigurationErrorMessage.missingSshKid.code,\r\n ClientConfigurationErrorMessage.missingSshKid.desc);\r\n }\r\n\r\n /**\r\n * Throws error when provided headers don't contain a header that a server nonce can be extracted from\r\n */\r\n static createMissingNonceAuthenticationHeadersError(): ClientConfigurationError {\r\n return new ClientConfigurationError(ClientConfigurationErrorMessage.missingNonceAuthenticationHeader.code,\r\n ClientConfigurationErrorMessage.missingNonceAuthenticationHeader.desc);\r\n }\r\n\r\n /**\r\n * Throws error when a provided header is invalid in any way\r\n */\r\n static createInvalidAuthenticationHeaderError(invalidHeaderName: string, details: string): ClientConfigurationError {\r\n return new ClientConfigurationError(ClientConfigurationErrorMessage.invalidAuthenticationHeader.code,\r\n `${ClientConfigurationErrorMessage.invalidAuthenticationHeader.desc}. Invalid header: ${invalidHeaderName}. Details: ${details}`);\r\n }\r\n}\r\n","/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License.\r\n */\r\n\r\nimport { ClientConfigurationError } from \"../error/ClientConfigurationError\";\r\nimport { StringUtils } from \"../utils/StringUtils\";\r\nimport { ClientAuthError } from \"../error/ClientAuthError\";\r\nimport { Constants, OIDC_SCOPES } from \"../utils/Constants\";\r\n\r\n/**\r\n * The ScopeSet class creates a set of scopes. Scopes are case-insensitive, unique values, so the Set object in JS makes\r\n * the most sense to implement for this class. All scopes are trimmed and converted to lower case strings in intersection and union functions\r\n * to ensure uniqueness of strings.\r\n */\r\nexport class ScopeSet {\r\n // Scopes as a Set of strings\r\n private scopes: Set;\r\n\r\n constructor(inputScopes: Array) {\r\n // Filter empty string and null/undefined array items\r\n const scopeArr = inputScopes ? StringUtils.trimArrayEntries([...inputScopes]) : [];\r\n const filteredInput = scopeArr ? StringUtils.removeEmptyStringsFromArray(scopeArr) : [];\r\n\r\n // Validate and filter scopes (validate function throws if validation fails)\r\n this.validateInputScopes(filteredInput);\r\n\r\n this.scopes = new Set(); // Iterator in constructor not supported by IE11\r\n filteredInput.forEach(scope => this.scopes.add(scope));\r\n }\r\n\r\n /**\r\n * Factory method to create ScopeSet from space-delimited string\r\n * @param inputScopeString\r\n * @param appClientId\r\n * @param scopesRequired\r\n */\r\n static fromString(inputScopeString: string): ScopeSet {\r\n const scopeString = inputScopeString || Constants.EMPTY_STRING;\r\n const inputScopes: Array = scopeString.split(\" \");\r\n return new ScopeSet(inputScopes);\r\n }\r\n\r\n /**\r\n * Used to validate the scopes input parameter requested by the developer.\r\n * @param {Array} inputScopes - Developer requested permissions. Not all scopes are guaranteed to be included in the access token returned.\r\n * @param {boolean} scopesRequired - Boolean indicating whether the scopes array is required or not\r\n */\r\n private validateInputScopes(inputScopes: Array): void {\r\n // Check if scopes are required but not given or is an empty array\r\n if (!inputScopes || inputScopes.length < 1) {\r\n throw ClientConfigurationError.createEmptyScopesArrayError();\r\n }\r\n }\r\n\r\n /**\r\n * Check if a given scope is present in this set of scopes.\r\n * @param scope\r\n */\r\n containsScope(scope: string): boolean {\r\n const lowerCaseScopes = this.printScopesLowerCase().split(\" \");\r\n const lowerCaseScopesSet = new ScopeSet(lowerCaseScopes);\r\n // compare lowercase scopes\r\n return !StringUtils.isEmpty(scope) ? lowerCaseScopesSet.scopes.has(scope.toLowerCase()) : false;\r\n }\r\n\r\n /**\r\n * Check if a set of scopes is present in this set of scopes.\r\n * @param scopeSet\r\n */\r\n containsScopeSet(scopeSet: ScopeSet): boolean {\r\n if (!scopeSet || scopeSet.scopes.size <= 0) {\r\n return false;\r\n }\r\n\r\n return (this.scopes.size >= scopeSet.scopes.size && scopeSet.asArray().every(scope => this.containsScope(scope)));\r\n }\r\n\r\n /**\r\n * Check if set of scopes contains only the defaults\r\n */\r\n containsOnlyOIDCScopes(): boolean {\r\n let defaultScopeCount = 0;\r\n OIDC_SCOPES.forEach((defaultScope: string) => {\r\n if (this.containsScope(defaultScope)) {\r\n defaultScopeCount += 1;\r\n }\r\n });\r\n\r\n return this.scopes.size === defaultScopeCount;\r\n }\r\n\r\n /**\r\n * Appends single scope if passed\r\n * @param newScope\r\n */\r\n appendScope(newScope: string): void {\r\n if (!StringUtils.isEmpty(newScope)) {\r\n this.scopes.add(newScope.trim());\r\n }\r\n }\r\n\r\n /**\r\n * Appends multiple scopes if passed\r\n * @param newScopes\r\n */\r\n appendScopes(newScopes: Array): void {\r\n try {\r\n newScopes.forEach(newScope => this.appendScope(newScope));\r\n } catch (e) {\r\n throw ClientAuthError.createAppendScopeSetError(e);\r\n }\r\n }\r\n\r\n /**\r\n * Removes element from set of scopes.\r\n * @param scope\r\n */\r\n removeScope(scope: string): void {\r\n if (StringUtils.isEmpty(scope)) {\r\n throw ClientAuthError.createRemoveEmptyScopeFromSetError(scope);\r\n }\r\n this.scopes.delete(scope.trim());\r\n }\r\n\r\n /**\r\n * Removes default scopes from set of scopes\r\n * Primarily used to prevent cache misses if the default scopes are not returned from the server\r\n */\r\n removeOIDCScopes(): void {\r\n OIDC_SCOPES.forEach((defaultScope: string) => {\r\n this.scopes.delete(defaultScope);\r\n });\r\n }\r\n\r\n /**\r\n * Combines an array of scopes with the current set of scopes.\r\n * @param otherScopes\r\n */\r\n unionScopeSets(otherScopes: ScopeSet): Set {\r\n if (!otherScopes) {\r\n throw ClientAuthError.createEmptyInputScopeSetError();\r\n }\r\n const unionScopes = new Set(); // Iterator in constructor not supported in IE11\r\n otherScopes.scopes.forEach(scope => unionScopes.add(scope.toLowerCase()));\r\n this.scopes.forEach(scope => unionScopes.add(scope.toLowerCase()));\r\n return unionScopes;\r\n }\r\n\r\n /**\r\n * Check if scopes intersect between this set and another.\r\n * @param otherScopes\r\n */\r\n intersectingScopeSets(otherScopes: ScopeSet): boolean {\r\n if (!otherScopes) {\r\n throw ClientAuthError.createEmptyInputScopeSetError();\r\n }\r\n \r\n // Do not allow OIDC scopes to be the only intersecting scopes\r\n if (!otherScopes.containsOnlyOIDCScopes()) {\r\n otherScopes.removeOIDCScopes();\r\n }\r\n const unionScopes = this.unionScopeSets(otherScopes);\r\n const sizeOtherScopes = otherScopes.getScopeCount();\r\n const sizeThisScopes = this.getScopeCount();\r\n const sizeUnionScopes = unionScopes.size;\r\n return sizeUnionScopes < (sizeThisScopes + sizeOtherScopes);\r\n }\r\n\r\n /**\r\n * Returns size of set of scopes.\r\n */\r\n getScopeCount(): number {\r\n return this.scopes.size;\r\n }\r\n\r\n /**\r\n * Returns the scopes as an array of string values\r\n */\r\n asArray(): Array {\r\n const array: Array = [];\r\n this.scopes.forEach(val => array.push(val));\r\n return array;\r\n }\r\n\r\n /**\r\n * Prints scopes into a space-delimited string\r\n */\r\n printScopes(): string {\r\n if (this.scopes) {\r\n const scopeArr = this.asArray();\r\n return scopeArr.join(\" \");\r\n }\r\n return Constants.EMPTY_STRING;\r\n }\r\n\r\n /**\r\n * Prints scopes into a space-delimited lower-case string (used for caching)\r\n */\r\n printScopesLowerCase(): string {\r\n return this.printScopes().toLowerCase();\r\n }\r\n}\r\n","/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License.\r\n */\r\n\r\nimport { ClientAuthError } from \"../error/ClientAuthError\";\r\nimport { StringUtils } from \"../utils/StringUtils\";\r\nimport { ICrypto } from \"../crypto/ICrypto\";\r\nimport { Separators, Constants } from \"../utils/Constants\";\r\n\r\n/**\r\n * Client info object which consists of two IDs. Need to add more info here.\r\n */\r\nexport type ClientInfo = {\r\n uid: string,\r\n utid: string\r\n};\r\n\r\n/**\r\n * Function to build a client info object from server clientInfo string\r\n * @param rawClientInfo\r\n * @param crypto\r\n */\r\nexport function buildClientInfo(rawClientInfo: string, crypto: ICrypto): ClientInfo {\r\n if (StringUtils.isEmpty(rawClientInfo)) {\r\n throw ClientAuthError.createClientInfoEmptyError();\r\n }\r\n\r\n try {\r\n const decodedClientInfo: string = crypto.base64Decode(rawClientInfo);\r\n return JSON.parse(decodedClientInfo) as ClientInfo;\r\n } catch (e) {\r\n throw ClientAuthError.createClientInfoDecodingError((e as ClientAuthError).message);\r\n }\r\n}\r\n\r\n/**\r\n * Function to build a client info object from cached homeAccountId string\r\n * @param homeAccountId \r\n */\r\nexport function buildClientInfoFromHomeAccountId(homeAccountId: string): ClientInfo {\r\n if (StringUtils.isEmpty(homeAccountId)) {\r\n throw ClientAuthError.createClientInfoDecodingError(\"Home account ID was empty.\");\r\n }\r\n const clientInfoParts: string[] = homeAccountId.split(Separators.CLIENT_INFO_SEPARATOR, 2);\r\n return {\r\n uid: clientInfoParts[0],\r\n utid: clientInfoParts.length < 2 ? Constants.EMPTY_STRING : clientInfoParts[1]\r\n };\r\n}\r\n","/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License.\r\n */\r\n\r\n/**\r\n * Authority types supported by MSAL.\r\n */\r\nexport enum AuthorityType {\r\n Default,\r\n Adfs,\r\n Dsts\r\n}\r\n","/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License.\r\n */\r\n\r\nimport {\r\n Separators,\r\n CacheAccountType,\r\n CacheType,\r\n Constants,\r\n} from \"../../utils/Constants\";\r\nimport { Authority } from \"../../authority/Authority\";\r\nimport { AuthToken } from \"../../account/AuthToken\";\r\nimport { ICrypto } from \"../../crypto/ICrypto\";\r\nimport { buildClientInfo } from \"../../account/ClientInfo\";\r\nimport { StringUtils } from \"../../utils/StringUtils\";\r\nimport { AccountInfo } from \"../../account/AccountInfo\";\r\nimport { ClientAuthError } from \"../../error/ClientAuthError\";\r\nimport { AuthorityType } from \"../../authority/AuthorityType\";\r\nimport { Logger } from \"../../logger/Logger\";\r\nimport { TokenClaims } from \"../../account/TokenClaims\";\r\n\r\n/**\r\n * Type that defines required and optional parameters for an Account field (based on universal cache schema implemented by all MSALs).\r\n *\r\n * Key : Value Schema\r\n *\r\n * Key: --\r\n *\r\n * Value Schema:\r\n * {\r\n * homeAccountId: home account identifier for the auth scheme,\r\n * environment: entity that issued the token, represented as a full host\r\n * realm: Full tenant or organizational identifier that the account belongs to\r\n * localAccountId: Original tenant-specific accountID, usually used for legacy cases\r\n * username: primary username that represents the user, usually corresponds to preferred_username in the v2 endpt\r\n * authorityType: Accounts authority type as a string\r\n * name: Full name for the account, including given name and family name,\r\n * clientInfo: Full base64 encoded client info received from ESTS\r\n * lastModificationTime: last time this entity was modified in the cache\r\n * lastModificationApp:\r\n * idTokenClaims: Object containing claims parsed from ID token\r\n * nativeAccountId: Account identifier on the native device\r\n * }\r\n */\r\nexport class AccountEntity {\r\n homeAccountId: string;\r\n environment: string;\r\n realm: string;\r\n localAccountId: string;\r\n username: string;\r\n authorityType: string;\r\n name?: string;\r\n clientInfo?: string;\r\n lastModificationTime?: string;\r\n lastModificationApp?: string;\r\n cloudGraphHostName?: string;\r\n msGraphHost?: string;\r\n idTokenClaims?: TokenClaims;\r\n nativeAccountId?: string;\r\n\r\n /**\r\n * Generate Account Id key component as per the schema: -\r\n */\r\n generateAccountId(): string {\r\n const accountId: Array = [this.homeAccountId, this.environment];\r\n return accountId.join(Separators.CACHE_KEY_SEPARATOR).toLowerCase();\r\n }\r\n\r\n /**\r\n * Generate Account Cache Key as per the schema: --\r\n */\r\n generateAccountKey(): string {\r\n return AccountEntity.generateAccountCacheKey({\r\n homeAccountId: this.homeAccountId,\r\n environment: this.environment,\r\n tenantId: this.realm,\r\n username: this.username,\r\n localAccountId: this.localAccountId\r\n });\r\n }\r\n\r\n /**\r\n * returns the type of the cache (in this case account)\r\n */\r\n generateType(): number {\r\n switch (this.authorityType) {\r\n case CacheAccountType.ADFS_ACCOUNT_TYPE:\r\n return CacheType.ADFS;\r\n case CacheAccountType.MSAV1_ACCOUNT_TYPE:\r\n return CacheType.MSA;\r\n case CacheAccountType.MSSTS_ACCOUNT_TYPE:\r\n return CacheType.MSSTS;\r\n case CacheAccountType.GENERIC_ACCOUNT_TYPE:\r\n return CacheType.GENERIC;\r\n default: {\r\n throw ClientAuthError.createUnexpectedAccountTypeError();\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Returns the AccountInfo interface for this account.\r\n */\r\n getAccountInfo(): AccountInfo {\r\n return {\r\n homeAccountId: this.homeAccountId,\r\n environment: this.environment,\r\n tenantId: this.realm,\r\n username: this.username,\r\n localAccountId: this.localAccountId,\r\n name: this.name,\r\n idTokenClaims: this.idTokenClaims,\r\n nativeAccountId: this.nativeAccountId\r\n };\r\n }\r\n\r\n /**\r\n * Generates account key from interface\r\n * @param accountInterface\r\n */\r\n static generateAccountCacheKey(accountInterface: AccountInfo): string {\r\n const accountKey = [\r\n accountInterface.homeAccountId,\r\n accountInterface.environment || Constants.EMPTY_STRING,\r\n accountInterface.tenantId || Constants.EMPTY_STRING,\r\n ];\r\n\r\n return accountKey.join(Separators.CACHE_KEY_SEPARATOR).toLowerCase();\r\n }\r\n\r\n /**\r\n * Build Account cache from IdToken, clientInfo and authority/policy. Associated with AAD.\r\n * @param clientInfo\r\n * @param authority\r\n * @param idToken\r\n * @param policy\r\n */\r\n static createAccount(\r\n clientInfo: string,\r\n homeAccountId: string,\r\n idToken: AuthToken,\r\n authority?: Authority,\r\n cloudGraphHostName?: string,\r\n msGraphHost?: string,\r\n environment?: string,\r\n nativeAccountId?: string\r\n ): AccountEntity {\r\n const account: AccountEntity = new AccountEntity();\r\n\r\n account.authorityType = CacheAccountType.MSSTS_ACCOUNT_TYPE;\r\n account.clientInfo = clientInfo;\r\n account.homeAccountId = homeAccountId;\r\n account.nativeAccountId = nativeAccountId;\r\n\r\n const env = environment || (authority && authority.getPreferredCache());\r\n\r\n if (!env) {\r\n throw ClientAuthError.createInvalidCacheEnvironmentError();\r\n }\r\n\r\n account.environment = env;\r\n // non AAD scenarios can have empty realm\r\n account.realm = idToken?.claims?.tid || Constants.EMPTY_STRING;\r\n\r\n if (idToken) {\r\n account.idTokenClaims = idToken.claims;\r\n\r\n // How do you account for MSA CID here?\r\n account.localAccountId = idToken?.claims?.oid || idToken?.claims?.sub || Constants.EMPTY_STRING;\r\n\r\n /*\r\n * In B2C scenarios the emails claim is used instead of preferred_username and it is an array.\r\n * In most cases it will contain a single email. This field should not be relied upon if a custom \r\n * policy is configured to return more than 1 email.\r\n */\r\n const preferredUsername = idToken?.claims?.preferred_username;\r\n const email = (idToken?.claims?.emails) ? idToken.claims.emails[0] : null;\r\n \r\n account.username = preferredUsername || email || Constants.EMPTY_STRING;\r\n account.name = idToken?.claims?.name;\r\n }\r\n\r\n account.cloudGraphHostName = cloudGraphHostName;\r\n account.msGraphHost = msGraphHost;\r\n\r\n return account;\r\n }\r\n\r\n /**\r\n * Builds non-AAD/ADFS account.\r\n * @param authority\r\n * @param idToken\r\n */\r\n static createGenericAccount(\r\n homeAccountId: string,\r\n idToken: AuthToken,\r\n authority?: Authority,\r\n cloudGraphHostName?: string,\r\n msGraphHost?: string,\r\n environment?: string\r\n ): AccountEntity {\r\n const account: AccountEntity = new AccountEntity();\r\n\r\n account.authorityType = (\r\n authority &&\r\n authority.authorityType === AuthorityType.Adfs\r\n ) ? CacheAccountType.ADFS_ACCOUNT_TYPE : CacheAccountType.GENERIC_ACCOUNT_TYPE;\r\n \r\n account.homeAccountId = homeAccountId;\r\n // non AAD scenarios can have empty realm\r\n account.realm = Constants.EMPTY_STRING;\r\n\r\n const env = environment || authority && authority.getPreferredCache();\r\n\r\n if (!env) {\r\n throw ClientAuthError.createInvalidCacheEnvironmentError();\r\n }\r\n\r\n if (idToken) {\r\n // How do you account for MSA CID here?\r\n account.localAccountId = idToken?.claims?.oid || idToken?.claims?.sub || Constants.EMPTY_STRING;\r\n // upn claim for most ADFS scenarios\r\n account.username = idToken?.claims?.upn || Constants.EMPTY_STRING;\r\n account.name = idToken?.claims?.name || Constants.EMPTY_STRING;\r\n account.idTokenClaims = idToken?.claims;\r\n }\r\n\r\n account.environment = env;\r\n\r\n account.cloudGraphHostName = cloudGraphHostName;\r\n account.msGraphHost = msGraphHost;\r\n\r\n /*\r\n * add uniqueName to claims\r\n * account.name = idToken.claims.uniqueName;\r\n */\r\n\r\n return account;\r\n }\r\n\r\n /**\r\n * Generate HomeAccountId from server response\r\n * @param serverClientInfo\r\n * @param authType\r\n */\r\n static generateHomeAccountId(\r\n serverClientInfo: string,\r\n authType: AuthorityType,\r\n logger: Logger,\r\n cryptoObj: ICrypto,\r\n idToken?: AuthToken\r\n ): string {\r\n\r\n const accountId = idToken?.claims?.sub ? idToken.claims.sub : Constants.EMPTY_STRING;\r\n\r\n // since ADFS does not have tid and does not set client_info\r\n if (authType === AuthorityType.Adfs || authType === AuthorityType.Dsts) {\r\n return accountId;\r\n }\r\n\r\n // for cases where there is clientInfo\r\n if (serverClientInfo) {\r\n try {\r\n const clientInfo = buildClientInfo(serverClientInfo, cryptoObj);\r\n if (!StringUtils.isEmpty(clientInfo.uid) && !StringUtils.isEmpty(clientInfo.utid)) {\r\n return `${clientInfo.uid}${Separators.CLIENT_INFO_SEPARATOR}${clientInfo.utid}`;\r\n }\r\n } catch (e) {}\r\n }\r\n\r\n // default to \"sub\" claim\r\n logger.verbose(\"No client info in response\");\r\n return accountId;\r\n }\r\n\r\n /**\r\n * Validates an entity: checks for all expected params\r\n * @param entity\r\n */\r\n static isAccountEntity(entity: object): boolean {\r\n\r\n if (!entity) {\r\n return false;\r\n }\r\n\r\n return (\r\n entity.hasOwnProperty(\"homeAccountId\") &&\r\n entity.hasOwnProperty(\"environment\") &&\r\n entity.hasOwnProperty(\"realm\") &&\r\n entity.hasOwnProperty(\"localAccountId\") &&\r\n entity.hasOwnProperty(\"username\") &&\r\n entity.hasOwnProperty(\"authorityType\")\r\n );\r\n }\r\n\r\n /**\r\n * Helper function to determine whether 2 accountInfo objects represent the same account\r\n * @param accountA\r\n * @param accountB\r\n * @param compareClaims - If set to true idTokenClaims will also be compared to determine account equality\r\n */\r\n static accountInfoIsEqual(accountA: AccountInfo | null, accountB: AccountInfo | null, compareClaims?: boolean): boolean {\r\n if (!accountA || !accountB) {\r\n return false;\r\n }\r\n\r\n let claimsMatch = true; // default to true so as to not fail comparison below if compareClaims: false\r\n if (compareClaims) {\r\n const accountAClaims = (accountA.idTokenClaims || {}) as TokenClaims;\r\n const accountBClaims = (accountB.idTokenClaims || {}) as TokenClaims;\r\n\r\n // issued at timestamp and nonce are expected to change each time a new id token is acquired\r\n claimsMatch = (accountAClaims.iat === accountBClaims.iat) &&\r\n (accountAClaims.nonce === accountBClaims.nonce);\r\n }\r\n\r\n return (accountA.homeAccountId === accountB.homeAccountId) &&\r\n (accountA.localAccountId === accountB.localAccountId) &&\r\n (accountA.username === accountB.username) &&\r\n (accountA.tenantId === accountB.tenantId) &&\r\n (accountA.environment === accountB.environment) &&\r\n (accountA.nativeAccountId === accountB.nativeAccountId) &&\r\n claimsMatch;\r\n }\r\n}\r\n","/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License.\r\n */\r\n\r\nimport { TokenClaims } from \"./TokenClaims\";\r\nimport { DecodedAuthToken } from \"./DecodedAuthToken\";\r\nimport { ClientAuthError } from \"../error/ClientAuthError\";\r\nimport { StringUtils } from \"../utils/StringUtils\";\r\nimport { ICrypto } from \"../crypto/ICrypto\";\r\n\r\n/**\r\n * JWT Token representation class. Parses token string and generates claims object.\r\n */\r\nexport class AuthToken {\r\n\r\n // Raw Token string\r\n rawToken: string;\r\n // Claims inside token\r\n claims: TokenClaims;\r\n constructor(rawToken: string, crypto: ICrypto) {\r\n if (StringUtils.isEmpty(rawToken)) {\r\n throw ClientAuthError.createTokenNullOrEmptyError(rawToken);\r\n }\r\n\r\n this.rawToken = rawToken;\r\n this.claims = AuthToken.extractTokenClaims(rawToken, crypto);\r\n }\r\n\r\n /**\r\n * Extract token by decoding the rawToken\r\n *\r\n * @param encodedToken\r\n */\r\n static extractTokenClaims(encodedToken: string, crypto: ICrypto): TokenClaims {\r\n\r\n const decodedToken: DecodedAuthToken = StringUtils.decodeAuthToken(encodedToken);\r\n\r\n // token will be decoded to get the username\r\n try {\r\n const base64TokenPayload = decodedToken.JWSPayload;\r\n\r\n // base64Decode() should throw an error if there is an issue\r\n const base64Decoded = crypto.base64Decode(base64TokenPayload);\r\n return JSON.parse(base64Decoded) as TokenClaims;\r\n } catch (err) {\r\n throw ClientAuthError.createTokenParsingError(err);\r\n }\r\n }\r\n\r\n /**\r\n * Determine if the token's max_age has transpired\r\n */\r\n static checkMaxAge(authTime: number, maxAge: number): void {\r\n /*\r\n * per https://openid.net/specs/openid-connect-core-1_0.html#AuthRequest\r\n * To force an immediate re-authentication: If an app requires that a user re-authenticate prior to access,\r\n * provide a value of 0 for the max_age parameter and the AS will force a fresh login.\r\n */\r\n const fiveMinuteSkew = 300000; // five minutes in milliseconds\r\n if ((maxAge === 0) || ((Date.now() - fiveMinuteSkew) > (authTime + maxAge))) {\r\n throw ClientAuthError.createMaxAgeTranspiredError();\r\n }\r\n }\r\n}\r\n","/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License.\r\n */\r\n\r\nimport { AccountCache, AccountFilter, CredentialFilter, CredentialCache, ValidCredentialType, AppMetadataFilter, AppMetadataCache } from \"./utils/CacheTypes\";\r\nimport { CacheRecord } from \"./entities/CacheRecord\";\r\nimport { CacheSchemaType, CredentialType, Constants, APP_METADATA, THE_FAMILY_ID, AUTHORITY_METADATA_CONSTANTS, AuthenticationScheme } from \"../utils/Constants\";\r\nimport { CredentialEntity } from \"./entities/CredentialEntity\";\r\nimport { ScopeSet } from \"../request/ScopeSet\";\r\nimport { AccountEntity } from \"./entities/AccountEntity\";\r\nimport { AccessTokenEntity } from \"./entities/AccessTokenEntity\";\r\nimport { IdTokenEntity } from \"./entities/IdTokenEntity\";\r\nimport { RefreshTokenEntity } from \"./entities/RefreshTokenEntity\";\r\nimport { AuthError } from \"../error/AuthError\";\r\nimport { ICacheManager } from \"./interface/ICacheManager\";\r\nimport { ClientAuthError } from \"../error/ClientAuthError\";\r\nimport { AccountInfo } from \"../account/AccountInfo\";\r\nimport { AppMetadataEntity } from \"./entities/AppMetadataEntity\";\r\nimport { ServerTelemetryEntity } from \"./entities/ServerTelemetryEntity\";\r\nimport { ThrottlingEntity } from \"./entities/ThrottlingEntity\";\r\nimport { AuthToken } from \"../account/AuthToken\";\r\nimport { ICrypto } from \"../crypto/ICrypto\";\r\nimport { AuthorityMetadataEntity } from \"./entities/AuthorityMetadataEntity\";\r\nimport { BaseAuthRequest } from \"../request/BaseAuthRequest\";\r\n\r\n/**\r\n * Interface class which implement cache storage functions used by MSAL to perform validity checks, and store tokens.\r\n */\r\nexport abstract class CacheManager implements ICacheManager {\r\n protected clientId: string;\r\n protected cryptoImpl: ICrypto;\r\n\r\n constructor(clientId: string, cryptoImpl: ICrypto) {\r\n this.clientId = clientId;\r\n this.cryptoImpl = cryptoImpl;\r\n }\r\n\r\n /**\r\n * fetch the account entity from the platform cache\r\n * @param accountKey\r\n */\r\n abstract getAccount(accountKey: string): AccountEntity | null;\r\n\r\n /**\r\n * set account entity in the platform cache\r\n * @param account\r\n */\r\n abstract setAccount(account: AccountEntity): void;\r\n\r\n /**\r\n * fetch the idToken entity from the platform cache\r\n * @param idTokenKey\r\n */\r\n abstract getIdTokenCredential(idTokenKey: string): IdTokenEntity | null;\r\n\r\n /**\r\n * set idToken entity to the platform cache\r\n * @param idToken\r\n */\r\n abstract setIdTokenCredential(idToken: IdTokenEntity): void;\r\n\r\n /**\r\n * fetch the idToken entity from the platform cache\r\n * @param accessTokenKey\r\n */\r\n abstract getAccessTokenCredential(accessTokenKey: string): AccessTokenEntity | null;\r\n\r\n /**\r\n * set idToken entity to the platform cache\r\n * @param accessToken\r\n */\r\n abstract setAccessTokenCredential(accessToken: AccessTokenEntity): void;\r\n\r\n /**\r\n * fetch the idToken entity from the platform cache\r\n * @param refreshTokenKey\r\n */\r\n abstract getRefreshTokenCredential(refreshTokenKey: string): RefreshTokenEntity | null;\r\n\r\n /**\r\n * set idToken entity to the platform cache\r\n * @param refreshToken\r\n */\r\n abstract setRefreshTokenCredential(refreshToken: RefreshTokenEntity): void;\r\n\r\n /**\r\n * fetch appMetadata entity from the platform cache\r\n * @param appMetadataKey\r\n */\r\n abstract getAppMetadata(appMetadataKey: string): AppMetadataEntity | null;\r\n\r\n /**\r\n * set appMetadata entity to the platform cache\r\n * @param appMetadata\r\n */\r\n abstract setAppMetadata(appMetadata: AppMetadataEntity): void;\r\n\r\n /**\r\n * fetch server telemetry entity from the platform cache\r\n * @param serverTelemetryKey\r\n */\r\n abstract getServerTelemetry(serverTelemetryKey: string): ServerTelemetryEntity | null;\r\n\r\n /**\r\n * set server telemetry entity to the platform cache\r\n * @param serverTelemetryKey\r\n * @param serverTelemetry\r\n */\r\n abstract setServerTelemetry(serverTelemetryKey: string, serverTelemetry: ServerTelemetryEntity): void;\r\n\r\n /**\r\n * fetch cloud discovery metadata entity from the platform cache\r\n * @param key\r\n */\r\n abstract getAuthorityMetadata(key: string): AuthorityMetadataEntity | null;\r\n\r\n /**\r\n *\r\n */\r\n abstract getAuthorityMetadataKeys(): Array;\r\n\r\n /**\r\n * set cloud discovery metadata entity to the platform cache\r\n * @param key\r\n * @param value\r\n */\r\n abstract setAuthorityMetadata(key: string, value: AuthorityMetadataEntity): void;\r\n\r\n /**\r\n * fetch throttling entity from the platform cache\r\n * @param throttlingCacheKey\r\n */\r\n abstract getThrottlingCache(throttlingCacheKey: string): ThrottlingEntity | null;\r\n\r\n /**\r\n * set throttling entity to the platform cache\r\n * @param throttlingCacheKey\r\n * @param throttlingCache\r\n */\r\n abstract setThrottlingCache(throttlingCacheKey: string, throttlingCache: ThrottlingEntity): void;;\r\n\r\n /**\r\n * Function to remove an item from cache given its key.\r\n * @param key\r\n */\r\n abstract removeItem(key: string, type?: string): boolean;\r\n\r\n /**\r\n * Function which returns boolean whether cache contains a specific key.\r\n * @param key\r\n */\r\n abstract containsKey(key: string, type?: string): boolean;\r\n\r\n /**\r\n * Function which retrieves all current keys from the cache.\r\n */\r\n abstract getKeys(): string[];\r\n\r\n /**\r\n * Function which clears cache.\r\n */\r\n abstract clear(): Promise;\r\n\r\n /**\r\n * Function which updates an outdated credential cache key\r\n */\r\n abstract updateCredentialCacheKey(currentCacheKey: string, credential: ValidCredentialType): string;\r\n\r\n /**\r\n * Returns all accounts in cache\r\n */\r\n getAllAccounts(): AccountInfo[] {\r\n const currentAccounts: AccountCache = this.getAccountsFilteredBy();\r\n const accountValues: AccountEntity[] = Object.keys(currentAccounts).map(accountKey => currentAccounts[accountKey]);\r\n const numAccounts = accountValues.length;\r\n if (numAccounts < 1) {\r\n return [];\r\n } else {\r\n const allAccounts = accountValues.map((value) => {\r\n const accountEntity = CacheManager.toObject(new AccountEntity(), value);\r\n const accountInfo = accountEntity.getAccountInfo();\r\n const idToken = this.readIdTokenFromCache(this.clientId, accountInfo);\r\n if (idToken && !accountInfo.idTokenClaims) {\r\n accountInfo.idToken = idToken.secret;\r\n accountInfo.idTokenClaims = new AuthToken(idToken.secret, this.cryptoImpl).claims;\r\n }\r\n\r\n return accountInfo;\r\n\r\n });\r\n return allAccounts;\r\n }\r\n }\r\n\r\n /**\r\n * saves a cache record\r\n * @param cacheRecord\r\n */\r\n async saveCacheRecord(cacheRecord: CacheRecord): Promise {\r\n if (!cacheRecord) {\r\n throw ClientAuthError.createNullOrUndefinedCacheRecord();\r\n }\r\n\r\n if (!!cacheRecord.account) {\r\n this.setAccount(cacheRecord.account);\r\n }\r\n\r\n if (!!cacheRecord.idToken) {\r\n this.setIdTokenCredential(cacheRecord.idToken);\r\n }\r\n\r\n if (!!cacheRecord.accessToken) {\r\n await this.saveAccessToken(cacheRecord.accessToken);\r\n }\r\n\r\n if (!!cacheRecord.refreshToken) {\r\n this.setRefreshTokenCredential(cacheRecord.refreshToken);\r\n }\r\n\r\n if (!!cacheRecord.appMetadata) {\r\n this.setAppMetadata(cacheRecord.appMetadata);\r\n }\r\n }\r\n\r\n /**\r\n * saves access token credential\r\n * @param credential\r\n */\r\n private async saveAccessToken(credential: AccessTokenEntity): Promise {\r\n const currentTokenCache = this.getCredentialsFilteredBy({\r\n clientId: credential.clientId,\r\n credentialType: credential.credentialType,\r\n environment: credential.environment,\r\n homeAccountId: credential.homeAccountId,\r\n realm: credential.realm,\r\n tokenType: credential.tokenType,\r\n requestedClaimsHash: credential.requestedClaimsHash\r\n });\r\n\r\n const currentScopes = ScopeSet.fromString(credential.target);\r\n const currentAccessTokens: AccessTokenEntity[] = Object.keys(currentTokenCache.accessTokens).map(key => currentTokenCache.accessTokens[key]);\r\n\r\n if (currentAccessTokens) {\r\n const removedAccessTokens: Array> = [];\r\n currentAccessTokens.forEach((tokenEntity) => {\r\n const tokenScopeSet = ScopeSet.fromString(tokenEntity.target);\r\n if (tokenScopeSet.intersectingScopeSets(currentScopes)) {\r\n removedAccessTokens.push(this.removeCredential(tokenEntity));\r\n }\r\n });\r\n await Promise.all(removedAccessTokens);\r\n }\r\n this.setAccessTokenCredential(credential);\r\n }\r\n\r\n /**\r\n * retrieve accounts matching all provided filters; if no filter is set, get all accounts\r\n * not checking for casing as keys are all generated in lower case, remember to convert to lower case if object properties are compared\r\n * @param homeAccountId\r\n * @param environment\r\n * @param realm\r\n */\r\n getAccountsFilteredBy(accountFilter?: AccountFilter): AccountCache {\r\n return this.getAccountsFilteredByInternal(\r\n accountFilter ? accountFilter.homeAccountId : Constants.EMPTY_STRING,\r\n accountFilter ? accountFilter.environment : Constants.EMPTY_STRING,\r\n accountFilter ? accountFilter.realm : Constants.EMPTY_STRING,\r\n accountFilter ? accountFilter.nativeAccountId: Constants.EMPTY_STRING,\r\n );\r\n }\r\n\r\n /**\r\n * retrieve accounts matching all provided filters; if no filter is set, get all accounts\r\n * not checking for casing as keys are all generated in lower case, remember to convert to lower case if object properties are compared\r\n * @param homeAccountId\r\n * @param environment\r\n * @param realm\r\n */\r\n private getAccountsFilteredByInternal(\r\n homeAccountId?: string,\r\n environment?: string,\r\n realm?: string,\r\n nativeAccountId?: string,\r\n ): AccountCache {\r\n const allCacheKeys = this.getKeys();\r\n const matchingAccounts: AccountCache = {};\r\n\r\n allCacheKeys.forEach((cacheKey) => {\r\n const entity: AccountEntity | null = this.getAccount(cacheKey);\r\n\r\n if (!entity) {\r\n return;\r\n }\r\n\r\n if (!!homeAccountId && !this.matchHomeAccountId(entity, homeAccountId)) {\r\n return;\r\n }\r\n\r\n if (!!environment && !this.matchEnvironment(entity, environment)) {\r\n return;\r\n }\r\n\r\n if (!!realm && !this.matchRealm(entity, realm)) {\r\n return;\r\n }\r\n\r\n if (!!nativeAccountId && !this.matchNativeAccountId(entity, nativeAccountId)) {\r\n return;\r\n }\r\n\r\n matchingAccounts[cacheKey] = entity;\r\n });\r\n\r\n return matchingAccounts;\r\n }\r\n\r\n /**\r\n * retrieve credentails matching all provided filters; if no filter is set, get all credentials\r\n * @param homeAccountId\r\n * @param environment\r\n * @param credentialType\r\n * @param clientId\r\n * @param realm\r\n * @param target\r\n */\r\n getCredentialsFilteredBy(filter: CredentialFilter): CredentialCache {\r\n return this.getCredentialsFilteredByInternal(\r\n filter.homeAccountId,\r\n filter.environment,\r\n filter.credentialType,\r\n filter.clientId,\r\n filter.familyId,\r\n filter.realm,\r\n filter.target,\r\n filter.userAssertionHash,\r\n filter.tokenType,\r\n filter.keyId,\r\n filter.requestedClaimsHash\r\n );\r\n }\r\n\r\n /**\r\n * Support function to help match credentials\r\n * @param homeAccountId\r\n * @param environment\r\n * @param credentialType\r\n * @param clientId\r\n * @param realm\r\n * @param target\r\n * @param userAssertionHash\r\n * @param tokenType\r\n */\r\n private getCredentialsFilteredByInternal(\r\n homeAccountId?: string,\r\n environment?: string,\r\n credentialType?: string,\r\n clientId?: string,\r\n familyId?: string,\r\n realm?: string,\r\n target?: string,\r\n userAssertionHash?: string,\r\n tokenType?: AuthenticationScheme,\r\n keyId?: string,\r\n requestedClaimsHash?: string\r\n ): CredentialCache {\r\n const allCacheKeys = this.getKeys();\r\n const matchingCredentials: CredentialCache = {\r\n idTokens: {},\r\n accessTokens: {},\r\n refreshTokens: {},\r\n };\r\n\r\n allCacheKeys.forEach((cacheKey) => {\r\n // don't parse any non-credential type cache entities\r\n const credType = CredentialEntity.getCredentialType(cacheKey);\r\n\r\n if (credType === Constants.NOT_DEFINED) {\r\n return;\r\n }\r\n\r\n // Attempt retrieval\r\n const entity = this.getSpecificCredential(cacheKey, credType);\r\n\r\n if (!entity) {\r\n return;\r\n }\r\n\r\n if (!!userAssertionHash && !this.matchUserAssertionHash(entity, userAssertionHash)) {\r\n return;\r\n }\r\n\r\n /*\r\n * homeAccountId can undefined, and we want to filter out cached items that have a homeAccountId of \"\"\r\n * because we don't want a client_credential request to return a cached token that has a homeAccountId\r\n */\r\n if ((typeof homeAccountId === \"string\") && !this.matchHomeAccountId(entity, homeAccountId)) {\r\n return;\r\n }\r\n\r\n if (!!environment && !this.matchEnvironment(entity, environment)) {\r\n return;\r\n }\r\n\r\n if (!!realm && !this.matchRealm(entity, realm)) {\r\n return;\r\n }\r\n\r\n if (!!credentialType && !this.matchCredentialType(entity, credentialType)) {\r\n return;\r\n }\r\n\r\n if (!!clientId && !this.matchClientId(entity, clientId)) {\r\n return;\r\n }\r\n\r\n if (!!familyId && !this.matchFamilyId(entity, familyId)) {\r\n return;\r\n }\r\n\r\n /*\r\n * idTokens do not have \"target\", target specific refreshTokens do exist for some types of authentication\r\n * Resource specific refresh tokens case will be added when the support is deemed necessary\r\n */\r\n if (!!target && !this.matchTarget(entity, target)) {\r\n return;\r\n }\r\n\r\n // If request OR cached entity has requested Claims Hash, check if they match\r\n if (requestedClaimsHash || entity.requestedClaimsHash) {\r\n // Don't match if either is undefined or they are different\r\n if (entity.requestedClaimsHash !== requestedClaimsHash) {\r\n return;\r\n }\r\n }\r\n\r\n // Access Token with Auth Scheme specific matching\r\n if (credentialType === CredentialType.ACCESS_TOKEN_WITH_AUTH_SCHEME) {\r\n if(!!tokenType && !this.matchTokenType(entity, tokenType)) {\r\n return;\r\n }\r\n\r\n // KeyId (sshKid) in request must match cached SSH certificate keyId because SSH cert is bound to a specific key\r\n if (tokenType === AuthenticationScheme.SSH) {\r\n if(keyId && !this.matchKeyId(entity, keyId)) {\r\n return;\r\n }\r\n }\r\n }\r\n\r\n // At this point, the entity matches the request, update cache key if key schema has changed\r\n const updatedCacheKey = this.updateCredentialCacheKey(cacheKey, entity);\r\n\r\n switch (credType) {\r\n case CredentialType.ID_TOKEN:\r\n matchingCredentials.idTokens[updatedCacheKey] = entity as IdTokenEntity;\r\n break;\r\n case CredentialType.ACCESS_TOKEN:\r\n case CredentialType.ACCESS_TOKEN_WITH_AUTH_SCHEME:\r\n matchingCredentials.accessTokens[updatedCacheKey] = entity as AccessTokenEntity;\r\n break;\r\n case CredentialType.REFRESH_TOKEN:\r\n matchingCredentials.refreshTokens[updatedCacheKey] = entity as RefreshTokenEntity;\r\n break;\r\n }\r\n });\r\n\r\n return matchingCredentials;\r\n }\r\n\r\n /**\r\n * retrieve appMetadata matching all provided filters; if no filter is set, get all appMetadata\r\n * @param filter\r\n */\r\n getAppMetadataFilteredBy(filter: AppMetadataFilter): AppMetadataCache {\r\n return this.getAppMetadataFilteredByInternal(\r\n filter.environment,\r\n filter.clientId,\r\n );\r\n }\r\n\r\n /**\r\n * Support function to help match appMetadata\r\n * @param environment\r\n * @param clientId\r\n */\r\n private getAppMetadataFilteredByInternal(\r\n environment?: string,\r\n clientId?: string\r\n ): AppMetadataCache {\r\n\r\n const allCacheKeys = this.getKeys();\r\n const matchingAppMetadata: AppMetadataCache = {};\r\n\r\n allCacheKeys.forEach((cacheKey) => {\r\n // don't parse any non-appMetadata type cache entities\r\n if (!this.isAppMetadata(cacheKey)) {\r\n return;\r\n }\r\n\r\n // Attempt retrieval\r\n const entity = this.getAppMetadata(cacheKey);\r\n\r\n if (!entity) {\r\n return;\r\n }\r\n\r\n if (!!environment && !this.matchEnvironment(entity, environment)) {\r\n return;\r\n }\r\n\r\n if (!!clientId && !this.matchClientId(entity, clientId)) {\r\n return;\r\n }\r\n\r\n matchingAppMetadata[cacheKey] = entity;\r\n\r\n });\r\n\r\n return matchingAppMetadata;\r\n }\r\n\r\n /**\r\n * retrieve authorityMetadata that contains a matching alias\r\n * @param filter\r\n */\r\n getAuthorityMetadataByAlias(host: string): AuthorityMetadataEntity | null {\r\n const allCacheKeys = this.getAuthorityMetadataKeys();\r\n let matchedEntity = null;\r\n\r\n allCacheKeys.forEach((cacheKey) => {\r\n // don't parse any non-authorityMetadata type cache entities\r\n if (!this.isAuthorityMetadata(cacheKey) || cacheKey.indexOf(this.clientId) === -1) {\r\n return;\r\n }\r\n\r\n // Attempt retrieval\r\n const entity = this.getAuthorityMetadata(cacheKey);\r\n\r\n if (!entity) {\r\n return;\r\n }\r\n\r\n if (entity.aliases.indexOf(host) === -1) {\r\n return;\r\n }\r\n\r\n matchedEntity = entity;\r\n\r\n });\r\n\r\n return matchedEntity;\r\n }\r\n\r\n /**\r\n * Removes all accounts and related tokens from cache.\r\n */\r\n async removeAllAccounts(): Promise {\r\n const allCacheKeys = this.getKeys();\r\n const removedAccounts: Array> = [];\r\n\r\n allCacheKeys.forEach((cacheKey) => {\r\n const entity = this.getAccount(cacheKey);\r\n if (!entity) {\r\n return;\r\n }\r\n removedAccounts.push(this.removeAccount(cacheKey));\r\n });\r\n\r\n await Promise.all(removedAccounts);\r\n return true;\r\n }\r\n\r\n /**\r\n * returns a boolean if the given account is removed\r\n * @param account\r\n */\r\n async removeAccount(accountKey: string): Promise {\r\n const account = this.getAccount(accountKey);\r\n if (!account) {\r\n throw ClientAuthError.createNoAccountFoundError();\r\n }\r\n return (await this.removeAccountContext(account) && this.removeItem(accountKey, CacheSchemaType.ACCOUNT));\r\n }\r\n\r\n /**\r\n * Removes credentials associated with the provided account\r\n * @param account\r\n */\r\n async removeAccountContext(account: AccountEntity): Promise {\r\n const allCacheKeys = this.getKeys();\r\n const accountId = account.generateAccountId();\r\n const removedCredentials: Array> = [];\r\n\r\n allCacheKeys.forEach((cacheKey) => {\r\n // don't parse any non-credential type cache entities\r\n const credType = CredentialEntity.getCredentialType(cacheKey);\r\n if (credType === Constants.NOT_DEFINED) {\r\n return;\r\n }\r\n\r\n const cacheEntity = this.getSpecificCredential(cacheKey, credType);\r\n if (!!cacheEntity && accountId === cacheEntity.generateAccountId()) {\r\n removedCredentials.push(this.removeCredential(cacheEntity));\r\n }\r\n });\r\n\r\n await Promise.all(removedCredentials);\r\n return true;\r\n }\r\n\r\n /**\r\n * returns a boolean if the given credential is removed\r\n * @param credential\r\n */\r\n async removeCredential(credential: CredentialEntity): Promise {\r\n const key = credential.generateCredentialKey();\r\n\r\n // Remove Token Binding Key from key store for PoP Tokens Credentials\r\n if (credential.credentialType.toLowerCase() === CredentialType.ACCESS_TOKEN_WITH_AUTH_SCHEME.toLowerCase()) {\r\n if(credential.tokenType === AuthenticationScheme.POP) {\r\n const accessTokenWithAuthSchemeEntity = credential as AccessTokenEntity;\r\n const kid = accessTokenWithAuthSchemeEntity.keyId;\r\n\r\n if (kid) {\r\n try {\r\n await this.cryptoImpl.removeTokenBindingKey(kid);\r\n } catch (error) {\r\n throw ClientAuthError.createBindingKeyNotRemovedError();\r\n }\r\n }\r\n }\r\n }\r\n\r\n return this.removeItem(key, CacheSchemaType.CREDENTIAL);\r\n }\r\n\r\n /**\r\n * Removes all app metadata objects from cache.\r\n */\r\n removeAppMetadata(): boolean {\r\n const allCacheKeys = this.getKeys();\r\n allCacheKeys.forEach((cacheKey) => {\r\n if (this.isAppMetadata(cacheKey)) {\r\n this.removeItem(cacheKey, CacheSchemaType.APP_METADATA);\r\n }\r\n });\r\n\r\n return true;\r\n }\r\n\r\n /**\r\n * Retrieve the cached credentials into a cacherecord\r\n * @param account\r\n * @param clientId\r\n * @param scopes\r\n * @param environment\r\n * @param authScheme\r\n */\r\n readCacheRecord(account: AccountInfo, clientId: string, request: BaseAuthRequest, environment: string): CacheRecord {\r\n\r\n const cachedAccount = this.readAccountFromCache(account);\r\n const cachedIdToken = this.readIdTokenFromCache(clientId, account);\r\n const cachedAccessToken = this.readAccessTokenFromCache(clientId, account, request);\r\n const cachedRefreshToken = this.readRefreshTokenFromCache(clientId, account, false);\r\n const cachedAppMetadata = this.readAppMetadataFromCache(environment, clientId);\r\n\r\n if (cachedAccount && cachedIdToken) {\r\n cachedAccount.idTokenClaims = new AuthToken(cachedIdToken.secret, this.cryptoImpl).claims;\r\n }\r\n\r\n return {\r\n account: cachedAccount,\r\n idToken: cachedIdToken,\r\n accessToken: cachedAccessToken,\r\n refreshToken: cachedRefreshToken,\r\n appMetadata: cachedAppMetadata,\r\n };\r\n }\r\n\r\n /**\r\n * Retrieve AccountEntity from cache\r\n * @param account\r\n */\r\n readAccountFromCache(account: AccountInfo): AccountEntity | null {\r\n const accountKey: string = AccountEntity.generateAccountCacheKey(account);\r\n return this.getAccount(accountKey);\r\n }\r\n\r\n /**\r\n * Retrieve AccountEntity from cache\r\n * @param nativeAccountId\r\n * @returns AccountEntity or Null\r\n */\r\n readAccountFromCacheWithNativeAccountId(nativeAccountId: string): AccountEntity | null {\r\n // fetch account from memory\r\n const accountFilter: AccountFilter = {\r\n nativeAccountId\r\n };\r\n const accountCache: AccountCache = this.getAccountsFilteredBy(accountFilter);\r\n const accounts = Object.keys(accountCache).map((key) => accountCache[key]);\r\n\r\n if (accounts.length < 1) {\r\n return null;\r\n } else if (accounts.length > 1) {\r\n throw ClientAuthError.createMultipleMatchingAccountsInCacheError();\r\n }\r\n\r\n return accountCache[0];\r\n }\r\n\r\n /**\r\n * Retrieve IdTokenEntity from cache\r\n * @param clientId\r\n * @param account\r\n * @param inputRealm\r\n */\r\n readIdTokenFromCache(clientId: string, account: AccountInfo): IdTokenEntity | null {\r\n const idTokenFilter: CredentialFilter = {\r\n homeAccountId: account.homeAccountId,\r\n environment: account.environment,\r\n credentialType: CredentialType.ID_TOKEN,\r\n clientId: clientId,\r\n realm: account.tenantId,\r\n };\r\n\r\n const credentialCache: CredentialCache = this.getCredentialsFilteredBy(idTokenFilter);\r\n const idTokens = Object.keys(credentialCache.idTokens).map((key) => credentialCache.idTokens[key]);\r\n const numIdTokens = idTokens.length;\r\n\r\n if (numIdTokens < 1) {\r\n return null;\r\n } else if (numIdTokens > 1) {\r\n throw ClientAuthError.createMultipleMatchingTokensInCacheError();\r\n }\r\n\r\n return idTokens[0] as IdTokenEntity;\r\n }\r\n\r\n /**\r\n * Retrieve AccessTokenEntity from cache\r\n * @param clientId\r\n * @param account\r\n * @param scopes\r\n * @param authScheme\r\n */\r\n readAccessTokenFromCache(clientId: string, account: AccountInfo, request: BaseAuthRequest): AccessTokenEntity | null {\r\n const scopes = new ScopeSet(request.scopes || []);\r\n const authScheme = request.authenticationScheme || AuthenticationScheme.BEARER;\r\n /*\r\n * Distinguish between Bearer and PoP/SSH token cache types\r\n * Cast to lowercase to handle \"bearer\" from ADFS\r\n */\r\n const credentialType = (authScheme && authScheme.toLowerCase() !== AuthenticationScheme.BEARER.toLowerCase()) ? CredentialType.ACCESS_TOKEN_WITH_AUTH_SCHEME : CredentialType.ACCESS_TOKEN;\r\n\r\n const accessTokenFilter: CredentialFilter = {\r\n homeAccountId: account.homeAccountId,\r\n environment: account.environment,\r\n credentialType: credentialType,\r\n clientId,\r\n realm: account.tenantId,\r\n target: scopes.printScopesLowerCase(),\r\n tokenType: authScheme,\r\n keyId: request.sshKid,\r\n requestedClaimsHash: request.requestedClaimsHash,\r\n };\r\n\r\n const credentialCache: CredentialCache = this.getCredentialsFilteredBy(accessTokenFilter);\r\n\r\n const accessTokens = Object.keys(credentialCache.accessTokens).map((key) => credentialCache.accessTokens[key]);\r\n\r\n const numAccessTokens = accessTokens.length;\r\n if (numAccessTokens < 1) {\r\n return null;\r\n } else if (numAccessTokens > 1) {\r\n throw ClientAuthError.createMultipleMatchingTokensInCacheError();\r\n }\r\n\r\n return accessTokens[0] as AccessTokenEntity;\r\n }\r\n\r\n /**\r\n * Helper to retrieve the appropriate refresh token from cache\r\n * @param clientId\r\n * @param account\r\n * @param familyRT\r\n */\r\n readRefreshTokenFromCache(clientId: string, account: AccountInfo, familyRT: boolean): RefreshTokenEntity | null {\r\n const id = familyRT ? THE_FAMILY_ID : undefined;\r\n const refreshTokenFilter: CredentialFilter = {\r\n homeAccountId: account.homeAccountId,\r\n environment: account.environment,\r\n credentialType: CredentialType.REFRESH_TOKEN,\r\n clientId: clientId,\r\n familyId: id,\r\n };\r\n\r\n const credentialCache: CredentialCache = this.getCredentialsFilteredBy(refreshTokenFilter);\r\n const refreshTokens = Object.keys(credentialCache.refreshTokens).map((key) => credentialCache.refreshTokens[key]);\r\n\r\n const numRefreshTokens = refreshTokens.length;\r\n if (numRefreshTokens < 1) {\r\n return null;\r\n }\r\n // address the else case after remove functions address environment aliases\r\n\r\n return refreshTokens[0] as RefreshTokenEntity;\r\n }\r\n\r\n /**\r\n * Retrieve AppMetadataEntity from cache\r\n */\r\n readAppMetadataFromCache(environment: string, clientId: string): AppMetadataEntity | null {\r\n const appMetadataFilter: AppMetadataFilter = {\r\n environment,\r\n clientId,\r\n };\r\n\r\n const appMetadata: AppMetadataCache = this.getAppMetadataFilteredBy(appMetadataFilter);\r\n const appMetadataEntries: AppMetadataEntity[] = Object.keys(appMetadata).map((key) => appMetadata[key]);\r\n\r\n const numAppMetadata = appMetadataEntries.length;\r\n if (numAppMetadata < 1) {\r\n return null;\r\n } else if (numAppMetadata > 1) {\r\n throw ClientAuthError.createMultipleMatchingAppMetadataInCacheError();\r\n }\r\n\r\n return appMetadataEntries[0] as AppMetadataEntity;\r\n }\r\n\r\n /**\r\n * Return the family_id value associated with FOCI\r\n * @param environment\r\n * @param clientId\r\n */\r\n isAppMetadataFOCI(environment: string, clientId: string): boolean {\r\n const appMetadata = this.readAppMetadataFromCache(environment, clientId);\r\n return !!(appMetadata && appMetadata.familyId === THE_FAMILY_ID);\r\n }\r\n\r\n /**\r\n * helper to match account ids\r\n * @param value\r\n * @param homeAccountId\r\n */\r\n private matchHomeAccountId(entity: AccountEntity | CredentialEntity, homeAccountId: string): boolean {\r\n return !!((typeof entity.homeAccountId === \"string\") && (homeAccountId === entity.homeAccountId));\r\n }\r\n\r\n /**\r\n * helper to match assertion\r\n * @param value\r\n * @param oboAssertion\r\n */\r\n private matchUserAssertionHash(entity: CredentialEntity, userAssertionHash: string): boolean {\r\n return !!(entity.userAssertionHash && userAssertionHash === entity.userAssertionHash);\r\n }\r\n\r\n /**\r\n * helper to match environment\r\n * @param value\r\n * @param environment\r\n */\r\n private matchEnvironment(entity: AccountEntity | CredentialEntity | AppMetadataEntity, environment: string): boolean {\r\n const cloudMetadata = this.getAuthorityMetadataByAlias(environment);\r\n if (cloudMetadata && cloudMetadata.aliases.indexOf(entity.environment) > -1) {\r\n return true;\r\n }\r\n\r\n return false;\r\n }\r\n\r\n /**\r\n * helper to match credential type\r\n * @param entity\r\n * @param credentialType\r\n */\r\n private matchCredentialType(entity: CredentialEntity, credentialType: string): boolean {\r\n return (entity.credentialType && credentialType.toLowerCase() === entity.credentialType.toLowerCase());\r\n }\r\n\r\n /**\r\n * helper to match client ids\r\n * @param entity\r\n * @param clientId\r\n */\r\n private matchClientId(entity: CredentialEntity | AppMetadataEntity, clientId: string): boolean {\r\n return !!(entity.clientId && clientId === entity.clientId);\r\n }\r\n\r\n /**\r\n * helper to match family ids\r\n * @param entity\r\n * @param familyId\r\n */\r\n private matchFamilyId(entity: CredentialEntity | AppMetadataEntity, familyId: string): boolean {\r\n return !!(entity.familyId && familyId === entity.familyId);\r\n }\r\n\r\n /**\r\n * helper to match realm\r\n * @param entity\r\n * @param realm\r\n */\r\n private matchRealm(entity: AccountEntity | CredentialEntity, realm: string): boolean {\r\n return !!(entity.realm && realm === entity.realm);\r\n }\r\n\r\n /**\r\n * helper to match nativeAccountId\r\n * @param entity\r\n * @param nativeAccountId\r\n * @returns boolean indicating the match result\r\n */\r\n private matchNativeAccountId(entity: AccountEntity, nativeAccountId: string): boolean {\r\n return !!(entity.nativeAccountId && nativeAccountId === entity.nativeAccountId);\r\n }\r\n\r\n /**\r\n * Returns true if the target scopes are a subset of the current entity's scopes, false otherwise.\r\n * @param entity\r\n * @param target\r\n */\r\n private matchTarget(entity: CredentialEntity, target: string): boolean {\r\n const isNotAccessTokenCredential = (entity.credentialType !== CredentialType.ACCESS_TOKEN && entity.credentialType !== CredentialType.ACCESS_TOKEN_WITH_AUTH_SCHEME);\r\n\r\n if ( isNotAccessTokenCredential || !entity.target) {\r\n return false;\r\n }\r\n\r\n const entityScopeSet: ScopeSet = ScopeSet.fromString(entity.target);\r\n const requestTargetScopeSet: ScopeSet = ScopeSet.fromString(target);\r\n\r\n if (!requestTargetScopeSet.containsOnlyOIDCScopes()) {\r\n requestTargetScopeSet.removeOIDCScopes(); // ignore OIDC scopes\r\n } else {\r\n requestTargetScopeSet.removeScope(Constants.OFFLINE_ACCESS_SCOPE);\r\n }\r\n return entityScopeSet.containsScopeSet(requestTargetScopeSet);\r\n }\r\n\r\n /**\r\n * Returns true if the credential's tokenType or Authentication Scheme matches the one in the request, false otherwise\r\n * @param entity\r\n * @param tokenType\r\n */\r\n private matchTokenType(entity: CredentialEntity, tokenType: AuthenticationScheme): boolean {\r\n return !!(entity.tokenType && entity.tokenType === tokenType);\r\n }\r\n\r\n /**\r\n * Returns true if the credential's keyId matches the one in the request, false otherwise\r\n * @param entity\r\n * @param tokenType\r\n */\r\n private matchKeyId(entity: CredentialEntity, keyId: string): boolean {\r\n return !!(entity.keyId && entity.keyId === keyId);\r\n }\r\n\r\n /**\r\n * returns if a given cache entity is of the type appmetadata\r\n * @param key\r\n */\r\n private isAppMetadata(key: string): boolean {\r\n return key.indexOf(APP_METADATA) !== -1;\r\n }\r\n\r\n /**\r\n * returns if a given cache entity is of the type authoritymetadata\r\n * @param key\r\n */\r\n protected isAuthorityMetadata(key: string): boolean {\r\n return key.indexOf(AUTHORITY_METADATA_CONSTANTS.CACHE_KEY) !== -1;\r\n }\r\n\r\n /**\r\n * returns cache key used for cloud instance metadata\r\n */\r\n generateAuthorityMetadataCacheKey(authority: string): string {\r\n return `${AUTHORITY_METADATA_CONSTANTS.CACHE_KEY}-${this.clientId}-${authority}`;\r\n }\r\n\r\n /**\r\n * Returns the specific credential (IdToken/AccessToken/RefreshToken) from the cache\r\n * @param key\r\n * @param credType\r\n */\r\n private getSpecificCredential(key: string, credType: string): ValidCredentialType | null {\r\n switch (credType) {\r\n case CredentialType.ID_TOKEN: {\r\n return this.getIdTokenCredential(key);\r\n }\r\n case CredentialType.ACCESS_TOKEN:\r\n case CredentialType.ACCESS_TOKEN_WITH_AUTH_SCHEME: {\r\n return this.getAccessTokenCredential(key);\r\n }\r\n case CredentialType.REFRESH_TOKEN: {\r\n return this.getRefreshTokenCredential(key);\r\n }\r\n default:\r\n return null;\r\n }\r\n }\r\n\r\n /**\r\n * Helper to convert serialized data to object\r\n * @param obj\r\n * @param json\r\n */\r\n static toObject(obj: T, json: object): T {\r\n for (const propertyName in json) {\r\n obj[propertyName] = json[propertyName];\r\n }\r\n return obj;\r\n }\r\n}\r\n\r\nexport class DefaultStorageClass extends CacheManager {\r\n setAccount(): void {\r\n const notImplErr = \"Storage interface - setAccount() has not been implemented for the cacheStorage interface.\";\r\n throw AuthError.createUnexpectedError(notImplErr);\r\n }\r\n getAccount(): AccountEntity {\r\n const notImplErr = \"Storage interface - getAccount() has not been implemented for the cacheStorage interface.\";\r\n throw AuthError.createUnexpectedError(notImplErr);\r\n }\r\n setIdTokenCredential(): void {\r\n const notImplErr = \"Storage interface - setIdTokenCredential() has not been implemented for the cacheStorage interface.\";\r\n throw AuthError.createUnexpectedError(notImplErr);\r\n }\r\n getIdTokenCredential(): IdTokenEntity {\r\n const notImplErr = \"Storage interface - getIdTokenCredential() has not been implemented for the cacheStorage interface.\";\r\n throw AuthError.createUnexpectedError(notImplErr);\r\n }\r\n setAccessTokenCredential(): void {\r\n const notImplErr = \"Storage interface - setAccessTokenCredential() has not been implemented for the cacheStorage interface.\";\r\n throw AuthError.createUnexpectedError(notImplErr);\r\n }\r\n getAccessTokenCredential(): AccessTokenEntity {\r\n const notImplErr = \"Storage interface - getAccessTokenCredential() has not been implemented for the cacheStorage interface.\";\r\n throw AuthError.createUnexpectedError(notImplErr);\r\n }\r\n setRefreshTokenCredential(): void {\r\n const notImplErr = \"Storage interface - setRefreshTokenCredential() has not been implemented for the cacheStorage interface.\";\r\n throw AuthError.createUnexpectedError(notImplErr);\r\n }\r\n getRefreshTokenCredential(): RefreshTokenEntity {\r\n const notImplErr = \"Storage interface - getRefreshTokenCredential() has not been implemented for the cacheStorage interface.\";\r\n throw AuthError.createUnexpectedError(notImplErr);\r\n }\r\n setAppMetadata(): void {\r\n const notImplErr = \"Storage interface - setAppMetadata() has not been implemented for the cacheStorage interface.\";\r\n throw AuthError.createUnexpectedError(notImplErr);\r\n }\r\n getAppMetadata(): AppMetadataEntity {\r\n const notImplErr = \"Storage interface - getAppMetadata() has not been implemented for the cacheStorage interface.\";\r\n throw AuthError.createUnexpectedError(notImplErr);\r\n }\r\n setServerTelemetry(): void {\r\n const notImplErr = \"Storage interface - setServerTelemetry() has not been implemented for the cacheStorage interface.\";\r\n throw AuthError.createUnexpectedError(notImplErr);\r\n }\r\n getServerTelemetry(): ServerTelemetryEntity {\r\n const notImplErr = \"Storage interface - getServerTelemetry() has not been implemented for the cacheStorage interface.\";\r\n throw AuthError.createUnexpectedError(notImplErr);\r\n }\r\n setAuthorityMetadata(): void {\r\n const notImplErr = \"Storage interface - setAuthorityMetadata() has not been implemented for the cacheStorage interface.\";\r\n throw AuthError.createUnexpectedError(notImplErr);\r\n }\r\n getAuthorityMetadata(): AuthorityMetadataEntity | null {\r\n const notImplErr = \"Storage interface - getAuthorityMetadata() has not been implemented for the cacheStorage interface.\";\r\n throw AuthError.createUnexpectedError(notImplErr);\r\n }\r\n getAuthorityMetadataKeys(): Array {\r\n const notImplErr = \"Storage interface - getAuthorityMetadataKeys() has not been implemented for the cacheStorage interface.\";\r\n throw AuthError.createUnexpectedError(notImplErr);\r\n }\r\n setThrottlingCache(): void {\r\n const notImplErr = \"Storage interface - setThrottlingCache() has not been implemented for the cacheStorage interface.\";\r\n throw AuthError.createUnexpectedError(notImplErr);\r\n }\r\n getThrottlingCache(): ThrottlingEntity {\r\n const notImplErr = \"Storage interface - getThrottlingCache() has not been implemented for the cacheStorage interface.\";\r\n throw AuthError.createUnexpectedError(notImplErr);\r\n }\r\n removeItem(): boolean {\r\n const notImplErr = \"Storage interface - removeItem() has not been implemented for the cacheStorage interface.\";\r\n throw AuthError.createUnexpectedError(notImplErr);\r\n }\r\n containsKey(): boolean {\r\n const notImplErr = \"Storage interface - containsKey() has not been implemented for the cacheStorage interface.\";\r\n throw AuthError.createUnexpectedError(notImplErr);\r\n }\r\n getKeys(): string[] {\r\n const notImplErr = \"Storage interface - getKeys() has not been implemented for the cacheStorage interface.\";\r\n throw AuthError.createUnexpectedError(notImplErr);\r\n }\r\n async clear(): Promise {\r\n const notImplErr = \"Storage interface - clear() has not been implemented for the cacheStorage interface.\";\r\n throw AuthError.createUnexpectedError(notImplErr);\r\n }\r\n updateCredentialCacheKey(): string {\r\n const notImplErr = \"Storage interface - updateCredentialCacheKey() has not been implemented for the cacheStorage interface.\";\r\n throw AuthError.createUnexpectedError(notImplErr);\r\n }\r\n}\r\n","/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License.\r\n */\r\n\r\nimport { INetworkModule } from \"../network/INetworkModule\";\r\nimport { DEFAULT_CRYPTO_IMPLEMENTATION, ICrypto } from \"../crypto/ICrypto\";\r\nimport { AuthError } from \"../error/AuthError\";\r\nimport { ILoggerCallback, LogLevel } from \"../logger/Logger\";\r\nimport { Constants } from \"../utils/Constants\";\r\nimport { version } from \"../packageMetadata\";\r\nimport { Authority } from \"../authority/Authority\";\r\nimport { AzureCloudInstance } from \"../authority/AuthorityOptions\";\r\nimport { CacheManager, DefaultStorageClass } from \"../cache/CacheManager\";\r\nimport { ServerTelemetryManager } from \"../telemetry/server/ServerTelemetryManager\";\r\nimport { ICachePlugin } from \"../cache/interface/ICachePlugin\";\r\nimport { ISerializableTokenCache } from \"../cache/interface/ISerializableTokenCache\";\r\nimport { ClientCredentials } from \"../account/ClientCredentials\";\r\n\r\n// Token renewal offset default in seconds\r\nconst DEFAULT_TOKEN_RENEWAL_OFFSET_SEC = 300;\r\n\r\n/**\r\n * Use the configuration object to configure MSAL Modules and initialize the base interfaces for MSAL.\r\n *\r\n * This object allows you to configure important elements of MSAL functionality:\r\n * - authOptions - Authentication for application\r\n * - cryptoInterface - Implementation of crypto functions\r\n * - libraryInfo - Library metadata\r\n * - telemetry - Telemetry options and data\r\n * - loggerOptions - Logging for application\r\n * - networkInterface - Network implementation\r\n * - storageInterface - Storage implementation\r\n * - systemOptions - Additional library options\r\n * - clientCredentials - Credentials options for confidential clients\r\n */\r\nexport type ClientConfiguration = {\r\n authOptions: AuthOptions,\r\n systemOptions?: SystemOptions,\r\n loggerOptions?: LoggerOptions,\r\n storageInterface?: CacheManager,\r\n networkInterface?: INetworkModule,\r\n cryptoInterface?: ICrypto,\r\n clientCredentials?: ClientCredentials,\r\n libraryInfo?: LibraryInfo\r\n telemetry?: TelemetryOptions,\r\n serverTelemetryManager?: ServerTelemetryManager | null,\r\n persistencePlugin?: ICachePlugin | null,\r\n serializableCache?: ISerializableTokenCache | null, \r\n};\r\n\r\nexport type CommonClientConfiguration = {\r\n authOptions: Required,\r\n systemOptions: Required,\r\n loggerOptions : Required,\r\n storageInterface: CacheManager,\r\n networkInterface : INetworkModule,\r\n cryptoInterface : Required,\r\n libraryInfo : LibraryInfo,\r\n telemetry: Required,\r\n serverTelemetryManager: ServerTelemetryManager | null,\r\n clientCredentials: ClientCredentials,\r\n persistencePlugin: ICachePlugin | null,\r\n serializableCache: ISerializableTokenCache | null, \r\n};\r\n\r\n/**\r\n * Use this to configure the auth options in the ClientConfiguration object\r\n *\r\n * - clientId - Client ID of your app registered with our Application registration portal : https://portal.azure.com/#blade/Microsoft_AAD_IAM/ActiveDirectoryMenuBlade/RegisteredAppsPreview in Microsoft Identity Platform\r\n * - authority - You can configure a specific authority, defaults to \" \" or \"https://login.microsoftonline.com/common\"\r\n * - knownAuthorities - An array of URIs that are known to be valid. Used in B2C scenarios.\r\n * - cloudDiscoveryMetadata - A string containing the cloud discovery response. Used in AAD scenarios.\r\n * - clientCapabilities - Array of capabilities which will be added to the claims.access_token.xms_cc request property on every network request.\r\n * - protocolMode - Enum that represents the protocol that msal follows. Used for configuring proper endpoints.\r\n * - skipAuthorityMetadataCache - A flag to choose whether to use or not use the local metadata cache during authority initialization. Defaults to false.\r\n */\r\nexport type AuthOptions = {\r\n clientId: string;\r\n authority: Authority;\r\n clientCapabilities?: Array;\r\n azureCloudOptions?: AzureCloudOptions;\r\n skipAuthorityMetadataCache?: boolean;\r\n};\r\n\r\n/**\r\n * Use this to configure token renewal info in the Configuration object\r\n *\r\n * - tokenRenewalOffsetSeconds - Sets the window of offset needed to renew the token before expiry\r\n */\r\nexport type SystemOptions = {\r\n tokenRenewalOffsetSeconds?: number;\r\n preventCorsPreflight?: boolean;\r\n proxyUrl?: string;\r\n};\r\n\r\n/**\r\n * Use this to configure the logging that MSAL does, by configuring logger options in the Configuration object\r\n *\r\n * - loggerCallback - Callback for logger\r\n * - piiLoggingEnabled - Sets whether pii logging is enabled\r\n * - logLevel - Sets the level at which logging happens\r\n * - correlationId - Sets the correlationId printed by the logger\r\n */\r\nexport type LoggerOptions = {\r\n loggerCallback?: ILoggerCallback,\r\n piiLoggingEnabled?: boolean,\r\n logLevel?: LogLevel,\r\n correlationId?: string\r\n};\r\n\r\n/**\r\n * Library-specific options\r\n */\r\nexport type LibraryInfo = {\r\n sku: string,\r\n version: string,\r\n cpu: string,\r\n os: string\r\n};\r\n\r\n/**\r\n * AzureCloudInstance specific options\r\n *\r\n * - azureCloudInstance - string enum providing short notation for soverign and public cloud authorities\r\n * - tenant - provision to provide the tenant info\r\n */\r\nexport type AzureCloudOptions = {\r\n azureCloudInstance: AzureCloudInstance;\r\n tenant?: string,\r\n};\r\n\r\nexport type TelemetryOptions = {\r\n application: ApplicationTelemetry;\r\n};\r\n\r\n/**\r\n * Telemetry information sent on request\r\n * - appName: Unique string name of an application\r\n * - appVersion: Version of the application using MSAL\r\n */\r\nexport type ApplicationTelemetry = {\r\n appName: string;\r\n appVersion: string;\r\n};\r\n\r\nexport const DEFAULT_SYSTEM_OPTIONS: Required = {\r\n tokenRenewalOffsetSeconds: DEFAULT_TOKEN_RENEWAL_OFFSET_SEC,\r\n preventCorsPreflight: false,\r\n proxyUrl: Constants.EMPTY_STRING\r\n};\r\n\r\nconst DEFAULT_LOGGER_IMPLEMENTATION: Required = {\r\n loggerCallback: () => {\r\n // allow users to not set loggerCallback\r\n },\r\n piiLoggingEnabled: false,\r\n logLevel: LogLevel.Info,\r\n correlationId: Constants.EMPTY_STRING\r\n};\r\n\r\nconst DEFAULT_NETWORK_IMPLEMENTATION: INetworkModule = {\r\n async sendGetRequestAsync(): Promise {\r\n const notImplErr = \"Network interface - sendGetRequestAsync() has not been implemented\";\r\n throw AuthError.createUnexpectedError(notImplErr);\r\n },\r\n async sendPostRequestAsync(): Promise {\r\n const notImplErr = \"Network interface - sendPostRequestAsync() has not been implemented\";\r\n throw AuthError.createUnexpectedError(notImplErr);\r\n }\r\n};\r\n\r\nconst DEFAULT_LIBRARY_INFO: LibraryInfo = {\r\n sku: Constants.SKU,\r\n version: version,\r\n cpu: Constants.EMPTY_STRING,\r\n os: Constants.EMPTY_STRING\r\n};\r\n\r\nconst DEFAULT_CLIENT_CREDENTIALS: ClientCredentials = {\r\n clientSecret: Constants.EMPTY_STRING,\r\n clientAssertion: undefined\r\n};\r\n\r\nconst DEFAULT_AZURE_CLOUD_OPTIONS: AzureCloudOptions = {\r\n azureCloudInstance: AzureCloudInstance.None,\r\n tenant: `${Constants.DEFAULT_COMMON_TENANT}`\r\n};\r\n\r\nconst DEFAULT_TELEMETRY_OPTIONS: Required = {\r\n application: {\r\n appName: \"\",\r\n appVersion: \"\"\r\n }\r\n};\r\n\r\n/**\r\n * Function that sets the default options when not explicitly configured from app developer\r\n *\r\n * @param Configuration\r\n *\r\n * @returns Configuration\r\n */\r\nexport function buildClientConfiguration(\r\n {\r\n authOptions: userAuthOptions,\r\n systemOptions: userSystemOptions,\r\n loggerOptions: userLoggerOption,\r\n storageInterface: storageImplementation,\r\n networkInterface: networkImplementation,\r\n cryptoInterface: cryptoImplementation,\r\n clientCredentials: clientCredentials,\r\n libraryInfo: libraryInfo,\r\n telemetry: telemetry,\r\n serverTelemetryManager: serverTelemetryManager,\r\n persistencePlugin: persistencePlugin,\r\n serializableCache: serializableCache, \r\n }: ClientConfiguration): CommonClientConfiguration {\r\n\r\n const loggerOptions = { ...DEFAULT_LOGGER_IMPLEMENTATION, ...userLoggerOption };\r\n\r\n return {\r\n authOptions: buildAuthOptions(userAuthOptions),\r\n systemOptions: { ...DEFAULT_SYSTEM_OPTIONS, ...userSystemOptions },\r\n loggerOptions: loggerOptions,\r\n storageInterface: storageImplementation || new DefaultStorageClass(userAuthOptions.clientId, DEFAULT_CRYPTO_IMPLEMENTATION),\r\n networkInterface: networkImplementation || DEFAULT_NETWORK_IMPLEMENTATION,\r\n cryptoInterface: cryptoImplementation || DEFAULT_CRYPTO_IMPLEMENTATION,\r\n clientCredentials: clientCredentials || DEFAULT_CLIENT_CREDENTIALS,\r\n libraryInfo: { ...DEFAULT_LIBRARY_INFO, ...libraryInfo },\r\n telemetry: { ...DEFAULT_TELEMETRY_OPTIONS, ...telemetry },\r\n serverTelemetryManager: serverTelemetryManager || null,\r\n persistencePlugin: persistencePlugin || null,\r\n serializableCache: serializableCache || null, \r\n };\r\n}\r\n\r\n/**\r\n * Construct authoptions from the client and platform passed values\r\n * @param authOptions\r\n */\r\nfunction buildAuthOptions(authOptions: AuthOptions): Required {\r\n return {\r\n clientCapabilities: [],\r\n azureCloudOptions: DEFAULT_AZURE_CLOUD_OPTIONS,\r\n skipAuthorityMetadataCache: false,\r\n ...authOptions\r\n };\r\n}\r\n","/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License.\r\n */\r\n\r\nimport { AuthError } from \"./AuthError\";\r\n\r\n/**\r\n * Error thrown when there is an error with the server code, for example, unavailability.\r\n */\r\nexport class ServerError extends AuthError {\r\n\r\n constructor(errorCode?: string, errorMessage?: string, subError?: string) {\r\n super(errorCode, errorMessage, subError);\r\n this.name = \"ServerError\";\r\n\r\n Object.setPrototypeOf(this, ServerError.prototype);\r\n }\r\n}\r\n","/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License.\r\n */\r\n\r\nimport { NetworkResponse } from \"./NetworkManager\";\r\nimport { ServerAuthorizationTokenResponse } from \"../response/ServerAuthorizationTokenResponse\";\r\nimport { HeaderNames, CacheSchemaType, ThrottlingConstants, Constants } from \"../utils/Constants\";\r\nimport { CacheManager } from \"../cache/CacheManager\";\r\nimport { ServerError } from \"../error/ServerError\";\r\nimport { RequestThumbprint } from \"./RequestThumbprint\";\r\nimport { ThrottlingEntity } from \"../cache/entities/ThrottlingEntity\";\r\nimport { BaseAuthRequest } from \"../request/BaseAuthRequest\";\r\n\r\nexport class ThrottlingUtils {\r\n\r\n /**\r\n * Prepares a RequestThumbprint to be stored as a key.\r\n * @param thumbprint\r\n */\r\n static generateThrottlingStorageKey(thumbprint: RequestThumbprint): string {\r\n return `${ThrottlingConstants.THROTTLING_PREFIX}.${JSON.stringify(thumbprint)}`;\r\n }\r\n\r\n /**\r\n * Performs necessary throttling checks before a network request.\r\n * @param cacheManager\r\n * @param thumbprint\r\n */\r\n static preProcess(cacheManager: CacheManager, thumbprint: RequestThumbprint): void {\r\n const key = ThrottlingUtils.generateThrottlingStorageKey(thumbprint);\r\n const value = cacheManager.getThrottlingCache(key);\r\n\r\n if (value) {\r\n if (value.throttleTime < Date.now()) {\r\n cacheManager.removeItem(key, CacheSchemaType.THROTTLING);\r\n return;\r\n }\r\n throw new ServerError(value.errorCodes?.join(\" \") || Constants.EMPTY_STRING, value.errorMessage, value.subError);\r\n }\r\n }\r\n\r\n /**\r\n * Performs necessary throttling checks after a network request.\r\n * @param cacheManager\r\n * @param thumbprint\r\n * @param response\r\n */\r\n static postProcess(cacheManager: CacheManager, thumbprint: RequestThumbprint, response: NetworkResponse): void {\r\n if (ThrottlingUtils.checkResponseStatus(response) || ThrottlingUtils.checkResponseForRetryAfter(response)) {\r\n const thumbprintValue: ThrottlingEntity = {\r\n throttleTime: ThrottlingUtils.calculateThrottleTime(parseInt(response.headers[HeaderNames.RETRY_AFTER])),\r\n error: response.body.error,\r\n errorCodes: response.body.error_codes,\r\n errorMessage: response.body.error_description,\r\n subError: response.body.suberror\r\n };\r\n cacheManager.setThrottlingCache(\r\n ThrottlingUtils.generateThrottlingStorageKey(thumbprint),\r\n thumbprintValue\r\n );\r\n }\r\n }\r\n\r\n /**\r\n * Checks a NetworkResponse object's status codes against 429 or 5xx\r\n * @param response\r\n */\r\n static checkResponseStatus(response: NetworkResponse): boolean {\r\n return response.status === 429 || response.status >= 500 && response.status < 600;\r\n }\r\n\r\n /**\r\n * Checks a NetworkResponse object's RetryAfter header\r\n * @param response\r\n */\r\n static checkResponseForRetryAfter(response: NetworkResponse): boolean {\r\n if (response.headers) {\r\n return response.headers.hasOwnProperty(HeaderNames.RETRY_AFTER) && (response.status < 200 || response.status >= 300);\r\n }\r\n return false;\r\n }\r\n\r\n /**\r\n * Calculates the Unix-time value for a throttle to expire given throttleTime in seconds.\r\n * @param throttleTime\r\n */\r\n static calculateThrottleTime(throttleTime: number): number {\r\n const time = throttleTime <= 0 ? 0 : throttleTime;\r\n\r\n const currentSeconds = Date.now() / 1000;\r\n return Math.floor(Math.min(\r\n currentSeconds + (time || ThrottlingConstants.DEFAULT_THROTTLE_TIME_SECONDS),\r\n currentSeconds + ThrottlingConstants.DEFAULT_MAX_THROTTLE_TIME_SECONDS\r\n ) * 1000);\r\n }\r\n\r\n static removeThrottle(cacheManager: CacheManager, clientId: string, request: BaseAuthRequest, homeAccountIdentifier?: string): boolean {\r\n const thumbprint: RequestThumbprint = {\r\n clientId: clientId,\r\n authority: request.authority,\r\n scopes: request.scopes,\r\n homeAccountIdentifier: homeAccountIdentifier,\r\n claims: request.claims,\r\n authenticationScheme: request.authenticationScheme,\r\n resourceRequestMethod: request.resourceRequestMethod,\r\n resourceRequestUri: request.resourceRequestUri,\r\n shrClaims: request.shrClaims,\r\n sshKid: request.sshKid\r\n };\r\n\r\n const key = this.generateThrottlingStorageKey(thumbprint);\r\n return cacheManager.removeItem(key, CacheSchemaType.THROTTLING);\r\n }\r\n}\r\n","/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License.\r\n */\r\n\r\nimport { INetworkModule, NetworkRequestOptions } from \"./INetworkModule\";\r\nimport { RequestThumbprint } from \"./RequestThumbprint\";\r\nimport { ThrottlingUtils } from \"./ThrottlingUtils\";\r\nimport { CacheManager } from \"../cache/CacheManager\";\r\nimport { AuthError } from \"../error/AuthError\";\r\nimport { ClientAuthError } from \"../error/ClientAuthError\";\r\n\r\nexport type NetworkResponse = {\r\n headers: Record;\r\n body: T;\r\n status: number;\r\n};\r\n\r\nexport class NetworkManager {\r\n private networkClient: INetworkModule;\r\n private cacheManager: CacheManager;\r\n\r\n constructor(networkClient: INetworkModule, cacheManager: CacheManager) {\r\n this.networkClient = networkClient;\r\n this.cacheManager = cacheManager;\r\n }\r\n\r\n /**\r\n * Wraps sendPostRequestAsync with necessary preflight and postflight logic\r\n * @param thumbprint\r\n * @param tokenEndpoint\r\n * @param options\r\n */\r\n async sendPostRequest(thumbprint: RequestThumbprint, tokenEndpoint: string, options: NetworkRequestOptions): Promise> {\r\n ThrottlingUtils.preProcess(this.cacheManager, thumbprint);\r\n\r\n let response;\r\n try {\r\n response = await this.networkClient.sendPostRequestAsync(tokenEndpoint, options);\r\n } catch (e) {\r\n if (e instanceof AuthError) {\r\n throw e;\r\n } else {\r\n throw ClientAuthError.createNetworkError(tokenEndpoint, e);\r\n }\r\n }\r\n\r\n ThrottlingUtils.postProcess(this.cacheManager, thumbprint, response);\r\n\r\n return response;\r\n }\r\n}\r\n","/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License.\r\n */\r\n\r\nexport type CcsCredential = {\r\n credential: string,\r\n type: CcsCredentialType\r\n};\r\n\r\nexport enum CcsCredentialType {\r\n HOME_ACCOUNT_ID = \"home_account_id\",\r\n UPN = \"UPN\"\r\n}\r\n","/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License.\r\n */\r\n\r\nimport { ClientConfiguration, buildClientConfiguration, CommonClientConfiguration } from \"../config/ClientConfiguration\";\r\nimport { INetworkModule } from \"../network/INetworkModule\";\r\nimport { NetworkManager, NetworkResponse } from \"../network/NetworkManager\";\r\nimport { ICrypto } from \"../crypto/ICrypto\";\r\nimport { Authority } from \"../authority/Authority\";\r\nimport { Logger } from \"../logger/Logger\";\r\nimport { Constants, HeaderNames } from \"../utils/Constants\";\r\nimport { ServerAuthorizationTokenResponse } from \"../response/ServerAuthorizationTokenResponse\";\r\nimport { CacheManager } from \"../cache/CacheManager\";\r\nimport { ServerTelemetryManager } from \"../telemetry/server/ServerTelemetryManager\";\r\nimport { RequestThumbprint } from \"../network/RequestThumbprint\";\r\nimport { version, name } from \"../packageMetadata\";\r\nimport { ClientAuthError } from \"../error/ClientAuthError\";\r\nimport { CcsCredential, CcsCredentialType } from \"../account/CcsCredential\";\r\nimport { buildClientInfoFromHomeAccountId } from \"../account/ClientInfo\";\r\nimport { IPerformanceClient } from \"../telemetry/performance/IPerformanceClient\";\r\n\r\n/**\r\n * Base application class which will construct requests to send to and handle responses from the Microsoft STS using the authorization code flow.\r\n */\r\nexport abstract class BaseClient {\r\n // Logger object\r\n public logger: Logger;\r\n\r\n // Application config\r\n protected config: CommonClientConfiguration;\r\n\r\n // Crypto Interface\r\n protected cryptoUtils: ICrypto;\r\n\r\n // Storage Interface\r\n protected cacheManager: CacheManager;\r\n\r\n // Network Interface\r\n protected networkClient: INetworkModule;\r\n\r\n // Server Telemetry Manager\r\n protected serverTelemetryManager: ServerTelemetryManager | null;\r\n\r\n // Network Manager\r\n protected networkManager: NetworkManager;\r\n\r\n // Default authority object\r\n public authority: Authority;\r\n\r\n // Performance telemetry client\r\n protected performanceClient?: IPerformanceClient;\r\n\r\n protected constructor(configuration: ClientConfiguration, performanceClient?: IPerformanceClient) {\r\n // Set the configuration\r\n this.config = buildClientConfiguration(configuration);\r\n\r\n // Initialize the logger\r\n this.logger = new Logger(this.config.loggerOptions, name, version);\r\n\r\n // Initialize crypto\r\n this.cryptoUtils = this.config.cryptoInterface;\r\n\r\n // Initialize storage interface\r\n this.cacheManager = this.config.storageInterface;\r\n\r\n // Set the network interface\r\n this.networkClient = this.config.networkInterface;\r\n\r\n // Set the NetworkManager\r\n this.networkManager = new NetworkManager(this.networkClient, this.cacheManager);\r\n\r\n // Set TelemetryManager\r\n this.serverTelemetryManager = this.config.serverTelemetryManager;\r\n\r\n // set Authority\r\n this.authority = this.config.authOptions.authority;\r\n\r\n // set performance telemetry client\r\n this.performanceClient = performanceClient;\r\n }\r\n\r\n /**\r\n * Creates default headers for requests to token endpoint\r\n */\r\n protected createTokenRequestHeaders(ccsCred?: CcsCredential): Record { \r\n const headers: Record = {};\r\n headers[HeaderNames.CONTENT_TYPE] = Constants.URL_FORM_CONTENT_TYPE;\r\n if (!this.config.systemOptions.preventCorsPreflight && ccsCred) {\r\n switch (ccsCred.type) {\r\n case CcsCredentialType.HOME_ACCOUNT_ID:\r\n try {\r\n const clientInfo = buildClientInfoFromHomeAccountId(ccsCred.credential);\r\n headers[HeaderNames.CCS_HEADER] = `Oid:${clientInfo.uid}@${clientInfo.utid}`;\r\n } catch (e) {\r\n this.logger.verbose(\"Could not parse home account ID for CCS Header: \" + e);\r\n }\r\n break;\r\n case CcsCredentialType.UPN:\r\n headers[HeaderNames.CCS_HEADER] = `UPN: ${ccsCred.credential}`;\r\n break;\r\n }\r\n } \r\n return headers;\r\n }\r\n\r\n /**\r\n * Http post to token endpoint\r\n * @param tokenEndpoint\r\n * @param queryString\r\n * @param headers\r\n * @param thumbprint\r\n */\r\n protected async executePostToTokenEndpoint(tokenEndpoint: string, queryString: string, headers: Record, thumbprint: RequestThumbprint): Promise> {\r\n const response = await this.networkManager.sendPostRequest(\r\n thumbprint,\r\n tokenEndpoint,\r\n { body: queryString, headers: headers, proxyUrl: this.config.systemOptions.proxyUrl }\r\n );\r\n\r\n if (this.config.serverTelemetryManager && response.status < 500 && response.status !== 429) {\r\n // Telemetry data successfully logged by server, clear Telemetry cache\r\n this.config.serverTelemetryManager.clearTelemetryCache();\r\n }\r\n\r\n return response;\r\n }\r\n\r\n /**\r\n * Updates the authority object of the client. Endpoint discovery must be completed.\r\n * @param updatedAuthority\r\n */\r\n updateAuthority(updatedAuthority: Authority): void {\r\n if (!updatedAuthority.discoveryComplete()) {\r\n throw ClientAuthError.createEndpointDiscoveryIncompleteError(\"Updated authority has not completed endpoint discovery.\");\r\n }\r\n this.authority = updatedAuthority;\r\n }\r\n}\r\n","/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License.\r\n */\r\n\r\nimport { StringUtils } from \"../utils/StringUtils\";\r\nimport { ClientConfigurationError } from \"../error/ClientConfigurationError\";\r\nimport { PromptValue, CodeChallengeMethodValues} from \"../utils/Constants\";\r\nimport { StringDict } from \"../utils/MsalTypes\";\r\n\r\n/**\r\n * Validates server consumable params from the \"request\" objects\r\n */\r\nexport class RequestValidator {\r\n\r\n /**\r\n * Utility to check if the `redirectUri` in the request is a non-null value\r\n * @param redirectUri\r\n */\r\n static validateRedirectUri(redirectUri: string) : void {\r\n if (StringUtils.isEmpty(redirectUri)) {\r\n throw ClientConfigurationError.createRedirectUriEmptyError();\r\n }\r\n }\r\n\r\n /**\r\n * Utility to validate prompt sent by the user in the request\r\n * @param prompt\r\n */\r\n static validatePrompt(prompt: string) : void {\r\n const promptValues = [];\r\n\r\n for (const value in PromptValue) {\r\n promptValues.push(PromptValue[value]);\r\n }\r\n\r\n if (promptValues.indexOf(prompt) < 0) {\r\n throw ClientConfigurationError.createInvalidPromptError(prompt);\r\n }\r\n }\r\n\r\n static validateClaims(claims: string) : void {\r\n try {\r\n JSON.parse(claims);\r\n } catch(e) {\r\n throw ClientConfigurationError.createInvalidClaimsRequestError();\r\n }\r\n }\r\n\r\n /**\r\n * Utility to validate code_challenge and code_challenge_method\r\n * @param codeChallenge\r\n * @param codeChallengeMethod\r\n */\r\n static validateCodeChallengeParams(codeChallenge: string, codeChallengeMethod: string) : void {\r\n if (StringUtils.isEmpty(codeChallenge) || StringUtils.isEmpty(codeChallengeMethod)) {\r\n throw ClientConfigurationError.createInvalidCodeChallengeParamsError();\r\n } else {\r\n this.validateCodeChallengeMethod(codeChallengeMethod);\r\n }\r\n }\r\n\r\n /**\r\n * Utility to validate code_challenge_method\r\n * @param codeChallengeMethod\r\n */\r\n static validateCodeChallengeMethod(codeChallengeMethod: string) : void {\r\n if (\r\n [\r\n CodeChallengeMethodValues.PLAIN,\r\n CodeChallengeMethodValues.S256\r\n ].indexOf(codeChallengeMethod) < 0\r\n ) {\r\n throw ClientConfigurationError.createInvalidCodeChallengeMethodError();\r\n }\r\n }\r\n\r\n /**\r\n * Removes unnecessary or duplicate query parameters from extraQueryParameters\r\n * @param request\r\n */\r\n static sanitizeEQParams(eQParams: StringDict, queryParams: Map) : StringDict {\r\n if (!eQParams) {\r\n return {};\r\n }\r\n\r\n // Remove any query parameters already included in SSO params\r\n queryParams.forEach((value, key) => {\r\n if (eQParams[key]) {\r\n delete eQParams[key];\r\n }\r\n });\r\n\r\n return eQParams;\r\n }\r\n}\r\n","/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License.\r\n */\r\n\r\nimport { AADServerParamKeys, Constants, ResponseMode, SSOTypes, CLIENT_INFO, AuthenticationScheme, ClaimsRequestKeys, PasswordGrantConstants, OIDC_DEFAULT_SCOPES, ThrottlingConstants, HeaderNames} from \"../utils/Constants\";\r\nimport { ScopeSet } from \"./ScopeSet\";\r\nimport { ClientConfigurationError } from \"../error/ClientConfigurationError\";\r\nimport { StringDict } from \"../utils/MsalTypes\";\r\nimport { RequestValidator } from \"./RequestValidator\";\r\nimport { ApplicationTelemetry, LibraryInfo } from \"../config/ClientConfiguration\";\r\nimport { StringUtils } from \"../utils/StringUtils\";\r\nimport { ServerTelemetryManager } from \"../telemetry/server/ServerTelemetryManager\";\r\nimport { ClientInfo } from \"../account/ClientInfo\";\r\n\r\nexport class RequestParameterBuilder {\r\n\r\n private parameters: Map;\r\n\r\n constructor() {\r\n this.parameters = new Map();\r\n }\r\n\r\n /**\r\n * add response_type = code\r\n */\r\n addResponseTypeCode(): void {\r\n this.parameters.set(\r\n AADServerParamKeys.RESPONSE_TYPE, encodeURIComponent(Constants.CODE_RESPONSE_TYPE)\r\n );\r\n }\r\n\r\n /**\r\n * add response_type = token id_token\r\n */\r\n addResponseTypeForTokenAndIdToken(): void {\r\n this.parameters.set(\r\n AADServerParamKeys.RESPONSE_TYPE, encodeURIComponent(`${Constants.TOKEN_RESPONSE_TYPE} ${Constants.ID_TOKEN_RESPONSE_TYPE}`)\r\n );\r\n }\r\n\r\n /**\r\n * add response_mode. defaults to query.\r\n * @param responseMode\r\n */\r\n addResponseMode(responseMode?: ResponseMode): void {\r\n this.parameters.set(\r\n AADServerParamKeys.RESPONSE_MODE,\r\n encodeURIComponent((responseMode) ? responseMode : ResponseMode.QUERY)\r\n );\r\n }\r\n\r\n /**\r\n * Add flag to indicate STS should attempt to use WAM if available\r\n */\r\n addNativeBroker(): void {\r\n this.parameters.set(\r\n AADServerParamKeys.NATIVE_BROKER,\r\n encodeURIComponent(\"1\")\r\n );\r\n }\r\n\r\n /**\r\n * add scopes. set addOidcScopes to false to prevent default scopes in non-user scenarios\r\n * @param scopeSet\r\n * @param addOidcScopes\r\n */\r\n addScopes(scopes: string[], addOidcScopes: boolean = true): void {\r\n const requestScopes = addOidcScopes ? [...scopes || [], ...OIDC_DEFAULT_SCOPES] : scopes || [];\r\n const scopeSet = new ScopeSet(requestScopes);\r\n this.parameters.set(AADServerParamKeys.SCOPE, encodeURIComponent(scopeSet.printScopes()));\r\n }\r\n\r\n /**\r\n * add clientId\r\n * @param clientId\r\n */\r\n addClientId(clientId: string): void {\r\n this.parameters.set(AADServerParamKeys.CLIENT_ID, encodeURIComponent(clientId));\r\n }\r\n\r\n /**\r\n * add redirect_uri\r\n * @param redirectUri\r\n */\r\n addRedirectUri(redirectUri: string): void {\r\n RequestValidator.validateRedirectUri(redirectUri);\r\n this.parameters.set(AADServerParamKeys.REDIRECT_URI, encodeURIComponent(redirectUri));\r\n }\r\n\r\n /**\r\n * add post logout redirectUri\r\n * @param redirectUri\r\n */\r\n addPostLogoutRedirectUri(redirectUri: string): void {\r\n RequestValidator.validateRedirectUri(redirectUri);\r\n this.parameters.set(AADServerParamKeys.POST_LOGOUT_URI, encodeURIComponent(redirectUri));\r\n }\r\n\r\n /**\r\n * add id_token_hint to logout request\r\n * @param idTokenHint\r\n */\r\n addIdTokenHint(idTokenHint: string): void {\r\n this.parameters.set(AADServerParamKeys.ID_TOKEN_HINT, encodeURIComponent(idTokenHint));\r\n }\r\n\r\n /**\r\n * add domain_hint\r\n * @param domainHint\r\n */\r\n addDomainHint(domainHint: string): void {\r\n this.parameters.set(SSOTypes.DOMAIN_HINT, encodeURIComponent(domainHint));\r\n }\r\n\r\n /**\r\n * add login_hint\r\n * @param loginHint\r\n */\r\n addLoginHint(loginHint: string): void {\r\n this.parameters.set(SSOTypes.LOGIN_HINT, encodeURIComponent(loginHint));\r\n }\r\n\r\n /**\r\n * Adds the CCS (Cache Credential Service) query parameter for login_hint\r\n * @param loginHint\r\n */\r\n addCcsUpn(loginHint: string): void {\r\n this.parameters.set(HeaderNames.CCS_HEADER, encodeURIComponent(`UPN:${loginHint}`));\r\n }\r\n\r\n /**\r\n * Adds the CCS (Cache Credential Service) query parameter for account object\r\n * @param loginHint\r\n */\r\n addCcsOid(clientInfo: ClientInfo): void {\r\n this.parameters.set(HeaderNames.CCS_HEADER, encodeURIComponent(`Oid:${clientInfo.uid}@${clientInfo.utid}`));\r\n }\r\n\r\n /**\r\n * add sid\r\n * @param sid\r\n */\r\n addSid(sid: string): void {\r\n this.parameters.set(SSOTypes.SID, encodeURIComponent(sid));\r\n }\r\n\r\n /**\r\n * add claims\r\n * @param claims\r\n */\r\n addClaims(claims?: string, clientCapabilities?: Array): void {\r\n const mergedClaims = this.addClientCapabilitiesToClaims(claims, clientCapabilities);\r\n RequestValidator.validateClaims(mergedClaims);\r\n this.parameters.set(AADServerParamKeys.CLAIMS, encodeURIComponent(mergedClaims));\r\n }\r\n\r\n /**\r\n * add correlationId\r\n * @param correlationId\r\n */\r\n addCorrelationId(correlationId: string): void {\r\n this.parameters.set(AADServerParamKeys.CLIENT_REQUEST_ID, encodeURIComponent(correlationId));\r\n }\r\n\r\n /**\r\n * add library info query params\r\n * @param libraryInfo\r\n */\r\n addLibraryInfo(libraryInfo: LibraryInfo): void {\r\n // Telemetry Info\r\n this.parameters.set(AADServerParamKeys.X_CLIENT_SKU, libraryInfo.sku);\r\n this.parameters.set(AADServerParamKeys.X_CLIENT_VER, libraryInfo.version);\r\n if (libraryInfo.os) {\r\n this.parameters.set(AADServerParamKeys.X_CLIENT_OS, libraryInfo.os);\r\n }\r\n if (libraryInfo.cpu) {\r\n this.parameters.set(AADServerParamKeys.X_CLIENT_CPU, libraryInfo.cpu);\r\n }\r\n }\r\n\r\n /**\r\n * Add client telemetry parameters\r\n * @param appTelemetry\r\n */\r\n addApplicationTelemetry(appTelemetry: ApplicationTelemetry): void {\r\n if (appTelemetry?.appName) {\r\n this.parameters.set(AADServerParamKeys.X_APP_NAME, appTelemetry.appName);\r\n }\r\n\r\n if (appTelemetry?.appVersion) {\r\n this.parameters.set(AADServerParamKeys.X_APP_VER, appTelemetry.appVersion);\r\n }\r\n }\r\n\r\n /**\r\n * add prompt\r\n * @param prompt\r\n */\r\n addPrompt(prompt: string): void {\r\n RequestValidator.validatePrompt(prompt);\r\n this.parameters.set(`${AADServerParamKeys.PROMPT}`, encodeURIComponent(prompt));\r\n }\r\n\r\n /**\r\n * add state\r\n * @param state\r\n */\r\n addState(state: string): void {\r\n if (!StringUtils.isEmpty(state)) {\r\n this.parameters.set(AADServerParamKeys.STATE, encodeURIComponent(state));\r\n }\r\n }\r\n\r\n /**\r\n * add nonce\r\n * @param nonce\r\n */\r\n addNonce(nonce: string): void {\r\n this.parameters.set(AADServerParamKeys.NONCE, encodeURIComponent(nonce));\r\n }\r\n\r\n /**\r\n * add code_challenge and code_challenge_method\r\n * - throw if either of them are not passed\r\n * @param codeChallenge\r\n * @param codeChallengeMethod\r\n */\r\n addCodeChallengeParams(\r\n codeChallenge: string,\r\n codeChallengeMethod: string\r\n ): void {\r\n RequestValidator.validateCodeChallengeParams(codeChallenge, codeChallengeMethod);\r\n if (codeChallenge && codeChallengeMethod) {\r\n this.parameters.set(AADServerParamKeys.CODE_CHALLENGE, encodeURIComponent(codeChallenge));\r\n this.parameters.set(AADServerParamKeys.CODE_CHALLENGE_METHOD, encodeURIComponent(codeChallengeMethod));\r\n } else {\r\n throw ClientConfigurationError.createInvalidCodeChallengeParamsError();\r\n }\r\n }\r\n\r\n /**\r\n * add the `authorization_code` passed by the user to exchange for a token\r\n * @param code\r\n */\r\n addAuthorizationCode(code: string): void {\r\n this.parameters.set(AADServerParamKeys.CODE, encodeURIComponent(code));\r\n }\r\n\r\n /**\r\n * add the `authorization_code` passed by the user to exchange for a token\r\n * @param code\r\n */\r\n addDeviceCode(code: string): void {\r\n this.parameters.set(AADServerParamKeys.DEVICE_CODE, encodeURIComponent(code));\r\n }\r\n\r\n /**\r\n * add the `refreshToken` passed by the user\r\n * @param refreshToken\r\n */\r\n addRefreshToken(refreshToken: string): void {\r\n this.parameters.set(AADServerParamKeys.REFRESH_TOKEN, encodeURIComponent(refreshToken));\r\n }\r\n\r\n /**\r\n * add the `code_verifier` passed by the user to exchange for a token\r\n * @param codeVerifier\r\n */\r\n addCodeVerifier(codeVerifier: string): void {\r\n this.parameters.set(AADServerParamKeys.CODE_VERIFIER, encodeURIComponent(codeVerifier));\r\n }\r\n\r\n /**\r\n * add client_secret\r\n * @param clientSecret\r\n */\r\n addClientSecret(clientSecret: string): void {\r\n this.parameters.set(AADServerParamKeys.CLIENT_SECRET, encodeURIComponent(clientSecret));\r\n }\r\n\r\n /**\r\n * add clientAssertion for confidential client flows\r\n * @param clientAssertion\r\n */\r\n addClientAssertion(clientAssertion: string): void {\r\n if (!StringUtils.isEmpty(clientAssertion)) {\r\n this.parameters.set(AADServerParamKeys.CLIENT_ASSERTION, encodeURIComponent(clientAssertion));\r\n }\r\n }\r\n\r\n /**\r\n * add clientAssertionType for confidential client flows\r\n * @param clientAssertionType\r\n */\r\n addClientAssertionType(clientAssertionType: string): void {\r\n if (!StringUtils.isEmpty(clientAssertionType)) {\r\n this.parameters.set(AADServerParamKeys.CLIENT_ASSERTION_TYPE, encodeURIComponent(clientAssertionType));\r\n }\r\n }\r\n\r\n /**\r\n * add OBO assertion for confidential client flows\r\n * @param clientAssertion\r\n */\r\n addOboAssertion(oboAssertion: string): void {\r\n this.parameters.set(AADServerParamKeys.OBO_ASSERTION, encodeURIComponent(oboAssertion));\r\n }\r\n\r\n /**\r\n * add grant type\r\n * @param grantType\r\n */\r\n addRequestTokenUse(tokenUse: string): void {\r\n this.parameters.set(AADServerParamKeys.REQUESTED_TOKEN_USE, encodeURIComponent(tokenUse));\r\n }\r\n\r\n /**\r\n * add grant type\r\n * @param grantType\r\n */\r\n addGrantType(grantType: string): void {\r\n this.parameters.set(AADServerParamKeys.GRANT_TYPE, encodeURIComponent(grantType));\r\n }\r\n\r\n /**\r\n * add client info\r\n *\r\n */\r\n addClientInfo(): void {\r\n this.parameters.set(CLIENT_INFO, \"1\");\r\n }\r\n\r\n /**\r\n * add extraQueryParams\r\n * @param eQparams\r\n */\r\n addExtraQueryParameters(eQparams: StringDict): void {\r\n RequestValidator.sanitizeEQParams(eQparams, this.parameters);\r\n Object.keys(eQparams).forEach((key) => {\r\n this.parameters.set(key, eQparams[key]);\r\n });\r\n }\r\n\r\n addClientCapabilitiesToClaims(claims?: string, clientCapabilities?: Array): string {\r\n let mergedClaims: object;\r\n\r\n // Parse provided claims into JSON object or initialize empty object\r\n if (!claims) {\r\n mergedClaims = {};\r\n } else {\r\n try {\r\n mergedClaims = JSON.parse(claims);\r\n } catch(e) {\r\n throw ClientConfigurationError.createInvalidClaimsRequestError();\r\n }\r\n }\r\n\r\n if (clientCapabilities && clientCapabilities.length > 0) {\r\n if (!mergedClaims.hasOwnProperty(ClaimsRequestKeys.ACCESS_TOKEN)){\r\n // Add access_token key to claims object\r\n mergedClaims[ClaimsRequestKeys.ACCESS_TOKEN] = {};\r\n }\r\n\r\n // Add xms_cc claim with provided clientCapabilities to access_token key\r\n mergedClaims[ClaimsRequestKeys.ACCESS_TOKEN][ClaimsRequestKeys.XMS_CC] = {\r\n values: clientCapabilities\r\n };\r\n }\r\n\r\n return JSON.stringify(mergedClaims);\r\n }\r\n\r\n /**\r\n * adds `username` for Password Grant flow\r\n * @param username\r\n */\r\n addUsername(username: string): void {\r\n this.parameters.set(PasswordGrantConstants.username, encodeURIComponent(username));\r\n }\r\n\r\n /**\r\n * adds `password` for Password Grant flow\r\n * @param password\r\n */\r\n addPassword(password: string): void {\r\n this.parameters.set(PasswordGrantConstants.password, encodeURIComponent(password));\r\n }\r\n\r\n /**\r\n * add pop_jwk to query params\r\n * @param cnfString\r\n */\r\n addPopToken(cnfString: string): void {\r\n if (!StringUtils.isEmpty(cnfString)) {\r\n this.parameters.set(AADServerParamKeys.TOKEN_TYPE, AuthenticationScheme.POP);\r\n this.parameters.set(AADServerParamKeys.REQ_CNF, encodeURIComponent(cnfString));\r\n }\r\n }\r\n\r\n /**\r\n * add SSH JWK and key ID to query params\r\n */\r\n addSshJwk(sshJwkString: string): void {\r\n if(!StringUtils.isEmpty(sshJwkString)) {\r\n this.parameters.set(AADServerParamKeys.TOKEN_TYPE, AuthenticationScheme.SSH);\r\n this.parameters.set(AADServerParamKeys.REQ_CNF, encodeURIComponent(sshJwkString));\r\n }\r\n }\r\n\r\n /**\r\n * add server telemetry fields\r\n * @param serverTelemetryManager\r\n */\r\n addServerTelemetry(serverTelemetryManager: ServerTelemetryManager): void {\r\n this.parameters.set(AADServerParamKeys.X_CLIENT_CURR_TELEM, serverTelemetryManager.generateCurrentRequestHeaderValue());\r\n this.parameters.set(AADServerParamKeys.X_CLIENT_LAST_TELEM, serverTelemetryManager.generateLastRequestHeaderValue());\r\n }\r\n\r\n /**\r\n * Adds parameter that indicates to the server that throttling is supported\r\n */\r\n addThrottling(): void {\r\n this.parameters.set(AADServerParamKeys.X_MS_LIB_CAPABILITY, ThrottlingConstants.X_MS_LIB_CAPABILITY_VALUE);\r\n }\r\n\r\n /**\r\n * Adds logout_hint parameter for \"silent\" logout which prevent server account picker\r\n */\r\n addLogoutHint(logoutHint: string): void {\r\n this.parameters.set(AADServerParamKeys.LOGOUT_HINT, encodeURIComponent(logoutHint));\r\n }\r\n\r\n /**\r\n * Utility to create a URL from the params map\r\n */\r\n createQueryString(): string {\r\n const queryParameterArray: Array = new Array();\r\n\r\n this.parameters.forEach((value, key) => {\r\n queryParameterArray.push(`${key}=${value}`);\r\n });\r\n\r\n return queryParameterArray.join(\"&\");\r\n }\r\n}\r\n","/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License.\r\n */\r\n\r\nimport { CredentialEntity } from \"./CredentialEntity\";\r\nimport { CredentialType } from \"../../utils/Constants\";\r\n\r\n/**\r\n * ID_TOKEN Cache\r\n *\r\n * Key:Value Schema:\r\n *\r\n * Key Example: uid.utid-login.microsoftonline.com-idtoken-clientId-contoso.com-\r\n *\r\n * Value Schema:\r\n * {\r\n * homeAccountId: home account identifier for the auth scheme,\r\n * environment: entity that issued the token, represented as a full host\r\n * credentialType: Type of credential as a string, can be one of the following: RefreshToken, AccessToken, IdToken, Password, Cookie, Certificate, Other\r\n * clientId: client ID of the application\r\n * secret: Actual credential as a string\r\n * realm: Full tenant or organizational identifier that the account belongs to\r\n * }\r\n */\r\nexport class IdTokenEntity extends CredentialEntity {\r\n realm: string;\r\n\r\n /**\r\n * Create IdTokenEntity\r\n * @param homeAccountId\r\n * @param authenticationResult\r\n * @param clientId\r\n * @param authority\r\n */\r\n static createIdTokenEntity(\r\n homeAccountId: string,\r\n environment: string,\r\n idToken: string,\r\n clientId: string,\r\n tenantId: string,\r\n ): IdTokenEntity {\r\n const idTokenEntity = new IdTokenEntity();\r\n\r\n idTokenEntity.credentialType = CredentialType.ID_TOKEN;\r\n idTokenEntity.homeAccountId = homeAccountId;\r\n idTokenEntity.environment = environment;\r\n idTokenEntity.clientId = clientId;\r\n idTokenEntity.secret = idToken;\r\n idTokenEntity.realm = tenantId;\r\n\r\n return idTokenEntity;\r\n }\r\n\r\n /**\r\n * Validates an entity: checks for all expected params\r\n * @param entity\r\n */\r\n static isIdTokenEntity(entity: object): boolean {\r\n\r\n if (!entity) {\r\n return false;\r\n }\r\n\r\n return (\r\n entity.hasOwnProperty(\"homeAccountId\") &&\r\n entity.hasOwnProperty(\"environment\") &&\r\n entity.hasOwnProperty(\"credentialType\") &&\r\n entity.hasOwnProperty(\"realm\") &&\r\n entity.hasOwnProperty(\"clientId\") &&\r\n entity.hasOwnProperty(\"secret\") &&\r\n entity[\"credentialType\"] === CredentialType.ID_TOKEN\r\n );\r\n }\r\n}\r\n","/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License.\r\n */\r\n\r\n/**\r\n * Utility class which exposes functions for managing date and time operations.\r\n */\r\nexport class TimeUtils {\r\n\r\n /**\r\n * return the current time in Unix time (seconds).\r\n */\r\n static nowSeconds(): number {\r\n // Date.getTime() returns in milliseconds.\r\n return Math.round(new Date().getTime() / 1000.0);\r\n }\r\n \r\n /**\r\n * check if a token is expired based on given UTC time in seconds.\r\n * @param expiresOn\r\n */\r\n static isTokenExpired(expiresOn: string, offset: number): boolean {\r\n // check for access token expiry\r\n const expirationSec = Number(expiresOn) || 0;\r\n const offsetCurrentTimeSec = TimeUtils.nowSeconds() + offset;\r\n\r\n // If current time + offset is greater than token expiration time, then token is expired.\r\n return (offsetCurrentTimeSec > expirationSec);\r\n }\r\n\r\n /**\r\n * If the current time is earlier than the time that a token was cached at, we must discard the token\r\n * i.e. The system clock was turned back after acquiring the cached token\r\n * @param cachedAt \r\n * @param offset \r\n */\r\n static wasClockTurnedBack(cachedAt: string): boolean {\r\n const cachedAtSec = Number(cachedAt);\r\n\r\n return cachedAtSec > TimeUtils.nowSeconds();\r\n }\r\n\r\n /**\r\n * Waits for t number of milliseconds\r\n * @param t number\r\n * @param value T\r\n */\r\n static delay(t: number, value?: T): Promise {\r\n return new Promise((resolve) => setTimeout(() => resolve(value), t));\r\n }\r\n}\r\n","/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License.\r\n */\r\n\r\nimport { CredentialEntity } from \"./CredentialEntity\";\r\nimport { CredentialType, AuthenticationScheme } from \"../../utils/Constants\";\r\nimport { TimeUtils } from \"../../utils/TimeUtils\";\r\nimport { StringUtils } from \"../../utils/StringUtils\";\r\nimport { ICrypto } from \"../../crypto/ICrypto\";\r\nimport { TokenClaims } from \"../../account/TokenClaims\";\r\nimport { AuthToken } from \"../../account/AuthToken\";\r\nimport { ClientAuthError } from \"../../error/ClientAuthError\";\r\n\r\n/**\r\n * ACCESS_TOKEN Credential Type\r\n *\r\n * Key:Value Schema:\r\n *\r\n * Key Example: uid.utid-login.microsoftonline.com-accesstoken-clientId-contoso.com-user.read\r\n *\r\n * Value Schema:\r\n * {\r\n * homeAccountId: home account identifier for the auth scheme,\r\n * environment: entity that issued the token, represented as a full host\r\n * credentialType: Type of credential as a string, can be one of the following: RefreshToken, AccessToken, IdToken, Password, Cookie, Certificate, Other\r\n * clientId: client ID of the application\r\n * secret: Actual credential as a string\r\n * familyId: Family ID identifier, usually only used for refresh tokens\r\n * realm: Full tenant or organizational identifier that the account belongs to\r\n * target: Permissions that are included in the token, or for refresh tokens, the resource identifier.\r\n * cachedAt: Absolute device time when entry was created in the cache.\r\n * expiresOn: Token expiry time, calculated based on current UTC time in seconds. Represented as a string.\r\n * extendedExpiresOn: Additional extended expiry time until when token is valid in case of server-side outage. Represented as string in UTC seconds.\r\n * keyId: used for POP and SSH tokenTypes\r\n * tokenType: Type of the token issued. Usually \"Bearer\"\r\n * }\r\n */\r\nexport class AccessTokenEntity extends CredentialEntity {\r\n realm: string;\r\n target: string;\r\n cachedAt: string;\r\n expiresOn: string;\r\n extendedExpiresOn?: string;\r\n refreshOn?: string;\r\n keyId?: string; // for POP and SSH tokenTypes\r\n tokenType?: AuthenticationScheme;\r\n requestedClaims?: string;\r\n requestedClaimsHash?: string;\r\n\r\n /**\r\n * Create AccessTokenEntity\r\n * @param homeAccountId\r\n * @param environment\r\n * @param accessToken\r\n * @param clientId\r\n * @param tenantId\r\n * @param scopes\r\n * @param expiresOn\r\n * @param extExpiresOn\r\n */\r\n static createAccessTokenEntity(\r\n homeAccountId: string,\r\n environment: string,\r\n accessToken: string,\r\n clientId: string,\r\n tenantId: string,\r\n scopes: string,\r\n expiresOn: number,\r\n extExpiresOn: number,\r\n cryptoUtils: ICrypto,\r\n refreshOn?: number,\r\n tokenType?: AuthenticationScheme,\r\n userAssertionHash?:string,\r\n keyId?: string,\r\n requestedClaims?: string,\r\n requestedClaimsHash?: string\r\n ): AccessTokenEntity {\r\n const atEntity: AccessTokenEntity = new AccessTokenEntity();\r\n\r\n atEntity.homeAccountId = homeAccountId;\r\n atEntity.credentialType = CredentialType.ACCESS_TOKEN;\r\n atEntity.secret = accessToken;\r\n\r\n const currentTime = TimeUtils.nowSeconds();\r\n atEntity.cachedAt = currentTime.toString();\r\n\r\n /*\r\n * Token expiry time.\r\n * This value should be  calculated based on the current UTC time measured locally and the value  expires_in Represented as a string in JSON.\r\n */\r\n atEntity.expiresOn = expiresOn.toString();\r\n atEntity.extendedExpiresOn = extExpiresOn.toString();\r\n if (refreshOn) {\r\n atEntity.refreshOn = refreshOn.toString();\r\n }\r\n\r\n atEntity.environment = environment;\r\n atEntity.clientId = clientId;\r\n atEntity.realm = tenantId;\r\n atEntity.target = scopes;\r\n atEntity.userAssertionHash = userAssertionHash;\r\n\r\n atEntity.tokenType = StringUtils.isEmpty(tokenType) ? AuthenticationScheme.BEARER : tokenType;\r\n\r\n if (requestedClaims) {\r\n atEntity.requestedClaims = requestedClaims;\r\n atEntity.requestedClaimsHash = requestedClaimsHash;\r\n }\r\n\r\n /*\r\n * Create Access Token With Auth Scheme instead of regular access token\r\n * Cast to lower to handle \"bearer\" from ADFS\r\n */\r\n if (atEntity.tokenType?.toLowerCase() !== AuthenticationScheme.BEARER.toLowerCase()) {\r\n atEntity.credentialType = CredentialType.ACCESS_TOKEN_WITH_AUTH_SCHEME;\r\n switch (atEntity.tokenType) {\r\n case AuthenticationScheme.POP:\r\n // Make sure keyId is present and add it to credential\r\n const tokenClaims: TokenClaims | null = AuthToken.extractTokenClaims(accessToken, cryptoUtils);\r\n if (!tokenClaims?.cnf?.kid) {\r\n throw ClientAuthError.createTokenClaimsRequiredError();\r\n }\r\n atEntity.keyId = tokenClaims.cnf.kid;\r\n break;\r\n case AuthenticationScheme.SSH:\r\n atEntity.keyId = keyId;\r\n }\r\n }\r\n\r\n return atEntity;\r\n }\r\n\r\n /**\r\n * Validates an entity: checks for all expected params\r\n * @param entity\r\n */\r\n static isAccessTokenEntity(entity: object): boolean {\r\n\r\n if (!entity) {\r\n return false;\r\n }\r\n\r\n return (\r\n entity.hasOwnProperty(\"homeAccountId\") &&\r\n entity.hasOwnProperty(\"environment\") &&\r\n entity.hasOwnProperty(\"credentialType\") &&\r\n entity.hasOwnProperty(\"realm\") &&\r\n entity.hasOwnProperty(\"clientId\") &&\r\n entity.hasOwnProperty(\"secret\") &&\r\n entity.hasOwnProperty(\"target\") &&\r\n (entity[\"credentialType\"] === CredentialType.ACCESS_TOKEN || entity[\"credentialType\"] === CredentialType.ACCESS_TOKEN_WITH_AUTH_SCHEME)\r\n );\r\n }\r\n}\r\n","/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License.\r\n */\r\n\r\nimport { CredentialEntity } from \"./CredentialEntity\";\r\nimport { CredentialType } from \"../../utils/Constants\";\r\n\r\n/**\r\n * REFRESH_TOKEN Cache\r\n *\r\n * Key:Value Schema:\r\n *\r\n * Key Example: uid.utid-login.microsoftonline.com-refreshtoken-clientId--\r\n *\r\n * Value:\r\n * {\r\n * homeAccountId: home account identifier for the auth scheme,\r\n * environment: entity that issued the token, represented as a full host\r\n * credentialType: Type of credential as a string, can be one of the following: RefreshToken, AccessToken, IdToken, Password, Cookie, Certificate, Other\r\n * clientId: client ID of the application\r\n * secret: Actual credential as a string\r\n * familyId: Family ID identifier, '1' represents Microsoft Family\r\n * realm: Full tenant or organizational identifier that the account belongs to\r\n * target: Permissions that are included in the token, or for refresh tokens, the resource identifier.\r\n * }\r\n */\r\nexport class RefreshTokenEntity extends CredentialEntity {\r\n familyId?: string;\r\n\r\n /**\r\n * Create RefreshTokenEntity\r\n * @param homeAccountId\r\n * @param authenticationResult\r\n * @param clientId\r\n * @param authority\r\n */\r\n static createRefreshTokenEntity(\r\n homeAccountId: string,\r\n environment: string,\r\n refreshToken: string,\r\n clientId: string,\r\n familyId?: string,\r\n userAssertionHash?: string\r\n ): RefreshTokenEntity {\r\n const rtEntity = new RefreshTokenEntity();\r\n\r\n rtEntity.clientId = clientId;\r\n rtEntity.credentialType = CredentialType.REFRESH_TOKEN;\r\n rtEntity.environment = environment;\r\n rtEntity.homeAccountId = homeAccountId;\r\n rtEntity.secret = refreshToken;\r\n rtEntity.userAssertionHash = userAssertionHash;\r\n\r\n if (familyId)\r\n rtEntity.familyId = familyId;\r\n\r\n return rtEntity;\r\n }\r\n\r\n /**\r\n * Validates an entity: checks for all expected params\r\n * @param entity\r\n */\r\n static isRefreshTokenEntity(entity: object): boolean {\r\n\r\n if (!entity) {\r\n return false;\r\n }\r\n\r\n return (\r\n entity.hasOwnProperty(\"homeAccountId\") &&\r\n entity.hasOwnProperty(\"environment\") &&\r\n entity.hasOwnProperty(\"credentialType\") &&\r\n entity.hasOwnProperty(\"clientId\") &&\r\n entity.hasOwnProperty(\"secret\") &&\r\n entity[\"credentialType\"] === CredentialType.REFRESH_TOKEN\r\n );\r\n }\r\n}\r\n","/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License.\r\n */\r\n\r\nimport { AuthError } from \"./AuthError\";\r\n\r\n/**\r\n * InteractionRequiredServerErrorMessage contains string constants used by error codes and messages returned by the server indicating interaction is required\r\n */\r\nexport const InteractionRequiredServerErrorMessage = [\r\n \"interaction_required\",\r\n \"consent_required\",\r\n \"login_required\"\r\n];\r\n\r\nexport const InteractionRequiredAuthSubErrorMessage = [\r\n \"message_only\",\r\n \"additional_action\",\r\n \"basic_action\",\r\n \"user_password_expired\",\r\n \"consent_required\"\r\n];\r\n\r\n/**\r\n * Interaction required errors defined by the SDK\r\n */\r\nexport const InteractionRequiredAuthErrorMessage = {\r\n noTokensFoundError: {\r\n code: \"no_tokens_found\",\r\n desc: \"No refresh token found in the cache. Please sign-in.\"\r\n },\r\n native_account_unavailable: {\r\n code: \"native_account_unavailable\",\r\n desc: \"The requested account is not available in the native broker. It may have been deleted or logged out. Please sign-in again using an interactive API.\"\r\n }\r\n};\r\n\r\n/**\r\n * Error thrown when user interaction is required.\r\n */\r\nexport class InteractionRequiredAuthError extends AuthError {\r\n\r\n constructor(errorCode?: string, errorMessage?: string, subError?: string) {\r\n super(errorCode, errorMessage, subError);\r\n this.name = \"InteractionRequiredAuthError\";\r\n\r\n Object.setPrototypeOf(this, InteractionRequiredAuthError.prototype);\r\n }\r\n\r\n /**\r\n * Helper function used to determine if an error thrown by the server requires interaction to resolve\r\n * @param errorCode \r\n * @param errorString \r\n * @param subError \r\n */\r\n static isInteractionRequiredError(errorCode?: string, errorString?: string, subError?: string): boolean {\r\n const isInteractionRequiredErrorCode = !!errorCode && InteractionRequiredServerErrorMessage.indexOf(errorCode) > -1;\r\n const isInteractionRequiredSubError = !!subError && InteractionRequiredAuthSubErrorMessage.indexOf(subError) > -1;\r\n const isInteractionRequiredErrorDesc = !!errorString && InteractionRequiredServerErrorMessage.some((irErrorCode) => {\r\n return errorString.indexOf(irErrorCode) > -1;\r\n });\r\n\r\n return isInteractionRequiredErrorCode || isInteractionRequiredErrorDesc || isInteractionRequiredSubError;\r\n }\r\n\r\n /**\r\n * Creates an error thrown when the authorization code required for a token request is null or empty.\r\n */\r\n static createNoTokensFoundError(): InteractionRequiredAuthError {\r\n return new InteractionRequiredAuthError(InteractionRequiredAuthErrorMessage.noTokensFoundError.code, InteractionRequiredAuthErrorMessage.noTokensFoundError.desc);\r\n }\r\n\r\n /**\r\n * Creates an error thrown when the native broker returns ACCOUNT_UNAVAILABLE status, indicating that the account was removed and interactive sign-in is required\r\n * @returns \r\n */\r\n static createNativeAccountUnavailableError(): InteractionRequiredAuthError {\r\n return new InteractionRequiredAuthError(InteractionRequiredAuthErrorMessage.native_account_unavailable.code, InteractionRequiredAuthErrorMessage.native_account_unavailable.desc);\r\n }\r\n}\r\n","/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License.\r\n */\r\n\r\nimport { IdTokenEntity } from \"./IdTokenEntity\";\r\nimport { AccessTokenEntity } from \"./AccessTokenEntity\";\r\nimport { RefreshTokenEntity } from \"./RefreshTokenEntity\";\r\nimport { AccountEntity } from \"./AccountEntity\";\r\nimport { AppMetadataEntity } from \"./AppMetadataEntity\";\r\n\r\nexport class CacheRecord {\r\n account: AccountEntity | null;\r\n idToken: IdTokenEntity | null;\r\n accessToken: AccessTokenEntity | null;\r\n refreshToken: RefreshTokenEntity | null;\r\n appMetadata: AppMetadataEntity | null;\r\n\r\n constructor(accountEntity?: AccountEntity | null, idTokenEntity?: IdTokenEntity | null, accessTokenEntity?: AccessTokenEntity | null, refreshTokenEntity?: RefreshTokenEntity | null, appMetadataEntity?: AppMetadataEntity | null) {\r\n this.account = accountEntity || null;\r\n this.idToken = idTokenEntity || null;\r\n this.accessToken = accessTokenEntity || null;\r\n this.refreshToken = refreshTokenEntity || null;\r\n this.appMetadata = appMetadataEntity || null;\r\n }\r\n}\r\n","/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License.\r\n */\r\n\r\nimport { StringUtils } from \"./StringUtils\";\r\nimport { Constants } from \"./Constants\";\r\nimport { ICrypto } from \"../crypto/ICrypto\";\r\nimport { ClientAuthError } from \"../error/ClientAuthError\";\r\n\r\n/**\r\n * Type which defines the object that is stringified, encoded and sent in the state value.\r\n * Contains the following:\r\n * - id - unique identifier for this request\r\n * - ts - timestamp for the time the request was made. Used to ensure that token expiration is not calculated incorrectly.\r\n * - platformState - string value sent from the platform.\r\n */\r\nexport type LibraryStateObject = {\r\n id: string,\r\n meta?: Record\r\n};\r\n\r\n/**\r\n * Type which defines the stringified and encoded object sent to the service in the authorize request.\r\n */\r\nexport type RequestStateObject = {\r\n userRequestState: string,\r\n libraryState: LibraryStateObject\r\n};\r\n\r\n/**\r\n * Class which provides helpers for OAuth 2.0 protocol specific values\r\n */\r\nexport class ProtocolUtils {\r\n\r\n /**\r\n * Appends user state with random guid, or returns random guid.\r\n * @param userState \r\n * @param randomGuid \r\n */\r\n static setRequestState(cryptoObj: ICrypto, userState?: string, meta?: Record): string {\r\n const libraryState = ProtocolUtils.generateLibraryState(cryptoObj, meta);\r\n return !StringUtils.isEmpty(userState) ? `${libraryState}${Constants.RESOURCE_DELIM}${userState}` : libraryState;\r\n }\r\n\r\n /**\r\n * Generates the state value used by the common library.\r\n * @param randomGuid \r\n * @param cryptoObj \r\n */\r\n static generateLibraryState(cryptoObj: ICrypto, meta?: Record): string {\r\n if (!cryptoObj) {\r\n throw ClientAuthError.createNoCryptoObjectError(\"generateLibraryState\");\r\n }\r\n\r\n // Create a state object containing a unique id and the timestamp of the request creation\r\n const stateObj: LibraryStateObject = {\r\n id: cryptoObj.createNewGuid()\r\n };\r\n\r\n if (meta) {\r\n stateObj.meta = meta;\r\n }\r\n\r\n const stateString = JSON.stringify(stateObj);\r\n\r\n return cryptoObj.base64Encode(stateString);\r\n }\r\n\r\n /**\r\n * Parses the state into the RequestStateObject, which contains the LibraryState info and the state passed by the user.\r\n * @param state \r\n * @param cryptoObj \r\n */\r\n static parseRequestState(cryptoObj: ICrypto, state: string): RequestStateObject {\r\n if (!cryptoObj) {\r\n throw ClientAuthError.createNoCryptoObjectError(\"parseRequestState\");\r\n }\r\n\r\n if (StringUtils.isEmpty(state)) {\r\n throw ClientAuthError.createInvalidStateError(state, \"Null, undefined or empty state\");\r\n }\r\n\r\n try {\r\n // Split the state between library state and user passed state and decode them separately\r\n const splitState = state.split(Constants.RESOURCE_DELIM);\r\n const libraryState = splitState[0];\r\n const userState = splitState.length > 1 ? splitState.slice(1).join(Constants.RESOURCE_DELIM) : Constants.EMPTY_STRING;\r\n const libraryStateString = cryptoObj.base64Decode(libraryState);\r\n const libraryStateObj = JSON.parse(libraryStateString) as LibraryStateObject;\r\n return {\r\n userRequestState: !StringUtils.isEmpty(userState) ? userState : Constants.EMPTY_STRING,\r\n libraryState: libraryStateObj\r\n };\r\n } catch(e) {\r\n throw ClientAuthError.createInvalidStateError(state, e);\r\n }\r\n }\r\n}\r\n","/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License.\r\n */\r\n\r\nimport { ServerAuthorizationCodeResponse } from \"../response/ServerAuthorizationCodeResponse\";\r\nimport { ClientConfigurationError } from \"../error/ClientConfigurationError\";\r\nimport { ClientAuthError } from \"../error/ClientAuthError\";\r\nimport { StringUtils } from \"../utils/StringUtils\";\r\nimport { IUri } from \"./IUri\";\r\nimport { AADAuthorityConstants, Constants } from \"../utils/Constants\";\r\n\r\n/**\r\n * Url object class which can perform various transformations on url strings.\r\n */\r\nexport class UrlString {\r\n\r\n // internal url string field\r\n private _urlString: string;\r\n public get urlString(): string {\r\n return this._urlString;\r\n }\r\n\r\n constructor(url: string) {\r\n this._urlString = url;\r\n if (StringUtils.isEmpty(this._urlString)) {\r\n // Throws error if url is empty\r\n throw ClientConfigurationError.createUrlEmptyError();\r\n }\r\n\r\n if (StringUtils.isEmpty(this.getHash())) {\r\n this._urlString = UrlString.canonicalizeUri(url);\r\n }\r\n }\r\n\r\n /**\r\n * Ensure urls are lower case and end with a / character.\r\n * @param url\r\n */\r\n static canonicalizeUri(url: string): string {\r\n if (url) {\r\n let lowerCaseUrl = url.toLowerCase();\r\n\r\n if (StringUtils.endsWith(lowerCaseUrl, \"?\")) {\r\n lowerCaseUrl = lowerCaseUrl.slice(0, -1);\r\n } else if (StringUtils.endsWith(lowerCaseUrl, \"?/\")) {\r\n lowerCaseUrl = lowerCaseUrl.slice(0, -2);\r\n }\r\n\r\n if (!StringUtils.endsWith(lowerCaseUrl, \"/\")) {\r\n lowerCaseUrl += \"/\";\r\n }\r\n\r\n return lowerCaseUrl;\r\n }\r\n\r\n return url;\r\n }\r\n\r\n /**\r\n * Throws if urlString passed is not a valid authority URI string.\r\n */\r\n validateAsUri(): void {\r\n // Attempts to parse url for uri components\r\n let components;\r\n try {\r\n components = this.getUrlComponents();\r\n } catch (e) {\r\n throw ClientConfigurationError.createUrlParseError(e);\r\n }\r\n\r\n // Throw error if URI or path segments are not parseable.\r\n if (!components.HostNameAndPort || !components.PathSegments) {\r\n throw ClientConfigurationError.createUrlParseError(`Given url string: ${this.urlString}`);\r\n }\r\n\r\n // Throw error if uri is insecure.\r\n if(!components.Protocol || components.Protocol.toLowerCase() !== \"https:\") {\r\n throw ClientConfigurationError.createInsecureAuthorityUriError(this.urlString);\r\n }\r\n }\r\n\r\n /**\r\n * Given a url and a query string return the url with provided query string appended\r\n * @param url\r\n * @param queryString\r\n */\r\n static appendQueryString(url: string, queryString: string): string {\r\n if (StringUtils.isEmpty(queryString)) {\r\n return url;\r\n }\r\n\r\n return url.indexOf(\"?\") < 0 ? `${url}?${queryString}` : `${url}&${queryString}`;\r\n }\r\n\r\n /**\r\n * Returns a url with the hash removed\r\n * @param url\r\n */\r\n static removeHashFromUrl(url: string): string {\r\n return UrlString.canonicalizeUri(url.split(\"#\")[0]);\r\n }\r\n\r\n /**\r\n * Given a url like https://a:b/common/d?e=f#g, and a tenantId, returns https://a:b/tenantId/d\r\n * @param href The url\r\n * @param tenantId The tenant id to replace\r\n */\r\n replaceTenantPath(tenantId: string): UrlString {\r\n const urlObject = this.getUrlComponents();\r\n const pathArray = urlObject.PathSegments;\r\n if (tenantId && (pathArray.length !== 0 && (pathArray[0] === AADAuthorityConstants.COMMON || pathArray[0] === AADAuthorityConstants.ORGANIZATIONS))) {\r\n pathArray[0] = tenantId;\r\n }\r\n return UrlString.constructAuthorityUriFromObject(urlObject);\r\n }\r\n\r\n /**\r\n * Returns the anchor part(#) of the URL\r\n */\r\n getHash(): string {\r\n return UrlString.parseHash(this.urlString);\r\n }\r\n\r\n /**\r\n * Parses out the components from a url string.\r\n * @returns An object with the various components. Please cache this value insted of calling this multiple times on the same url.\r\n */\r\n getUrlComponents(): IUri {\r\n // https://gist.github.com/curtisz/11139b2cfcaef4a261e0\r\n const regEx = RegExp(\"^(([^:/?#]+):)?(//([^/?#]*))?([^?#]*)(\\\\?([^#]*))?(#(.*))?\");\r\n\r\n // If url string does not match regEx, we throw an error\r\n const match = this.urlString.match(regEx);\r\n if (!match) {\r\n throw ClientConfigurationError.createUrlParseError(`Given url string: ${this.urlString}`);\r\n }\r\n\r\n // Url component object\r\n const urlComponents = {\r\n Protocol: match[1],\r\n HostNameAndPort: match[4],\r\n AbsolutePath: match[5],\r\n QueryString: match[7]\r\n } as IUri;\r\n\r\n let pathSegments = urlComponents.AbsolutePath.split(\"/\");\r\n pathSegments = pathSegments.filter((val) => val && val.length > 0); // remove empty elements\r\n urlComponents.PathSegments = pathSegments;\r\n\r\n if (!StringUtils.isEmpty(urlComponents.QueryString) && urlComponents.QueryString.endsWith(\"/\")) {\r\n urlComponents.QueryString = urlComponents.QueryString.substring(0, urlComponents.QueryString.length-1);\r\n }\r\n return urlComponents;\r\n }\r\n\r\n static getDomainFromUrl(url: string): string {\r\n const regEx = RegExp(\"^([^:/?#]+://)?([^/?#]*)\");\r\n\r\n const match = url.match(regEx);\r\n\r\n if (!match) {\r\n throw ClientConfigurationError.createUrlParseError(`Given url string: ${url}`);\r\n }\r\n\r\n return match[2];\r\n }\r\n\r\n static getAbsoluteUrl(relativeUrl: string, baseUrl: string): string {\r\n if (relativeUrl[0] === Constants.FORWARD_SLASH) {\r\n const url = new UrlString(baseUrl);\r\n const baseComponents = url.getUrlComponents();\r\n\r\n return baseComponents.Protocol + \"//\" + baseComponents.HostNameAndPort + relativeUrl;\r\n }\r\n\r\n return relativeUrl;\r\n }\r\n\r\n /**\r\n * Parses hash string from given string. Returns empty string if no hash symbol is found.\r\n * @param hashString\r\n */\r\n static parseHash(hashString: string): string {\r\n const hashIndex1 = hashString.indexOf(\"#\");\r\n const hashIndex2 = hashString.indexOf(\"#/\");\r\n if (hashIndex2 > -1) {\r\n return hashString.substring(hashIndex2 + 2);\r\n } else if (hashIndex1 > -1) {\r\n return hashString.substring(hashIndex1 + 1);\r\n }\r\n return Constants.EMPTY_STRING;\r\n }\r\n\r\n /**\r\n * Parses query string from given string. Returns empty string if no query symbol is found.\r\n * @param queryString\r\n */\r\n static parseQueryString(queryString: string): string {\r\n const queryIndex1 = queryString.indexOf(\"?\");\r\n const queryIndex2 = queryString.indexOf(\"/?\");\r\n if (queryIndex2 > -1) {\r\n return queryString.substring(queryIndex2 + 2);\r\n } else if (queryIndex1 > -1) {\r\n return queryString.substring(queryIndex1 + 1);\r\n }\r\n return Constants.EMPTY_STRING;\r\n }\r\n\r\n static constructAuthorityUriFromObject(urlObject: IUri): UrlString {\r\n return new UrlString(urlObject.Protocol + \"//\" + urlObject.HostNameAndPort + \"/\" + urlObject.PathSegments.join(\"/\"));\r\n }\r\n\r\n /**\r\n * Returns URL hash as server auth code response object.\r\n */\r\n static getDeserializedHash(hash: string): ServerAuthorizationCodeResponse {\r\n // Check if given hash is empty\r\n if (StringUtils.isEmpty(hash)) {\r\n return {};\r\n }\r\n // Strip the # symbol if present\r\n const parsedHash = UrlString.parseHash(hash);\r\n // If # symbol was not present, above will return empty string, so give original hash value\r\n const deserializedHash: ServerAuthorizationCodeResponse = StringUtils.queryStringToObject(StringUtils.isEmpty(parsedHash) ? hash : parsedHash);\r\n // Check if deserialization didn't work\r\n if (!deserializedHash) {\r\n throw ClientAuthError.createHashNotDeserializedError(JSON.stringify(deserializedHash));\r\n }\r\n return deserializedHash;\r\n }\r\n\r\n /**\r\n * Returns URL query string as server auth code response object.\r\n */\r\n static getDeserializedQueryString(query: string): ServerAuthorizationCodeResponse {\r\n // Check if given query is empty\r\n if (StringUtils.isEmpty(query)) {\r\n return {};\r\n }\r\n // Strip the ? symbol if present\r\n const parsedQueryString = UrlString.parseQueryString(query);\r\n // If ? symbol was not present, above will return empty string, so give original query value\r\n const deserializedQueryString: ServerAuthorizationCodeResponse = StringUtils.queryStringToObject(StringUtils.isEmpty(parsedQueryString) ? query : parsedQueryString);\r\n // Check if deserialization didn't work\r\n if (!deserializedQueryString) {\r\n throw ClientAuthError.createHashNotDeserializedError(JSON.stringify(deserializedQueryString));\r\n }\r\n return deserializedQueryString;\r\n }\r\n\r\n /**\r\n * Check if the hash of the URL string contains known properties\r\n */\r\n static hashContainsKnownProperties(hash: string): boolean {\r\n if (StringUtils.isEmpty(hash) || hash.indexOf(\"=\") < 0) {\r\n // Hash doesn't contain key/value pairs\r\n return false;\r\n }\r\n\r\n const parameters: ServerAuthorizationCodeResponse = UrlString.getDeserializedHash(hash);\r\n return !!(\r\n parameters.code ||\r\n parameters.error_description ||\r\n parameters.error ||\r\n parameters.state\r\n );\r\n }\r\n}\r\n","/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License.\r\n */\r\n\r\nimport { ICrypto, SignedHttpRequestParameters } from \"./ICrypto\";\r\nimport { TimeUtils } from \"../utils/TimeUtils\";\r\nimport { UrlString } from \"../url/UrlString\";\r\n\r\n/**\r\n * See eSTS docs for more info.\r\n * - A kid element, with the value containing an RFC 7638-compliant JWK thumbprint that is base64 encoded.\r\n * - xms_ksl element, representing the storage location of the key's secret component on the client device. One of two values:\r\n * - sw: software storage\r\n * - uhw: hardware storage\r\n */\r\ntype ReqCnf = {\r\n kid: string;\r\n xms_ksl: KeyLocation;\r\n};\r\n\r\nexport type ReqCnfData = {\r\n kid: string;\r\n reqCnfString: string;\r\n reqCnfHash: string;\r\n};\r\n\r\nenum KeyLocation {\r\n SW = \"sw\",\r\n UHW = \"uhw\"\r\n}\r\n\r\nexport class PopTokenGenerator {\r\n\r\n private cryptoUtils: ICrypto;\r\n\r\n constructor(cryptoUtils: ICrypto) {\r\n this.cryptoUtils = cryptoUtils;\r\n }\r\n\r\n /**\r\n * Generates the req_cnf validated at the RP in the POP protocol for SHR parameters\r\n * and returns an object containing the keyid, the full req_cnf string and the req_cnf string hash\r\n * @param request\r\n * @returns\r\n */\r\n async generateCnf(request: SignedHttpRequestParameters): Promise {\r\n const reqCnf = await this.generateKid(request);\r\n const reqCnfString: string = this.cryptoUtils.base64Encode(JSON.stringify(reqCnf));\r\n\r\n return {\r\n kid: reqCnf.kid,\r\n reqCnfString, \r\n reqCnfHash: await this.cryptoUtils.hashString(reqCnfString) \r\n };\r\n }\r\n\r\n /**\r\n * Generates key_id for a SHR token request\r\n * @param request\r\n * @returns\r\n */\r\n async generateKid(request: SignedHttpRequestParameters): Promise {\r\n const kidThumbprint = await this.cryptoUtils.getPublicKeyThumbprint(request);\r\n\r\n return {\r\n kid: kidThumbprint,\r\n xms_ksl: KeyLocation.SW\r\n };\r\n }\r\n\r\n /**\r\n * Signs the POP access_token with the local generated key-pair\r\n * @param accessToken\r\n * @param request\r\n * @returns\r\n */\r\n async signPopToken(accessToken: string, keyId: string, request: SignedHttpRequestParameters): Promise {\r\n return this.signPayload(accessToken, keyId, request);\r\n }\r\n\r\n /**\r\n * Utility function to generate the signed JWT for an access_token\r\n * @param payload\r\n * @param kid\r\n * @param request\r\n * @param claims\r\n * @returns\r\n */\r\n async signPayload(payload: string, keyId: string, request: SignedHttpRequestParameters, claims?: object): Promise {\r\n\r\n // Deconstruct request to extract SHR parameters\r\n const { resourceRequestMethod, resourceRequestUri, shrClaims, shrNonce } = request;\r\n\r\n const resourceUrlString = (resourceRequestUri) ? new UrlString(resourceRequestUri) : undefined;\r\n const resourceUrlComponents = resourceUrlString?.getUrlComponents();\r\n return await this.cryptoUtils.signJwt({\r\n at: payload,\r\n ts: TimeUtils.nowSeconds(),\r\n m: resourceRequestMethod?.toUpperCase(),\r\n u: resourceUrlComponents?.HostNameAndPort,\r\n nonce: shrNonce || this.cryptoUtils.createNewGuid(),\r\n p: resourceUrlComponents?.AbsolutePath,\r\n q: (resourceUrlComponents?.QueryString) ? [[], resourceUrlComponents.QueryString] : undefined,\r\n client_claims: shrClaims || undefined,\r\n ...claims\r\n }, keyId, request.correlationId);\r\n }\r\n}\r\n","/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License.\r\n */\r\n\r\nimport { APP_METADATA, Separators } from \"../../utils/Constants\";\r\n\r\n/**\r\n * APP_METADATA Cache\r\n *\r\n * Key:Value Schema:\r\n *\r\n * Key: appmetadata--\r\n *\r\n * Value:\r\n * {\r\n * clientId: client ID of the application\r\n * environment: entity that issued the token, represented as a full host\r\n * familyId: Family ID identifier, '1' represents Microsoft Family\r\n * }\r\n */\r\nexport class AppMetadataEntity {\r\n clientId: string;\r\n environment: string;\r\n familyId?: string;\r\n\r\n /**\r\n * Generate AppMetadata Cache Key as per the schema: appmetadata--\r\n */\r\n generateAppMetadataKey(): string {\r\n return AppMetadataEntity.generateAppMetadataCacheKey(this.environment, this.clientId);\r\n }\r\n\r\n /**\r\n * Generate AppMetadata Cache Key\r\n */\r\n static generateAppMetadataCacheKey(environment: string, clientId: string): string {\r\n const appMetaDataKeyArray: Array = [\r\n APP_METADATA,\r\n environment,\r\n clientId,\r\n ];\r\n return appMetaDataKeyArray.join(Separators.CACHE_KEY_SEPARATOR).toLowerCase();\r\n }\r\n\r\n /**\r\n * Creates AppMetadataEntity\r\n * @param clientId\r\n * @param environment\r\n * @param familyId\r\n */\r\n static createAppMetadataEntity(clientId: string, environment: string, familyId?: string): AppMetadataEntity {\r\n const appMetadata = new AppMetadataEntity();\r\n\r\n appMetadata.clientId = clientId;\r\n appMetadata.environment = environment;\r\n if (familyId) {\r\n appMetadata.familyId = familyId;\r\n }\r\n\r\n return appMetadata;\r\n }\r\n\r\n /**\r\n * Validates an entity: checks for all expected params\r\n * @param entity\r\n */\r\n static isAppMetadataEntity(key: string, entity: object): boolean {\r\n\r\n if (!entity) {\r\n return false;\r\n }\r\n\r\n return (\r\n key.indexOf(APP_METADATA) === 0 &&\r\n entity.hasOwnProperty(\"clientId\") &&\r\n entity.hasOwnProperty(\"environment\")\r\n );\r\n }\r\n}\r\n","/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License.\r\n */\r\n\r\nimport { ISerializableTokenCache } from \"../interface/ISerializableTokenCache\";\r\n\r\n/**\r\n * This class instance helps track the memory changes facilitating\r\n * decisions to read from and write to the persistent cache\r\n */export class TokenCacheContext {\r\n /**\r\n * boolean indicating cache change\r\n */\r\n hasChanged: boolean;\r\n /**\r\n * serializable token cache interface\r\n */\r\n cache: ISerializableTokenCache;\r\n\r\n constructor(tokenCache: ISerializableTokenCache, hasChanged: boolean) {\r\n this.cache = tokenCache;\r\n this.hasChanged = hasChanged;\r\n }\r\n\r\n /**\r\n * boolean which indicates the changes in cache\r\n */\r\n get cacheHasChanged(): boolean {\r\n return this.hasChanged;\r\n }\r\n\r\n /**\r\n * function to retrieve the token cache\r\n */\r\n get tokenCache(): ISerializableTokenCache {\r\n return this.cache;\r\n }\r\n}\r\n","/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License.\r\n */\r\n\r\nimport { ServerAuthorizationTokenResponse } from \"./ServerAuthorizationTokenResponse\";\r\nimport { buildClientInfo} from \"../account/ClientInfo\";\r\nimport { ICrypto } from \"../crypto/ICrypto\";\r\nimport { ClientAuthError } from \"../error/ClientAuthError\";\r\nimport { StringUtils } from \"../utils/StringUtils\";\r\nimport { ServerAuthorizationCodeResponse } from \"./ServerAuthorizationCodeResponse\";\r\nimport { Logger } from \"../logger/Logger\";\r\nimport { ServerError } from \"../error/ServerError\";\r\nimport { AuthToken } from \"../account/AuthToken\";\r\nimport { ScopeSet } from \"../request/ScopeSet\";\r\nimport { AuthenticationResult } from \"./AuthenticationResult\";\r\nimport { AccountEntity } from \"../cache/entities/AccountEntity\";\r\nimport { Authority } from \"../authority/Authority\";\r\nimport { AuthorityType } from \"../authority/AuthorityType\";\r\nimport { IdTokenEntity } from \"../cache/entities/IdTokenEntity\";\r\nimport { AccessTokenEntity } from \"../cache/entities/AccessTokenEntity\";\r\nimport { RefreshTokenEntity } from \"../cache/entities/RefreshTokenEntity\";\r\nimport { InteractionRequiredAuthError } from \"../error/InteractionRequiredAuthError\";\r\nimport { CacheRecord } from \"../cache/entities/CacheRecord\";\r\nimport { CacheManager } from \"../cache/CacheManager\";\r\nimport { ProtocolUtils, RequestStateObject } from \"../utils/ProtocolUtils\";\r\nimport { AuthenticationScheme, Constants, THE_FAMILY_ID } from \"../utils/Constants\";\r\nimport { PopTokenGenerator } from \"../crypto/PopTokenGenerator\";\r\nimport { AppMetadataEntity } from \"../cache/entities/AppMetadataEntity\";\r\nimport { ICachePlugin } from \"../cache/interface/ICachePlugin\";\r\nimport { TokenCacheContext } from \"../cache/persistence/TokenCacheContext\";\r\nimport { ISerializableTokenCache } from \"../cache/interface/ISerializableTokenCache\";\r\nimport { AuthorizationCodePayload } from \"./AuthorizationCodePayload\";\r\nimport { BaseAuthRequest } from \"../request/BaseAuthRequest\";\r\n\r\n/**\r\n * Class that handles response parsing.\r\n */\r\nexport class ResponseHandler {\r\n private clientId: string;\r\n private cacheStorage: CacheManager;\r\n private cryptoObj: ICrypto;\r\n private logger: Logger;\r\n private homeAccountIdentifier: string;\r\n private serializableCache: ISerializableTokenCache | null;\r\n private persistencePlugin: ICachePlugin | null;\r\n\r\n constructor(clientId: string, cacheStorage: CacheManager, cryptoObj: ICrypto, logger: Logger, serializableCache: ISerializableTokenCache | null, persistencePlugin: ICachePlugin | null) {\r\n this.clientId = clientId;\r\n this.cacheStorage = cacheStorage;\r\n this.cryptoObj = cryptoObj;\r\n this.logger = logger;\r\n this.serializableCache = serializableCache;\r\n this.persistencePlugin = persistencePlugin;\r\n }\r\n\r\n /**\r\n * Function which validates server authorization code response.\r\n * @param serverResponseHash\r\n * @param cachedState\r\n * @param cryptoObj\r\n */\r\n validateServerAuthorizationCodeResponse(serverResponseHash: ServerAuthorizationCodeResponse, cachedState: string, cryptoObj: ICrypto): void {\r\n\r\n if (!serverResponseHash.state || !cachedState) {\r\n throw !serverResponseHash.state ? ClientAuthError.createStateNotFoundError(\"Server State\") : ClientAuthError.createStateNotFoundError(\"Cached State\");\r\n }\r\n\r\n if (decodeURIComponent(serverResponseHash.state) !== decodeURIComponent(cachedState)) {\r\n throw ClientAuthError.createStateMismatchError();\r\n }\r\n\r\n // Check for error\r\n if (serverResponseHash.error || serverResponseHash.error_description || serverResponseHash.suberror) {\r\n if (InteractionRequiredAuthError.isInteractionRequiredError(serverResponseHash.error, serverResponseHash.error_description, serverResponseHash.suberror)) {\r\n throw new InteractionRequiredAuthError(serverResponseHash.error || Constants.EMPTY_STRING, serverResponseHash.error_description, serverResponseHash.suberror);\r\n }\r\n\r\n throw new ServerError(serverResponseHash.error || Constants.EMPTY_STRING, serverResponseHash.error_description, serverResponseHash.suberror);\r\n }\r\n\r\n if (serverResponseHash.client_info) {\r\n buildClientInfo(serverResponseHash.client_info, cryptoObj);\r\n }\r\n }\r\n\r\n /**\r\n * Function which validates server authorization token response.\r\n * @param serverResponse\r\n */\r\n validateTokenResponse(serverResponse: ServerAuthorizationTokenResponse): void {\r\n // Check for error\r\n if (serverResponse.error || serverResponse.error_description || serverResponse.suberror) {\r\n if (InteractionRequiredAuthError.isInteractionRequiredError(serverResponse.error, serverResponse.error_description, serverResponse.suberror)) {\r\n throw new InteractionRequiredAuthError(serverResponse.error, serverResponse.error_description, serverResponse.suberror);\r\n }\r\n\r\n const errString = `${serverResponse.error_codes} - [${serverResponse.timestamp}]: ${serverResponse.error_description} - Correlation ID: ${serverResponse.correlation_id} - Trace ID: ${serverResponse.trace_id}`;\r\n throw new ServerError(serverResponse.error, errString, serverResponse.suberror);\r\n }\r\n }\r\n\r\n /**\r\n * Returns a constructed token response based on given string. Also manages the cache updates and cleanups.\r\n * @param serverTokenResponse\r\n * @param authority\r\n */\r\n async handleServerTokenResponse(\r\n serverTokenResponse: ServerAuthorizationTokenResponse,\r\n authority: Authority,\r\n reqTimestamp: number,\r\n request: BaseAuthRequest,\r\n authCodePayload?: AuthorizationCodePayload,\r\n userAssertionHash?: string,\r\n handlingRefreshTokenResponse?: boolean,\r\n forceCacheRefreshTokenResponse?: boolean,\r\n serverRequestId?: string): Promise {\r\n\r\n // create an idToken object (not entity)\r\n let idTokenObj: AuthToken | undefined;\r\n if (serverTokenResponse.id_token) {\r\n idTokenObj = new AuthToken(serverTokenResponse.id_token || Constants.EMPTY_STRING, this.cryptoObj);\r\n\r\n // token nonce check (TODO: Add a warning if no nonce is given?)\r\n if (authCodePayload && !StringUtils.isEmpty(authCodePayload.nonce)) {\r\n if (idTokenObj.claims.nonce !== authCodePayload.nonce) {\r\n throw ClientAuthError.createNonceMismatchError();\r\n }\r\n }\r\n\r\n // token max_age check\r\n if (request.maxAge || (request.maxAge === 0)) {\r\n const authTime = idTokenObj.claims.auth_time;\r\n if (!authTime) {\r\n throw ClientAuthError.createAuthTimeNotFoundError();\r\n }\r\n\r\n AuthToken.checkMaxAge(authTime, request.maxAge);\r\n }\r\n }\r\n\r\n // generate homeAccountId\r\n this.homeAccountIdentifier = AccountEntity.generateHomeAccountId(serverTokenResponse.client_info || Constants.EMPTY_STRING, authority.authorityType, this.logger, this.cryptoObj, idTokenObj);\r\n\r\n // save the response tokens\r\n let requestStateObj: RequestStateObject | undefined;\r\n if (!!authCodePayload && !!authCodePayload.state) {\r\n requestStateObj = ProtocolUtils.parseRequestState(this.cryptoObj, authCodePayload.state);\r\n }\r\n\r\n // Add keyId from request to serverTokenResponse if defined\r\n serverTokenResponse.key_id = serverTokenResponse.key_id || request.sshKid || undefined;\r\n\r\n const cacheRecord = this.generateCacheRecord(serverTokenResponse, authority, reqTimestamp, request, idTokenObj, userAssertionHash, authCodePayload);\r\n let cacheContext;\r\n try {\r\n if (this.persistencePlugin && this.serializableCache) {\r\n this.logger.verbose(\"Persistence enabled, calling beforeCacheAccess\");\r\n cacheContext = new TokenCacheContext(this.serializableCache, true);\r\n await this.persistencePlugin.beforeCacheAccess(cacheContext);\r\n }\r\n /*\r\n * When saving a refreshed tokens to the cache, it is expected that the account that was used is present in the cache.\r\n * If not present, we should return null, as it's the case that another application called removeAccount in between\r\n * the calls to getAllAccounts and acquireTokenSilent. We should not overwrite that removal, unless explicitly flagged by\r\n * the developer, as in the case of refresh token flow used in ADAL Node to MSAL Node migration.\r\n */\r\n if (handlingRefreshTokenResponse && !forceCacheRefreshTokenResponse && cacheRecord.account) {\r\n const key = cacheRecord.account.generateAccountKey();\r\n const account = this.cacheStorage.getAccount(key);\r\n if (!account) {\r\n this.logger.warning(\"Account used to refresh tokens not in persistence, refreshed tokens will not be stored in the cache\");\r\n return ResponseHandler.generateAuthenticationResult(this.cryptoObj, authority, cacheRecord, false, request, idTokenObj, requestStateObj, undefined, serverRequestId);\r\n }\r\n }\r\n await this.cacheStorage.saveCacheRecord(cacheRecord);\r\n } finally {\r\n if (this.persistencePlugin && this.serializableCache && cacheContext) {\r\n this.logger.verbose(\"Persistence enabled, calling afterCacheAccess\");\r\n await this.persistencePlugin.afterCacheAccess(cacheContext);\r\n }\r\n }\r\n return ResponseHandler.generateAuthenticationResult(this.cryptoObj, authority, cacheRecord, false, request, idTokenObj, requestStateObj, serverTokenResponse.spa_code, serverRequestId);\r\n }\r\n\r\n /**\r\n * Generates CacheRecord\r\n * @param serverTokenResponse\r\n * @param idTokenObj\r\n * @param authority\r\n */\r\n private generateCacheRecord(serverTokenResponse: ServerAuthorizationTokenResponse, authority: Authority, reqTimestamp: number, request: BaseAuthRequest, idTokenObj?: AuthToken, userAssertionHash?: string, authCodePayload?: AuthorizationCodePayload): CacheRecord {\r\n const env = authority.getPreferredCache();\r\n if (StringUtils.isEmpty(env)) {\r\n throw ClientAuthError.createInvalidCacheEnvironmentError();\r\n }\r\n\r\n // IdToken: non AAD scenarios can have empty realm\r\n let cachedIdToken: IdTokenEntity | undefined;\r\n let cachedAccount: AccountEntity | undefined;\r\n if (!StringUtils.isEmpty(serverTokenResponse.id_token) && !!idTokenObj) {\r\n cachedIdToken = IdTokenEntity.createIdTokenEntity(\r\n this.homeAccountIdentifier,\r\n env,\r\n serverTokenResponse.id_token || Constants.EMPTY_STRING,\r\n this.clientId,\r\n idTokenObj.claims.tid || Constants.EMPTY_STRING,\r\n );\r\n\r\n cachedAccount = this.generateAccountEntity(\r\n serverTokenResponse,\r\n idTokenObj,\r\n authority,\r\n authCodePayload\r\n );\r\n }\r\n\r\n // AccessToken\r\n let cachedAccessToken: AccessTokenEntity | null = null;\r\n if (!StringUtils.isEmpty(serverTokenResponse.access_token)) {\r\n\r\n // If scopes not returned in server response, use request scopes\r\n const responseScopes = serverTokenResponse.scope ? ScopeSet.fromString(serverTokenResponse.scope) : new ScopeSet(request.scopes || []);\r\n\r\n /*\r\n * Use timestamp calculated before request\r\n * Server may return timestamps as strings, parse to numbers if so.\r\n */\r\n const expiresIn: number = (typeof serverTokenResponse.expires_in === \"string\" ? parseInt(serverTokenResponse.expires_in, 10) : serverTokenResponse.expires_in) || 0;\r\n const extExpiresIn: number = (typeof serverTokenResponse.ext_expires_in === \"string\" ? parseInt(serverTokenResponse.ext_expires_in, 10) : serverTokenResponse.ext_expires_in) || 0;\r\n const refreshIn: number | undefined = (typeof serverTokenResponse.refresh_in === \"string\" ? parseInt(serverTokenResponse.refresh_in, 10) : serverTokenResponse.refresh_in) || undefined;\r\n const tokenExpirationSeconds = reqTimestamp + expiresIn;\r\n const extendedTokenExpirationSeconds = tokenExpirationSeconds + extExpiresIn;\r\n const refreshOnSeconds = refreshIn && refreshIn > 0 ? reqTimestamp + refreshIn : undefined;\r\n\r\n // non AAD scenarios can have empty realm\r\n cachedAccessToken = AccessTokenEntity.createAccessTokenEntity(\r\n this.homeAccountIdentifier,\r\n env,\r\n serverTokenResponse.access_token || Constants.EMPTY_STRING,\r\n this.clientId,\r\n idTokenObj ? idTokenObj.claims.tid || Constants.EMPTY_STRING : authority.tenant,\r\n responseScopes.printScopes(),\r\n tokenExpirationSeconds,\r\n extendedTokenExpirationSeconds,\r\n this.cryptoObj,\r\n refreshOnSeconds,\r\n serverTokenResponse.token_type,\r\n userAssertionHash,\r\n serverTokenResponse.key_id,\r\n request.claims,\r\n request.requestedClaimsHash\r\n );\r\n }\r\n\r\n // refreshToken\r\n let cachedRefreshToken: RefreshTokenEntity | null = null;\r\n if (!StringUtils.isEmpty(serverTokenResponse.refresh_token)) {\r\n cachedRefreshToken = RefreshTokenEntity.createRefreshTokenEntity(\r\n this.homeAccountIdentifier,\r\n env,\r\n serverTokenResponse.refresh_token || Constants.EMPTY_STRING,\r\n this.clientId,\r\n serverTokenResponse.foci,\r\n userAssertionHash\r\n );\r\n }\r\n\r\n // appMetadata\r\n let cachedAppMetadata: AppMetadataEntity | null = null;\r\n if (!StringUtils.isEmpty(serverTokenResponse.foci)) {\r\n cachedAppMetadata = AppMetadataEntity.createAppMetadataEntity(this.clientId, env, serverTokenResponse.foci);\r\n }\r\n\r\n return new CacheRecord(cachedAccount, cachedIdToken, cachedAccessToken, cachedRefreshToken, cachedAppMetadata);\r\n }\r\n\r\n /**\r\n * Generate Account\r\n * @param serverTokenResponse\r\n * @param idToken\r\n * @param authority\r\n */\r\n private generateAccountEntity(serverTokenResponse: ServerAuthorizationTokenResponse, idToken: AuthToken, authority: Authority, authCodePayload?: AuthorizationCodePayload): AccountEntity {\r\n const authorityType = authority.authorityType;\r\n const cloudGraphHostName = authCodePayload ? authCodePayload.cloud_graph_host_name : Constants.EMPTY_STRING;\r\n const msGraphhost = authCodePayload ? authCodePayload.msgraph_host : Constants.EMPTY_STRING;\r\n\r\n // ADFS does not require client_info in the response\r\n if (authorityType === AuthorityType.Adfs) {\r\n this.logger.verbose(\"Authority type is ADFS, creating ADFS account\");\r\n return AccountEntity.createGenericAccount(this.homeAccountIdentifier, idToken, authority, cloudGraphHostName, msGraphhost);\r\n }\r\n\r\n // This fallback applies to B2C as well as they fall under an AAD account type.\r\n if (StringUtils.isEmpty(serverTokenResponse.client_info) && authority.protocolMode === \"AAD\") {\r\n throw ClientAuthError.createClientInfoEmptyError();\r\n }\r\n\r\n return serverTokenResponse.client_info ?\r\n AccountEntity.createAccount(serverTokenResponse.client_info, this.homeAccountIdentifier, idToken, authority, cloudGraphHostName, msGraphhost) :\r\n AccountEntity.createGenericAccount(this.homeAccountIdentifier, idToken, authority, cloudGraphHostName, msGraphhost);\r\n }\r\n\r\n /**\r\n * Creates an @AuthenticationResult from @CacheRecord , @IdToken , and a boolean that states whether or not the result is from cache.\r\n *\r\n * Optionally takes a state string that is set as-is in the response.\r\n *\r\n * @param cacheRecord\r\n * @param idTokenObj\r\n * @param fromTokenCache\r\n * @param stateString\r\n */\r\n static async generateAuthenticationResult(\r\n cryptoObj: ICrypto,\r\n authority: Authority,\r\n cacheRecord: CacheRecord,\r\n fromTokenCache: boolean,\r\n request: BaseAuthRequest,\r\n idTokenObj?: AuthToken,\r\n requestState?: RequestStateObject,\r\n code?: string,\r\n requestId?: string\r\n ): Promise {\r\n let accessToken: string = Constants.EMPTY_STRING;\r\n let responseScopes: Array = [];\r\n let expiresOn: Date | null = null;\r\n let extExpiresOn: Date | undefined;\r\n let familyId: string = Constants.EMPTY_STRING;\r\n\r\n if (cacheRecord.accessToken) {\r\n if (cacheRecord.accessToken.tokenType === AuthenticationScheme.POP) {\r\n const popTokenGenerator: PopTokenGenerator = new PopTokenGenerator(cryptoObj);\r\n const { secret, keyId } = cacheRecord.accessToken;\r\n\r\n if (!keyId) {\r\n throw ClientAuthError.createKeyIdMissingError();\r\n }\r\n\r\n accessToken = await popTokenGenerator.signPopToken(secret, keyId, request);\r\n } else {\r\n accessToken = cacheRecord.accessToken.secret;\r\n }\r\n responseScopes = ScopeSet.fromString(cacheRecord.accessToken.target).asArray();\r\n expiresOn = new Date(Number(cacheRecord.accessToken.expiresOn) * 1000);\r\n extExpiresOn = new Date(Number(cacheRecord.accessToken.extendedExpiresOn) * 1000);\r\n }\r\n\r\n if (cacheRecord.appMetadata) {\r\n familyId = cacheRecord.appMetadata.familyId === THE_FAMILY_ID ? THE_FAMILY_ID : Constants.EMPTY_STRING;\r\n }\r\n const uid = idTokenObj?.claims.oid || idTokenObj?.claims.sub || Constants.EMPTY_STRING;\r\n const tid = idTokenObj?.claims.tid || Constants.EMPTY_STRING;\r\n\r\n return {\r\n authority: authority.canonicalAuthority,\r\n uniqueId: uid,\r\n tenantId: tid,\r\n scopes: responseScopes,\r\n account: cacheRecord.account ? cacheRecord.account.getAccountInfo() : null,\r\n idToken: idTokenObj ? idTokenObj.rawToken : Constants.EMPTY_STRING,\r\n idTokenClaims: idTokenObj ? idTokenObj.claims : {},\r\n accessToken: accessToken,\r\n fromCache: fromTokenCache,\r\n expiresOn: expiresOn,\r\n correlationId: request.correlationId,\r\n requestId: requestId || Constants.EMPTY_STRING,\r\n extExpiresOn: extExpiresOn,\r\n familyId: familyId,\r\n tokenType: cacheRecord.accessToken?.tokenType || Constants.EMPTY_STRING,\r\n state: requestState ? requestState.userRequestState : Constants.EMPTY_STRING,\r\n cloudGraphHostName: cacheRecord.account?.cloudGraphHostName || Constants.EMPTY_STRING,\r\n msGraphHost: cacheRecord.account?.msGraphHost || Constants.EMPTY_STRING,\r\n code,\r\n fromNativeBroker: false,\r\n };\r\n }\r\n}\r\n","/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License.\r\n */\r\n\r\nimport { BaseClient } from \"./BaseClient\";\r\nimport { CommonAuthorizationUrlRequest } from \"../request/CommonAuthorizationUrlRequest\";\r\nimport { CommonAuthorizationCodeRequest } from \"../request/CommonAuthorizationCodeRequest\";\r\nimport { Authority } from \"../authority/Authority\";\r\nimport { RequestParameterBuilder } from \"../request/RequestParameterBuilder\";\r\nimport { GrantType, AuthenticationScheme, PromptValue, Separators, AADServerParamKeys, HeaderNames } from \"../utils/Constants\";\r\nimport { ClientConfiguration } from \"../config/ClientConfiguration\";\r\nimport { ServerAuthorizationTokenResponse } from \"../response/ServerAuthorizationTokenResponse\";\r\nimport { NetworkResponse } from \"../network/NetworkManager\";\r\nimport { ResponseHandler } from \"../response/ResponseHandler\";\r\nimport { AuthenticationResult } from \"../response/AuthenticationResult\";\r\nimport { StringUtils } from \"../utils/StringUtils\";\r\nimport { ClientAuthError } from \"../error/ClientAuthError\";\r\nimport { UrlString } from \"../url/UrlString\";\r\nimport { ServerAuthorizationCodeResponse } from \"../response/ServerAuthorizationCodeResponse\";\r\nimport { CommonEndSessionRequest } from \"../request/CommonEndSessionRequest\";\r\nimport { PopTokenGenerator } from \"../crypto/PopTokenGenerator\";\r\nimport { RequestThumbprint } from \"../network/RequestThumbprint\";\r\nimport { AuthorizationCodePayload } from \"../response/AuthorizationCodePayload\";\r\nimport { TimeUtils } from \"../utils/TimeUtils\";\r\nimport { AccountInfo } from \"../account/AccountInfo\";\r\nimport { buildClientInfoFromHomeAccountId, buildClientInfo } from \"../account/ClientInfo\";\r\nimport { CcsCredentialType, CcsCredential } from \"../account/CcsCredential\";\r\nimport { ClientConfigurationError } from \"../error/ClientConfigurationError\";\r\nimport { RequestValidator } from \"../request/RequestValidator\";\r\nimport { IPerformanceClient } from \"../telemetry/performance/IPerformanceClient\";\r\n\r\n/**\r\n * Oauth2.0 Authorization Code client\r\n */\r\nexport class AuthorizationCodeClient extends BaseClient {\r\n // Flag to indicate if client is for hybrid spa auth code redemption\r\n protected includeRedirectUri: boolean = true;\r\n\r\n constructor(configuration: ClientConfiguration, performanceClient?: IPerformanceClient) {\r\n super(configuration, performanceClient);\r\n }\r\n\r\n /**\r\n * Creates the URL of the authorization request letting the user input credentials and consent to the\r\n * application. The URL target the /authorize endpoint of the authority configured in the\r\n * application object.\r\n *\r\n * Once the user inputs their credentials and consents, the authority will send a response to the redirect URI\r\n * sent in the request and should contain an authorization code, which can then be used to acquire tokens via\r\n * acquireToken(AuthorizationCodeRequest)\r\n * @param request\r\n */\r\n async getAuthCodeUrl(request: CommonAuthorizationUrlRequest): Promise {\r\n const queryString = await this.createAuthCodeUrlQueryString(request);\r\n\r\n return UrlString.appendQueryString(this.authority.authorizationEndpoint, queryString);\r\n }\r\n\r\n /**\r\n * API to acquire a token in exchange of 'authorization_code` acquired by the user in the first leg of the\r\n * authorization_code_grant\r\n * @param request\r\n */\r\n async acquireToken(request: CommonAuthorizationCodeRequest, authCodePayload?: AuthorizationCodePayload): Promise {\r\n \r\n // @ts-ignore\r\n const atsMeasurement = this.performanceClient?.startMeasurement(\"AuthCodeClientAcquireToken\", request.correlationId);\r\n this.logger.info(\"in acquireToken call in auth-code client\");\r\n if (!request || StringUtils.isEmpty(request.code)) {\r\n throw ClientAuthError.createTokenRequestCannotBeMadeError();\r\n }\r\n\r\n const reqTimestamp = TimeUtils.nowSeconds();\r\n const response = await this.executeTokenRequest(this.authority, request);\r\n\r\n // Retrieve requestId from response headers\r\n const requestId = response.headers?.[HeaderNames.X_MS_REQUEST_ID];\r\n const httpVerAuthority = response.headers?.[HeaderNames.X_MS_HTTP_VERSION];\r\n if(httpVerAuthority)\r\n {\r\n atsMeasurement?.addStaticFields({\r\n httpVerAuthority\r\n });\r\n }\r\n const responseHandler = new ResponseHandler(\r\n this.config.authOptions.clientId,\r\n this.cacheManager,\r\n this.cryptoUtils,\r\n this.logger,\r\n this.config.serializableCache,\r\n this.config.persistencePlugin\r\n );\r\n\r\n // Validate response. This function throws a server error if an error is returned by the server.\r\n responseHandler.validateTokenResponse(response.body);\r\n return responseHandler.handleServerTokenResponse(response.body,\r\n this.authority,\r\n reqTimestamp,\r\n request,\r\n authCodePayload,\r\n undefined,\r\n undefined,\r\n undefined,\r\n requestId,\r\n ).then((result: AuthenticationResult) => {\r\n atsMeasurement?.endMeasurement({\r\n success: true\r\n });\r\n return result;\r\n })\r\n .catch((error) => {\r\n this.logger.verbose(\"Error in fetching token in ACC\", request.correlationId);\r\n atsMeasurement?.endMeasurement({\r\n errorCode: error.errorCode,\r\n subErrorCode: error.subError,\r\n success: false\r\n });\r\n throw error;\r\n });\r\n }\r\n\r\n /**\r\n * Handles the hash fragment response from public client code request. Returns a code response used by\r\n * the client to exchange for a token in acquireToken.\r\n * @param hashFragment\r\n */\r\n handleFragmentResponse(hashFragment: string, cachedState: string): AuthorizationCodePayload {\r\n // Handle responses.\r\n const responseHandler = new ResponseHandler(this.config.authOptions.clientId, this.cacheManager, this.cryptoUtils, this.logger, null, null);\r\n\r\n // Deserialize hash fragment response parameters.\r\n const hashUrlString = new UrlString(hashFragment);\r\n // Deserialize hash fragment response parameters.\r\n const serverParams: ServerAuthorizationCodeResponse = UrlString.getDeserializedHash(hashUrlString.getHash());\r\n\r\n // Get code response\r\n responseHandler.validateServerAuthorizationCodeResponse(serverParams, cachedState, this.cryptoUtils);\r\n\r\n // throw when there is no auth code in the response\r\n if (!serverParams.code) {\r\n throw ClientAuthError.createNoAuthCodeInServerResponseError();\r\n }\r\n return {\r\n ...serverParams,\r\n // Code param is optional in ServerAuthorizationCodeResponse but required in AuthorizationCodePaylod\r\n code: serverParams.code\r\n };\r\n }\r\n\r\n /**\r\n * Used to log out the current user, and redirect the user to the postLogoutRedirectUri.\r\n * Default behaviour is to redirect the user to `window.location.href`.\r\n * @param authorityUri\r\n */\r\n getLogoutUri(logoutRequest: CommonEndSessionRequest): string {\r\n // Throw error if logoutRequest is null/undefined\r\n if (!logoutRequest) {\r\n throw ClientConfigurationError.createEmptyLogoutRequestError();\r\n }\r\n const queryString = this.createLogoutUrlQueryString(logoutRequest);\r\n\r\n // Construct logout URI\r\n return UrlString.appendQueryString(this.authority.endSessionEndpoint, queryString);\r\n }\r\n\r\n /**\r\n * Executes POST request to token endpoint\r\n * @param authority\r\n * @param request\r\n */\r\n private async executeTokenRequest(authority: Authority, request: CommonAuthorizationCodeRequest): Promise> {\r\n const thumbprint: RequestThumbprint = {\r\n clientId: this.config.authOptions.clientId,\r\n authority: authority.canonicalAuthority,\r\n scopes: request.scopes,\r\n claims: request.claims,\r\n authenticationScheme: request.authenticationScheme,\r\n resourceRequestMethod: request.resourceRequestMethod,\r\n resourceRequestUri: request.resourceRequestUri,\r\n shrClaims: request.shrClaims,\r\n sshKid: request.sshKid\r\n };\r\n\r\n const requestBody = await this.createTokenRequestBody(request);\r\n const queryParameters = this.createTokenQueryParameters(request);\r\n let ccsCredential: CcsCredential | undefined = undefined;\r\n if (request.clientInfo) {\r\n try {\r\n const clientInfo = buildClientInfo(request.clientInfo, this.cryptoUtils);\r\n ccsCredential = {\r\n credential: `${clientInfo.uid}${Separators.CLIENT_INFO_SEPARATOR}${clientInfo.utid}`,\r\n type: CcsCredentialType.HOME_ACCOUNT_ID\r\n };\r\n } catch (e) {\r\n this.logger.verbose(\"Could not parse client info for CCS Header: \" + e);\r\n }\r\n }\r\n const headers: Record = this.createTokenRequestHeaders(ccsCredential || request.ccsCredential);\r\n const endpoint = StringUtils.isEmpty(queryParameters) ? authority.tokenEndpoint : `${authority.tokenEndpoint}?${queryParameters}`;\r\n\r\n return this.executePostToTokenEndpoint(endpoint, requestBody, headers, thumbprint);\r\n }\r\n\r\n /**\r\n * Creates query string for the /token request\r\n * @param request\r\n */\r\n private createTokenQueryParameters(request: CommonAuthorizationCodeRequest): string {\r\n const parameterBuilder = new RequestParameterBuilder();\r\n\r\n if (request.tokenQueryParameters) {\r\n parameterBuilder.addExtraQueryParameters(request.tokenQueryParameters);\r\n }\r\n\r\n return parameterBuilder.createQueryString();\r\n }\r\n\r\n /**\r\n * Generates a map for all the params to be sent to the service\r\n * @param request\r\n */\r\n private async createTokenRequestBody(request: CommonAuthorizationCodeRequest): Promise {\r\n const parameterBuilder = new RequestParameterBuilder();\r\n\r\n parameterBuilder.addClientId(this.config.authOptions.clientId);\r\n\r\n /*\r\n * For hybrid spa flow, there will be a code but no verifier\r\n * In this scenario, don't include redirect uri as auth code will not be bound to redirect URI\r\n */\r\n if (!this.includeRedirectUri) {\r\n // Just validate\r\n RequestValidator.validateRedirectUri(request.redirectUri);\r\n } else {\r\n // Validate and include redirect uri\r\n parameterBuilder.addRedirectUri(request.redirectUri);\r\n }\r\n\r\n // Add scope array, parameter builder will add default scopes and dedupe\r\n parameterBuilder.addScopes(request.scopes);\r\n\r\n // add code: user set, not validated\r\n parameterBuilder.addAuthorizationCode(request.code);\r\n\r\n // Add library metadata\r\n parameterBuilder.addLibraryInfo(this.config.libraryInfo);\r\n parameterBuilder.addApplicationTelemetry(this.config.telemetry.application);\r\n parameterBuilder.addThrottling();\r\n\r\n if (this.serverTelemetryManager) {\r\n parameterBuilder.addServerTelemetry(this.serverTelemetryManager);\r\n }\r\n\r\n // add code_verifier if passed\r\n if (request.codeVerifier) {\r\n parameterBuilder.addCodeVerifier(request.codeVerifier);\r\n }\r\n\r\n if (this.config.clientCredentials.clientSecret) {\r\n parameterBuilder.addClientSecret(this.config.clientCredentials.clientSecret);\r\n }\r\n\r\n if (this.config.clientCredentials.clientAssertion) {\r\n const clientAssertion = this.config.clientCredentials.clientAssertion;\r\n parameterBuilder.addClientAssertion(clientAssertion.assertion);\r\n parameterBuilder.addClientAssertionType(clientAssertion.assertionType);\r\n }\r\n\r\n parameterBuilder.addGrantType(GrantType.AUTHORIZATION_CODE_GRANT);\r\n parameterBuilder.addClientInfo();\r\n\r\n if (request.authenticationScheme === AuthenticationScheme.POP) {\r\n const popTokenGenerator = new PopTokenGenerator(this.cryptoUtils);\r\n const reqCnfData = await popTokenGenerator.generateCnf(request);\r\n // SPA PoP requires full Base64Url encoded req_cnf string (unhashed)\r\n parameterBuilder.addPopToken(reqCnfData.reqCnfString);\r\n } else if (request.authenticationScheme === AuthenticationScheme.SSH) {\r\n if (request.sshJwk) {\r\n parameterBuilder.addSshJwk(request.sshJwk);\r\n } else {\r\n throw ClientConfigurationError.createMissingSshJwkError();\r\n }\r\n }\r\n\r\n const correlationId = request.correlationId || this.config.cryptoInterface.createNewGuid();\r\n parameterBuilder.addCorrelationId(correlationId);\r\n\r\n if (!StringUtils.isEmptyObj(request.claims) || this.config.authOptions.clientCapabilities && this.config.authOptions.clientCapabilities.length > 0) {\r\n parameterBuilder.addClaims(request.claims, this.config.authOptions.clientCapabilities);\r\n }\r\n\r\n let ccsCred: CcsCredential | undefined = undefined;\r\n if (request.clientInfo) {\r\n try {\r\n const clientInfo = buildClientInfo(request.clientInfo, this.cryptoUtils);\r\n ccsCred = {\r\n credential: `${clientInfo.uid}${Separators.CLIENT_INFO_SEPARATOR}${clientInfo.utid}`,\r\n type: CcsCredentialType.HOME_ACCOUNT_ID\r\n };\r\n } catch (e) {\r\n this.logger.verbose(\"Could not parse client info for CCS Header: \" + e);\r\n }\r\n } else {\r\n ccsCred = request.ccsCredential;\r\n }\r\n\r\n // Adds these as parameters in the request instead of headers to prevent CORS preflight request\r\n if (this.config.systemOptions.preventCorsPreflight && ccsCred) {\r\n switch (ccsCred.type) {\r\n case CcsCredentialType.HOME_ACCOUNT_ID:\r\n try {\r\n const clientInfo = buildClientInfoFromHomeAccountId(ccsCred.credential);\r\n parameterBuilder.addCcsOid(clientInfo);\r\n } catch (e) {\r\n this.logger.verbose(\"Could not parse home account ID for CCS Header: \" + e);\r\n }\r\n break;\r\n case CcsCredentialType.UPN:\r\n parameterBuilder.addCcsUpn(ccsCred.credential);\r\n break;\r\n }\r\n }\r\n\r\n if (request.tokenBodyParameters) {\r\n parameterBuilder.addExtraQueryParameters(request.tokenBodyParameters);\r\n }\r\n\r\n // Add hybrid spa parameters if not already provided\r\n if (request.enableSpaAuthorizationCode && (!request.tokenBodyParameters || !request.tokenBodyParameters[AADServerParamKeys.RETURN_SPA_CODE])) {\r\n parameterBuilder.addExtraQueryParameters({\r\n [AADServerParamKeys.RETURN_SPA_CODE]: \"1\"\r\n });\r\n }\r\n\r\n return parameterBuilder.createQueryString();\r\n }\r\n\r\n /**\r\n * This API validates the `AuthorizationCodeUrlRequest` and creates a URL\r\n * @param request\r\n */\r\n private async createAuthCodeUrlQueryString(request: CommonAuthorizationUrlRequest): Promise {\r\n const parameterBuilder = new RequestParameterBuilder();\r\n\r\n parameterBuilder.addClientId(this.config.authOptions.clientId);\r\n\r\n const requestScopes = [...request.scopes || [], ...request.extraScopesToConsent || []];\r\n parameterBuilder.addScopes(requestScopes);\r\n\r\n // validate the redirectUri (to be a non null value)\r\n parameterBuilder.addRedirectUri(request.redirectUri);\r\n\r\n // generate the correlationId if not set by the user and add\r\n const correlationId = request.correlationId || this.config.cryptoInterface.createNewGuid();\r\n parameterBuilder.addCorrelationId(correlationId);\r\n\r\n // add response_mode. If not passed in it defaults to query.\r\n parameterBuilder.addResponseMode(request.responseMode);\r\n\r\n // add response_type = code\r\n parameterBuilder.addResponseTypeCode();\r\n\r\n // add library info parameters\r\n parameterBuilder.addLibraryInfo(this.config.libraryInfo);\r\n parameterBuilder.addApplicationTelemetry(this.config.telemetry.application);\r\n\r\n // add client_info=1\r\n parameterBuilder.addClientInfo();\r\n\r\n if (request.codeChallenge && request.codeChallengeMethod) {\r\n parameterBuilder.addCodeChallengeParams(request.codeChallenge, request.codeChallengeMethod);\r\n }\r\n\r\n if (request.prompt) {\r\n parameterBuilder.addPrompt(request.prompt);\r\n }\r\n\r\n if (request.domainHint) {\r\n parameterBuilder.addDomainHint(request.domainHint);\r\n }\r\n\r\n // Add sid or loginHint with preference for login_hint claim (in request) -> sid -> loginHint (upn/email) -> username of AccountInfo object\r\n if (request.prompt !== PromptValue.SELECT_ACCOUNT) {\r\n // AAD will throw if prompt=select_account is passed with an account hint\r\n if (request.sid && request.prompt === PromptValue.NONE) {\r\n // SessionID is only used in silent calls\r\n this.logger.verbose(\"createAuthCodeUrlQueryString: Prompt is none, adding sid from request\");\r\n parameterBuilder.addSid(request.sid);\r\n } else if (request.account) {\r\n const accountSid = this.extractAccountSid(request.account);\r\n const accountLoginHintClaim = this.extractLoginHint(request.account);\r\n // If login_hint claim is present, use it over sid/username\r\n if (accountLoginHintClaim) {\r\n this.logger.verbose(\"createAuthCodeUrlQueryString: login_hint claim present on account\");\r\n parameterBuilder.addLoginHint(accountLoginHintClaim);\r\n try {\r\n const clientInfo = buildClientInfoFromHomeAccountId(request.account.homeAccountId);\r\n parameterBuilder.addCcsOid(clientInfo);\r\n } catch (e) {\r\n this.logger.verbose(\"createAuthCodeUrlQueryString: Could not parse home account ID for CCS Header\");\r\n }\r\n } else if (accountSid && request.prompt === PromptValue.NONE) {\r\n /*\r\n * If account and loginHint are provided, we will check account first for sid before adding loginHint\r\n * SessionId is only used in silent calls\r\n */\r\n this.logger.verbose(\"createAuthCodeUrlQueryString: Prompt is none, adding sid from account\");\r\n parameterBuilder.addSid(accountSid);\r\n try {\r\n const clientInfo = buildClientInfoFromHomeAccountId(request.account.homeAccountId);\r\n parameterBuilder.addCcsOid(clientInfo);\r\n } catch (e) {\r\n this.logger.verbose(\"createAuthCodeUrlQueryString: Could not parse home account ID for CCS Header\");\r\n }\r\n } else if (request.loginHint) {\r\n this.logger.verbose(\"createAuthCodeUrlQueryString: Adding login_hint from request\");\r\n parameterBuilder.addLoginHint(request.loginHint);\r\n parameterBuilder.addCcsUpn(request.loginHint);\r\n } else if (request.account.username) {\r\n // Fallback to account username if provided\r\n this.logger.verbose(\"createAuthCodeUrlQueryString: Adding login_hint from account\");\r\n parameterBuilder.addLoginHint(request.account.username);\r\n try {\r\n const clientInfo = buildClientInfoFromHomeAccountId(request.account.homeAccountId);\r\n parameterBuilder.addCcsOid(clientInfo);\r\n } catch (e) {\r\n this.logger.verbose(\"createAuthCodeUrlQueryString: Could not parse home account ID for CCS Header\");\r\n }\r\n }\r\n } else if (request.loginHint) {\r\n this.logger.verbose(\"createAuthCodeUrlQueryString: No account, adding login_hint from request\");\r\n parameterBuilder.addLoginHint(request.loginHint);\r\n parameterBuilder.addCcsUpn(request.loginHint);\r\n }\r\n } else {\r\n this.logger.verbose(\"createAuthCodeUrlQueryString: Prompt is select_account, ignoring account hints\");\r\n }\r\n\r\n if (request.nonce) {\r\n parameterBuilder.addNonce(request.nonce);\r\n }\r\n\r\n if (request.state) {\r\n parameterBuilder.addState(request.state);\r\n }\r\n\r\n if (!StringUtils.isEmpty(request.claims) || this.config.authOptions.clientCapabilities && this.config.authOptions.clientCapabilities.length > 0) {\r\n parameterBuilder.addClaims(request.claims, this.config.authOptions.clientCapabilities);\r\n }\r\n\r\n if (request.extraQueryParameters) {\r\n parameterBuilder.addExtraQueryParameters(request.extraQueryParameters);\r\n }\r\n\r\n if (request.nativeBroker) {\r\n // signal ests that this is a WAM call\r\n parameterBuilder.addNativeBroker();\r\n\r\n // pass the req_cnf for POP\r\n if (request.authenticationScheme === AuthenticationScheme.POP) {\r\n const popTokenGenerator = new PopTokenGenerator(this.cryptoUtils);\r\n // to reduce the URL length, it is recommended to send the hash of the req_cnf instead of the whole string\r\n const reqCnfData = await popTokenGenerator.generateCnf(request);\r\n parameterBuilder.addPopToken(reqCnfData.reqCnfHash);\r\n }\r\n }\r\n\r\n return parameterBuilder.createQueryString();\r\n }\r\n\r\n /**\r\n * This API validates the `EndSessionRequest` and creates a URL\r\n * @param request\r\n */\r\n private createLogoutUrlQueryString(request: CommonEndSessionRequest): string {\r\n const parameterBuilder = new RequestParameterBuilder();\r\n\r\n if (request.postLogoutRedirectUri) {\r\n parameterBuilder.addPostLogoutRedirectUri(request.postLogoutRedirectUri);\r\n }\r\n\r\n if (request.correlationId) {\r\n parameterBuilder.addCorrelationId(request.correlationId);\r\n }\r\n\r\n if (request.idTokenHint) {\r\n parameterBuilder.addIdTokenHint(request.idTokenHint);\r\n }\r\n\r\n if (request.state) {\r\n parameterBuilder.addState(request.state);\r\n }\r\n\r\n if (request.logoutHint) {\r\n parameterBuilder.addLogoutHint(request.logoutHint);\r\n }\r\n\r\n if (request.extraQueryParameters) {\r\n parameterBuilder.addExtraQueryParameters(request.extraQueryParameters);\r\n }\r\n\r\n return parameterBuilder.createQueryString();\r\n }\r\n\r\n /**\r\n * Helper to get sid from account. Returns null if idTokenClaims are not present or sid is not present.\r\n * @param account\r\n */\r\n private extractAccountSid(account: AccountInfo): string | null {\r\n return account.idTokenClaims?.sid || null;\r\n }\r\n\r\n private extractLoginHint(account: AccountInfo): string | null {\r\n return account.idTokenClaims?.login_hint || null;\r\n }\r\n}\r\n","/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License.\r\n */\r\n\r\nimport { DeviceCodeResponse, ServerDeviceCodeResponse } from \"../response/DeviceCodeResponse\";\r\nimport { BaseClient } from \"./BaseClient\";\r\nimport { CommonDeviceCodeRequest } from \"../request/CommonDeviceCodeRequest\";\r\nimport { ClientAuthError } from \"../error/ClientAuthError\";\r\nimport { RequestParameterBuilder } from \"../request/RequestParameterBuilder\";\r\nimport { Constants, GrantType } from \"../utils/Constants\";\r\nimport { ClientConfiguration } from \"../config/ClientConfiguration\";\r\nimport { TimeUtils } from \"../utils/TimeUtils\";\r\nimport { ServerAuthorizationTokenResponse } from \"../response/ServerAuthorizationTokenResponse\";\r\nimport { ResponseHandler } from \"../response/ResponseHandler\";\r\nimport { AuthenticationResult } from \"../response/AuthenticationResult\";\r\nimport { StringUtils } from \"../utils/StringUtils\";\r\nimport { RequestThumbprint } from \"../network/RequestThumbprint\";\r\nimport { ServerError } from \"../error/ServerError\";\r\n\r\n/**\r\n * OAuth2.0 Device code client\r\n */\r\nexport class DeviceCodeClient extends BaseClient {\r\n\r\n constructor(configuration: ClientConfiguration) {\r\n super(configuration);\r\n }\r\n\r\n /**\r\n * Gets device code from device code endpoint, calls back to with device code response, and\r\n * polls token endpoint to exchange device code for tokens\r\n * @param request\r\n */\r\n public async acquireToken(request: CommonDeviceCodeRequest): Promise {\r\n const deviceCodeResponse: DeviceCodeResponse = await this.getDeviceCode(request);\r\n request.deviceCodeCallback(deviceCodeResponse);\r\n const reqTimestamp = TimeUtils.nowSeconds();\r\n const response: ServerAuthorizationTokenResponse = await this.acquireTokenWithDeviceCode(\r\n request,\r\n deviceCodeResponse);\r\n\r\n const responseHandler = new ResponseHandler(\r\n this.config.authOptions.clientId,\r\n this.cacheManager,\r\n this.cryptoUtils,\r\n this.logger,\r\n this.config.serializableCache,\r\n this.config.persistencePlugin\r\n );\r\n\r\n // Validate response. This function throws a server error if an error is returned by the server.\r\n responseHandler.validateTokenResponse(response);\r\n return await responseHandler.handleServerTokenResponse(\r\n response,\r\n this.authority,\r\n reqTimestamp,\r\n request\r\n );\r\n }\r\n\r\n /**\r\n * Creates device code request and executes http GET\r\n * @param request\r\n */\r\n private async getDeviceCode(request: CommonDeviceCodeRequest): Promise {\r\n const queryString = this.createQueryString(request);\r\n const headers = this.createTokenRequestHeaders();\r\n const thumbprint: RequestThumbprint = {\r\n clientId: this.config.authOptions.clientId,\r\n authority: request.authority,\r\n scopes: request.scopes,\r\n claims: request.claims,\r\n authenticationScheme: request.authenticationScheme,\r\n resourceRequestMethod: request.resourceRequestMethod,\r\n resourceRequestUri: request.resourceRequestUri,\r\n shrClaims: request.shrClaims,\r\n sshKid: request.sshKid\r\n };\r\n\r\n return this.executePostRequestToDeviceCodeEndpoint(this.authority.deviceCodeEndpoint, queryString, headers, thumbprint);\r\n }\r\n\r\n /**\r\n * Executes POST request to device code endpoint\r\n * @param deviceCodeEndpoint\r\n * @param queryString\r\n * @param headers\r\n */\r\n private async executePostRequestToDeviceCodeEndpoint(\r\n deviceCodeEndpoint: string,\r\n queryString: string,\r\n headers: Record,\r\n thumbprint: RequestThumbprint): Promise {\r\n\r\n const {\r\n body: {\r\n user_code: userCode,\r\n device_code: deviceCode,\r\n verification_uri: verificationUri,\r\n expires_in: expiresIn,\r\n interval,\r\n message\r\n }\r\n } = await this.networkManager.sendPostRequest(\r\n thumbprint,\r\n deviceCodeEndpoint,\r\n {\r\n body: queryString,\r\n headers: headers,\r\n proxyUrl: this.config.systemOptions.proxyUrl\r\n });\r\n\r\n return {\r\n userCode,\r\n deviceCode,\r\n verificationUri,\r\n expiresIn,\r\n interval,\r\n message\r\n };\r\n }\r\n\r\n /**\r\n * Create device code endpoint query parameters and returns string\r\n */\r\n private createQueryString(request: CommonDeviceCodeRequest): string {\r\n\r\n const parameterBuilder: RequestParameterBuilder = new RequestParameterBuilder();\r\n\r\n parameterBuilder.addScopes(request.scopes);\r\n parameterBuilder.addClientId(this.config.authOptions.clientId);\r\n\r\n if (!StringUtils.isEmpty(request.claims) || this.config.authOptions.clientCapabilities && this.config.authOptions.clientCapabilities.length > 0) {\r\n parameterBuilder.addClaims(request.claims, this.config.authOptions.clientCapabilities);\r\n }\r\n\r\n return parameterBuilder.createQueryString();\r\n }\r\n\r\n /**\r\n * Breaks the polling with specific conditions.\r\n * @param request CommonDeviceCodeRequest\r\n * @param deviceCodeResponse DeviceCodeResponse\r\n */\r\n private continuePolling(\r\n deviceCodeExpirationTime: number,\r\n userSpecifiedTimeout?: number,\r\n userSpecifiedCancelFlag?: boolean,\r\n ): boolean {\r\n if (userSpecifiedCancelFlag) {\r\n this.logger.error(\"Token request cancelled by setting DeviceCodeRequest.cancel = true\");\r\n throw ClientAuthError.createDeviceCodeCancelledError();\r\n } else if (userSpecifiedTimeout && userSpecifiedTimeout < deviceCodeExpirationTime && TimeUtils.nowSeconds() > userSpecifiedTimeout) {\r\n this.logger.error(`User defined timeout for device code polling reached. The timeout was set for ${userSpecifiedTimeout}`);\r\n throw ClientAuthError.createUserTimeoutReachedError();\r\n } else if (TimeUtils.nowSeconds() > deviceCodeExpirationTime) {\r\n if (userSpecifiedTimeout) {\r\n this.logger.verbose(`User specified timeout ignored as the device code has expired before the timeout elapsed. The user specified timeout was set for ${userSpecifiedTimeout}`);\r\n }\r\n this.logger.error(`Device code expired. Expiration time of device code was ${deviceCodeExpirationTime}`);\r\n throw ClientAuthError.createDeviceCodeExpiredError();\r\n }\r\n return true;\r\n }\r\n\r\n /**\r\n * Creates token request with device code response and polls token endpoint at interval set by the device code\r\n * response\r\n * @param request\r\n * @param deviceCodeResponse\r\n */\r\n private async acquireTokenWithDeviceCode(\r\n request: CommonDeviceCodeRequest,\r\n deviceCodeResponse: DeviceCodeResponse): Promise {\r\n\r\n const requestBody = this.createTokenRequestBody(request, deviceCodeResponse);\r\n const headers: Record = this.createTokenRequestHeaders();\r\n\r\n const userSpecifiedTimeout = request.timeout ? TimeUtils.nowSeconds() + request.timeout : undefined;\r\n const deviceCodeExpirationTime = TimeUtils.nowSeconds() + deviceCodeResponse.expiresIn;\r\n const pollingIntervalMilli = deviceCodeResponse.interval * 1000;\r\n\r\n /*\r\n * Poll token endpoint while (device code is not expired AND operation has not been cancelled by\r\n * setting CancellationToken.cancel = true). POST request is sent at interval set by pollingIntervalMilli\r\n */\r\n while (this.continuePolling(deviceCodeExpirationTime, userSpecifiedTimeout, request.cancel)) {\r\n const thumbprint: RequestThumbprint = {\r\n clientId: this.config.authOptions.clientId,\r\n authority: request.authority,\r\n scopes: request.scopes,\r\n claims: request.claims,\r\n authenticationScheme: request.authenticationScheme,\r\n resourceRequestMethod: request.resourceRequestMethod,\r\n resourceRequestUri: request.resourceRequestUri,\r\n shrClaims: request.shrClaims,\r\n sshKid: request.sshKid\r\n };\r\n\r\n const response = await this.executePostToTokenEndpoint(\r\n this.authority.tokenEndpoint,\r\n requestBody,\r\n headers,\r\n thumbprint);\r\n\r\n if (response.body && response.body.error) {\r\n // user authorization is pending. Sleep for polling interval and try again\r\n if(response.body.error === Constants.AUTHORIZATION_PENDING) {\r\n this.logger.info(\"Authorization pending. Continue polling.\");\r\n await TimeUtils.delay(pollingIntervalMilli);\r\n } else {\r\n // for any other error, throw\r\n this.logger.info(\"Unexpected error in polling from the server\");\r\n throw ServerError.createPostRequestFailed(response.body.error);\r\n }\r\n } else {\r\n this.logger.verbose(\"Authorization completed successfully. Polling stopped.\");\r\n return response.body;\r\n }\r\n }\r\n\r\n /*\r\n * The above code should've thrown by this point, but to satisfy TypeScript,\r\n * and in the rare case the conditionals in continuePolling() may not catch everything...\r\n */\r\n this.logger.error(\"Polling stopped for unknown reasons.\");\r\n throw ClientAuthError.createDeviceCodeUnknownError();\r\n }\r\n\r\n /**\r\n * Creates query parameters and converts to string.\r\n * @param request\r\n * @param deviceCodeResponse\r\n */\r\n private createTokenRequestBody(request: CommonDeviceCodeRequest, deviceCodeResponse: DeviceCodeResponse): string {\r\n\r\n const requestParameters: RequestParameterBuilder = new RequestParameterBuilder();\r\n\r\n requestParameters.addScopes(request.scopes);\r\n requestParameters.addClientId(this.config.authOptions.clientId);\r\n requestParameters.addGrantType(GrantType.DEVICE_CODE_GRANT);\r\n requestParameters.addDeviceCode(deviceCodeResponse.deviceCode);\r\n const correlationId = request.correlationId || this.config.cryptoInterface.createNewGuid();\r\n requestParameters.addCorrelationId(correlationId);\r\n requestParameters.addClientInfo();\r\n requestParameters.addLibraryInfo(this.config.libraryInfo);\r\n requestParameters.addApplicationTelemetry(this.config.telemetry.application);\r\n requestParameters.addThrottling();\r\n if (this.serverTelemetryManager) {\r\n requestParameters.addServerTelemetry(this.serverTelemetryManager);\r\n }\r\n\r\n if (!StringUtils.isEmptyObj(request.claims) || this.config.authOptions.clientCapabilities && this.config.authOptions.clientCapabilities.length > 0) {\r\n requestParameters.addClaims(request.claims, this.config.authOptions.clientCapabilities);\r\n }\r\n return requestParameters.createQueryString();\r\n }\r\n}\r\n","/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License.\r\n */\r\n\r\n/**\r\n * Enumeration of operations that are instrumented by have their performance measured by the PerformanceClient.\r\n *\r\n * @export\r\n * @enum {number}\r\n */\r\nexport enum PerformanceEvents {\r\n\r\n /**\r\n * acquireTokenByCode API (msal-browser and msal-node).\r\n * Used to acquire tokens by trading an authorization code against the token endpoint.\r\n */\r\n AcquireTokenByCode = \"acquireTokenByCode\",\r\n\r\n /**\r\n * acquireTokenByRefreshToken API (msal-browser and msal-node).\r\n * Used to renew an access token using a refresh token against the token endpoint.\r\n */\r\n AcquireTokenByRefreshToken = \"acquireTokenByRefreshToken\",\r\n\r\n /**\r\n * acquireTokenSilent API (msal-browser and msal-node).\r\n * Used to silently acquire a new access token (from the cache or the network).\r\n */\r\n AcquireTokenSilent = \"acquireTokenSilent\",\r\n\r\n /**\r\n * acquireTokenSilentAsync (msal-browser).\r\n * Internal API for acquireTokenSilent.\r\n */\r\n AcquireTokenSilentAsync = \"acquireTokenSilentAsync\",\r\n\r\n /**\r\n * acquireTokenPopup (msal-browser).\r\n * Used to acquire a new access token interactively through pop ups\r\n */\r\n AcquireTokenPopup = \"acquireTokenPopup\",\r\n\r\n /**\r\n * getPublicKeyThumbprint API in CryptoOpts class (msal-browser).\r\n * Used to generate a public/private keypair and generate a public key thumbprint for pop requests.\r\n */\r\n CryptoOptsGetPublicKeyThumbprint = \"cryptoOptsGetPublicKeyThumbprint\",\r\n\r\n /**\r\n * signJwt API in CryptoOpts class (msal-browser).\r\n * Used to signed a pop token.\r\n */\r\n CryptoOptsSignJwt = \"cryptoOptsSignJwt\",\r\n\r\n /**\r\n * acquireToken API in the SilentCacheClient class (msal-browser).\r\n * Used to read access tokens from the cache.\r\n */\r\n SilentCacheClientAcquireToken = \"silentCacheClientAcquireToken\",\r\n\r\n /**\r\n * acquireToken API in the SilentIframeClient class (msal-browser).\r\n * Used to acquire a new set of tokens from the authorize endpoint in a hidden iframe.\r\n */\r\n SilentIframeClientAcquireToken = \"silentIframeClientAcquireToken\",\r\n\r\n /**\r\n * acquireToken API in SilentRereshClient (msal-browser).\r\n * Used to acquire a new set of tokens from the token endpoint using a refresh token.\r\n */\r\n SilentRefreshClientAcquireToken = \"silentRefreshClientAcquireToken\",\r\n\r\n /**\r\n * ssoSilent API (msal-browser).\r\n * Used to silently acquire an authorization code and set of tokens using a hidden iframe.\r\n */\r\n SsoSilent = \"ssoSilent\",\r\n\r\n /**\r\n * getDiscoveredAuthority API in StandardInteractionClient class (msal-browser).\r\n * Used to load authority metadata for a request.\r\n */\r\n StandardInteractionClientGetDiscoveredAuthority = \"standardInteractionClientGetDiscoveredAuthority\",\r\n\r\n /**\r\n * acquireToken APIs in msal-browser.\r\n * Used to make an /authorize endpoint call with native brokering enabled.\r\n */\r\n FetchAccountIdWithNativeBroker = \"fetchAccountIdWithNativeBroker\",\r\n\r\n /**\r\n * acquireToken API in NativeInteractionClient class (msal-browser).\r\n * Used to acquire a token from Native component when native brokering is enabled.\r\n */\r\n NativeInteractionClientAcquireToken = \"nativeInteractionClientAcquireToken\",\r\n /**\r\n * Time spent creating default headers for requests to token endpoint\r\n */\r\n BaseClientCreateTokenRequestHeaders = \"baseClientCreateTokenRequestHeaders\",\r\n /**\r\n * Used to measure the time taken for completing embedded-broker handshake (PW-Broker).\r\n */\r\n BrokerHandhshake = \"brokerHandshake\",\r\n /**\r\n * acquireTokenByRefreshToken API in BrokerClientApplication (PW-Broker) .\r\n */\r\n AcquireTokenByRefreshTokenInBroker = \"acquireTokenByRefreshTokenInBroker\",\r\n /**\r\n * Time taken for token acquisition by broker\r\n */\r\n AcquireTokenByBroker = \"acquireTokenByBroker\",\r\n\r\n /**\r\n * Time spent on the network for refresh token acquisition\r\n */\r\n RefreshTokenClientExecuteTokenRequest = \"refreshTokenClientExecuteTokenRequest\",\r\n\r\n /**\r\n * Time taken for acquiring refresh token , records RT size\r\n */\r\n RefreshTokenClientAcquireToken = \"refreshTokenClientAcquireToken\",\r\n\r\n /**\r\n * Time taken for acquiring cached refresh token\r\n */\r\n RefreshTokenClientAcquireTokenWithCachedRefreshToken = \"refreshTokenClientAcquireTokenWithCachedRefreshToken\",\r\n\r\n AcquireTokenByCodeAsync = \"acquireTokenByCodeAsync\",\r\n\r\n GetEndpointMetadataFromNetwork = \"getEndpointMetadataFromNetwork\",\r\n GetCloudDiscoveryMetadataFromNetworkMeasurement = \"getCloudDiscoveryMetadataFromNetworkMeasurement\",\r\n\r\n HandleRedirectPromiseMeasurement= \"handleRedirectPromiseMeasurement\",\r\n\r\n UpdateCloudDiscoveryMetadataMeasurement = \"updateCloudDiscoveryMetadataMeasurement\",\r\n\r\n UsernamePasswordClientAcquireToken = \"usernamePasswordClientAcquireToken\",\r\n\r\n}\r\n\r\n/**\r\n * State of the performance event.\r\n *\r\n * @export\r\n * @enum {number}\r\n */\r\nexport enum PerformanceEventStatus {\r\n NotStarted,\r\n InProgress,\r\n Completed\r\n}\r\n\r\n/**\r\n * Fields whose value will not change throughout a request\r\n */\r\nexport type StaticFields = {\r\n /**\r\n * The Silent Token Cache Lookup Policy\r\n *\r\n * @type {?(number | undefined)}\r\n */\r\n cacheLookupPolicy?: number | undefined,\r\n\r\n /**\r\n * Size of the id token\r\n *\r\n * @type {number}\r\n */\r\n idTokenSize?: number,\r\n\r\n /**\r\n *\r\n * Size of the access token\r\n *\r\n * @type {number}\r\n */\r\n\r\n accessTokenSize?: number,\r\n\r\n /**\r\n *\r\n * Size of the refresh token\r\n *\r\n * @type {number}\r\n */\r\n\r\n refreshTokenSize?: number | undefined,\r\n\r\n /**\r\n * Application name as specified by the app.\r\n *\r\n * @type {?string}\r\n */\r\n appName?: string,\r\n\r\n /**\r\n * Application version as specified by the app.\r\n *\r\n * @type {?string}\r\n */\r\n appVersion?: string,\r\n\r\n /**\r\n * The following are fields that may be emitted in native broker scenarios\r\n */\r\n extensionId?: string,\r\n extensionVersion?: string\r\n matsBrokerVersion?: string;\r\n matsAccountJoinOnStart?: string;\r\n matsAccountJoinOnEnd?: string;\r\n matsDeviceJoin?: string;\r\n matsPromptBehavior?: string;\r\n matsApiErrorCode?: number;\r\n matsUiVisible?: boolean;\r\n matsSilentCode?: number;\r\n matsSilentBiSubCode?: number;\r\n matsSilentMessage?: string;\r\n matsSilentStatus?: number;\r\n matsHttpStatus?: number\r\n matsHttpEventCount?: number;\r\n httpVerToken?: string;\r\n httpVerAuthority?: string;\r\n\r\n // Broker timeouts used by 1p browser lib\r\n brokerInteractionTimeoutMs?: number;\r\n brokerMessageTimeoutMs?: number;\r\n brokerHandshakeTimeoutMs?: number;\r\n brokerIframeTimeoutMs?: number;\r\n};\r\n\r\n/**\r\n * Fields whose value may change throughout a request\r\n */\r\nexport type Counters = {\r\n visibilityChangeCount?: number;\r\n};\r\n\r\n/**\r\n * Performance measurement taken by the library, including metadata about the request and application.\r\n *\r\n * @export\r\n * @typedef {PerformanceEvent}\r\n */\r\nexport type PerformanceEvent = StaticFields & Counters & {\r\n /**\r\n * Unique id for the event\r\n *\r\n * @type {string}\r\n */\r\n eventId: string,\r\n\r\n /**\r\n * State of the perforance measure.\r\n *\r\n * @type {PerformanceEventStatus}\r\n */\r\n status: PerformanceEventStatus,\r\n\r\n /**\r\n * Login authority used for the request\r\n *\r\n * @type {string}\r\n */\r\n authority: string,\r\n\r\n /**\r\n * Client id for the application\r\n *\r\n * @type {string}\r\n */\r\n clientId: string\r\n\r\n /**\r\n * Correlation ID used for the request\r\n *\r\n * @type {string}\r\n */\r\n correlationId: string,\r\n\r\n /**\r\n * End-to-end duration in milliseconds.\r\n * @date 3/22/2022 - 3:40:05 PM\r\n *\r\n * @type {number}\r\n */\r\n durationMs?: number,\r\n\r\n /**\r\n * Visibility of the page when the event completed.\r\n * Read from: https://developer.mozilla.org/docs/Web/API/Page_Visibility_API\r\n *\r\n * @type {?(string | null)}\r\n */\r\n endPageVisibility?: string | null,\r\n\r\n /**\r\n * Whether the result was retrieved from the cache.\r\n *\r\n * @type {(boolean | null)}\r\n */\r\n fromCache?: boolean | null,\r\n\r\n /**\r\n * Event name (usually in the form of classNameFunctionName)\r\n *\r\n * @type {PerformanceEvents}\r\n */\r\n name: PerformanceEvents,\r\n\r\n /**\r\n * Visibility of the page when the event completed.\r\n * Read from: https://developer.mozilla.org/docs/Web/API/Page_Visibility_API\r\n *\r\n * @type {?(string | null)}\r\n */\r\n startPageVisibility?: string | null,\r\n\r\n /**\r\n * Unix millisecond timestamp when the event was initiated.\r\n *\r\n * @type {number}\r\n */\r\n startTimeMs: number,\r\n\r\n /**\r\n * Whether or the operation completed successfully.\r\n *\r\n * @type {(boolean | null)}\r\n */\r\n success?: boolean | null,\r\n\r\n /**\r\n * Add specific error code in case of failure\r\n *\r\n * @type {string}\r\n */\r\n errorCode?: string,\r\n\r\n /**\r\n * Add specific sub error code in case of failure\r\n *\r\n * @type {string}\r\n */\r\n subErrorCode?: string,\r\n\r\n /**\r\n * Name of the library used for the operation.\r\n *\r\n * @type {string}\r\n */\r\n libraryName: string,\r\n\r\n /**\r\n * Version of the library used for the operation.\r\n *\r\n * @type {string}\r\n */\r\n libraryVersion: string,\r\n\r\n /**\r\n * Whether the response is from a native component (e.g., WAM)\r\n *\r\n * @type {?boolean}\r\n */\r\n isNativeBroker?: boolean,\r\n\r\n /**\r\n * Request ID returned from the response\r\n *\r\n * @type {?string}\r\n */\r\n requestId?: string\r\n};\r\n","/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License.\r\n */\r\n\r\nimport { ClientConfiguration } from \"../config/ClientConfiguration\";\r\nimport { BaseClient } from \"./BaseClient\";\r\nimport { CommonRefreshTokenRequest } from \"../request/CommonRefreshTokenRequest\";\r\nimport { Authority } from \"../authority/Authority\";\r\nimport { ServerAuthorizationTokenResponse } from \"../response/ServerAuthorizationTokenResponse\";\r\nimport { RequestParameterBuilder } from \"../request/RequestParameterBuilder\";\r\nimport { GrantType, AuthenticationScheme, Errors, HeaderNames } from \"../utils/Constants\";\r\nimport { ResponseHandler } from \"../response/ResponseHandler\";\r\nimport { AuthenticationResult } from \"../response/AuthenticationResult\";\r\nimport { PopTokenGenerator } from \"../crypto/PopTokenGenerator\";\r\nimport { StringUtils } from \"../utils/StringUtils\";\r\nimport { RequestThumbprint } from \"../network/RequestThumbprint\";\r\nimport { NetworkResponse } from \"../network/NetworkManager\";\r\nimport { CommonSilentFlowRequest } from \"../request/CommonSilentFlowRequest\";\r\nimport { ClientConfigurationError } from \"../error/ClientConfigurationError\";\r\nimport { ClientAuthError } from \"../error/ClientAuthError\";\r\nimport { ServerError } from \"../error/ServerError\";\r\nimport { TimeUtils } from \"../utils/TimeUtils\";\r\nimport { UrlString } from \"../url/UrlString\";\r\nimport { CcsCredentialType } from \"../account/CcsCredential\";\r\nimport { buildClientInfoFromHomeAccountId } from \"../account/ClientInfo\";\r\nimport { InteractionRequiredAuthError, InteractionRequiredAuthErrorMessage } from \"../error/InteractionRequiredAuthError\";\r\nimport { PerformanceEvents } from \"../telemetry/performance/PerformanceEvent\";\r\nimport { IPerformanceClient } from \"../telemetry/performance/IPerformanceClient\";\r\n/**\r\n * OAuth2.0 refresh token client\r\n */\r\nexport class RefreshTokenClient extends BaseClient {\r\n constructor(configuration: ClientConfiguration, performanceClient?: IPerformanceClient) {\r\n super(configuration, performanceClient);\r\n\r\n }\r\n public async acquireToken(request: CommonRefreshTokenRequest): Promise {\r\n const atsMeasurement = this.performanceClient?.startMeasurement(PerformanceEvents.RefreshTokenClientAcquireToken, request.correlationId);\r\n this.logger.verbose(\"RefreshTokenClientAcquireToken called\", request.correlationId);\r\n const reqTimestamp = TimeUtils.nowSeconds();\r\n const response = await this.executeTokenRequest(request, this.authority);\r\n const httpVerToken = response.headers?.[HeaderNames.X_MS_HTTP_VERSION];\r\n atsMeasurement?.addStaticFields({\r\n refreshTokenSize: response.body.refresh_token?.length || 0,\r\n });\r\n if(httpVerToken)\r\n {\r\n atsMeasurement?.addStaticFields({\r\n httpVerToken,\r\n });\r\n }\r\n\r\n // Retrieve requestId from response headers\r\n const requestId = response.headers?.[HeaderNames.X_MS_REQUEST_ID];\r\n const responseHandler = new ResponseHandler(\r\n this.config.authOptions.clientId,\r\n this.cacheManager,\r\n this.cryptoUtils,\r\n this.logger,\r\n this.config.serializableCache,\r\n this.config.persistencePlugin\r\n );\r\n responseHandler.validateTokenResponse(response.body);\r\n\r\n return responseHandler.handleServerTokenResponse(\r\n response.body,\r\n this.authority,\r\n reqTimestamp,\r\n request,\r\n undefined,\r\n undefined,\r\n true,\r\n request.forceCache,\r\n requestId,\r\n ).then((result: AuthenticationResult) => {\r\n atsMeasurement?.endMeasurement({\r\n success: true\r\n });\r\n return result;\r\n })\r\n .catch((error) => {\r\n this.logger.verbose(\"Error in fetching refresh token\", request.correlationId);\r\n atsMeasurement?.endMeasurement({\r\n errorCode: error.errorCode,\r\n subErrorCode: error.subError,\r\n success: false\r\n });\r\n throw error;\r\n });\r\n }\r\n\r\n /**\r\n * Gets cached refresh token and attaches to request, then calls acquireToken API\r\n * @param request\r\n */\r\n public async acquireTokenByRefreshToken(request: CommonSilentFlowRequest): Promise {\r\n // Cannot renew token if no request object is given.\r\n if (!request) {\r\n throw ClientConfigurationError.createEmptyTokenRequestError();\r\n }\r\n\r\n // We currently do not support silent flow for account === null use cases; This will be revisited for confidential flow usecases\r\n if (!request.account) {\r\n throw ClientAuthError.createNoAccountInSilentRequestError();\r\n }\r\n\r\n // try checking if FOCI is enabled for the given application\r\n const isFOCI = this.cacheManager.isAppMetadataFOCI(request.account.environment, this.config.authOptions.clientId);\r\n\r\n // if the app is part of the family, retrive a Family refresh token if present and make a refreshTokenRequest\r\n if (isFOCI) {\r\n try {\r\n return this.acquireTokenWithCachedRefreshToken(request, true);\r\n } catch (e) {\r\n const noFamilyRTInCache = e instanceof InteractionRequiredAuthError && e.errorCode === InteractionRequiredAuthErrorMessage.noTokensFoundError.code;\r\n const clientMismatchErrorWithFamilyRT = e instanceof ServerError && e.errorCode === Errors.INVALID_GRANT_ERROR && e.subError === Errors.CLIENT_MISMATCH_ERROR;\r\n\r\n // if family Refresh Token (FRT) cache acquisition fails or if client_mismatch error is seen with FRT, reattempt with application Refresh Token (ART)\r\n if (noFamilyRTInCache || clientMismatchErrorWithFamilyRT) {\r\n return this.acquireTokenWithCachedRefreshToken(request, false);\r\n // throw in all other cases\r\n } else {\r\n throw e;\r\n }\r\n }\r\n }\r\n // fall back to application refresh token acquisition\r\n return this.acquireTokenWithCachedRefreshToken(request, false);\r\n\r\n }\r\n\r\n /**\r\n * makes a network call to acquire tokens by exchanging RefreshToken available in userCache; throws if refresh token is not cached\r\n * @param request\r\n */\r\n private async acquireTokenWithCachedRefreshToken(request: CommonSilentFlowRequest, foci: boolean) {\r\n // fetches family RT or application RT based on FOCI value\r\n\r\n const atsMeasurement = this.performanceClient?.startMeasurement(PerformanceEvents.RefreshTokenClientAcquireTokenWithCachedRefreshToken, request.correlationId);\r\n this.logger.verbose(\"RefreshTokenClientAcquireTokenWithCachedRefreshToken called\", request.correlationId);\r\n const refreshToken = this.cacheManager.readRefreshTokenFromCache(this.config.authOptions.clientId, request.account, foci);\r\n\r\n if (!refreshToken) {\r\n atsMeasurement?.discardMeasurement();\r\n throw InteractionRequiredAuthError.createNoTokensFoundError();\r\n }\r\n // attach cached RT size to the current measurement\r\n atsMeasurement?.endMeasurement({\r\n success: true\r\n });\r\n\r\n const refreshTokenRequest: CommonRefreshTokenRequest = {\r\n ...request,\r\n refreshToken: refreshToken.secret,\r\n authenticationScheme: request.authenticationScheme || AuthenticationScheme.BEARER,\r\n ccsCredential: {\r\n credential: request.account.homeAccountId,\r\n type: CcsCredentialType.HOME_ACCOUNT_ID\r\n }\r\n };\r\n\r\n return this.acquireToken(refreshTokenRequest);\r\n }\r\n\r\n /**\r\n * Constructs the network message and makes a NW call to the underlying secure token service\r\n * @param request\r\n * @param authority\r\n */\r\n private async executeTokenRequest(request: CommonRefreshTokenRequest, authority: Authority)\r\n : Promise> {\r\n const acquireTokenMeasurement = this.performanceClient?.startMeasurement(PerformanceEvents.RefreshTokenClientExecuteTokenRequest, request.correlationId);\r\n const requestBody = await this.createTokenRequestBody(request);\r\n const queryParameters = this.createTokenQueryParameters(request);\r\n const headers: Record = this.createTokenRequestHeaders(request.ccsCredential);\r\n const thumbprint: RequestThumbprint = {\r\n clientId: this.config.authOptions.clientId,\r\n authority: authority.canonicalAuthority,\r\n scopes: request.scopes,\r\n claims: request.claims,\r\n authenticationScheme: request.authenticationScheme,\r\n resourceRequestMethod: request.resourceRequestMethod,\r\n resourceRequestUri: request.resourceRequestUri,\r\n shrClaims: request.shrClaims,\r\n sshKid: request.sshKid\r\n };\r\n\r\n const endpoint = UrlString.appendQueryString(authority.tokenEndpoint, queryParameters);\r\n return this.executePostToTokenEndpoint(endpoint, requestBody, headers, thumbprint)\r\n .then((result) => {\r\n acquireTokenMeasurement?.endMeasurement({\r\n success: true\r\n });\r\n return result;\r\n })\r\n .catch((error) => {\r\n acquireTokenMeasurement?.endMeasurement({\r\n success: false\r\n });\r\n throw error;\r\n });\r\n }\r\n\r\n /**\r\n * Creates query string for the /token request\r\n * @param request\r\n */\r\n private createTokenQueryParameters(request: CommonRefreshTokenRequest): string {\r\n const parameterBuilder = new RequestParameterBuilder();\r\n\r\n if (request.tokenQueryParameters) {\r\n parameterBuilder.addExtraQueryParameters(request.tokenQueryParameters);\r\n }\r\n\r\n return parameterBuilder.createQueryString();\r\n }\r\n\r\n /**\r\n * Helper function to create the token request body\r\n * @param request\r\n */\r\n private async createTokenRequestBody(request: CommonRefreshTokenRequest): Promise {\r\n const correlationId = request.correlationId;\r\n const acquireTokenMeasurement = this.performanceClient?.startMeasurement(PerformanceEvents.BaseClientCreateTokenRequestHeaders, correlationId);\r\n const parameterBuilder = new RequestParameterBuilder();\r\n\r\n parameterBuilder.addClientId(this.config.authOptions.clientId);\r\n\r\n parameterBuilder.addScopes(request.scopes);\r\n\r\n parameterBuilder.addGrantType(GrantType.REFRESH_TOKEN_GRANT);\r\n\r\n parameterBuilder.addClientInfo();\r\n\r\n parameterBuilder.addLibraryInfo(this.config.libraryInfo);\r\n parameterBuilder.addApplicationTelemetry(this.config.telemetry.application);\r\n parameterBuilder.addThrottling();\r\n\r\n if (this.serverTelemetryManager) {\r\n parameterBuilder.addServerTelemetry(this.serverTelemetryManager);\r\n }\r\n\r\n parameterBuilder.addCorrelationId(correlationId);\r\n\r\n parameterBuilder.addRefreshToken(request.refreshToken);\r\n\r\n if (this.config.clientCredentials.clientSecret) {\r\n parameterBuilder.addClientSecret(this.config.clientCredentials.clientSecret);\r\n }\r\n\r\n if (this.config.clientCredentials.clientAssertion) {\r\n const clientAssertion = this.config.clientCredentials.clientAssertion;\r\n parameterBuilder.addClientAssertion(clientAssertion.assertion);\r\n parameterBuilder.addClientAssertionType(clientAssertion.assertionType);\r\n }\r\n\r\n if (request.authenticationScheme === AuthenticationScheme.POP) {\r\n const popTokenGenerator = new PopTokenGenerator(this.cryptoUtils);\r\n const reqCnfData = await popTokenGenerator.generateCnf(request);\r\n // SPA PoP requires full Base64Url encoded req_cnf string (unhashed)\r\n parameterBuilder.addPopToken(reqCnfData.reqCnfString);\r\n } else if (request.authenticationScheme === AuthenticationScheme.SSH) {\r\n if (request.sshJwk) {\r\n parameterBuilder.addSshJwk(request.sshJwk);\r\n } else {\r\n acquireTokenMeasurement?.endMeasurement({\r\n success: false\r\n });\r\n throw ClientConfigurationError.createMissingSshJwkError();\r\n }\r\n }\r\n\r\n if (!StringUtils.isEmptyObj(request.claims) || this.config.authOptions.clientCapabilities && this.config.authOptions.clientCapabilities.length > 0) {\r\n parameterBuilder.addClaims(request.claims, this.config.authOptions.clientCapabilities);\r\n }\r\n\r\n if (this.config.systemOptions.preventCorsPreflight && request.ccsCredential) {\r\n switch (request.ccsCredential.type) {\r\n case CcsCredentialType.HOME_ACCOUNT_ID:\r\n try {\r\n const clientInfo = buildClientInfoFromHomeAccountId(request.ccsCredential.credential);\r\n parameterBuilder.addCcsOid(clientInfo);\r\n } catch (e) {\r\n this.logger.verbose(\"Could not parse home account ID for CCS Header: \" + e);\r\n }\r\n break;\r\n case CcsCredentialType.UPN:\r\n parameterBuilder.addCcsUpn(request.ccsCredential.credential);\r\n break;\r\n }\r\n }\r\n acquireTokenMeasurement?.endMeasurement({\r\n success: true\r\n });\r\n return parameterBuilder.createQueryString();\r\n }\r\n}\r\n","/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License.\r\n */\r\n\r\nimport { ClientConfiguration } from \"../config/ClientConfiguration\";\r\nimport { BaseClient } from \"./BaseClient\";\r\nimport { Authority } from \"../authority/Authority\";\r\nimport { RequestParameterBuilder } from \"../request/RequestParameterBuilder\";\r\nimport { ScopeSet } from \"../request/ScopeSet\";\r\nimport { GrantType , CredentialType, CacheOutcome, Constants, AuthenticationScheme } from \"../utils/Constants\";\r\nimport { ResponseHandler } from \"../response/ResponseHandler\";\r\nimport { AuthenticationResult } from \"../response/AuthenticationResult\";\r\nimport { CommonClientCredentialRequest } from \"../request/CommonClientCredentialRequest\";\r\nimport { CredentialFilter, CredentialCache } from \"../cache/utils/CacheTypes\";\r\nimport { AccessTokenEntity } from \"../cache/entities/AccessTokenEntity\";\r\nimport { TimeUtils } from \"../utils/TimeUtils\";\r\nimport { StringUtils } from \"../utils/StringUtils\";\r\nimport { RequestThumbprint } from \"../network/RequestThumbprint\";\r\nimport { ClientAuthError } from \"../error/ClientAuthError\";\r\nimport { ServerAuthorizationTokenResponse } from \"../response/ServerAuthorizationTokenResponse\";\r\nimport { IAppTokenProvider } from \"../config/AppTokenProvider\";\r\n\r\n/**\r\n * OAuth2.0 client credential grant\r\n */\r\nexport class ClientCredentialClient extends BaseClient {\r\n\r\n private scopeSet: ScopeSet;\r\n private readonly appTokenProvider?: IAppTokenProvider;\r\n\r\n constructor(configuration: ClientConfiguration, appTokenProvider?: IAppTokenProvider) {\r\n super(configuration);\r\n this.appTokenProvider = appTokenProvider;\r\n }\r\n\r\n /**\r\n * Public API to acquire a token with ClientCredential Flow for Confidential clients\r\n * @param request\r\n */\r\n public async acquireToken(request: CommonClientCredentialRequest): Promise {\r\n\r\n this.scopeSet = new ScopeSet(request.scopes || []);\r\n\r\n if (request.skipCache) {\r\n return await this.executeTokenRequest(request, this.authority);\r\n }\r\n\r\n const cachedAuthenticationResult = await this.getCachedAuthenticationResult(request);\r\n if (cachedAuthenticationResult) {\r\n return cachedAuthenticationResult;\r\n } else {\r\n return await this.executeTokenRequest(request, this.authority);\r\n }\r\n }\r\n\r\n /**\r\n * looks up cache if the tokens are cached already\r\n */\r\n private async getCachedAuthenticationResult(request: CommonClientCredentialRequest): Promise {\r\n \r\n const cachedAccessToken = this.readAccessTokenFromCache();\r\n\r\n if (!cachedAccessToken) {\r\n this.serverTelemetryManager?.setCacheOutcome(CacheOutcome.NO_CACHED_ACCESS_TOKEN);\r\n return null;\r\n }\r\n\r\n if (TimeUtils.isTokenExpired(cachedAccessToken.expiresOn, this.config.systemOptions.tokenRenewalOffsetSeconds)) {\r\n this.serverTelemetryManager?.setCacheOutcome(CacheOutcome.CACHED_ACCESS_TOKEN_EXPIRED);\r\n return null;\r\n }\r\n\r\n return await ResponseHandler.generateAuthenticationResult(\r\n this.cryptoUtils,\r\n this.authority,\r\n {\r\n account: null,\r\n idToken: null,\r\n accessToken: cachedAccessToken,\r\n refreshToken: null,\r\n appMetadata: null\r\n },\r\n true,\r\n request\r\n );\r\n }\r\n\r\n /**\r\n * Reads access token from the cache\r\n * TODO: Move this call to cacheManager instead\r\n */\r\n private readAccessTokenFromCache(): AccessTokenEntity | null {\r\n const accessTokenFilter: CredentialFilter = {\r\n homeAccountId: Constants.EMPTY_STRING,\r\n environment: this.authority.canonicalAuthorityUrlComponents.HostNameAndPort,\r\n credentialType: CredentialType.ACCESS_TOKEN,\r\n clientId: this.config.authOptions.clientId,\r\n realm: this.authority.tenant,\r\n target: this.scopeSet.printScopesLowerCase()\r\n };\r\n const credentialCache: CredentialCache = this.cacheManager.getCredentialsFilteredBy(accessTokenFilter);\r\n const accessTokens = Object.keys(credentialCache.accessTokens).map(key => credentialCache.accessTokens[key]);\r\n if (accessTokens.length < 1) {\r\n return null;\r\n } else if (accessTokens.length > 1) {\r\n throw ClientAuthError.createMultipleMatchingTokensInCacheError();\r\n }\r\n return accessTokens[0] as AccessTokenEntity;\r\n }\r\n\r\n /**\r\n * Makes a network call to request the token from the service\r\n * @param request\r\n * @param authority\r\n */\r\n private async executeTokenRequest(request: CommonClientCredentialRequest, authority: Authority)\r\n : Promise {\r\n \r\n let serverTokenResponse: ServerAuthorizationTokenResponse;\r\n let reqTimestamp: number;\r\n\r\n if (this.appTokenProvider) {\r\n this.logger.info(\"Using appTokenProvider extensibility.\");\r\n\r\n const appTokenPropviderParameters = {\r\n correlationId: request.correlationId,\r\n tenantId: this.config.authOptions.authority.tenant,\r\n scopes: request.scopes,\r\n claims: request.claims,\r\n };\r\n\r\n reqTimestamp = TimeUtils.nowSeconds();\r\n const appTokenProviderResult = await this.appTokenProvider(appTokenPropviderParameters);\r\n\r\n serverTokenResponse = {\r\n access_token: appTokenProviderResult.accessToken, \r\n expires_in: appTokenProviderResult.expiresInSeconds,\r\n refresh_in: appTokenProviderResult.refreshInSeconds,\r\n token_type : AuthenticationScheme.BEARER\r\n };\r\n } else {\r\n const requestBody = this.createTokenRequestBody(request);\r\n const headers: Record = this.createTokenRequestHeaders();\r\n const thumbprint: RequestThumbprint = {\r\n clientId: this.config.authOptions.clientId,\r\n authority: request.authority,\r\n scopes: request.scopes,\r\n claims: request.claims,\r\n authenticationScheme: request.authenticationScheme,\r\n resourceRequestMethod: request.resourceRequestMethod,\r\n resourceRequestUri: request.resourceRequestUri,\r\n shrClaims: request.shrClaims,\r\n sshKid: request.sshKid\r\n };\r\n \r\n reqTimestamp = TimeUtils.nowSeconds();\r\n const response = await this.executePostToTokenEndpoint(authority.tokenEndpoint, requestBody, headers, thumbprint);\r\n serverTokenResponse = response.body;\r\n }\r\n\r\n const responseHandler = new ResponseHandler(\r\n this.config.authOptions.clientId,\r\n this.cacheManager,\r\n this.cryptoUtils,\r\n this.logger,\r\n this.config.serializableCache,\r\n this.config.persistencePlugin\r\n );\r\n\r\n responseHandler.validateTokenResponse(serverTokenResponse);\r\n \r\n const tokenResponse = await responseHandler.handleServerTokenResponse(\r\n serverTokenResponse,\r\n this.authority,\r\n reqTimestamp,\r\n request\r\n );\r\n\r\n return tokenResponse;\r\n }\r\n\r\n /**\r\n * generate the request to the server in the acceptable format\r\n * @param request\r\n */\r\n private createTokenRequestBody(request: CommonClientCredentialRequest): string {\r\n const parameterBuilder = new RequestParameterBuilder();\r\n\r\n parameterBuilder.addClientId(this.config.authOptions.clientId);\r\n\r\n parameterBuilder.addScopes(request.scopes, false);\r\n\r\n parameterBuilder.addGrantType(GrantType.CLIENT_CREDENTIALS_GRANT);\r\n\r\n parameterBuilder.addLibraryInfo(this.config.libraryInfo);\r\n parameterBuilder.addApplicationTelemetry(this.config.telemetry.application);\r\n\r\n parameterBuilder.addThrottling();\r\n \r\n if (this.serverTelemetryManager) {\r\n parameterBuilder.addServerTelemetry(this.serverTelemetryManager);\r\n }\r\n\r\n const correlationId = request.correlationId || this.config.cryptoInterface.createNewGuid();\r\n parameterBuilder.addCorrelationId(correlationId);\r\n\r\n if (this.config.clientCredentials.clientSecret) {\r\n parameterBuilder.addClientSecret(this.config.clientCredentials.clientSecret);\r\n }\r\n\r\n // Use clientAssertion from request, fallback to client assertion in base configuration\r\n const clientAssertion = request.clientAssertion || this.config.clientCredentials.clientAssertion;\r\n\r\n if (clientAssertion) {\r\n parameterBuilder.addClientAssertion(clientAssertion.assertion);\r\n parameterBuilder.addClientAssertionType(clientAssertion.assertionType);\r\n }\r\n\r\n if (!StringUtils.isEmptyObj(request.claims) || this.config.authOptions.clientCapabilities && this.config.authOptions.clientCapabilities.length > 0) {\r\n parameterBuilder.addClaims(request.claims, this.config.authOptions.clientCapabilities);\r\n }\r\n\r\n return parameterBuilder.createQueryString();\r\n }\r\n}\r\n","/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License.\r\n */\r\n\r\nimport { ClientConfiguration } from \"../config/ClientConfiguration\";\r\nimport { BaseClient } from \"./BaseClient\";\r\nimport { Authority } from \"../authority/Authority\";\r\nimport { RequestParameterBuilder } from \"../request/RequestParameterBuilder\";\r\nimport { ScopeSet } from \"../request/ScopeSet\";\r\nimport { GrantType, AADServerParamKeys , CredentialType, Constants, CacheOutcome, AuthenticationScheme } from \"../utils/Constants\";\r\nimport { ResponseHandler } from \"../response/ResponseHandler\";\r\nimport { AuthenticationResult } from \"../response/AuthenticationResult\";\r\nimport { CommonOnBehalfOfRequest } from \"../request/CommonOnBehalfOfRequest\";\r\nimport { TimeUtils } from \"../utils/TimeUtils\";\r\nimport { CredentialFilter, CredentialCache } from \"../cache/utils/CacheTypes\";\r\nimport { AccessTokenEntity } from \"../cache/entities/AccessTokenEntity\";\r\nimport { IdTokenEntity } from \"../cache/entities/IdTokenEntity\";\r\nimport { AccountEntity } from \"../cache/entities/AccountEntity\";\r\nimport { AuthToken } from \"../account/AuthToken\";\r\nimport { ClientAuthError } from \"../error/ClientAuthError\";\r\nimport { RequestThumbprint } from \"../network/RequestThumbprint\";\r\nimport { AccountInfo } from \"../account/AccountInfo\";\r\n\r\n/**\r\n * On-Behalf-Of client\r\n */\r\nexport class OnBehalfOfClient extends BaseClient {\r\n\r\n private scopeSet: ScopeSet;\r\n private userAssertionHash: string;\r\n\r\n constructor(configuration: ClientConfiguration) {\r\n super(configuration);\r\n }\r\n\r\n /**\r\n * Public API to acquire tokens with on behalf of flow\r\n * @param request\r\n */\r\n public async acquireToken(request: CommonOnBehalfOfRequest): Promise {\r\n this.scopeSet = new ScopeSet(request.scopes || []);\r\n\r\n // generate the user_assertion_hash for OBOAssertion\r\n this.userAssertionHash = await this.cryptoUtils.hashString(request.oboAssertion);\r\n\r\n if (request.skipCache) {\r\n return await this.executeTokenRequest(request, this.authority, this.userAssertionHash);\r\n }\r\n\r\n try {\r\n return await this.getCachedAuthenticationResult(request);\r\n } catch (e) {\r\n // Any failure falls back to interactive request, once we implement distributed cache, we plan to handle `createRefreshRequiredError` to refresh using the RT\r\n return await this.executeTokenRequest(request, this.authority, this.userAssertionHash);\r\n }\r\n }\r\n\r\n /**\r\n * look up cache for tokens\r\n * Find idtoken in the cache\r\n * Find accessToken based on user assertion and account info in the cache\r\n * Please note we are not yet supported OBO tokens refreshed with long lived RT. User will have to send a new assertion if the current access token expires\r\n * This is to prevent security issues when the assertion changes over time, however, longlived RT helps retaining the session\r\n * @param request\r\n */\r\n private async getCachedAuthenticationResult(request: CommonOnBehalfOfRequest): Promise {\r\n\r\n // look in the cache for the access_token which matches the incoming_assertion\r\n const cachedAccessToken = this.readAccessTokenFromCacheForOBO(this.config.authOptions.clientId, request);\r\n if (!cachedAccessToken) {\r\n // Must refresh due to non-existent access_token.\r\n this.serverTelemetryManager?.setCacheOutcome(CacheOutcome.NO_CACHED_ACCESS_TOKEN);\r\n this.logger.info(\"SilentFlowClient:acquireCachedToken - No access token found in cache for the given properties.\");\r\n throw ClientAuthError.createRefreshRequiredError();\r\n } else if (TimeUtils.isTokenExpired(cachedAccessToken.expiresOn, this.config.systemOptions.tokenRenewalOffsetSeconds)) {\r\n // Access token expired, will need to renewed\r\n this.serverTelemetryManager?.setCacheOutcome(CacheOutcome.CACHED_ACCESS_TOKEN_EXPIRED);\r\n this.logger.info(`OnbehalfofFlow:getCachedAuthenticationResult - Cached access token is expired or will expire within ${this.config.systemOptions.tokenRenewalOffsetSeconds} seconds.`);\r\n throw ClientAuthError.createRefreshRequiredError();\r\n }\r\n\r\n // fetch the idToken from cache\r\n const cachedIdToken = this.readIdTokenFromCacheForOBO(request, cachedAccessToken.homeAccountId);\r\n let idTokenObject: AuthToken | undefined;\r\n let cachedAccount: AccountEntity | null = null;\r\n if (cachedIdToken) {\r\n idTokenObject = new AuthToken(cachedIdToken.secret, this.config.cryptoInterface);\r\n const localAccountId = idTokenObject.claims.oid ? idTokenObject.claims.oid : idTokenObject.claims.sub;\r\n const accountInfo: AccountInfo = {\r\n homeAccountId: cachedIdToken.homeAccountId,\r\n environment: cachedIdToken.environment,\r\n tenantId: cachedIdToken.realm,\r\n username: Constants.EMPTY_STRING,\r\n localAccountId: localAccountId || Constants.EMPTY_STRING\r\n };\r\n\r\n cachedAccount = this.cacheManager.readAccountFromCache(accountInfo);\r\n }\r\n\r\n // increment telemetry cache hit counter\r\n if (this.config.serverTelemetryManager) {\r\n this.config.serverTelemetryManager.incrementCacheHits();\r\n }\r\n\r\n return await ResponseHandler.generateAuthenticationResult(\r\n this.cryptoUtils,\r\n this.authority,\r\n {\r\n account: cachedAccount,\r\n accessToken: cachedAccessToken,\r\n idToken: cachedIdToken,\r\n refreshToken: null,\r\n appMetadata: null\r\n },\r\n true,\r\n request,\r\n idTokenObject);\r\n }\r\n\r\n /**\r\n * read idtoken from cache, this is a specific implementation for OBO as the requirements differ from a generic lookup in the cacheManager\r\n * Certain use cases of OBO flow do not expect an idToken in the cache/or from the service\r\n * @param request\r\n */\r\n private readIdTokenFromCacheForOBO(request: CommonOnBehalfOfRequest, atHomeAccountId: string): IdTokenEntity | null {\r\n\r\n const idTokenFilter: CredentialFilter = {\r\n homeAccountId: atHomeAccountId,\r\n environment: this.authority.canonicalAuthorityUrlComponents.HostNameAndPort,\r\n credentialType: CredentialType.ID_TOKEN,\r\n clientId: this.config.authOptions.clientId,\r\n realm: this.authority.tenant\r\n };\r\n\r\n const credentialCache: CredentialCache = this.cacheManager.getCredentialsFilteredBy(idTokenFilter);\r\n const idTokens = Object.keys(credentialCache.idTokens).map(key => credentialCache.idTokens[key]);\r\n // When acquiring a token on behalf of an application, there might not be an id token in the cache\r\n if (idTokens.length < 1) {\r\n return null;\r\n }\r\n return idTokens[0] as IdTokenEntity;\r\n }\r\n\r\n /**\r\n * Fetches the cached access token based on incoming assertion\r\n * @param clientId\r\n * @param request\r\n * @param userAssertionHash\r\n */\r\n private readAccessTokenFromCacheForOBO(clientId: string, request: CommonOnBehalfOfRequest) {\r\n const authScheme = request.authenticationScheme || AuthenticationScheme.BEARER;\r\n /*\r\n * Distinguish between Bearer and PoP/SSH token cache types\r\n * Cast to lowercase to handle \"bearer\" from ADFS\r\n */\r\n const credentialType = (authScheme && authScheme.toLowerCase() !== AuthenticationScheme.BEARER.toLowerCase()) ? CredentialType.ACCESS_TOKEN_WITH_AUTH_SCHEME : CredentialType.ACCESS_TOKEN;\r\n\r\n const accessTokenFilter: CredentialFilter = {\r\n credentialType: credentialType,\r\n clientId,\r\n target: this.scopeSet.printScopesLowerCase(),\r\n tokenType: authScheme,\r\n keyId: request.sshKid,\r\n requestedClaimsHash: request.requestedClaimsHash,\r\n userAssertionHash: this.userAssertionHash\r\n };\r\n\r\n const credentialCache: CredentialCache = this.cacheManager.getCredentialsFilteredBy(accessTokenFilter);\r\n\r\n const accessTokens = Object.keys(credentialCache.accessTokens).map((key) => credentialCache.accessTokens[key]);\r\n\r\n const numAccessTokens = accessTokens.length;\r\n if (numAccessTokens < 1) {\r\n return null;\r\n } else if (numAccessTokens > 1) {\r\n throw ClientAuthError.createMultipleMatchingTokensInCacheError();\r\n }\r\n\r\n return accessTokens[0] as AccessTokenEntity;\r\n }\r\n\r\n /**\r\n * Make a network call to the server requesting credentials\r\n * @param request\r\n * @param authority\r\n */\r\n private async executeTokenRequest(request: CommonOnBehalfOfRequest, authority: Authority, userAssertionHash: string)\r\n : Promise {\r\n\r\n const requestBody = this.createTokenRequestBody(request);\r\n const headers: Record = this.createTokenRequestHeaders();\r\n const thumbprint: RequestThumbprint = {\r\n clientId: this.config.authOptions.clientId,\r\n authority: request.authority,\r\n scopes: request.scopes,\r\n claims: request.claims,\r\n authenticationScheme: request.authenticationScheme,\r\n resourceRequestMethod: request.resourceRequestMethod,\r\n resourceRequestUri: request.resourceRequestUri,\r\n shrClaims: request.shrClaims,\r\n sshKid: request.sshKid\r\n };\r\n\r\n const reqTimestamp = TimeUtils.nowSeconds();\r\n const response = await this.executePostToTokenEndpoint(authority.tokenEndpoint, requestBody, headers, thumbprint);\r\n\r\n const responseHandler = new ResponseHandler(\r\n this.config.authOptions.clientId,\r\n this.cacheManager,\r\n this.cryptoUtils,\r\n this.logger,\r\n this.config.serializableCache,\r\n this.config.persistencePlugin\r\n );\r\n\r\n responseHandler.validateTokenResponse(response.body);\r\n const tokenResponse = await responseHandler.handleServerTokenResponse(\r\n response.body,\r\n this.authority,\r\n reqTimestamp,\r\n request,\r\n undefined,\r\n userAssertionHash\r\n );\r\n\r\n return tokenResponse;\r\n }\r\n\r\n /**\r\n * generate a server request in accepable format\r\n * @param request\r\n */\r\n private createTokenRequestBody(request: CommonOnBehalfOfRequest): string {\r\n const parameterBuilder = new RequestParameterBuilder();\r\n\r\n parameterBuilder.addClientId(this.config.authOptions.clientId);\r\n\r\n parameterBuilder.addScopes(request.scopes);\r\n\r\n parameterBuilder.addGrantType(GrantType.JWT_BEARER);\r\n\r\n parameterBuilder.addClientInfo();\r\n\r\n parameterBuilder.addLibraryInfo(this.config.libraryInfo);\r\n parameterBuilder.addApplicationTelemetry(this.config.telemetry.application);\r\n parameterBuilder.addThrottling();\r\n\r\n if (this.serverTelemetryManager) {\r\n parameterBuilder.addServerTelemetry(this.serverTelemetryManager);\r\n }\r\n\r\n const correlationId = request.correlationId || this.config.cryptoInterface.createNewGuid();\r\n parameterBuilder.addCorrelationId(correlationId);\r\n\r\n parameterBuilder.addRequestTokenUse(AADServerParamKeys.ON_BEHALF_OF);\r\n\r\n parameterBuilder.addOboAssertion(request.oboAssertion);\r\n\r\n if (this.config.clientCredentials.clientSecret) {\r\n parameterBuilder.addClientSecret(this.config.clientCredentials.clientSecret);\r\n }\r\n\r\n if (this.config.clientCredentials.clientAssertion) {\r\n const clientAssertion = this.config.clientCredentials.clientAssertion;\r\n parameterBuilder.addClientAssertion(clientAssertion.assertion);\r\n parameterBuilder.addClientAssertionType(clientAssertion.assertionType);\r\n }\r\n\r\n if (request.claims || (this.config.authOptions.clientCapabilities && this.config.authOptions.clientCapabilities.length > 0)) {\r\n parameterBuilder.addClaims(request.claims, this.config.authOptions.clientCapabilities);\r\n }\r\n \r\n return parameterBuilder.createQueryString();\r\n }\r\n}\r\n","/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License.\r\n */\r\n\r\nimport { BaseClient } from \"./BaseClient\";\r\nimport { ClientConfiguration } from \"../config/ClientConfiguration\";\r\nimport { CommonSilentFlowRequest } from \"../request/CommonSilentFlowRequest\";\r\nimport { AuthenticationResult } from \"../response/AuthenticationResult\";\r\nimport { AuthToken } from \"../account/AuthToken\";\r\nimport { TimeUtils } from \"../utils/TimeUtils\";\r\nimport { RefreshTokenClient } from \"./RefreshTokenClient\";\r\nimport { ClientAuthError, ClientAuthErrorMessage } from \"../error/ClientAuthError\";\r\nimport { ClientConfigurationError } from \"../error/ClientConfigurationError\";\r\nimport { ResponseHandler } from \"../response/ResponseHandler\";\r\nimport { CacheRecord } from \"../cache/entities/CacheRecord\";\r\nimport { CacheOutcome } from \"../utils/Constants\";\r\nimport { IPerformanceClient } from \"../telemetry/performance/IPerformanceClient\";\r\n\r\nexport class SilentFlowClient extends BaseClient {\r\n \r\n constructor(configuration: ClientConfiguration, performanceClient?: IPerformanceClient) {\r\n super(configuration,performanceClient);\r\n }\r\n \r\n /**\r\n * Retrieves a token from cache if it is still valid, or uses the cached refresh token to renew\r\n * the given token and returns the renewed token\r\n * @param request\r\n */\r\n async acquireToken(request: CommonSilentFlowRequest): Promise {\r\n try {\r\n return await this.acquireCachedToken(request);\r\n } catch (e) {\r\n if (e instanceof ClientAuthError && e.errorCode === ClientAuthErrorMessage.tokenRefreshRequired.code) {\r\n const refreshTokenClient = new RefreshTokenClient(this.config, this.performanceClient);\r\n return refreshTokenClient.acquireTokenByRefreshToken(request);\r\n } else {\r\n throw e;\r\n }\r\n }\r\n }\r\n \r\n /**\r\n * Retrieves token from cache or throws an error if it must be refreshed.\r\n * @param request\r\n */\r\n async acquireCachedToken(request: CommonSilentFlowRequest): Promise {\r\n // Cannot renew token if no request object is given.\r\n if (!request) {\r\n throw ClientConfigurationError.createEmptyTokenRequestError();\r\n }\r\n\r\n if (request.forceRefresh) {\r\n // Must refresh due to present force_refresh flag.\r\n this.serverTelemetryManager?.setCacheOutcome(CacheOutcome.FORCE_REFRESH);\r\n this.logger.info(\"SilentFlowClient:acquireCachedToken - Skipping cache because forceRefresh is true.\");\r\n throw ClientAuthError.createRefreshRequiredError();\r\n }\r\n\r\n // We currently do not support silent flow for account === null use cases; This will be revisited for confidential flow usecases\r\n if (!request.account) {\r\n throw ClientAuthError.createNoAccountInSilentRequestError();\r\n }\r\n\r\n const environment = request.authority || this.authority.getPreferredCache();\r\n\r\n const cacheRecord = this.cacheManager.readCacheRecord(request.account, this.config.authOptions.clientId, request, environment);\r\n\r\n if (!cacheRecord.accessToken) {\r\n // Must refresh due to non-existent access_token.\r\n this.serverTelemetryManager?.setCacheOutcome(CacheOutcome.NO_CACHED_ACCESS_TOKEN);\r\n this.logger.info(\"SilentFlowClient:acquireCachedToken - No access token found in cache for the given properties.\");\r\n throw ClientAuthError.createRefreshRequiredError();\r\n } else if (\r\n TimeUtils.wasClockTurnedBack(cacheRecord.accessToken.cachedAt) ||\r\n TimeUtils.isTokenExpired(cacheRecord.accessToken.expiresOn, this.config.systemOptions.tokenRenewalOffsetSeconds)\r\n ) {\r\n // Must refresh due to expired access_token.\r\n this.serverTelemetryManager?.setCacheOutcome(CacheOutcome.CACHED_ACCESS_TOKEN_EXPIRED);\r\n this.logger.info(`SilentFlowClient:acquireCachedToken - Cached access token is expired or will expire within ${this.config.systemOptions.tokenRenewalOffsetSeconds} seconds.`);\r\n throw ClientAuthError.createRefreshRequiredError();\r\n } else if (cacheRecord.accessToken.refreshOn && TimeUtils.isTokenExpired(cacheRecord.accessToken.refreshOn, 0)) {\r\n // Must refresh due to the refresh_in value.\r\n this.serverTelemetryManager?.setCacheOutcome(CacheOutcome.REFRESH_CACHED_ACCESS_TOKEN);\r\n this.logger.info(\"SilentFlowClient:acquireCachedToken - Cached access token's refreshOn property has been exceeded'.\");\r\n throw ClientAuthError.createRefreshRequiredError();\r\n }\r\n\r\n if (this.config.serverTelemetryManager) {\r\n this.config.serverTelemetryManager.incrementCacheHits();\r\n }\r\n\r\n return await this.generateResultFromCacheRecord(cacheRecord, request);\r\n }\r\n\r\n /**\r\n * Helper function to build response object from the CacheRecord\r\n * @param cacheRecord\r\n */\r\n private async generateResultFromCacheRecord(cacheRecord: CacheRecord, request: CommonSilentFlowRequest): Promise {\r\n let idTokenObj: AuthToken | undefined;\r\n if (cacheRecord.idToken) {\r\n idTokenObj = new AuthToken(cacheRecord.idToken.secret, this.config.cryptoInterface);\r\n }\r\n\r\n // token max_age check\r\n if (request.maxAge || (request.maxAge === 0)) {\r\n const authTime = idTokenObj?.claims.auth_time;\r\n if (!authTime) {\r\n throw ClientAuthError.createAuthTimeNotFoundError();\r\n }\r\n\r\n AuthToken.checkMaxAge(authTime, request.maxAge);\r\n }\r\n\r\n return await ResponseHandler.generateAuthenticationResult(\r\n this.cryptoUtils,\r\n this.authority,\r\n cacheRecord,\r\n true,\r\n request,\r\n idTokenObj\r\n );\r\n }\r\n}\r\n","/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License.\r\n */\r\n\r\nimport { BaseClient } from \"./BaseClient\";\r\nimport { ClientConfiguration } from \"../config/ClientConfiguration\";\r\nimport { CommonUsernamePasswordRequest } from \"../request/CommonUsernamePasswordRequest\";\r\nimport { AuthenticationResult } from \"../response/AuthenticationResult\";\r\nimport { ResponseHandler } from \"../response/ResponseHandler\";\r\nimport { Authority } from \"../authority/Authority\";\r\nimport { NetworkResponse } from \"../network/NetworkManager\";\r\nimport { ServerAuthorizationTokenResponse } from \"../response/ServerAuthorizationTokenResponse\";\r\nimport { RequestParameterBuilder } from \"../request/RequestParameterBuilder\";\r\nimport { GrantType, HeaderNames } from \"../utils/Constants\";\r\nimport { StringUtils } from \"../utils/StringUtils\";\r\nimport { RequestThumbprint } from \"../network/RequestThumbprint\";\r\nimport { TimeUtils } from \"../utils/TimeUtils\";\r\nimport { CcsCredentialType } from \"../account/CcsCredential\";\r\n\r\n/**\r\n * Oauth2.0 Password grant client\r\n * Note: We are only supporting public clients for password grant and for purely testing purposes\r\n */\r\nexport class UsernamePasswordClient extends BaseClient {\r\n\r\n constructor(configuration: ClientConfiguration) {\r\n super(configuration);\r\n }\r\n\r\n /**\r\n * API to acquire a token by passing the username and password to the service in exchage of credentials\r\n * password_grant\r\n * @param request\r\n */\r\n async acquireToken(request: CommonUsernamePasswordRequest): Promise {\r\n // @ts-ignore\r\n const atsMeasurement = this.performanceClient?.startMeasurement(\"UsernamePasswordClientAcquireToken\", request.correlationId);\r\n this.logger.info(\"in acquireToken call in username-password client\");\r\n\r\n const reqTimestamp = TimeUtils.nowSeconds();\r\n const response = await this.executeTokenRequest(this.authority, request);\r\n\r\n const httpVerToken = response.headers?.[HeaderNames.X_MS_HTTP_VERSION];\r\n atsMeasurement?.addStaticFields({\r\n httpVerToken\r\n });\r\n \r\n const responseHandler = new ResponseHandler(\r\n this.config.authOptions.clientId,\r\n this.cacheManager,\r\n this.cryptoUtils,\r\n this.logger,\r\n this.config.serializableCache,\r\n this.config.persistencePlugin\r\n );\r\n\r\n // Validate response. This function throws a server error if an error is returned by the server.\r\n responseHandler.validateTokenResponse(response.body);\r\n const tokenResponse = responseHandler.handleServerTokenResponse(response.body, this.authority, reqTimestamp, request);\r\n\r\n return tokenResponse;\r\n }\r\n\r\n /**\r\n * Executes POST request to token endpoint\r\n * @param authority\r\n * @param request\r\n */\r\n private async executeTokenRequest(authority: Authority, request: CommonUsernamePasswordRequest): Promise> {\r\n const thumbprint: RequestThumbprint = {\r\n clientId: this.config.authOptions.clientId,\r\n authority: authority.canonicalAuthority,\r\n scopes: request.scopes,\r\n claims: request.claims,\r\n authenticationScheme: request.authenticationScheme,\r\n resourceRequestMethod: request.resourceRequestMethod,\r\n resourceRequestUri: request.resourceRequestUri,\r\n shrClaims: request.shrClaims,\r\n sshKid: request.sshKid\r\n };\r\n const requestBody = this.createTokenRequestBody(request);\r\n const headers: Record = this.createTokenRequestHeaders({\r\n credential: request.username,\r\n type: CcsCredentialType.UPN\r\n });\r\n\r\n return this.executePostToTokenEndpoint(authority.tokenEndpoint, requestBody, headers, thumbprint);\r\n }\r\n\r\n /**\r\n * Generates a map for all the params to be sent to the service\r\n * @param request\r\n */\r\n private createTokenRequestBody(request: CommonUsernamePasswordRequest): string {\r\n const parameterBuilder = new RequestParameterBuilder();\r\n\r\n parameterBuilder.addClientId(this.config.authOptions.clientId);\r\n parameterBuilder.addUsername(request.username);\r\n parameterBuilder.addPassword(request.password);\r\n\r\n parameterBuilder.addScopes(request.scopes);\r\n\r\n parameterBuilder.addResponseTypeForTokenAndIdToken();\r\n\r\n parameterBuilder.addGrantType(GrantType.RESOURCE_OWNER_PASSWORD_GRANT);\r\n parameterBuilder.addClientInfo();\r\n\r\n parameterBuilder.addLibraryInfo(this.config.libraryInfo);\r\n parameterBuilder.addApplicationTelemetry(this.config.telemetry.application);\r\n parameterBuilder.addThrottling();\r\n\r\n if (this.serverTelemetryManager) {\r\n parameterBuilder.addServerTelemetry(this.serverTelemetryManager);\r\n }\r\n\r\n const correlationId = request.correlationId || this.config.cryptoInterface.createNewGuid();\r\n parameterBuilder.addCorrelationId(correlationId);\r\n\r\n if (this.config.clientCredentials.clientSecret) {\r\n parameterBuilder.addClientSecret(this.config.clientCredentials.clientSecret);\r\n }\r\n\r\n if (this.config.clientCredentials.clientAssertion) {\r\n const clientAssertion = this.config.clientCredentials.clientAssertion;\r\n parameterBuilder.addClientAssertion(clientAssertion.assertion);\r\n parameterBuilder.addClientAssertionType(clientAssertion.assertionType);\r\n }\r\n\r\n if (!StringUtils.isEmptyObj(request.claims) || this.config.authOptions.clientCapabilities && this.config.authOptions.clientCapabilities.length > 0) {\r\n parameterBuilder.addClaims(request.claims, this.config.authOptions.clientCapabilities);\r\n }\r\n\r\n if (this.config.systemOptions.preventCorsPreflight && request.username) {\r\n parameterBuilder.addCcsUpn(request.username);\r\n }\r\n\r\n return parameterBuilder.createQueryString();\r\n }\r\n}\r\n","/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License.\r\n */\r\n\r\n/**\r\n * Tenant Discovery Response which contains the relevant OAuth endpoints and data needed for authentication and authorization.\r\n */\r\nexport type OpenIdConfigResponse = {\r\n authorization_endpoint: string;\r\n token_endpoint: string;\r\n end_session_endpoint?: string;\r\n issuer: string;\r\n jwks_uri: string;\r\n};\r\n\r\nexport function isOpenIdConfigResponse(response: object): boolean {\r\n return (\r\n response.hasOwnProperty(\"authorization_endpoint\") &&\r\n response.hasOwnProperty(\"token_endpoint\") && \r\n response.hasOwnProperty(\"issuer\") &&\r\n response.hasOwnProperty(\"jwks_uri\")\r\n );\r\n}\r\n","/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License.\r\n */\r\n\r\nexport const rawMetdataJSON = {\"endpointMetadata\":{\"https://login.microsoftonline.com/common/\":{\"token_endpoint\":\"https://login.microsoftonline.com/common/oauth2/v2.0/token\",\"token_endpoint_auth_methods_supported\":[\"client_secret_post\",\"private_key_jwt\",\"client_secret_basic\"],\"jwks_uri\":\"https://login.microsoftonline.com/common/discovery/v2.0/keys\",\"response_modes_supported\":[\"query\",\"fragment\",\"form_post\"],\"subject_types_supported\":[\"pairwise\"],\"id_token_signing_alg_values_supported\":[\"RS256\"],\"response_types_supported\":[\"code\",\"id_token\",\"code id_token\",\"id_token token\"],\"scopes_supported\":[\"openid\",\"profile\",\"email\",\"offline_access\"],\"issuer\":\"https://login.microsoftonline.com/{tenantid}/v2.0\",\"request_uri_parameter_supported\":false,\"userinfo_endpoint\":\"https://graph.microsoft.com/oidc/userinfo\",\"authorization_endpoint\":\"https://login.microsoftonline.com/common/oauth2/v2.0/authorize\",\"device_authorization_endpoint\":\"https://login.microsoftonline.com/common/oauth2/v2.0/devicecode\",\"http_logout_supported\":true,\"frontchannel_logout_supported\":true,\"end_session_endpoint\":\"https://login.microsoftonline.com/common/oauth2/v2.0/logout\",\"claims_supported\":[\"sub\",\"iss\",\"cloud_instance_name\",\"cloud_instance_host_name\",\"cloud_graph_host_name\",\"msgraph_host\",\"aud\",\"exp\",\"iat\",\"auth_time\",\"acr\",\"nonce\",\"preferred_username\",\"name\",\"tid\",\"ver\",\"at_hash\",\"c_hash\",\"email\"],\"kerberos_endpoint\":\"https://login.microsoftonline.com/common/kerberos\",\"tenant_region_scope\":null,\"cloud_instance_name\":\"microsoftonline.com\",\"cloud_graph_host_name\":\"graph.windows.net\",\"msgraph_host\":\"graph.microsoft.com\",\"rbac_url\":\"https://pas.windows.net\"},\"https://login.chinacloudapi.cn/common/\":{\"token_endpoint\":\"https://login.chinacloudapi.cn/common/oauth2/v2.0/token\",\"token_endpoint_auth_methods_supported\":[\"client_secret_post\",\"private_key_jwt\",\"client_secret_basic\"],\"jwks_uri\":\"https://login.chinacloudapi.cn/common/discovery/v2.0/keys\",\"response_modes_supported\":[\"query\",\"fragment\",\"form_post\"],\"subject_types_supported\":[\"pairwise\"],\"id_token_signing_alg_values_supported\":[\"RS256\"],\"response_types_supported\":[\"code\",\"id_token\",\"code id_token\",\"id_token token\"],\"scopes_supported\":[\"openid\",\"profile\",\"email\",\"offline_access\"],\"issuer\":\"https://login.partner.microsoftonline.cn/{tenantid}/v2.0\",\"request_uri_parameter_supported\":false,\"userinfo_endpoint\":\"https://microsoftgraph.chinacloudapi.cn/oidc/userinfo\",\"authorization_endpoint\":\"https://login.chinacloudapi.cn/common/oauth2/v2.0/authorize\",\"device_authorization_endpoint\":\"https://login.chinacloudapi.cn/common/oauth2/v2.0/devicecode\",\"http_logout_supported\":true,\"frontchannel_logout_supported\":true,\"end_session_endpoint\":\"https://login.chinacloudapi.cn/common/oauth2/v2.0/logout\",\"claims_supported\":[\"sub\",\"iss\",\"cloud_instance_name\",\"cloud_instance_host_name\",\"cloud_graph_host_name\",\"msgraph_host\",\"aud\",\"exp\",\"iat\",\"auth_time\",\"acr\",\"nonce\",\"preferred_username\",\"name\",\"tid\",\"ver\",\"at_hash\",\"c_hash\",\"email\"],\"kerberos_endpoint\":\"https://login.chinacloudapi.cn/common/kerberos\",\"tenant_region_scope\":null,\"cloud_instance_name\":\"partner.microsoftonline.cn\",\"cloud_graph_host_name\":\"graph.chinacloudapi.cn\",\"msgraph_host\":\"microsoftgraph.chinacloudapi.cn\",\"rbac_url\":\"https://pas.chinacloudapi.cn\"},\"https://login.microsoftonline.us/common/\":{\"token_endpoint\":\"https://login.microsoftonline.us/common/oauth2/v2.0/token\",\"token_endpoint_auth_methods_supported\":[\"client_secret_post\",\"private_key_jwt\",\"client_secret_basic\"],\"jwks_uri\":\"https://login.microsoftonline.us/common/discovery/v2.0/keys\",\"response_modes_supported\":[\"query\",\"fragment\",\"form_post\"],\"subject_types_supported\":[\"pairwise\"],\"id_token_signing_alg_values_supported\":[\"RS256\"],\"response_types_supported\":[\"code\",\"id_token\",\"code id_token\",\"id_token token\"],\"scopes_supported\":[\"openid\",\"profile\",\"email\",\"offline_access\"],\"issuer\":\"https://login.microsoftonline.us/{tenantid}/v2.0\",\"request_uri_parameter_supported\":false,\"userinfo_endpoint\":\"https://graph.microsoft.com/oidc/userinfo\",\"authorization_endpoint\":\"https://login.microsoftonline.us/common/oauth2/v2.0/authorize\",\"device_authorization_endpoint\":\"https://login.microsoftonline.us/common/oauth2/v2.0/devicecode\",\"http_logout_supported\":true,\"frontchannel_logout_supported\":true,\"end_session_endpoint\":\"https://login.microsoftonline.us/common/oauth2/v2.0/logout\",\"claims_supported\":[\"sub\",\"iss\",\"cloud_instance_name\",\"cloud_instance_host_name\",\"cloud_graph_host_name\",\"msgraph_host\",\"aud\",\"exp\",\"iat\",\"auth_time\",\"acr\",\"nonce\",\"preferred_username\",\"name\",\"tid\",\"ver\",\"at_hash\",\"c_hash\",\"email\"],\"kerberos_endpoint\":\"https://login.microsoftonline.us/common/kerberos\",\"tenant_region_scope\":null,\"cloud_instance_name\":\"microsoftonline.us\",\"cloud_graph_host_name\":\"graph.windows.net\",\"msgraph_host\":\"graph.microsoft.com\",\"rbac_url\":\"https://pasff.usgovcloudapi.net\"},\"https://login.microsoftonline.com/consumers/\":{\"token_endpoint\":\"https://login.microsoftonline.com/consumers/oauth2/v2.0/token\",\"token_endpoint_auth_methods_supported\":[\"client_secret_post\",\"private_key_jwt\",\"client_secret_basic\"],\"jwks_uri\":\"https://login.microsoftonline.com/consumers/discovery/v2.0/keys\",\"response_modes_supported\":[\"query\",\"fragment\",\"form_post\"],\"subject_types_supported\":[\"pairwise\"],\"id_token_signing_alg_values_supported\":[\"RS256\"],\"response_types_supported\":[\"code\",\"id_token\",\"code id_token\",\"id_token token\"],\"scopes_supported\":[\"openid\",\"profile\",\"email\",\"offline_access\"],\"issuer\":\"https://login.microsoftonline.com/9188040d-6c67-4c5b-b112-36a304b66dad/v2.0\",\"request_uri_parameter_supported\":false,\"userinfo_endpoint\":\"https://graph.microsoft.com/oidc/userinfo\",\"authorization_endpoint\":\"https://login.microsoftonline.com/consumers/oauth2/v2.0/authorize\",\"device_authorization_endpoint\":\"https://login.microsoftonline.com/consumers/oauth2/v2.0/devicecode\",\"http_logout_supported\":true,\"frontchannel_logout_supported\":true,\"end_session_endpoint\":\"https://login.microsoftonline.com/consumers/oauth2/v2.0/logout\",\"claims_supported\":[\"sub\",\"iss\",\"cloud_instance_name\",\"cloud_instance_host_name\",\"cloud_graph_host_name\",\"msgraph_host\",\"aud\",\"exp\",\"iat\",\"auth_time\",\"acr\",\"nonce\",\"preferred_username\",\"name\",\"tid\",\"ver\",\"at_hash\",\"c_hash\",\"email\"],\"kerberos_endpoint\":\"https://login.microsoftonline.com/consumers/kerberos\",\"tenant_region_scope\":null,\"cloud_instance_name\":\"microsoftonline.com\",\"cloud_graph_host_name\":\"graph.windows.net\",\"msgraph_host\":\"graph.microsoft.com\",\"rbac_url\":\"https://pas.windows.net\"},\"https://login.chinacloudapi.cn/consumers/\":{\"token_endpoint\":\"https://login.chinacloudapi.cn/consumers/oauth2/v2.0/token\",\"token_endpoint_auth_methods_supported\":[\"client_secret_post\",\"private_key_jwt\",\"client_secret_basic\"],\"jwks_uri\":\"https://login.chinacloudapi.cn/consumers/discovery/v2.0/keys\",\"response_modes_supported\":[\"query\",\"fragment\",\"form_post\"],\"subject_types_supported\":[\"pairwise\"],\"id_token_signing_alg_values_supported\":[\"RS256\"],\"response_types_supported\":[\"code\",\"id_token\",\"code id_token\",\"id_token token\"],\"scopes_supported\":[\"openid\",\"profile\",\"email\",\"offline_access\"],\"issuer\":\"https://login.partner.microsoftonline.cn/9188040d-6c67-4c5b-b112-36a304b66dad/v2.0\",\"request_uri_parameter_supported\":false,\"userinfo_endpoint\":\"https://microsoftgraph.chinacloudapi.cn/oidc/userinfo\",\"authorization_endpoint\":\"https://login.chinacloudapi.cn/consumers/oauth2/v2.0/authorize\",\"device_authorization_endpoint\":\"https://login.chinacloudapi.cn/consumers/oauth2/v2.0/devicecode\",\"http_logout_supported\":true,\"frontchannel_logout_supported\":true,\"end_session_endpoint\":\"https://login.chinacloudapi.cn/consumers/oauth2/v2.0/logout\",\"claims_supported\":[\"sub\",\"iss\",\"cloud_instance_name\",\"cloud_instance_host_name\",\"cloud_graph_host_name\",\"msgraph_host\",\"aud\",\"exp\",\"iat\",\"auth_time\",\"acr\",\"nonce\",\"preferred_username\",\"name\",\"tid\",\"ver\",\"at_hash\",\"c_hash\",\"email\"],\"kerberos_endpoint\":\"https://login.chinacloudapi.cn/consumers/kerberos\",\"tenant_region_scope\":null,\"cloud_instance_name\":\"partner.microsoftonline.cn\",\"cloud_graph_host_name\":\"graph.chinacloudapi.cn\",\"msgraph_host\":\"microsoftgraph.chinacloudapi.cn\",\"rbac_url\":\"https://pas.chinacloudapi.cn\"},\"https://login.microsoftonline.us/consumers/\":{\"token_endpoint\":\"https://login.microsoftonline.us/consumers/oauth2/v2.0/token\",\"token_endpoint_auth_methods_supported\":[\"client_secret_post\",\"private_key_jwt\",\"client_secret_basic\"],\"jwks_uri\":\"https://login.microsoftonline.us/consumers/discovery/v2.0/keys\",\"response_modes_supported\":[\"query\",\"fragment\",\"form_post\"],\"subject_types_supported\":[\"pairwise\"],\"id_token_signing_alg_values_supported\":[\"RS256\"],\"response_types_supported\":[\"code\",\"id_token\",\"code id_token\",\"id_token token\"],\"scopes_supported\":[\"openid\",\"profile\",\"email\",\"offline_access\"],\"issuer\":\"https://login.microsoftonline.us/9188040d-6c67-4c5b-b112-36a304b66dad/v2.0\",\"request_uri_parameter_supported\":false,\"userinfo_endpoint\":\"https://graph.microsoft.com/oidc/userinfo\",\"authorization_endpoint\":\"https://login.microsoftonline.us/consumers/oauth2/v2.0/authorize\",\"device_authorization_endpoint\":\"https://login.microsoftonline.us/consumers/oauth2/v2.0/devicecode\",\"http_logout_supported\":true,\"frontchannel_logout_supported\":true,\"end_session_endpoint\":\"https://login.microsoftonline.us/consumers/oauth2/v2.0/logout\",\"claims_supported\":[\"sub\",\"iss\",\"cloud_instance_name\",\"cloud_instance_host_name\",\"cloud_graph_host_name\",\"msgraph_host\",\"aud\",\"exp\",\"iat\",\"auth_time\",\"acr\",\"nonce\",\"preferred_username\",\"name\",\"tid\",\"ver\",\"at_hash\",\"c_hash\",\"email\"],\"kerberos_endpoint\":\"https://login.microsoftonline.us/consumers/kerberos\",\"tenant_region_scope\":null,\"cloud_instance_name\":\"microsoftonline.us\",\"cloud_graph_host_name\":\"graph.windows.net\",\"msgraph_host\":\"graph.microsoft.com\",\"rbac_url\":\"https://pasff.usgovcloudapi.net\"},\"https://login.microsoftonline.com/organizations/\":{\"token_endpoint\":\"https://login.microsoftonline.com/organizations/oauth2/v2.0/token\",\"token_endpoint_auth_methods_supported\":[\"client_secret_post\",\"private_key_jwt\",\"client_secret_basic\"],\"jwks_uri\":\"https://login.microsoftonline.com/organizations/discovery/v2.0/keys\",\"response_modes_supported\":[\"query\",\"fragment\",\"form_post\"],\"subject_types_supported\":[\"pairwise\"],\"id_token_signing_alg_values_supported\":[\"RS256\"],\"response_types_supported\":[\"code\",\"id_token\",\"code id_token\",\"id_token token\"],\"scopes_supported\":[\"openid\",\"profile\",\"email\",\"offline_access\"],\"issuer\":\"https://login.microsoftonline.com/{tenantid}/v2.0\",\"request_uri_parameter_supported\":false,\"userinfo_endpoint\":\"https://graph.microsoft.com/oidc/userinfo\",\"authorization_endpoint\":\"https://login.microsoftonline.com/organizations/oauth2/v2.0/authorize\",\"device_authorization_endpoint\":\"https://login.microsoftonline.com/organizations/oauth2/v2.0/devicecode\",\"http_logout_supported\":true,\"frontchannel_logout_supported\":true,\"end_session_endpoint\":\"https://login.microsoftonline.com/organizations/oauth2/v2.0/logout\",\"claims_supported\":[\"sub\",\"iss\",\"cloud_instance_name\",\"cloud_instance_host_name\",\"cloud_graph_host_name\",\"msgraph_host\",\"aud\",\"exp\",\"iat\",\"auth_time\",\"acr\",\"nonce\",\"preferred_username\",\"name\",\"tid\",\"ver\",\"at_hash\",\"c_hash\",\"email\"],\"kerberos_endpoint\":\"https://login.microsoftonline.com/organizations/kerberos\",\"tenant_region_scope\":null,\"cloud_instance_name\":\"microsoftonline.com\",\"cloud_graph_host_name\":\"graph.windows.net\",\"msgraph_host\":\"graph.microsoft.com\",\"rbac_url\":\"https://pas.windows.net\"},\"https://login.chinacloudapi.cn/organizations/\":{\"token_endpoint\":\"https://login.chinacloudapi.cn/organizations/oauth2/v2.0/token\",\"token_endpoint_auth_methods_supported\":[\"client_secret_post\",\"private_key_jwt\",\"client_secret_basic\"],\"jwks_uri\":\"https://login.chinacloudapi.cn/organizations/discovery/v2.0/keys\",\"response_modes_supported\":[\"query\",\"fragment\",\"form_post\"],\"subject_types_supported\":[\"pairwise\"],\"id_token_signing_alg_values_supported\":[\"RS256\"],\"response_types_supported\":[\"code\",\"id_token\",\"code id_token\",\"id_token token\"],\"scopes_supported\":[\"openid\",\"profile\",\"email\",\"offline_access\"],\"issuer\":\"https://login.partner.microsoftonline.cn/{tenantid}/v2.0\",\"request_uri_parameter_supported\":false,\"userinfo_endpoint\":\"https://microsoftgraph.chinacloudapi.cn/oidc/userinfo\",\"authorization_endpoint\":\"https://login.chinacloudapi.cn/organizations/oauth2/v2.0/authorize\",\"device_authorization_endpoint\":\"https://login.chinacloudapi.cn/organizations/oauth2/v2.0/devicecode\",\"http_logout_supported\":true,\"frontchannel_logout_supported\":true,\"end_session_endpoint\":\"https://login.chinacloudapi.cn/organizations/oauth2/v2.0/logout\",\"claims_supported\":[\"sub\",\"iss\",\"cloud_instance_name\",\"cloud_instance_host_name\",\"cloud_graph_host_name\",\"msgraph_host\",\"aud\",\"exp\",\"iat\",\"auth_time\",\"acr\",\"nonce\",\"preferred_username\",\"name\",\"tid\",\"ver\",\"at_hash\",\"c_hash\",\"email\"],\"kerberos_endpoint\":\"https://login.chinacloudapi.cn/organizations/kerberos\",\"tenant_region_scope\":null,\"cloud_instance_name\":\"partner.microsoftonline.cn\",\"cloud_graph_host_name\":\"graph.chinacloudapi.cn\",\"msgraph_host\":\"microsoftgraph.chinacloudapi.cn\",\"rbac_url\":\"https://pas.chinacloudapi.cn\"},\"https://login.microsoftonline.us/organizations/\":{\"token_endpoint\":\"https://login.microsoftonline.us/organizations/oauth2/v2.0/token\",\"token_endpoint_auth_methods_supported\":[\"client_secret_post\",\"private_key_jwt\",\"client_secret_basic\"],\"jwks_uri\":\"https://login.microsoftonline.us/organizations/discovery/v2.0/keys\",\"response_modes_supported\":[\"query\",\"fragment\",\"form_post\"],\"subject_types_supported\":[\"pairwise\"],\"id_token_signing_alg_values_supported\":[\"RS256\"],\"response_types_supported\":[\"code\",\"id_token\",\"code id_token\",\"id_token token\"],\"scopes_supported\":[\"openid\",\"profile\",\"email\",\"offline_access\"],\"issuer\":\"https://login.microsoftonline.us/{tenantid}/v2.0\",\"request_uri_parameter_supported\":false,\"userinfo_endpoint\":\"https://graph.microsoft.com/oidc/userinfo\",\"authorization_endpoint\":\"https://login.microsoftonline.us/organizations/oauth2/v2.0/authorize\",\"device_authorization_endpoint\":\"https://login.microsoftonline.us/organizations/oauth2/v2.0/devicecode\",\"http_logout_supported\":true,\"frontchannel_logout_supported\":true,\"end_session_endpoint\":\"https://login.microsoftonline.us/organizations/oauth2/v2.0/logout\",\"claims_supported\":[\"sub\",\"iss\",\"cloud_instance_name\",\"cloud_instance_host_name\",\"cloud_graph_host_name\",\"msgraph_host\",\"aud\",\"exp\",\"iat\",\"auth_time\",\"acr\",\"nonce\",\"preferred_username\",\"name\",\"tid\",\"ver\",\"at_hash\",\"c_hash\",\"email\"],\"kerberos_endpoint\":\"https://login.microsoftonline.us/organizations/kerberos\",\"tenant_region_scope\":null,\"cloud_instance_name\":\"microsoftonline.us\",\"cloud_graph_host_name\":\"graph.windows.net\",\"msgraph_host\":\"graph.microsoft.com\",\"rbac_url\":\"https://pasff.usgovcloudapi.net\"}},\"instanceDiscoveryMetadata\":{\"https://login.microsoftonline.com/common/\":{\"tenant_discovery_endpoint\":\"https://login.microsoftonline.com/common/v2.0/.well-known/openid-configuration\",\"api-version\":\"1.1\",\"metadata\":[{\"preferred_network\":\"login.microsoftonline.com\",\"preferred_cache\":\"login.windows.net\",\"aliases\":[\"login.microsoftonline.com\",\"login.windows.net\",\"login.microsoft.com\",\"sts.windows.net\"]},{\"preferred_network\":\"login.partner.microsoftonline.cn\",\"preferred_cache\":\"login.partner.microsoftonline.cn\",\"aliases\":[\"login.partner.microsoftonline.cn\",\"login.chinacloudapi.cn\"]},{\"preferred_network\":\"login.microsoftonline.de\",\"preferred_cache\":\"login.microsoftonline.de\",\"aliases\":[\"login.microsoftonline.de\"]},{\"preferred_network\":\"login.microsoftonline.us\",\"preferred_cache\":\"login.microsoftonline.us\",\"aliases\":[\"login.microsoftonline.us\",\"login.usgovcloudapi.net\"]},{\"preferred_network\":\"login-us.microsoftonline.com\",\"preferred_cache\":\"login-us.microsoftonline.com\",\"aliases\":[\"login-us.microsoftonline.com\"]}]},\"https://login.chinacloudapi.cn/common/\":{\"tenant_discovery_endpoint\":\"https://login.chinacloudapi.cn/common/v2.0/.well-known/openid-configuration\",\"api-version\":\"1.1\",\"metadata\":[{\"preferred_network\":\"login.microsoftonline.com\",\"preferred_cache\":\"login.windows.net\",\"aliases\":[\"login.microsoftonline.com\",\"login.windows.net\",\"login.microsoft.com\",\"sts.windows.net\"]},{\"preferred_network\":\"login.partner.microsoftonline.cn\",\"preferred_cache\":\"login.partner.microsoftonline.cn\",\"aliases\":[\"login.partner.microsoftonline.cn\",\"login.chinacloudapi.cn\"]},{\"preferred_network\":\"login.microsoftonline.de\",\"preferred_cache\":\"login.microsoftonline.de\",\"aliases\":[\"login.microsoftonline.de\"]},{\"preferred_network\":\"login.microsoftonline.us\",\"preferred_cache\":\"login.microsoftonline.us\",\"aliases\":[\"login.microsoftonline.us\",\"login.usgovcloudapi.net\"]},{\"preferred_network\":\"login-us.microsoftonline.com\",\"preferred_cache\":\"login-us.microsoftonline.com\",\"aliases\":[\"login-us.microsoftonline.com\"]}]},\"https://login.microsoftonline.us/common/\":{\"tenant_discovery_endpoint\":\"https://login.microsoftonline.us/common/v2.0/.well-known/openid-configuration\",\"api-version\":\"1.1\",\"metadata\":[{\"preferred_network\":\"login.microsoftonline.com\",\"preferred_cache\":\"login.windows.net\",\"aliases\":[\"login.microsoftonline.com\",\"login.windows.net\",\"login.microsoft.com\",\"sts.windows.net\"]},{\"preferred_network\":\"login.partner.microsoftonline.cn\",\"preferred_cache\":\"login.partner.microsoftonline.cn\",\"aliases\":[\"login.partner.microsoftonline.cn\",\"login.chinacloudapi.cn\"]},{\"preferred_network\":\"login.microsoftonline.de\",\"preferred_cache\":\"login.microsoftonline.de\",\"aliases\":[\"login.microsoftonline.de\"]},{\"preferred_network\":\"login.microsoftonline.us\",\"preferred_cache\":\"login.microsoftonline.us\",\"aliases\":[\"login.microsoftonline.us\",\"login.usgovcloudapi.net\"]},{\"preferred_network\":\"login-us.microsoftonline.com\",\"preferred_cache\":\"login-us.microsoftonline.com\",\"aliases\":[\"login-us.microsoftonline.com\"]}]},\"https://login.microsoftonline.com/consumers/\":{\"tenant_discovery_endpoint\":\"https://login.microsoftonline.com/consumers/v2.0/.well-known/openid-configuration\",\"api-version\":\"1.1\",\"metadata\":[{\"preferred_network\":\"login.microsoftonline.com\",\"preferred_cache\":\"login.windows.net\",\"aliases\":[\"login.microsoftonline.com\",\"login.windows.net\",\"login.microsoft.com\",\"sts.windows.net\"]},{\"preferred_network\":\"login.partner.microsoftonline.cn\",\"preferred_cache\":\"login.partner.microsoftonline.cn\",\"aliases\":[\"login.partner.microsoftonline.cn\",\"login.chinacloudapi.cn\"]},{\"preferred_network\":\"login.microsoftonline.de\",\"preferred_cache\":\"login.microsoftonline.de\",\"aliases\":[\"login.microsoftonline.de\"]},{\"preferred_network\":\"login.microsoftonline.us\",\"preferred_cache\":\"login.microsoftonline.us\",\"aliases\":[\"login.microsoftonline.us\",\"login.usgovcloudapi.net\"]},{\"preferred_network\":\"login-us.microsoftonline.com\",\"preferred_cache\":\"login-us.microsoftonline.com\",\"aliases\":[\"login-us.microsoftonline.com\"]}]},\"https://login.chinacloudapi.cn/consumers/\":{\"tenant_discovery_endpoint\":\"https://login.chinacloudapi.cn/consumers/v2.0/.well-known/openid-configuration\",\"api-version\":\"1.1\",\"metadata\":[{\"preferred_network\":\"login.microsoftonline.com\",\"preferred_cache\":\"login.windows.net\",\"aliases\":[\"login.microsoftonline.com\",\"login.windows.net\",\"login.microsoft.com\",\"sts.windows.net\"]},{\"preferred_network\":\"login.partner.microsoftonline.cn\",\"preferred_cache\":\"login.partner.microsoftonline.cn\",\"aliases\":[\"login.partner.microsoftonline.cn\",\"login.chinacloudapi.cn\"]},{\"preferred_network\":\"login.microsoftonline.de\",\"preferred_cache\":\"login.microsoftonline.de\",\"aliases\":[\"login.microsoftonline.de\"]},{\"preferred_network\":\"login.microsoftonline.us\",\"preferred_cache\":\"login.microsoftonline.us\",\"aliases\":[\"login.microsoftonline.us\",\"login.usgovcloudapi.net\"]},{\"preferred_network\":\"login-us.microsoftonline.com\",\"preferred_cache\":\"login-us.microsoftonline.com\",\"aliases\":[\"login-us.microsoftonline.com\"]}]},\"https://login.microsoftonline.us/consumers/\":{\"tenant_discovery_endpoint\":\"https://login.microsoftonline.us/consumers/v2.0/.well-known/openid-configuration\",\"api-version\":\"1.1\",\"metadata\":[{\"preferred_network\":\"login.microsoftonline.com\",\"preferred_cache\":\"login.windows.net\",\"aliases\":[\"login.microsoftonline.com\",\"login.windows.net\",\"login.microsoft.com\",\"sts.windows.net\"]},{\"preferred_network\":\"login.partner.microsoftonline.cn\",\"preferred_cache\":\"login.partner.microsoftonline.cn\",\"aliases\":[\"login.partner.microsoftonline.cn\",\"login.chinacloudapi.cn\"]},{\"preferred_network\":\"login.microsoftonline.de\",\"preferred_cache\":\"login.microsoftonline.de\",\"aliases\":[\"login.microsoftonline.de\"]},{\"preferred_network\":\"login.microsoftonline.us\",\"preferred_cache\":\"login.microsoftonline.us\",\"aliases\":[\"login.microsoftonline.us\",\"login.usgovcloudapi.net\"]},{\"preferred_network\":\"login-us.microsoftonline.com\",\"preferred_cache\":\"login-us.microsoftonline.com\",\"aliases\":[\"login-us.microsoftonline.com\"]}]},\"https://login.microsoftonline.com/organizations/\":{\"tenant_discovery_endpoint\":\"https://login.microsoftonline.com/organizations/v2.0/.well-known/openid-configuration\",\"api-version\":\"1.1\",\"metadata\":[{\"preferred_network\":\"login.microsoftonline.com\",\"preferred_cache\":\"login.windows.net\",\"aliases\":[\"login.microsoftonline.com\",\"login.windows.net\",\"login.microsoft.com\",\"sts.windows.net\"]},{\"preferred_network\":\"login.partner.microsoftonline.cn\",\"preferred_cache\":\"login.partner.microsoftonline.cn\",\"aliases\":[\"login.partner.microsoftonline.cn\",\"login.chinacloudapi.cn\"]},{\"preferred_network\":\"login.microsoftonline.de\",\"preferred_cache\":\"login.microsoftonline.de\",\"aliases\":[\"login.microsoftonline.de\"]},{\"preferred_network\":\"login.microsoftonline.us\",\"preferred_cache\":\"login.microsoftonline.us\",\"aliases\":[\"login.microsoftonline.us\",\"login.usgovcloudapi.net\"]},{\"preferred_network\":\"login-us.microsoftonline.com\",\"preferred_cache\":\"login-us.microsoftonline.com\",\"aliases\":[\"login-us.microsoftonline.com\"]}]},\"https://login.chinacloudapi.cn/organizations/\":{\"tenant_discovery_endpoint\":\"https://login.chinacloudapi.cn/organizations/v2.0/.well-known/openid-configuration\",\"api-version\":\"1.1\",\"metadata\":[{\"preferred_network\":\"login.microsoftonline.com\",\"preferred_cache\":\"login.windows.net\",\"aliases\":[\"login.microsoftonline.com\",\"login.windows.net\",\"login.microsoft.com\",\"sts.windows.net\"]},{\"preferred_network\":\"login.partner.microsoftonline.cn\",\"preferred_cache\":\"login.partner.microsoftonline.cn\",\"aliases\":[\"login.partner.microsoftonline.cn\",\"login.chinacloudapi.cn\"]},{\"preferred_network\":\"login.microsoftonline.de\",\"preferred_cache\":\"login.microsoftonline.de\",\"aliases\":[\"login.microsoftonline.de\"]},{\"preferred_network\":\"login.microsoftonline.us\",\"preferred_cache\":\"login.microsoftonline.us\",\"aliases\":[\"login.microsoftonline.us\",\"login.usgovcloudapi.net\"]},{\"preferred_network\":\"login-us.microsoftonline.com\",\"preferred_cache\":\"login-us.microsoftonline.com\",\"aliases\":[\"login-us.microsoftonline.com\"]}]},\"https://login.microsoftonline.us/organizations/\":{\"tenant_discovery_endpoint\":\"https://login.microsoftonline.us/organizations/v2.0/.well-known/openid-configuration\",\"api-version\":\"1.1\",\"metadata\":[{\"preferred_network\":\"login.microsoftonline.com\",\"preferred_cache\":\"login.windows.net\",\"aliases\":[\"login.microsoftonline.com\",\"login.windows.net\",\"login.microsoft.com\",\"sts.windows.net\"]},{\"preferred_network\":\"login.partner.microsoftonline.cn\",\"preferred_cache\":\"login.partner.microsoftonline.cn\",\"aliases\":[\"login.partner.microsoftonline.cn\",\"login.chinacloudapi.cn\"]},{\"preferred_network\":\"login.microsoftonline.de\",\"preferred_cache\":\"login.microsoftonline.de\",\"aliases\":[\"login.microsoftonline.de\"]},{\"preferred_network\":\"login.microsoftonline.us\",\"preferred_cache\":\"login.microsoftonline.us\",\"aliases\":[\"login.microsoftonline.us\",\"login.usgovcloudapi.net\"]},{\"preferred_network\":\"login-us.microsoftonline.com\",\"preferred_cache\":\"login-us.microsoftonline.com\",\"aliases\":[\"login-us.microsoftonline.com\"]}]}}};\r\n\r\nexport const EndpointMetadata = rawMetdataJSON.endpointMetadata;\r\nexport const InstanceDiscoveryMetadata = rawMetdataJSON.instanceDiscoveryMetadata;\r\n\r\n","/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License.\r\n */\r\n\r\n/**\r\n * Protocol modes supported by MSAL.\r\n */\r\nexport enum ProtocolMode {\r\n AAD = \"AAD\",\r\n OIDC = \"OIDC\"\r\n}\r\n","/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License.\r\n */\r\n\r\nimport { CloudDiscoveryMetadata } from \"../../authority/CloudDiscoveryMetadata\";\r\nimport { OpenIdConfigResponse } from \"../../authority/OpenIdConfigResponse\";\r\nimport { AUTHORITY_METADATA_CONSTANTS } from \"../../utils/Constants\";\r\nimport { TimeUtils } from \"../../utils/TimeUtils\";\r\n\r\nexport class AuthorityMetadataEntity {\r\n aliases: Array;\r\n preferred_cache: string;\r\n preferred_network: string;\r\n canonical_authority: string;\r\n authorization_endpoint: string;\r\n token_endpoint: string;\r\n end_session_endpoint?: string;\r\n issuer: string;\r\n aliasesFromNetwork: boolean;\r\n endpointsFromNetwork: boolean;\r\n expiresAt: number;\r\n jwks_uri: string;\r\n\r\n constructor() {\r\n this.expiresAt = TimeUtils.nowSeconds() + AUTHORITY_METADATA_CONSTANTS.REFRESH_TIME_SECONDS;\r\n }\r\n\r\n /**\r\n * Update the entity with new aliases, preferred_cache and preferred_network values\r\n * @param metadata \r\n * @param fromNetwork \r\n */\r\n updateCloudDiscoveryMetadata(metadata: CloudDiscoveryMetadata, fromNetwork: boolean): void {\r\n this.aliases = metadata.aliases;\r\n this.preferred_cache = metadata.preferred_cache;\r\n this.preferred_network = metadata.preferred_network;\r\n this.aliasesFromNetwork = fromNetwork;\r\n }\r\n\r\n /**\r\n * Update the entity with new endpoints\r\n * @param metadata \r\n * @param fromNetwork \r\n */\r\n updateEndpointMetadata(metadata: OpenIdConfigResponse, fromNetwork: boolean): void {\r\n this.authorization_endpoint = metadata.authorization_endpoint;\r\n this.token_endpoint = metadata.token_endpoint;\r\n this.end_session_endpoint = metadata.end_session_endpoint;\r\n this.issuer = metadata.issuer;\r\n this.endpointsFromNetwork = fromNetwork;\r\n this.jwks_uri = metadata.jwks_uri;\r\n }\r\n\r\n /**\r\n * Save the authority that was used to create this cache entry\r\n * @param authority \r\n */\r\n updateCanonicalAuthority(authority: string): void {\r\n this.canonical_authority = authority;\r\n }\r\n\r\n /**\r\n * Reset the exiresAt value\r\n */\r\n resetExpiresAt(): void {\r\n this.expiresAt = TimeUtils.nowSeconds() + AUTHORITY_METADATA_CONSTANTS.REFRESH_TIME_SECONDS;\r\n }\r\n\r\n /**\r\n * Returns whether or not the data needs to be refreshed\r\n */\r\n isExpired(): boolean {\r\n return this.expiresAt <= TimeUtils.nowSeconds();\r\n }\r\n\r\n /**\r\n * Validates an entity: checks for all expected params\r\n * @param entity\r\n */\r\n static isAuthorityMetadataEntity(key: string, entity: object): boolean {\r\n\r\n if (!entity) {\r\n return false;\r\n }\r\n\r\n return (\r\n key.indexOf(AUTHORITY_METADATA_CONSTANTS.CACHE_KEY) === 0 &&\r\n entity.hasOwnProperty(\"aliases\") &&\r\n entity.hasOwnProperty(\"preferred_cache\") &&\r\n entity.hasOwnProperty(\"preferred_network\") &&\r\n entity.hasOwnProperty(\"canonical_authority\") &&\r\n entity.hasOwnProperty(\"authorization_endpoint\") &&\r\n entity.hasOwnProperty(\"token_endpoint\") &&\r\n entity.hasOwnProperty(\"issuer\") &&\r\n entity.hasOwnProperty(\"aliasesFromNetwork\") &&\r\n entity.hasOwnProperty(\"endpointsFromNetwork\") &&\r\n entity.hasOwnProperty(\"expiresAt\") &&\r\n entity.hasOwnProperty(\"jwks_uri\")\r\n );\r\n }\r\n}\r\n","/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License.\r\n */\r\n\r\nimport { CloudDiscoveryMetadata } from \"./CloudDiscoveryMetadata\";\r\n\r\n/**\r\n * The OpenID Configuration Endpoint Response type. Used by the authority class to get relevant OAuth endpoints.\r\n */\r\nexport type CloudInstanceDiscoveryResponse = {\r\n tenant_discovery_endpoint: string;\r\n metadata: Array;\r\n};\r\n\r\nexport function isCloudInstanceDiscoveryResponse(response: object): boolean {\r\n return (\r\n response.hasOwnProperty(\"tenant_discovery_endpoint\") &&\r\n response.hasOwnProperty(\"metadata\")\r\n );\r\n}\r\n","/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License.\r\n */\r\n\r\n/**\r\n * The OpenID Configuration Endpoint Response type. Used by the authority class to get relevant OAuth endpoints.\r\n */\r\nexport type CloudInstanceDiscoveryErrorResponse = {\r\n error: String;\r\n error_description: String;\r\n error_codes?: Array;\r\n timestamp?: String;\r\n trace_id?: String;\r\n correlation_id?: String;\r\n error_uri?: String;\r\n};\r\n\r\nexport function isCloudInstanceDiscoveryErrorResponse(response: object): boolean {\r\n return (\r\n response.hasOwnProperty(\"error\") &&\r\n response.hasOwnProperty(\"error_description\")\r\n );\r\n}\r\n","/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License.\r\n */\r\n\r\nimport { INetworkModule } from \"../network/INetworkModule\";\r\nimport { NetworkResponse } from \"../network/NetworkManager\";\r\nimport { IMDSBadResponse } from \"../response/IMDSBadResponse\";\r\nimport { Constants, RegionDiscoverySources, ResponseCodes } from \"../utils/Constants\";\r\nimport { RegionDiscoveryMetadata } from \"./RegionDiscoveryMetadata\";\r\nimport { ImdsOptions } from \"./ImdsOptions\";\r\n\r\nexport class RegionDiscovery {\r\n // Network interface to make requests with.\r\n protected networkInterface: INetworkModule;\r\n // Options for the IMDS endpoint request\r\n protected static IMDS_OPTIONS: ImdsOptions = {\r\n headers: {\r\n Metadata: \"true\",\r\n },\r\n };\r\n\r\n constructor(networkInterface: INetworkModule) {\r\n this.networkInterface = networkInterface;\r\n }\r\n\r\n /**\r\n * Detect the region from the application's environment.\r\n * \r\n * @returns Promise\r\n */\r\n public async detectRegion(environmentRegion: string | undefined, regionDiscoveryMetadata: RegionDiscoveryMetadata, proxyUrl: string): Promise {\r\n // Initialize auto detected region with the region from the envrionment \r\n let autodetectedRegionName = environmentRegion;\r\n\r\n // Check if a region was detected from the environment, if not, attempt to get the region from IMDS \r\n if (!autodetectedRegionName) {\r\n const options = RegionDiscovery.IMDS_OPTIONS;\r\n if (proxyUrl) {\r\n options.proxyUrl = proxyUrl;\r\n }\r\n\r\n try {\r\n const localIMDSVersionResponse = await this.getRegionFromIMDS(Constants.IMDS_VERSION, options);\r\n if (localIMDSVersionResponse.status === ResponseCodes.httpSuccess) {\r\n autodetectedRegionName = localIMDSVersionResponse.body;\r\n regionDiscoveryMetadata.region_source = RegionDiscoverySources.IMDS;\r\n } \r\n \r\n // If the response using the local IMDS version failed, try to fetch the current version of IMDS and retry. \r\n if (localIMDSVersionResponse.status === ResponseCodes.httpBadRequest) {\r\n const currentIMDSVersion = await this.getCurrentVersion(options);\r\n if (!currentIMDSVersion) {\r\n regionDiscoveryMetadata.region_source = RegionDiscoverySources.FAILED_AUTO_DETECTION;\r\n return null;\r\n }\r\n\r\n const currentIMDSVersionResponse = await this.getRegionFromIMDS(currentIMDSVersion, options);\r\n if (currentIMDSVersionResponse.status === ResponseCodes.httpSuccess) {\r\n autodetectedRegionName = currentIMDSVersionResponse.body;\r\n regionDiscoveryMetadata.region_source = RegionDiscoverySources.IMDS;\r\n }\r\n }\r\n } catch(e) {\r\n regionDiscoveryMetadata.region_source = RegionDiscoverySources.FAILED_AUTO_DETECTION;\r\n return null;\r\n } \r\n } else {\r\n regionDiscoveryMetadata.region_source = RegionDiscoverySources.ENVIRONMENT_VARIABLE;\r\n }\r\n\r\n // If no region was auto detected from the environment or from the IMDS endpoint, mark the attempt as a FAILED_AUTO_DETECTION\r\n if (!autodetectedRegionName) {\r\n regionDiscoveryMetadata.region_source = RegionDiscoverySources.FAILED_AUTO_DETECTION;\r\n }\r\n\r\n return autodetectedRegionName || null;\r\n }\r\n\r\n /**\r\n * Make the call to the IMDS endpoint\r\n * \r\n * @param imdsEndpointUrl\r\n * @returns Promise>\r\n */\r\n private async getRegionFromIMDS(version: string, options: ImdsOptions): Promise> {\r\n return this.networkInterface.sendGetRequestAsync(`${Constants.IMDS_ENDPOINT}?api-version=${version}&format=text`, options, Constants.IMDS_TIMEOUT);\r\n }\r\n\r\n /**\r\n * Get the most recent version of the IMDS endpoint available\r\n * \r\n * @returns Promise\r\n */\r\n private async getCurrentVersion(options: ImdsOptions): Promise {\r\n try {\r\n const response = await this.networkInterface.sendGetRequestAsync(`${Constants.IMDS_ENDPOINT}?format=json`, options);\r\n\r\n // When IMDS endpoint is called without the api version query param, bad request response comes back with latest version.\r\n if (response.status === ResponseCodes.httpBadRequest && response.body && response.body[\"newest-versions\"] && response.body[\"newest-versions\"].length > 0) {\r\n return response.body[\"newest-versions\"][0];\r\n }\r\n\r\n return null;\r\n } catch (e) {\r\n return null;\r\n }\r\n }\r\n}\r\n","/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License.\r\n */\r\n\r\nimport { AuthorityType } from \"./AuthorityType\";\r\nimport { isOpenIdConfigResponse, OpenIdConfigResponse } from \"./OpenIdConfigResponse\";\r\nimport { UrlString } from \"../url/UrlString\";\r\nimport { IUri } from \"../url/IUri\";\r\nimport { ClientAuthError } from \"../error/ClientAuthError\";\r\nimport { INetworkModule } from \"../network/INetworkModule\";\r\nimport { AuthorityMetadataSource, Constants, RegionDiscoveryOutcomes } from \"../utils/Constants\";\r\nimport { EndpointMetadata, InstanceDiscoveryMetadata } from \"./AuthorityMetadata\";\r\nimport { ClientConfigurationError } from \"../error/ClientConfigurationError\";\r\nimport { ProtocolMode } from \"./ProtocolMode\";\r\nimport { ICacheManager } from \"../cache/interface/ICacheManager\";\r\nimport { AuthorityMetadataEntity } from \"../cache/entities/AuthorityMetadataEntity\";\r\nimport { AuthorityOptions , AzureCloudInstance } from \"./AuthorityOptions\";\r\nimport { CloudInstanceDiscoveryResponse, isCloudInstanceDiscoveryResponse } from \"./CloudInstanceDiscoveryResponse\";\r\nimport { CloudInstanceDiscoveryErrorResponse, isCloudInstanceDiscoveryErrorResponse } from \"./CloudInstanceDiscoveryErrorResponse\";\r\nimport { CloudDiscoveryMetadata } from \"./CloudDiscoveryMetadata\";\r\nimport { RegionDiscovery } from \"./RegionDiscovery\";\r\nimport { RegionDiscoveryMetadata } from \"./RegionDiscoveryMetadata\";\r\nimport { ImdsOptions } from \"./ImdsOptions\";\r\nimport { AzureCloudOptions } from \"../config/ClientConfiguration\";\r\nimport { Logger } from \"../logger/Logger\";\r\nimport { AuthError } from \"../error/AuthError\";\r\n\r\n/**\r\n * The authority class validates the authority URIs used by the user, and retrieves the OpenID Configuration Data from the\r\n * endpoint. It will store the pertinent config data in this object for use during token calls.\r\n */\r\nexport class Authority {\r\n // Canonical authority url string\r\n private _canonicalAuthority: UrlString;\r\n // Canonicaly authority url components\r\n private _canonicalAuthorityUrlComponents: IUri | null;\r\n // Network interface to make requests with.\r\n protected networkInterface: INetworkModule;\r\n // Cache Manager to cache network responses\r\n protected cacheManager: ICacheManager;\r\n // Protocol mode to construct endpoints\r\n private authorityOptions: AuthorityOptions;\r\n // Authority metadata\r\n private metadata: AuthorityMetadataEntity;\r\n // Region discovery service\r\n private regionDiscovery: RegionDiscovery;\r\n // Region discovery metadata\r\n public regionDiscoveryMetadata: RegionDiscoveryMetadata;\r\n // Proxy url string\r\n private proxyUrl: string;\r\n // Logger object\r\n private logger: Logger;\r\n\r\n constructor(\r\n authority: string,\r\n networkInterface: INetworkModule,\r\n cacheManager: ICacheManager,\r\n authorityOptions: AuthorityOptions,\r\n logger: Logger,\r\n proxyUrl?: string\r\n ) {\r\n this.canonicalAuthority = authority;\r\n this._canonicalAuthority.validateAsUri();\r\n this.networkInterface = networkInterface;\r\n this.cacheManager = cacheManager;\r\n this.authorityOptions = authorityOptions;\r\n this.regionDiscovery = new RegionDiscovery(networkInterface);\r\n this.regionDiscoveryMetadata = { region_used: undefined, region_source: undefined, region_outcome: undefined };\r\n this.proxyUrl = proxyUrl || Constants.EMPTY_STRING;\r\n this.logger = logger;\r\n }\r\n\r\n // See above for AuthorityType\r\n public get authorityType(): AuthorityType {\r\n const pathSegments = this.canonicalAuthorityUrlComponents.PathSegments;\r\n if (pathSegments.length) {\r\n switch(pathSegments[0].toLowerCase()) {\r\n case Constants.ADFS:\r\n return AuthorityType.Adfs;\r\n case Constants.DSTS:\r\n return AuthorityType.Dsts;\r\n default:\r\n break;\r\n }\r\n }\r\n return AuthorityType.Default;\r\n }\r\n\r\n /**\r\n * ProtocolMode enum representing the way endpoints are constructed.\r\n */\r\n public get protocolMode(): ProtocolMode {\r\n return this.authorityOptions.protocolMode;\r\n }\r\n\r\n /**\r\n * Returns authorityOptions which can be used to reinstantiate a new authority instance\r\n */\r\n public get options(): AuthorityOptions {\r\n return this.authorityOptions;\r\n }\r\n\r\n /**\r\n * A URL that is the authority set by the developer\r\n */\r\n public get canonicalAuthority(): string {\r\n return this._canonicalAuthority.urlString;\r\n }\r\n\r\n /**\r\n * Sets canonical authority.\r\n */\r\n public set canonicalAuthority(url: string) {\r\n this._canonicalAuthority = new UrlString(url);\r\n this._canonicalAuthority.validateAsUri();\r\n this._canonicalAuthorityUrlComponents = null;\r\n }\r\n\r\n /**\r\n * Get authority components.\r\n */\r\n public get canonicalAuthorityUrlComponents(): IUri {\r\n if (!this._canonicalAuthorityUrlComponents) {\r\n this._canonicalAuthorityUrlComponents = this._canonicalAuthority.getUrlComponents();\r\n }\r\n\r\n return this._canonicalAuthorityUrlComponents;\r\n }\r\n\r\n /**\r\n * Get hostname and port i.e. login.microsoftonline.com\r\n */\r\n public get hostnameAndPort(): string {\r\n return this.canonicalAuthorityUrlComponents.HostNameAndPort.toLowerCase();\r\n }\r\n\r\n /**\r\n * Get tenant for authority.\r\n */\r\n public get tenant(): string {\r\n return this.canonicalAuthorityUrlComponents.PathSegments[0];\r\n }\r\n\r\n /**\r\n * OAuth /authorize endpoint for requests\r\n */\r\n public get authorizationEndpoint(): string {\r\n if(this.discoveryComplete()) {\r\n const endpoint = this.replacePath(this.metadata.authorization_endpoint);\r\n return this.replaceTenant(endpoint);\r\n } else {\r\n throw ClientAuthError.createEndpointDiscoveryIncompleteError(\"Discovery incomplete.\");\r\n }\r\n }\r\n\r\n /**\r\n * OAuth /token endpoint for requests\r\n */\r\n public get tokenEndpoint(): string {\r\n if(this.discoveryComplete()) {\r\n const endpoint = this.replacePath(this.metadata.token_endpoint);\r\n return this.replaceTenant(endpoint);\r\n } else {\r\n throw ClientAuthError.createEndpointDiscoveryIncompleteError(\"Discovery incomplete.\");\r\n }\r\n }\r\n\r\n public get deviceCodeEndpoint(): string {\r\n if(this.discoveryComplete()) {\r\n const endpoint = this.replacePath(this.metadata.token_endpoint.replace(\"/token\", \"/devicecode\"));\r\n return this.replaceTenant(endpoint);\r\n } else {\r\n throw ClientAuthError.createEndpointDiscoveryIncompleteError(\"Discovery incomplete.\");\r\n }\r\n }\r\n\r\n /**\r\n * OAuth logout endpoint for requests\r\n */\r\n public get endSessionEndpoint(): string {\r\n if(this.discoveryComplete()) {\r\n // ROPC policies may not have end_session_endpoint set\r\n if (!this.metadata.end_session_endpoint) {\r\n throw ClientAuthError.createLogoutNotSupportedError();\r\n }\r\n const endpoint = this.replacePath(this.metadata.end_session_endpoint);\r\n return this.replaceTenant(endpoint);\r\n } else {\r\n throw ClientAuthError.createEndpointDiscoveryIncompleteError(\"Discovery incomplete.\");\r\n }\r\n }\r\n\r\n /**\r\n * OAuth issuer for requests\r\n */\r\n public get selfSignedJwtAudience(): string {\r\n if(this.discoveryComplete()) {\r\n const endpoint = this.replacePath(this.metadata.issuer);\r\n return this.replaceTenant(endpoint);\r\n } else {\r\n throw ClientAuthError.createEndpointDiscoveryIncompleteError(\"Discovery incomplete.\");\r\n }\r\n }\r\n\r\n /**\r\n * Jwks_uri for token signing keys\r\n */\r\n public get jwksUri(): string {\r\n if(this.discoveryComplete()) {\r\n const endpoint = this.replacePath(this.metadata.jwks_uri);\r\n return this.replaceTenant(endpoint);\r\n } else {\r\n throw ClientAuthError.createEndpointDiscoveryIncompleteError(\"Discovery incomplete.\");\r\n }\r\n }\r\n\r\n /**\r\n * Replaces tenant in url path with current tenant. Defaults to common.\r\n * @param urlString\r\n */\r\n private replaceTenant(urlString: string): string {\r\n return urlString.replace(/{tenant}|{tenantid}/g, this.tenant);\r\n }\r\n\r\n /**\r\n * Replaces path such as tenant or policy with the current tenant or policy.\r\n * @param urlString\r\n */\r\n private replacePath(urlString: string): string {\r\n let endpoint = urlString;\r\n const cachedAuthorityUrl = new UrlString(this.metadata.canonical_authority);\r\n const cachedAuthorityParts = cachedAuthorityUrl.getUrlComponents().PathSegments;\r\n const currentAuthorityParts = this.canonicalAuthorityUrlComponents.PathSegments;\r\n\r\n currentAuthorityParts.forEach((currentPart, index) => {\r\n const cachedPart = cachedAuthorityParts[index];\r\n if (currentPart !== cachedPart) {\r\n endpoint = endpoint.replace(`/${cachedPart}/`, `/${currentPart}/`);\r\n }\r\n });\r\n\r\n return endpoint;\r\n }\r\n\r\n /**\r\n * The default open id configuration endpoint for any canonical authority.\r\n */\r\n protected get defaultOpenIdConfigurationEndpoint(): string {\r\n if (\r\n this.authorityType === AuthorityType.Adfs ||\r\n this.authorityType === AuthorityType.Dsts ||\r\n this.protocolMode === ProtocolMode.OIDC\r\n ) {\r\n return `${this.canonicalAuthority}.well-known/openid-configuration`;\r\n }\r\n return `${this.canonicalAuthority}v2.0/.well-known/openid-configuration`;\r\n }\r\n\r\n /**\r\n * Boolean that returns whethr or not tenant discovery has been completed.\r\n */\r\n discoveryComplete(): boolean {\r\n return !!this.metadata;\r\n }\r\n\r\n /**\r\n * Perform endpoint discovery to discover aliases, preferred_cache, preferred_network\r\n * and the /authorize, /token and logout endpoints.\r\n */\r\n public async resolveEndpointsAsync(): Promise {\r\n let metadataEntity = this.cacheManager.getAuthorityMetadataByAlias(this.hostnameAndPort);\r\n if (!metadataEntity) {\r\n metadataEntity = new AuthorityMetadataEntity();\r\n metadataEntity.updateCanonicalAuthority(this.canonicalAuthority);\r\n }\r\n\r\n const cloudDiscoverySource = await this.updateCloudDiscoveryMetadata(metadataEntity);\r\n this.canonicalAuthority = this.canonicalAuthority.replace(this.hostnameAndPort, metadataEntity.preferred_network);\r\n const endpointSource = await this.updateEndpointMetadata(metadataEntity);\r\n\r\n if (cloudDiscoverySource !== AuthorityMetadataSource.CACHE && endpointSource !== AuthorityMetadataSource.CACHE) {\r\n // Reset the expiration time unless both values came from a successful cache lookup\r\n metadataEntity.resetExpiresAt();\r\n metadataEntity.updateCanonicalAuthority(this.canonicalAuthority);\r\n }\r\n\r\n const cacheKey = this.cacheManager.generateAuthorityMetadataCacheKey(metadataEntity.preferred_cache);\r\n this.cacheManager.setAuthorityMetadata(cacheKey, metadataEntity);\r\n this.metadata = metadataEntity;\r\n }\r\n\r\n /**\r\n * Update AuthorityMetadataEntity with new endpoints and return where the information came from\r\n * @param metadataEntity\r\n */\r\n private async updateEndpointMetadata(metadataEntity: AuthorityMetadataEntity): Promise {\r\n let metadata = this.getEndpointMetadataFromConfig();\r\n if (metadata) {\r\n metadataEntity.updateEndpointMetadata(metadata, false);\r\n return AuthorityMetadataSource.CONFIG;\r\n }\r\n\r\n if (this.isAuthoritySameType(metadataEntity) && metadataEntity.endpointsFromNetwork && !metadataEntity.isExpired()) {\r\n // No need to update\r\n return AuthorityMetadataSource.CACHE;\r\n }\r\n\r\n let harcodedMetadata = this.getEndpointMetadataFromHardcodedValues();\r\n metadata = await this.getEndpointMetadataFromNetwork();\r\n if (metadata) {\r\n // If the user prefers to use an azure region replace the global endpoints with regional information.\r\n if (this.authorityOptions.azureRegionConfiguration?.azureRegion) {\r\n metadata = await this.updateMetadataWithRegionalInformation(metadata);\r\n }\r\n\r\n metadataEntity.updateEndpointMetadata(metadata, true);\r\n return AuthorityMetadataSource.NETWORK;\r\n } \r\n\r\n if (harcodedMetadata && !this.authorityOptions.skipAuthorityMetadataCache) {\r\n // If the user prefers to use an azure region replace the global endpoints with regional information.\r\n if (this.authorityOptions.azureRegionConfiguration?.azureRegion) {\r\n harcodedMetadata = await this.updateMetadataWithRegionalInformation(\r\n harcodedMetadata\r\n );\r\n }\r\n\r\n metadataEntity.updateEndpointMetadata(harcodedMetadata, false);\r\n return AuthorityMetadataSource.HARDCODED_VALUES;\r\n } else {\r\n throw ClientAuthError.createUnableToGetOpenidConfigError(\r\n this.defaultOpenIdConfigurationEndpoint\r\n );\r\n }\r\n }\r\n\r\n /**\r\n * Compares the number of url components after the domain to determine if the cached \r\n * authority metadata can be used for the requested authority. Protects against same domain different \r\n * authority such as login.microsoftonline.com/tenant and login.microsoftonline.com/tfp/tenant/policy\r\n * @param metadataEntity\r\n */\r\n private isAuthoritySameType(metadataEntity: AuthorityMetadataEntity): boolean {\r\n const cachedAuthorityUrl = new UrlString(metadataEntity.canonical_authority);\r\n const cachedParts = cachedAuthorityUrl.getUrlComponents().PathSegments;\r\n\r\n return cachedParts.length === this.canonicalAuthorityUrlComponents.PathSegments.length;\r\n }\r\n\r\n /**\r\n * Parse authorityMetadata config option\r\n */\r\n private getEndpointMetadataFromConfig(): OpenIdConfigResponse | null {\r\n if (this.authorityOptions.authorityMetadata) {\r\n try {\r\n return JSON.parse(this.authorityOptions.authorityMetadata) as OpenIdConfigResponse;\r\n } catch (e) {\r\n throw ClientConfigurationError.createInvalidAuthorityMetadataError();\r\n }\r\n }\r\n\r\n return null;\r\n }\r\n\r\n /**\r\n * Gets OAuth endpoints from the given OpenID configuration endpoint.\r\n * \r\n * @param hasHardcodedMetadata boolean\r\n */\r\n private async getEndpointMetadataFromNetwork(): Promise {\r\n const options: ImdsOptions = {};\r\n if (this.proxyUrl) {\r\n options.proxyUrl = this.proxyUrl;\r\n }\r\n\r\n /*\r\n * TODO: Add a timeout if the authority exists in our library's \r\n * hardcoded list of metadata\r\n */\r\n\r\n try {\r\n const response = await this.networkInterface.\r\n sendGetRequestAsync(this.defaultOpenIdConfigurationEndpoint, options);\r\n return isOpenIdConfigResponse(response.body) ? response.body : null;\r\n } catch (e) {\r\n return null;\r\n }\r\n }\r\n\r\n /**\r\n * Get OAuth endpoints for common authorities.\r\n */\r\n private getEndpointMetadataFromHardcodedValues(): OpenIdConfigResponse | null {\r\n if (this.canonicalAuthority in EndpointMetadata) {\r\n return EndpointMetadata[this.canonicalAuthority];\r\n }\r\n\r\n return null;\r\n }\r\n\r\n /**\r\n * Update the retrieved metadata with regional information.\r\n */\r\n private async updateMetadataWithRegionalInformation(metadata: OpenIdConfigResponse): Promise {\r\n const autodetectedRegionName = await this.regionDiscovery.detectRegion(\r\n this.authorityOptions.azureRegionConfiguration?.environmentRegion,\r\n this.regionDiscoveryMetadata,\r\n this.proxyUrl\r\n );\r\n\r\n const azureRegion = \r\n this.authorityOptions.azureRegionConfiguration?.azureRegion === Constants.AZURE_REGION_AUTO_DISCOVER_FLAG\r\n ? autodetectedRegionName\r\n : this.authorityOptions.azureRegionConfiguration?.azureRegion;\r\n\r\n if (this.authorityOptions.azureRegionConfiguration?.azureRegion === Constants.AZURE_REGION_AUTO_DISCOVER_FLAG) {\r\n this.regionDiscoveryMetadata.region_outcome = autodetectedRegionName ?\r\n RegionDiscoveryOutcomes.AUTO_DETECTION_REQUESTED_SUCCESSFUL :\r\n RegionDiscoveryOutcomes.AUTO_DETECTION_REQUESTED_FAILED;\r\n } else {\r\n if (autodetectedRegionName) {\r\n this.regionDiscoveryMetadata.region_outcome = (\r\n this.authorityOptions.azureRegionConfiguration?.azureRegion === autodetectedRegionName\r\n ) ?\r\n RegionDiscoveryOutcomes.CONFIGURED_MATCHES_DETECTED :\r\n RegionDiscoveryOutcomes.CONFIGURED_NOT_DETECTED;\r\n } else {\r\n this.regionDiscoveryMetadata.region_outcome = RegionDiscoveryOutcomes.CONFIGURED_NO_AUTO_DETECTION;\r\n }\r\n }\r\n\r\n if (azureRegion) {\r\n this.regionDiscoveryMetadata.region_used = azureRegion;\r\n return Authority.replaceWithRegionalInformation(metadata, azureRegion);\r\n }\r\n\r\n return metadata;\r\n }\r\n\r\n /**\r\n * Updates the AuthorityMetadataEntity with new aliases, preferred_network and preferred_cache\r\n * and returns where the information was retrieved from\r\n * @param cachedMetadata\r\n * @param newMetadata\r\n */\r\n private async updateCloudDiscoveryMetadata(metadataEntity: AuthorityMetadataEntity): Promise {\r\n this.logger.verbose(\"Attempting to get cloud discovery metadata in the config\");\r\n this.logger.verbosePii(`Known Authorities: ${this.authorityOptions.knownAuthorities || Constants.NOT_APPLICABLE}`);\r\n this.logger.verbosePii(`Authority Metadata: ${this.authorityOptions.authorityMetadata || Constants.NOT_APPLICABLE}`);\r\n this.logger.verbosePii(`Canonical Authority: ${metadataEntity.canonical_authority || Constants.NOT_APPLICABLE}`);\r\n let metadata = this.getCloudDiscoveryMetadataFromConfig();\r\n if (metadata) {\r\n this.logger.verbose(\"Found cloud discovery metadata in the config.\");\r\n metadataEntity.updateCloudDiscoveryMetadata(metadata, false);\r\n return AuthorityMetadataSource.CONFIG;\r\n }\r\n\r\n // If the cached metadata came from config but that config was not passed to this instance, we must go to the network\r\n this.logger.verbose(\"Did not find cloud discovery metadata in the config... Attempting to get cloud discovery metadata from the cache.\");\r\n const metadataEntityExpired = metadataEntity.isExpired();\r\n if (this.isAuthoritySameType(metadataEntity) && metadataEntity.aliasesFromNetwork && !metadataEntityExpired) {\r\n this.logger.verbose(\"Found metadata in the cache.\");\r\n // No need to update\r\n return AuthorityMetadataSource.CACHE;\r\n } else if (metadataEntityExpired) {\r\n this.logger.verbose(\"The metadata entity is expired.\");\r\n }\r\n\r\n this.logger.verbose(\"Did not find cloud discovery metadata in the cache... Attempting to get cloud discovery metadata from the network.\");\r\n metadata = await this.getCloudDiscoveryMetadataFromNetwork();\r\n if (metadata) {\r\n this.logger.verbose(\"cloud discovery metadata was successfully returned from getCloudDiscoveryMetadataFromNetwork()\");\r\n metadataEntity.updateCloudDiscoveryMetadata(metadata, true);\r\n return AuthorityMetadataSource.NETWORK;\r\n }\r\n \r\n this.logger.verbose(\"Did not find cloud discovery metadata from the network... Attempting to get cloud discovery metadata from hardcoded values.\");\r\n const harcodedMetadata = this.getCloudDiscoveryMetadataFromHarcodedValues();\r\n if (harcodedMetadata && !this.options.skipAuthorityMetadataCache) {\r\n this.logger.verbose(\"Found cloud discovery metadata from hardcoded values.\");\r\n metadataEntity.updateCloudDiscoveryMetadata(harcodedMetadata, false);\r\n return AuthorityMetadataSource.HARDCODED_VALUES;\r\n }\r\n \r\n // Metadata could not be obtained from the config, cache, network or hardcoded values\r\n this.logger.error(\"Did not find cloud discovery metadata from hardcoded values... Metadata could not be obtained from config, cache, network or hardcoded values. Throwing Untrusted Authority Error.\");\r\n throw ClientConfigurationError.createUntrustedAuthorityError();\r\n }\r\n\r\n /**\r\n * Parse cloudDiscoveryMetadata config or check knownAuthorities\r\n */\r\n private getCloudDiscoveryMetadataFromConfig(): CloudDiscoveryMetadata | null {\r\n // Check if network response was provided in config\r\n if (this.authorityOptions.cloudDiscoveryMetadata) {\r\n this.logger.verbose(\"The cloud discovery metadata has been provided as a network response, in the config.\");\r\n try {\r\n this.logger.verbose(\"Attempting to parse the cloud discovery metadata.\");\r\n const parsedResponse = JSON.parse(this.authorityOptions.cloudDiscoveryMetadata) as CloudInstanceDiscoveryResponse;\r\n const metadata = Authority.getCloudDiscoveryMetadataFromNetworkResponse(\r\n parsedResponse.metadata,\r\n this.hostnameAndPort\r\n );\r\n this.logger.verbose(\"Parsed the cloud discovery metadata.\");\r\n if (metadata) {\r\n this.logger.verbose(\"There is returnable metadata attached to the parsed cloud discovery metadata.\");\r\n return metadata;\r\n } else {\r\n this.logger.verbose(\"There is no metadata attached to the parsed cloud discovery metadata.\");\r\n }\r\n } catch (e) {\r\n this.logger.verbose(\"Unable to parse the cloud discovery metadata. Throwing Invalid Cloud Discovery Metadata Error.\");\r\n throw ClientConfigurationError.createInvalidCloudDiscoveryMetadataError();\r\n }\r\n }\r\n\r\n // If cloudDiscoveryMetadata is empty or does not contain the host, check knownAuthorities\r\n if (this.isInKnownAuthorities()) {\r\n this.logger.verbose(\"The host is included in knownAuthorities. Creating new cloud discovery metadata from the host.\");\r\n return Authority.createCloudDiscoveryMetadataFromHost(this.hostnameAndPort);\r\n }\r\n\r\n return null;\r\n }\r\n\r\n /**\r\n * Called to get metadata from network if CloudDiscoveryMetadata was not populated by config\r\n * \r\n * @param hasHardcodedMetadata boolean\r\n */\r\n private async getCloudDiscoveryMetadataFromNetwork(): Promise {\r\n const instanceDiscoveryEndpoint =\r\n `${Constants.AAD_INSTANCE_DISCOVERY_ENDPT}${this.canonicalAuthority}oauth2/v2.0/authorize`;\r\n const options: ImdsOptions = {};\r\n if (this.proxyUrl) {\r\n options.proxyUrl = this.proxyUrl;\r\n }\r\n\r\n /*\r\n * TODO: Add a timeout if the authority exists in our library's\r\n * hardcoded list of metadata\r\n */\r\n\r\n let match = null;\r\n try {\r\n const response =\r\n await this.networkInterface.sendGetRequestAsync(\r\n instanceDiscoveryEndpoint,\r\n options\r\n );\r\n \r\n let typedResponseBody: CloudInstanceDiscoveryResponse | CloudInstanceDiscoveryErrorResponse;\r\n let metadata: Array;\r\n if (isCloudInstanceDiscoveryResponse(response.body)) {\r\n typedResponseBody = response.body as CloudInstanceDiscoveryResponse;\r\n metadata = typedResponseBody.metadata;\r\n\r\n this.logger.verbosePii(`tenant_discovery_endpoint is: ${typedResponseBody.tenant_discovery_endpoint}`);\r\n } else if (isCloudInstanceDiscoveryErrorResponse(response.body)) {\r\n this.logger.warning(`A CloudInstanceDiscoveryErrorResponse was returned. The cloud instance discovery network request's status code is: ${response.status}`);\r\n\r\n typedResponseBody = response.body as CloudInstanceDiscoveryErrorResponse;\r\n if (typedResponseBody.error === Constants.INVALID_INSTANCE) {\r\n this.logger.error(\"The CloudInstanceDiscoveryErrorResponse error is invalid_instance.\");\r\n return null;\r\n }\r\n\r\n this.logger.warning(`The CloudInstanceDiscoveryErrorResponse error is ${typedResponseBody.error}`);\r\n this.logger.warning(`The CloudInstanceDiscoveryErrorResponse error description is ${typedResponseBody.error_description}`);\r\n \r\n this.logger.warning(\"Setting the value of the CloudInstanceDiscoveryMetadata (returned from the network) to []\");\r\n metadata = [];\r\n } else {\r\n this.logger.error(\"AAD did not return a CloudInstanceDiscoveryResponse or CloudInstanceDiscoveryErrorResponse\");\r\n return null;\r\n }\r\n\r\n this.logger.verbose(\"Attempting to find a match between the developer's authority and the CloudInstanceDiscoveryMetadata returned from the network request.\");\r\n match = Authority.getCloudDiscoveryMetadataFromNetworkResponse(\r\n metadata,\r\n this.hostnameAndPort\r\n );\r\n } catch (error) {\r\n if (error instanceof AuthError) {\r\n this.logger.error(`There was a network error while attempting to get the cloud discovery instance metadata.\\nError: ${error.errorCode}\\nError Description: ${error.errorMessage}`);\r\n } else {\r\n const typedError = error as Error;\r\n this.logger.error(`A non-MSALJS error was thrown while attempting to get the cloud instance discovery metadata.\\nError: ${typedError.name}\\nError Description: ${typedError.message}`);\r\n }\r\n \r\n return null;\r\n }\r\n\r\n // Custom Domain scenario, host is trusted because Instance Discovery call succeeded\r\n if (!match) {\r\n this.logger.warning(\"The developer's authority was not found within the CloudInstanceDiscoveryMetadata returned from the network request.\");\r\n this.logger.verbose(\"Creating custom Authority for custom domain scenario.\");\r\n\r\n match = Authority.createCloudDiscoveryMetadataFromHost(\r\n this.hostnameAndPort\r\n );\r\n }\r\n return match;\r\n }\r\n\r\n /**\r\n * Get cloud discovery metadata for common authorities \r\n */\r\n private getCloudDiscoveryMetadataFromHarcodedValues(): CloudDiscoveryMetadata | null {\r\n if (this.canonicalAuthority in InstanceDiscoveryMetadata) {\r\n return InstanceDiscoveryMetadata[this.canonicalAuthority];\r\n }\r\n\r\n return null;\r\n }\r\n\r\n /**\r\n * Helper function to determine if this host is included in the knownAuthorities config option\r\n */\r\n private isInKnownAuthorities(): boolean {\r\n const matches = this.authorityOptions.knownAuthorities.filter((authority) => {\r\n return UrlString.getDomainFromUrl(authority).toLowerCase() === this.hostnameAndPort;\r\n });\r\n\r\n return matches.length > 0;\r\n }\r\n\r\n /**\r\n * helper function to populate the authority based on azureCloudOptions\r\n * @param authorityString\r\n * @param azureCloudOptions\r\n */\r\n static generateAuthority(authorityString: string, azureCloudOptions?: AzureCloudOptions): string {\r\n let authorityAzureCloudInstance;\r\n\r\n if (azureCloudOptions && azureCloudOptions.azureCloudInstance !== AzureCloudInstance.None) {\r\n const tenant = azureCloudOptions.tenant ? azureCloudOptions.tenant : Constants.DEFAULT_COMMON_TENANT;\r\n authorityAzureCloudInstance = `${azureCloudOptions.azureCloudInstance}/${tenant}/`;\r\n }\r\n\r\n return authorityAzureCloudInstance ? authorityAzureCloudInstance : authorityString;\r\n }\r\n\r\n /**\r\n * Creates cloud discovery metadata object from a given host\r\n * @param host\r\n */\r\n static createCloudDiscoveryMetadataFromHost(host: string): CloudDiscoveryMetadata {\r\n return {\r\n preferred_network: host,\r\n preferred_cache: host,\r\n aliases: [host]\r\n };\r\n }\r\n\r\n /**\r\n * Searches instance discovery network response for the entry that contains the host in the aliases list\r\n * @param response\r\n * @param authority\r\n */\r\n static getCloudDiscoveryMetadataFromNetworkResponse(\r\n response: CloudDiscoveryMetadata[],\r\n authority: string\r\n ): CloudDiscoveryMetadata | null {\r\n for (let i = 0; i < response.length; i++) {\r\n const metadata = response[i];\r\n if (metadata.aliases.indexOf(authority) > -1) {\r\n return metadata;\r\n }\r\n }\r\n\r\n return null;\r\n }\r\n\r\n /**\r\n * helper function to generate environment from authority object\r\n */\r\n getPreferredCache(): string {\r\n if(this.discoveryComplete()) {\r\n return this.metadata.preferred_cache;\r\n } else {\r\n throw ClientAuthError.createEndpointDiscoveryIncompleteError(\"Discovery incomplete.\");\r\n }\r\n }\r\n\r\n /**\r\n * Returns whether or not the provided host is an alias of this authority instance\r\n * @param host\r\n */\r\n isAlias(host: string): boolean {\r\n return this.metadata.aliases.indexOf(host) > -1;\r\n }\r\n\r\n /**\r\n * Checks whether the provided host is that of a public cloud authority\r\n *\r\n * @param authority string\r\n * @returns bool\r\n */\r\n static isPublicCloudAuthority(host: string): boolean {\r\n return Constants.KNOWN_PUBLIC_CLOUDS.indexOf(host) >= 0;\r\n }\r\n\r\n /**\r\n * Rebuild the authority string with the region\r\n *\r\n * @param host string\r\n * @param region string\r\n */\r\n static buildRegionalAuthorityString(host: string, region: string, queryString?: string): string {\r\n // Create and validate a Url string object with the initial authority string\r\n const authorityUrlInstance = new UrlString(host);\r\n authorityUrlInstance.validateAsUri();\r\n\r\n const authorityUrlParts = authorityUrlInstance.getUrlComponents();\r\n\r\n let hostNameAndPort= `${region}.${authorityUrlParts.HostNameAndPort}`;\r\n\r\n if (this.isPublicCloudAuthority(authorityUrlParts.HostNameAndPort)) {\r\n hostNameAndPort = `${region}.${Constants.REGIONAL_AUTH_PUBLIC_CLOUD_SUFFIX}`;\r\n }\r\n\r\n // Include the query string portion of the url\r\n const url = UrlString.constructAuthorityUriFromObject({\r\n ...authorityUrlInstance.getUrlComponents(),\r\n HostNameAndPort: hostNameAndPort\r\n }).urlString;\r\n\r\n // Add the query string if a query string was provided\r\n if (queryString) return `${url}?${queryString}`;\r\n\r\n return url;\r\n }\r\n\r\n /**\r\n * Replace the endpoints in the metadata object with their regional equivalents.\r\n *\r\n * @param metadata OpenIdConfigResponse\r\n * @param azureRegion string\r\n */\r\n static replaceWithRegionalInformation(metadata: OpenIdConfigResponse, azureRegion: string): OpenIdConfigResponse {\r\n metadata.authorization_endpoint = Authority.buildRegionalAuthorityString(metadata.authorization_endpoint, azureRegion);\r\n // TODO: Enquire on whether we should leave the query string or remove it before releasing the feature\r\n metadata.token_endpoint = Authority.buildRegionalAuthorityString(\r\n metadata.token_endpoint, azureRegion, Constants.REGIONAL_AUTH_NON_MSI_QUERY_STRING\r\n );\r\n\r\n if (metadata.end_session_endpoint) {\r\n metadata.end_session_endpoint = Authority.buildRegionalAuthorityString(metadata.end_session_endpoint, azureRegion);\r\n }\r\n\r\n return metadata;\r\n }\r\n}\r\n\r\n","/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License.\r\n */\r\n\r\nimport { Authority } from \"./Authority\";\r\nimport { ClientConfigurationError } from \"../error/ClientConfigurationError\";\r\nimport { INetworkModule } from \"../network/INetworkModule\";\r\nimport { StringUtils } from \"../utils/StringUtils\";\r\nimport { ClientAuthError } from \"../error/ClientAuthError\";\r\nimport { ICacheManager } from \"../cache/interface/ICacheManager\";\r\nimport { AuthorityOptions } from \"./AuthorityOptions\";\r\nimport { Logger } from \"../logger/Logger\";\r\n\r\nexport class AuthorityFactory {\r\n\r\n /**\r\n * Create an authority object of the correct type based on the url\r\n * Performs basic authority validation - checks to see if the authority is of a valid type (i.e. aad, b2c, adfs)\r\n *\r\n * Also performs endpoint discovery.\r\n *\r\n * @param authorityUri\r\n * @param networkClient\r\n * @param protocolMode\r\n */\r\n static async createDiscoveredInstance(\r\n authorityUri: string,\r\n networkClient: INetworkModule,\r\n cacheManager: ICacheManager,\r\n authorityOptions: AuthorityOptions,\r\n logger: Logger,\r\n proxyUrl?: string\r\n ): Promise {\r\n // Initialize authority and perform discovery endpoint check.\r\n const acquireTokenAuthority: Authority = AuthorityFactory.createInstance(\r\n authorityUri,\r\n networkClient,\r\n cacheManager,\r\n authorityOptions,\r\n logger,\r\n proxyUrl\r\n );\r\n\r\n try {\r\n await acquireTokenAuthority.resolveEndpointsAsync();\r\n return acquireTokenAuthority;\r\n } catch (e) {\r\n throw ClientAuthError.createEndpointDiscoveryIncompleteError(e);\r\n }\r\n }\r\n\r\n /**\r\n * Create an authority object of the correct type based on the url\r\n * Performs basic authority validation - checks to see if the authority is of a valid type (i.e. aad, b2c, adfs)\r\n *\r\n * Does not perform endpoint discovery.\r\n *\r\n * @param authorityUrl\r\n * @param networkInterface\r\n * @param protocolMode\r\n */\r\n static createInstance(\r\n authorityUrl: string,\r\n networkInterface: INetworkModule,\r\n cacheManager: ICacheManager,\r\n authorityOptions: AuthorityOptions,\r\n logger: Logger,\r\n proxyUrl?: string\r\n ): Authority {\r\n // Throw error if authority url is empty\r\n if (StringUtils.isEmpty(authorityUrl)) {\r\n throw ClientConfigurationError.createUrlEmptyError();\r\n }\r\n\r\n return new Authority(authorityUrl, networkInterface, cacheManager, authorityOptions, logger, proxyUrl);\r\n }\r\n}\r\n","/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License.\r\n */\r\n\r\nimport { SERVER_TELEM_CONSTANTS } from \"../../utils/Constants\";\r\n\r\nexport class ServerTelemetryEntity {\r\n failedRequests: Array;\r\n errors: string[];\r\n cacheHits: number;\r\n\r\n constructor() {\r\n this.failedRequests = [];\r\n this.errors = [];\r\n this.cacheHits = 0;\r\n }\r\n\r\n /**\r\n * validates if a given cache entry is \"Telemetry\", parses \r\n * @param key\r\n * @param entity\r\n */\r\n static isServerTelemetryEntity(key: string, entity?: object): boolean {\r\n\r\n const validateKey: boolean = key.indexOf(SERVER_TELEM_CONSTANTS.CACHE_KEY) === 0;\r\n let validateEntity: boolean = true;\r\n\r\n if (entity) {\r\n validateEntity =\r\n entity.hasOwnProperty(\"failedRequests\") &&\r\n entity.hasOwnProperty(\"errors\") &&\r\n entity.hasOwnProperty(\"cacheHits\");\r\n }\r\n\r\n return validateKey && validateEntity;\r\n }\r\n}\r\n","/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License.\r\n */\r\n\r\nimport { ThrottlingConstants } from \"../../utils/Constants\";\r\n\r\nexport class ThrottlingEntity {\r\n // Unix-time value representing the expiration of the throttle\r\n throttleTime: number;\r\n // Information provided by the server\r\n error?: string;\r\n errorCodes?: Array;\r\n errorMessage?: string;\r\n subError?: string;\r\n\r\n /**\r\n * validates if a given cache entry is \"Throttling\", parses \r\n * @param key\r\n * @param entity\r\n */\r\n static isThrottlingEntity(key: string, entity?: object): boolean {\r\n \r\n let validateKey: boolean = false;\r\n if (key) {\r\n validateKey = key.indexOf(ThrottlingConstants.THROTTLING_PREFIX) === 0;\r\n }\r\n \r\n let validateEntity: boolean = true;\r\n if (entity) {\r\n validateEntity = entity.hasOwnProperty(\"throttleTime\");\r\n }\r\n\r\n return validateKey && validateEntity;\r\n }\r\n}\r\n","/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License.\r\n */\r\n\r\nimport { AuthError } from \"../error/AuthError\";\r\nimport { NetworkResponse } from \"./NetworkManager\";\r\n\r\n/**\r\n * Options allowed by network request APIs.\r\n */\r\nexport type NetworkRequestOptions = {\r\n headers?: Record,\r\n body?: string;\r\n proxyUrl?: string;\r\n};\r\n\r\n/**\r\n * Client network interface to send backend requests.\r\n * @interface\r\n */\r\nexport interface INetworkModule {\r\n\r\n /**\r\n * Interface function for async network \"GET\" requests. Based on the Fetch standard: https://fetch.spec.whatwg.org/\r\n * @param url\r\n * @param requestParams\r\n * @param enableCaching\r\n */\r\n sendGetRequestAsync(url: string, options?: NetworkRequestOptions, cancellationToken?: number): Promise>;\r\n\r\n /**\r\n * Interface function for async network \"POST\" requests. Based on the Fetch standard: https://fetch.spec.whatwg.org/\r\n * @param url\r\n * @param requestParams\r\n * @param enableCaching\r\n */\r\n sendPostRequestAsync(url: string, options?: NetworkRequestOptions): Promise>;\r\n}\r\n\r\nexport const StubbedNetworkModule: INetworkModule = {\r\n sendGetRequestAsync: () => {\r\n const notImplErr = \"Network interface - sendGetRequestAsync() has not been implemented for the Network interface.\";\r\n return Promise.reject(AuthError.createUnexpectedError(notImplErr));\r\n },\r\n sendPostRequestAsync: () => {\r\n const notImplErr = \"Network interface - sendPostRequestAsync() has not been implemented for the Network interface.\";\r\n return Promise.reject(AuthError.createUnexpectedError(notImplErr));\r\n }\r\n};\r\n","/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License.\r\n */\r\n\r\nimport { AuthError } from \"./AuthError\";\r\n\r\n/**\r\n * ClientAuthErrorMessage class containing string constants used by error codes and messages.\r\n */\r\nexport const JoseHeaderErrorMessage = {\r\n missingKidError: {\r\n code: \"missing_kid_error\",\r\n desc: \"The JOSE Header for the requested JWT, JWS or JWK object requires a keyId to be configured as the 'kid' header claim. No 'kid' value was provided.\"\r\n },\r\n missingAlgError: {\r\n code: \"missing_alg_error\",\r\n desc: \"The JOSE Header for the requested JWT, JWS or JWK object requires an algorithm to be specified as the 'alg' header claim. No 'alg' value was provided.\"\r\n },\r\n};\r\n\r\n/**\r\n * Error thrown when there is an error in the client code running on the browser.\r\n */\r\nexport class JoseHeaderError extends AuthError {\r\n constructor(errorCode: string, errorMessage?: string) {\r\n super(errorCode, errorMessage);\r\n this.name = \"JoseHeaderError\";\r\n\r\n Object.setPrototypeOf(this, JoseHeaderError.prototype);\r\n }\r\n\r\n /**\r\n * Creates an error thrown when keyId isn't set on JOSE header.\r\n */\r\n static createMissingKidError(): JoseHeaderError {\r\n return new JoseHeaderError(JoseHeaderErrorMessage.missingKidError.code, JoseHeaderErrorMessage.missingKidError.desc);\r\n }\r\n\r\n /**\r\n * Creates an error thrown when algorithm isn't set on JOSE header.\r\n */\r\n static createMissingAlgError(): JoseHeaderError {\r\n return new JoseHeaderError(JoseHeaderErrorMessage.missingAlgError.code, JoseHeaderErrorMessage.missingAlgError.desc);\r\n }\r\n}\r\n","/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License.\r\n */\r\n\r\nimport { JoseHeaderError } from \"../error/JoseHeaderError\";\r\nimport { JsonTypes } from \"../utils/Constants\";\r\n\r\nexport type JoseHeaderOptions = {\r\n typ?: JsonTypes,\r\n alg?: string,\r\n kid?: string\r\n};\r\n\r\nexport class JoseHeader {\r\n public typ?: JsonTypes;\r\n public alg?: string;\r\n public kid?: string;\r\n\r\n constructor (options: JoseHeaderOptions) {\r\n this.typ = options.typ;\r\n this.alg = options.alg;\r\n this.kid = options.kid;\r\n }\r\n\r\n /**\r\n * Builds SignedHttpRequest formatted JOSE Header from the\r\n * JOSE Header options provided or previously set on the object and returns\r\n * the stringified header object.\r\n * Throws if keyId or algorithm aren't provided since they are required for Access Token Binding.\r\n * @param shrHeaderOptions \r\n * @returns \r\n */\r\n static getShrHeaderString(shrHeaderOptions: JoseHeaderOptions): string {\r\n // KeyID is required on the SHR header\r\n if (!shrHeaderOptions.kid) {\r\n throw JoseHeaderError.createMissingKidError();\r\n }\r\n\r\n // Alg is required on the SHR header\r\n if (!shrHeaderOptions.alg) {\r\n throw JoseHeaderError.createMissingAlgError();\r\n }\r\n\r\n const shrHeader = new JoseHeader({\r\n // Access Token PoP headers must have type JWT, but the type header can be overriden for special cases\r\n typ: shrHeaderOptions.typ || JsonTypes.Jwt,\r\n kid: shrHeaderOptions.kid,\r\n alg: shrHeaderOptions.alg\r\n });\r\n\r\n return JSON.stringify(shrHeader);\r\n }\r\n}\r\n","/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License.\r\n */\r\n\r\nimport { ClientConfigurationError } from \"../error/ClientConfigurationError\";\r\nimport { Constants, HeaderNames } from \"../utils/Constants\";\r\n\r\ntype WWWAuthenticateChallenges = {\r\n nonce?: string,\r\n};\r\n\r\ntype AuthenticationInfoChallenges = {\r\n nextnonce?: string\r\n};\r\n\r\n/**\r\n * This is a helper class that parses supported HTTP response authentication headers to extract and return\r\n * header challenge values that can be used outside the basic authorization flows.\r\n */\r\nexport class AuthenticationHeaderParser {\r\n private headers: Record;\r\n\r\n constructor(headers: Record) {\r\n this.headers = headers;\r\n }\r\n\r\n /**\r\n * This method parses the SHR nonce value out of either the Authentication-Info or WWW-Authenticate authentication headers.\r\n * @returns \r\n */\r\n getShrNonce(): string {\r\n // Attempt to parse nonce from Authentiacation-Info\r\n const authenticationInfo = this.headers[HeaderNames.AuthenticationInfo];\r\n if (authenticationInfo) {\r\n const authenticationInfoChallenges = this.parseChallenges(authenticationInfo);\r\n if (authenticationInfoChallenges.nextnonce) {\r\n return authenticationInfoChallenges.nextnonce;\r\n }\r\n throw ClientConfigurationError.createInvalidAuthenticationHeaderError(HeaderNames.AuthenticationInfo, \"nextnonce challenge is missing.\");\r\n }\r\n\r\n // Attempt to parse nonce from WWW-Authenticate\r\n const wwwAuthenticate = this.headers[HeaderNames.WWWAuthenticate];\r\n if (wwwAuthenticate) {\r\n const wwwAuthenticateChallenges = this.parseChallenges(wwwAuthenticate); \r\n if (wwwAuthenticateChallenges.nonce){\r\n return wwwAuthenticateChallenges.nonce;\r\n }\r\n throw ClientConfigurationError.createInvalidAuthenticationHeaderError(HeaderNames.WWWAuthenticate, \"nonce challenge is missing.\");\r\n }\r\n\r\n // If neither header is present, throw missing headers error\r\n throw ClientConfigurationError.createMissingNonceAuthenticationHeadersError();\r\n }\r\n\r\n /**\r\n * Parses an HTTP header's challenge set into a key/value map.\r\n * @param header \r\n * @returns \r\n */\r\n private parseChallenges(header: string): T {\r\n const schemeSeparator = header.indexOf(\" \");\r\n const challenges = header.substr(schemeSeparator + 1).split(\",\");\r\n const challengeMap = {} as T;\r\n\r\n challenges.forEach((challenge: string) => {\r\n const [ key, value ] = challenge.split(\"=\");\r\n // Remove escaped quotation marks (', \") from challenge string to keep only the challenge value\r\n challengeMap[key] = unescape(value.replace(/['\"]+/g, Constants.EMPTY_STRING));\r\n });\r\n\r\n return challengeMap;\r\n }\r\n}\r\n","/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License.\r\n */\r\n\r\nimport { SERVER_TELEM_CONSTANTS, Separators, CacheOutcome, Constants, RegionDiscoverySources, RegionDiscoveryOutcomes } from \"../../utils/Constants\";\r\nimport { CacheManager } from \"../../cache/CacheManager\";\r\nimport { AuthError } from \"../../error/AuthError\";\r\nimport { ServerTelemetryRequest } from \"./ServerTelemetryRequest\";\r\nimport { ServerTelemetryEntity } from \"../../cache/entities/ServerTelemetryEntity\";\r\nimport { StringUtils } from \"../../utils/StringUtils\";\r\nimport { RegionDiscoveryMetadata } from \"../../authority/RegionDiscoveryMetadata\";\r\n\r\nexport class ServerTelemetryManager {\r\n private cacheManager: CacheManager;\r\n private apiId: number;\r\n private correlationId: string;\r\n private telemetryCacheKey: string;\r\n private wrapperSKU: String;\r\n private wrapperVer: String;\r\n private regionUsed: string | undefined;\r\n private regionSource: RegionDiscoverySources | undefined;\r\n private regionOutcome: RegionDiscoveryOutcomes | undefined;\r\n private cacheOutcome: CacheOutcome = CacheOutcome.NO_CACHE_HIT;\r\n\r\n constructor(telemetryRequest: ServerTelemetryRequest, cacheManager: CacheManager) {\r\n this.cacheManager = cacheManager;\r\n this.apiId = telemetryRequest.apiId;\r\n this.correlationId = telemetryRequest.correlationId;\r\n this.wrapperSKU = telemetryRequest.wrapperSKU || Constants.EMPTY_STRING;\r\n this.wrapperVer = telemetryRequest.wrapperVer || Constants.EMPTY_STRING;\r\n\r\n this.telemetryCacheKey = SERVER_TELEM_CONSTANTS.CACHE_KEY + Separators.CACHE_KEY_SEPARATOR + telemetryRequest.clientId;\r\n }\r\n\r\n /**\r\n * API to add MSER Telemetry to request\r\n */\r\n generateCurrentRequestHeaderValue(): string {\r\n const request = `${this.apiId}${SERVER_TELEM_CONSTANTS.VALUE_SEPARATOR}${this.cacheOutcome}`;\r\n const platformFields = [this.wrapperSKU, this.wrapperVer].join(SERVER_TELEM_CONSTANTS.VALUE_SEPARATOR);\r\n const regionDiscoveryFields = this.getRegionDiscoveryFields();\r\n const requestWithRegionDiscoveryFields = [request, regionDiscoveryFields].join(SERVER_TELEM_CONSTANTS.VALUE_SEPARATOR);\r\n\r\n return [SERVER_TELEM_CONSTANTS.SCHEMA_VERSION, requestWithRegionDiscoveryFields, platformFields].join(SERVER_TELEM_CONSTANTS.CATEGORY_SEPARATOR);\r\n }\r\n\r\n /**\r\n * API to add MSER Telemetry for the last failed request\r\n */\r\n generateLastRequestHeaderValue(): string {\r\n const lastRequests = this.getLastRequests();\r\n\r\n const maxErrors = ServerTelemetryManager.maxErrorsToSend(lastRequests);\r\n const failedRequests = lastRequests.failedRequests.slice(0, 2*maxErrors).join(SERVER_TELEM_CONSTANTS.VALUE_SEPARATOR);\r\n const errors = lastRequests.errors.slice(0, maxErrors).join(SERVER_TELEM_CONSTANTS.VALUE_SEPARATOR);\r\n const errorCount = lastRequests.errors.length;\r\n\r\n // Indicate whether this header contains all data or partial data\r\n const overflow = maxErrors < errorCount ? SERVER_TELEM_CONSTANTS.OVERFLOW_TRUE : SERVER_TELEM_CONSTANTS.OVERFLOW_FALSE;\r\n const platformFields = [errorCount, overflow].join(SERVER_TELEM_CONSTANTS.VALUE_SEPARATOR);\r\n\r\n return [SERVER_TELEM_CONSTANTS.SCHEMA_VERSION, lastRequests.cacheHits, failedRequests, errors, platformFields].join(SERVER_TELEM_CONSTANTS.CATEGORY_SEPARATOR);\r\n }\r\n\r\n /**\r\n * API to cache token failures for MSER data capture\r\n * @param error\r\n */\r\n cacheFailedRequest(error: AuthError): void {\r\n const lastRequests = this.getLastRequests();\r\n if (lastRequests.errors.length >= SERVER_TELEM_CONSTANTS.MAX_CACHED_ERRORS) {\r\n // Remove a cached error to make room, first in first out\r\n lastRequests.failedRequests.shift(); // apiId\r\n lastRequests.failedRequests.shift(); // correlationId\r\n lastRequests.errors.shift();\r\n }\r\n \r\n lastRequests.failedRequests.push(this.apiId, this.correlationId);\r\n\r\n if (!StringUtils.isEmpty(error.subError)) {\r\n lastRequests.errors.push(error.subError);\r\n } else if (!StringUtils.isEmpty(error.errorCode)) {\r\n lastRequests.errors.push(error.errorCode);\r\n } else if (!!error && error.toString()) {\r\n lastRequests.errors.push(error.toString());\r\n } else {\r\n lastRequests.errors.push(SERVER_TELEM_CONSTANTS.UNKNOWN_ERROR);\r\n }\r\n\r\n this.cacheManager.setServerTelemetry(this.telemetryCacheKey, lastRequests);\r\n\r\n return;\r\n }\r\n\r\n /**\r\n * Update server telemetry cache entry by incrementing cache hit counter\r\n */\r\n incrementCacheHits(): number {\r\n const lastRequests = this.getLastRequests();\r\n lastRequests.cacheHits += 1;\r\n\r\n this.cacheManager.setServerTelemetry(this.telemetryCacheKey, lastRequests);\r\n return lastRequests.cacheHits;\r\n }\r\n\r\n /**\r\n * Get the server telemetry entity from cache or initialize a new one\r\n */\r\n getLastRequests(): ServerTelemetryEntity {\r\n const initialValue: ServerTelemetryEntity = new ServerTelemetryEntity();\r\n const lastRequests = this.cacheManager.getServerTelemetry(this.telemetryCacheKey) as ServerTelemetryEntity;\r\n\r\n return lastRequests || initialValue;\r\n }\r\n\r\n /**\r\n * Remove server telemetry cache entry\r\n */\r\n clearTelemetryCache(): void {\r\n const lastRequests = this.getLastRequests();\r\n const numErrorsFlushed = ServerTelemetryManager.maxErrorsToSend(lastRequests);\r\n const errorCount = lastRequests.errors.length;\r\n if (numErrorsFlushed === errorCount) {\r\n // All errors were sent on last request, clear Telemetry cache\r\n this.cacheManager.removeItem(this.telemetryCacheKey);\r\n } else {\r\n // Partial data was flushed to server, construct a new telemetry cache item with errors that were not flushed\r\n const serverTelemEntity = new ServerTelemetryEntity();\r\n serverTelemEntity.failedRequests = lastRequests.failedRequests.slice(numErrorsFlushed*2); // failedRequests contains 2 items for each error\r\n serverTelemEntity.errors = lastRequests.errors.slice(numErrorsFlushed);\r\n\r\n this.cacheManager.setServerTelemetry(this.telemetryCacheKey, serverTelemEntity);\r\n }\r\n }\r\n\r\n /**\r\n * Returns the maximum number of errors that can be flushed to the server in the next network request\r\n * @param serverTelemetryEntity\r\n */\r\n static maxErrorsToSend(serverTelemetryEntity: ServerTelemetryEntity): number {\r\n let i;\r\n let maxErrors = 0;\r\n let dataSize = 0;\r\n const errorCount = serverTelemetryEntity.errors.length;\r\n for (i = 0; i < errorCount; i++) {\r\n // failedRequests parameter contains pairs of apiId and correlationId, multiply index by 2 to preserve pairs\r\n const apiId = serverTelemetryEntity.failedRequests[2*i] || Constants.EMPTY_STRING;\r\n const correlationId = serverTelemetryEntity.failedRequests[2*i + 1] || Constants.EMPTY_STRING;\r\n const errorCode = serverTelemetryEntity.errors[i] || Constants.EMPTY_STRING;\r\n\r\n // Count number of characters that would be added to header, each character is 1 byte. Add 3 at the end to account for separators\r\n dataSize += apiId.toString().length + correlationId.toString().length + errorCode.length + 3;\r\n\r\n if (dataSize < SERVER_TELEM_CONSTANTS.MAX_LAST_HEADER_BYTES) {\r\n // Adding this entry to the header would still keep header size below the limit\r\n maxErrors += 1;\r\n } else {\r\n break;\r\n }\r\n }\r\n\r\n return maxErrors;\r\n }\r\n\r\n /**\r\n * Get the region discovery fields\r\n * \r\n * @returns string\r\n */\r\n getRegionDiscoveryFields(): string {\r\n const regionDiscoveryFields: string[] = [];\r\n\r\n regionDiscoveryFields.push(this.regionUsed || Constants.EMPTY_STRING);\r\n regionDiscoveryFields.push(this.regionSource || Constants.EMPTY_STRING);\r\n regionDiscoveryFields.push(this.regionOutcome || Constants.EMPTY_STRING);\r\n\r\n return regionDiscoveryFields.join(\",\");\r\n }\r\n\r\n /**\r\n * Update the region discovery metadata\r\n * \r\n * @param regionDiscoveryMetadata\r\n * @returns void\r\n */\r\n updateRegionDiscoveryMetadata(regionDiscoveryMetadata: RegionDiscoveryMetadata): void {\r\n this.regionUsed = regionDiscoveryMetadata.region_used;\r\n this.regionSource = regionDiscoveryMetadata.region_source;\r\n this.regionOutcome = regionDiscoveryMetadata.region_outcome;\r\n }\r\n\r\n /**\r\n * Set cache outcome \r\n */\r\n setCacheOutcome(cacheOutcome: CacheOutcome): void {\r\n this.cacheOutcome = cacheOutcome;\r\n }\r\n}\r\n","/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License.\r\n */\r\n\r\nimport { ApplicationTelemetry } from \"../../config/ClientConfiguration\";\r\nimport { Logger } from \"../../logger/Logger\";\r\nimport { InProgressPerformanceEvent, IPerformanceClient, PerformanceCallbackFunction } from \"./IPerformanceClient\";\r\nimport { IPerformanceMeasurement } from \"./IPerformanceMeasurement\";\r\nimport { Counters, PerformanceEvent, PerformanceEvents, PerformanceEventStatus, StaticFields } from \"./PerformanceEvent\";\r\n\r\nexport abstract class PerformanceClient implements IPerformanceClient {\r\n protected authority: string;\r\n protected libraryName: string;\r\n protected libraryVersion: string;\r\n protected applicationTelemetry: ApplicationTelemetry;\r\n protected clientId: string;\r\n protected logger: Logger;\r\n protected callbacks: Map;\r\n\r\n /**\r\n * Multiple events with the same correlation id.\r\n * Double keyed by correlation id and event id.\r\n * @protected\r\n * @type {Map>}\r\n */\r\n protected eventsByCorrelationId: Map>;\r\n\r\n /**\r\n * Fields to be emitted which are scoped to the top level request and whose value will not change in submeasurements\r\n * For example: App name, version, etc.\r\n */\r\n protected staticFieldsByCorrelationId: Map;\r\n\r\n /**\r\n * Counters to be emitted which are scoped to the top level request and whose value may change in sub-measurements\r\n */\r\n protected countersByCorrelationId: Map;\r\n\r\n /**\r\n * Underlying performance measurements for each operation\r\n *\r\n * @protected\r\n * @type {Map}\r\n */\r\n protected measurementsById: Map;\r\n\r\n /**\r\n * Creates an instance of PerformanceClient,\r\n * an abstract class containing core performance telemetry logic.\r\n *\r\n * @constructor\r\n * @param {string} clientId Client ID of the application\r\n * @param {string} authority Authority used by the application\r\n * @param {Logger} logger Logger used by the application\r\n * @param {string} libraryName Name of the library\r\n * @param {string} libraryVersion Version of the library\r\n */\r\n constructor(clientId: string, authority: string, logger: Logger, libraryName: string, libraryVersion: string, applicationTelemetry: ApplicationTelemetry) {\r\n this.authority = authority;\r\n this.libraryName = libraryName;\r\n this.libraryVersion = libraryVersion;\r\n this.applicationTelemetry = applicationTelemetry;\r\n this.clientId = clientId;\r\n this.logger = logger;\r\n this.callbacks = new Map();\r\n this.eventsByCorrelationId = new Map();\r\n this.staticFieldsByCorrelationId = new Map();\r\n this.measurementsById = new Map();\r\n this.countersByCorrelationId = new Map();\r\n }\r\n\r\n /**\r\n * Generates and returns a unique id, typically a guid.\r\n *\r\n * @abstract\r\n * @returns {string}\r\n */\r\n abstract generateId(): string;\r\n\r\n /**\r\n * Starts and returns an platform-specific implementation of IPerformanceMeasurement.\r\n * Note: this function can be changed to abstract at the next major version bump.\r\n *\r\n * @param {string} measureName\r\n * @param {string} correlationId\r\n * @returns {IPerformanceMeasurement}\r\n */\r\n /* eslint-disable-next-line @typescript-eslint/no-unused-vars */\r\n startPerformanceMeasurement(measureName: string, correlationId: string): IPerformanceMeasurement {\r\n return {} as IPerformanceMeasurement;\r\n }\r\n\r\n /**\r\n * Starts and returns an platform-specific implementation of IPerformanceMeasurement.\r\n * Note: this incorrectly-named function will be removed at the next major version bump.\r\n *\r\n * @param {string} measureName\r\n * @param {string} correlationId\r\n * @returns {IPerformanceMeasurement}\r\n */\r\n /* eslint-disable-next-line @typescript-eslint/no-unused-vars */\r\n startPerformanceMeasuremeant(measureName: string, correlationId: string): IPerformanceMeasurement {\r\n return {} as IPerformanceMeasurement;\r\n }\r\n\r\n /**\r\n * Starts measuring performance for a given operation. Returns a function that should be used to end the measurement.\r\n *\r\n * @param {PerformanceEvents} measureName\r\n * @param {?string} [correlationId]\r\n * @returns {InProgressPerformanceEvent}\r\n */\r\n startMeasurement(measureName: PerformanceEvents, correlationId?: string): InProgressPerformanceEvent {\r\n // Generate a placeholder correlation if the request does not provide one\r\n const eventCorrelationId = correlationId || this.generateId();\r\n if (!correlationId) {\r\n this.logger.info(`PerformanceClient: No correlation id provided for ${measureName}, generating`, eventCorrelationId);\r\n }\r\n\r\n // Duplicate code to address spelling error will be removed at the next major version bump.\r\n this.logger.trace(`PerformanceClient: Performance measurement started for ${measureName}`, eventCorrelationId);\r\n let validMeasurement: IPerformanceMeasurement;\r\n const performanceMeasuremeant = this.startPerformanceMeasuremeant(measureName, eventCorrelationId);\r\n if (performanceMeasuremeant.startMeasurement) {\r\n performanceMeasuremeant.startMeasurement();\r\n validMeasurement = performanceMeasuremeant;\r\n } else {\r\n const performanceMeasurement = this.startPerformanceMeasurement(measureName, eventCorrelationId);\r\n performanceMeasurement.startMeasurement();\r\n validMeasurement = performanceMeasurement;\r\n }\r\n\r\n const inProgressEvent: PerformanceEvent = {\r\n eventId: this.generateId(),\r\n status: PerformanceEventStatus.InProgress,\r\n authority: this.authority,\r\n libraryName: this.libraryName,\r\n libraryVersion: this.libraryVersion,\r\n clientId: this.clientId,\r\n name: measureName,\r\n startTimeMs: Date.now(),\r\n correlationId: eventCorrelationId,\r\n };\r\n\r\n // Store in progress events so they can be discarded if not ended properly\r\n this.cacheEventByCorrelationId(inProgressEvent);\r\n\r\n const staticFields: StaticFields = {\r\n appName: this.applicationTelemetry?.appName,\r\n appVersion: this.applicationTelemetry?.appVersion,\r\n };\r\n this.addStaticFields(staticFields, eventCorrelationId);\r\n this.cacheMeasurement(inProgressEvent, validMeasurement);\r\n\r\n // Return the event and functions the caller can use to properly end/flush the measurement\r\n return {\r\n endMeasurement: (event?: Partial): PerformanceEvent | null => {\r\n const completedEvent = this.endMeasurement({\r\n // Initial set of event properties\r\n ...inProgressEvent,\r\n // Properties set when event ends\r\n ...event\r\n });\r\n\r\n if (completedEvent) {\r\n // Cache event so that submeasurements can be added downstream\r\n this.cacheEventByCorrelationId(completedEvent);\r\n }\r\n return completedEvent;\r\n },\r\n flushMeasurement: () => {\r\n return this.flushMeasurements(inProgressEvent.name, inProgressEvent.correlationId);\r\n },\r\n discardMeasurement: () => {\r\n return this.discardMeasurements(inProgressEvent.correlationId);\r\n },\r\n addStaticFields: (fields: StaticFields) => {\r\n return this.addStaticFields(fields, inProgressEvent.correlationId);\r\n },\r\n increment: (counters: Counters) => {\r\n return this.increment(counters, inProgressEvent.correlationId);\r\n },\r\n measurement: validMeasurement,\r\n event: inProgressEvent\r\n };\r\n\r\n }\r\n\r\n /**\r\n * Stops measuring the performance for an operation. Should only be called directly by PerformanceClient classes,\r\n * as consumers should instead use the function returned by startMeasurement.\r\n *\r\n * @param {PerformanceEvent} event\r\n * @returns {(PerformanceEvent | null)}\r\n */\r\n endMeasurement(event: PerformanceEvent): PerformanceEvent | null {\r\n const performanceMeasurement = this.measurementsById.get(event.eventId);\r\n if (performanceMeasurement) {\r\n // Immediately delete so that the same event isnt ended twice\r\n this.measurementsById.delete(event.eventId);\r\n performanceMeasurement.endMeasurement();\r\n const durationMs = performanceMeasurement.flushMeasurement();\r\n // null indicates no measurement was taken (e.g. needed performance APIs not present)\r\n if (durationMs !== null) {\r\n this.logger.trace(`PerformanceClient: Performance measurement ended for ${event.name}: ${durationMs} ms`, event.correlationId);\r\n const completedEvent: PerformanceEvent = {\r\n // Allow duration to be overwritten when event ends (e.g. testing), but not status\r\n durationMs: Math.round(durationMs),\r\n ...event,\r\n status: PerformanceEventStatus.Completed,\r\n };\r\n\r\n return completedEvent;\r\n } else {\r\n this.logger.trace(\"PerformanceClient: Performance measurement not taken\", event.correlationId);\r\n }\r\n } else {\r\n this.logger.trace(`PerformanceClient: Measurement not found for ${event.eventId}`, event.correlationId);\r\n }\r\n\r\n return null;\r\n }\r\n\r\n /**\r\n * Saves extra information to be emitted when the measurements are flushed\r\n * @param fields\r\n * @param correlationId\r\n */\r\n addStaticFields(fields: StaticFields, correlationId: string) : void{\r\n const existingStaticFields = this.staticFieldsByCorrelationId.get(correlationId);\r\n if (existingStaticFields) {\r\n this.logger.trace(\"PerformanceClient: Updating static fields\");\r\n this.staticFieldsByCorrelationId.set(correlationId, {...existingStaticFields, ...fields});\r\n } else {\r\n this.logger.trace(\"PerformanceClient: Adding static fields\");\r\n this.staticFieldsByCorrelationId.set(correlationId, fields);\r\n }\r\n }\r\n\r\n /**\r\n * Increment counters to be emitted when the measurements are flushed\r\n * @param counters {Counters}\r\n * @param correlationId {string} correlation identifier\r\n */\r\n increment(counters: Counters, correlationId: string): void {\r\n const existing: Counters | undefined = this.countersByCorrelationId.get(correlationId);\r\n if (!existing) {\r\n this.logger.trace(\"PerformanceClient: Setting counters\");\r\n this.countersByCorrelationId.set(correlationId, { ...counters });\r\n return;\r\n }\r\n\r\n this.logger.trace(\"PerformanceClient: Updating counters\");\r\n for (const counter in counters) {\r\n if (!existing.hasOwnProperty(counter)) {\r\n existing[counter] = 0;\r\n }\r\n existing[counter] += counters[counter];\r\n }\r\n }\r\n\r\n /**\r\n * Upserts event into event cache.\r\n * First key is the correlation id, second key is the event id.\r\n * Allows for events to be grouped by correlation id,\r\n * and to easily allow for properties on them to be updated.\r\n *\r\n * @private\r\n * @param {PerformanceEvent} event\r\n */\r\n private cacheEventByCorrelationId(event: PerformanceEvent) {\r\n const existingEvents = this.eventsByCorrelationId.get(event.correlationId);\r\n if (existingEvents) {\r\n this.logger.trace(`PerformanceClient: Performance measurement for ${event.name} added/updated`, event.correlationId);\r\n existingEvents.set(event.eventId, event);\r\n } else {\r\n this.logger.trace(`PerformanceClient: Performance measurement for ${event.name} started`, event.correlationId);\r\n this.eventsByCorrelationId.set(event.correlationId, new Map().set(event.eventId, event));\r\n }\r\n }\r\n\r\n /**\r\n * Cache measurements by their id.\r\n *\r\n * @private\r\n * @param {PerformanceEvent} event\r\n * @param {IPerformanceMeasurement} measurement\r\n */\r\n private cacheMeasurement(event: PerformanceEvent, measurement: IPerformanceMeasurement) {\r\n this.measurementsById.set(event.eventId, measurement);\r\n }\r\n\r\n /**\r\n * Gathers and emits performance events for measurements taked for the given top-level API and correlation ID.\r\n *\r\n * @param {PerformanceEvents} measureName\r\n * @param {string} correlationId\r\n */\r\n flushMeasurements(measureName: PerformanceEvents, correlationId: string): void {\r\n this.logger.trace(`PerformanceClient: Performance measurements flushed for ${measureName}`, correlationId);\r\n const eventsForCorrelationId = this.eventsByCorrelationId.get(correlationId);\r\n const staticFields = this.staticFieldsByCorrelationId.get(correlationId);\r\n const counters = this.countersByCorrelationId.get(correlationId);\r\n\r\n if (eventsForCorrelationId) {\r\n this.discardCache(correlationId);\r\n\r\n /*\r\n * Manually end incomplete submeasurements to ensure there arent orphaned/never ending events.\r\n * Incomplete submeasurements are likely an instrumentation bug that should be fixed.\r\n * IE only supports Map.forEach.\r\n */\r\n const completedEvents: PerformanceEvent[] = [];\r\n eventsForCorrelationId.forEach(event => {\r\n if (event.name !== measureName && event.status !== PerformanceEventStatus.Completed) {\r\n this.logger.trace(`PerformanceClient: Incomplete submeasurement ${event.name} found for ${measureName}`, correlationId);\r\n\r\n const completedEvent = this.endMeasurement(event);\r\n if (completedEvent) {\r\n completedEvents.push(completedEvent);\r\n }\r\n }\r\n\r\n completedEvents.push(event);\r\n });\r\n\r\n // Sort events by start time (earliest first)\r\n const sortedCompletedEvents = completedEvents.sort((eventA, eventB) => eventA.startTimeMs - eventB.startTimeMs);\r\n\r\n // Take completed top level event and add completed submeasurements durations as properties\r\n const topLevelEvents = sortedCompletedEvents.filter(event => event.name === measureName && event.status === PerformanceEventStatus.Completed);\r\n if (topLevelEvents.length > 0) {\r\n /*\r\n * Only take the first top-level event if there are multiple events with the same correlation id.\r\n * This greatly simplifies logic for submeasurements.\r\n */\r\n if (topLevelEvents.length > 1) {\r\n this.logger.verbose(\"PerformanceClient: Multiple distinct top-level performance events found, using the first\", correlationId);\r\n }\r\n const topLevelEvent = topLevelEvents[0];\r\n this.logger.verbose(`PerformanceClient: Measurement found for ${measureName}`, correlationId);\r\n\r\n // Build event object with top level and sub measurements\r\n const eventToEmit = sortedCompletedEvents.reduce((previous, current) => {\r\n if (current.name !== measureName) {\r\n this.logger.trace(`PerformanceClient: Complete submeasurement found for ${current.name}`, correlationId);\r\n // TODO: Emit additional properties for each subMeasurement\r\n const subMeasurementName = `${current.name}DurationMs`;\r\n /*\r\n * Some code paths, such as resolving an authority, can occur multiple times.\r\n * Only take the first measurement, since the second could be read from the cache,\r\n * or due to the same correlation id being used for two distinct requests.\r\n */\r\n if (!previous[subMeasurementName]) {\r\n previous[subMeasurementName] = current.durationMs;\r\n } else {\r\n this.logger.verbose(`PerformanceClient: Submeasurement for ${measureName} already exists for ${current.name}, ignoring`, correlationId);\r\n }\r\n }\r\n\r\n return previous;\r\n }, topLevelEvent);\r\n\r\n const finalEvent: PerformanceEvent = {\r\n ...eventToEmit,\r\n ...staticFields,\r\n ...counters\r\n };\r\n\r\n this.emitEvents([finalEvent], eventToEmit.correlationId);\r\n } else {\r\n this.logger.verbose(`PerformanceClient: No completed top-level measurements found for ${measureName}`, correlationId);\r\n }\r\n } else {\r\n this.logger.verbose(\"PerformanceClient: No measurements found\", correlationId);\r\n }\r\n }\r\n\r\n /**\r\n * Removes measurements for a given correlation id.\r\n *\r\n * @param {string} correlationId\r\n */\r\n discardMeasurements(correlationId: string): void {\r\n this.logger.trace(\"PerformanceClient: Performance measurements discarded\", correlationId);\r\n this.eventsByCorrelationId.delete(correlationId);\r\n }\r\n\r\n /**\r\n * Removes cache for a given correlation id.\r\n *\r\n * @param {string} correlation identifier\r\n */\r\n private discardCache(correlationId: string): void {\r\n this.discardMeasurements(correlationId);\r\n\r\n this.logger.trace(\"PerformanceClient: Static fields discarded\", correlationId);\r\n this.staticFieldsByCorrelationId.delete(correlationId);\r\n\r\n this.logger.trace(\"PerformanceClient: Counters discarded\", correlationId);\r\n this.countersByCorrelationId.delete(correlationId);\r\n }\r\n\r\n /**\r\n * Registers a callback function to receive performance events.\r\n *\r\n * @param {PerformanceCallbackFunction} callback\r\n * @returns {string}\r\n */\r\n addPerformanceCallback(callback: PerformanceCallbackFunction): string {\r\n const callbackId = this.generateId();\r\n this.callbacks.set(callbackId, callback);\r\n this.logger.verbose(`PerformanceClient: Performance callback registered with id: ${callbackId}`);\r\n\r\n return callbackId;\r\n }\r\n\r\n /**\r\n * Removes a callback registered with addPerformanceCallback.\r\n *\r\n * @param {string} callbackId\r\n * @returns {boolean}\r\n */\r\n removePerformanceCallback(callbackId: string): boolean {\r\n const result = this.callbacks.delete(callbackId);\r\n\r\n if (result) {\r\n this.logger.verbose(`PerformanceClient: Performance callback ${callbackId} removed.`);\r\n } else {\r\n this.logger.verbose(`PerformanceClient: Performance callback ${callbackId} not removed.`);\r\n }\r\n\r\n return result;\r\n }\r\n\r\n /**\r\n * Emits events to all registered callbacks.\r\n *\r\n * @param {PerformanceEvent[]} events\r\n * @param {?string} [correlationId]\r\n */\r\n emitEvents(events: PerformanceEvent[], correlationId: string): void {\r\n this.logger.verbose(\"PerformanceClient: Emitting performance events\", correlationId);\r\n\r\n this.callbacks.forEach((callback: PerformanceCallbackFunction, callbackId: string) => {\r\n this.logger.trace(`PerformanceClient: Emitting event to callback ${callbackId}`, correlationId);\r\n callback.apply(null, [events]);\r\n });\r\n }\r\n\r\n}\r\n","/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License.\r\n */\r\n\r\nimport { IPerformanceClient } from \"./IPerformanceClient\";\r\nimport { IPerformanceMeasurement } from \"./IPerformanceMeasurement\";\r\nimport { PerformanceClient } from \"./PerformanceClient\";\r\n\r\nexport class StubPerformanceMeasurement implements IPerformanceMeasurement {\r\n /* eslint-disable-next-line @typescript-eslint/no-empty-function */\r\n startMeasurement(): void { }\r\n /* eslint-disable-next-line @typescript-eslint/no-empty-function */\r\n endMeasurement(): void { }\r\n flushMeasurement(): number | null {\r\n return null;\r\n }\r\n \r\n}\r\n\r\nexport class StubPerformanceClient extends PerformanceClient implements IPerformanceClient {\r\n generateId(): string {\r\n return \"callback-id\";\r\n }\r\n \r\n startPerformanceMeasuremeant(): IPerformanceMeasurement {\r\n return new StubPerformanceMeasurement();\r\n }\r\n\r\n startPerformanceMeasurement(): IPerformanceMeasurement {\r\n return new StubPerformanceMeasurement();\r\n }\r\n}\r\n"],"names":["HeaderNames","PersistentCacheKeys","AADServerParamKeys","ClaimsRequestKeys","SSOTypes","ResponseMode","CacheAccountType","CredentialType","CacheSchemaType","CacheType","AuthenticationScheme","PasswordGrantConstants","LogLevel","AzureCloudInstance","AuthorityType","CcsCredentialType","PerformanceEvents","PerformanceEventStatus","ProtocolMode"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;AAGG;AAEU,IAAA,SAAS,GAAG;AACrB,IAAA,YAAY,EAAE,SAAS;AACvB,IAAA,GAAG,EAAE,gBAAgB;;AAErB,IAAA,YAAY,EAAE,MAAM;;AAEpB,IAAA,iBAAiB,EAAE,2CAA2C;AAC9D,IAAA,sBAAsB,EAAE,2BAA2B;AACnD,IAAA,qBAAqB,EAAE,QAAQ;;AAE/B,IAAA,IAAI,EAA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