@azure/msal-node 1.17.2 → 2.0.0-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -0
- package/dist/cache/ITokenCache.d.ts.map +1 -1
- package/dist/cache/NodeStorage.d.ts.map +1 -1
- package/dist/cache/NodeStorage.esm.js +410 -0
- package/dist/cache/NodeStorage.esm.js.map +1 -0
- package/dist/cache/NodeStorage.js +412 -0
- package/dist/cache/NodeStorage.js.map +1 -0
- package/dist/cache/TokenCache.d.ts.map +1 -1
- package/dist/cache/TokenCache.esm.js +278 -0
- package/dist/cache/TokenCache.esm.js.map +1 -0
- package/dist/cache/TokenCache.js +280 -0
- package/dist/cache/TokenCache.js.map +1 -0
- package/dist/cache/distributed/DistributedCachePlugin.d.ts.map +1 -1
- package/dist/cache/distributed/DistributedCachePlugin.esm.js +33 -0
- package/dist/cache/distributed/DistributedCachePlugin.esm.js.map +1 -0
- package/dist/cache/distributed/DistributedCachePlugin.js +35 -0
- package/dist/cache/distributed/DistributedCachePlugin.js.map +1 -0
- package/dist/cache/distributed/ICacheClient.d.ts.map +1 -1
- package/dist/cache/distributed/IPartitionManager.d.ts.map +1 -1
- package/dist/cache/serializer/Deserializer.d.ts.map +1 -1
- package/dist/cache/serializer/Deserializer.esm.js +182 -0
- package/dist/cache/serializer/Deserializer.esm.js.map +1 -0
- package/dist/cache/serializer/Deserializer.js +184 -0
- package/dist/cache/serializer/Deserializer.js.map +1 -0
- package/dist/cache/serializer/Serializer.d.ts.map +1 -1
- package/dist/cache/serializer/Serializer.esm.js +139 -0
- package/dist/cache/serializer/Serializer.esm.js.map +1 -0
- package/dist/cache/serializer/Serializer.js +141 -0
- package/dist/cache/serializer/Serializer.js.map +1 -0
- package/dist/cache/serializer/SerializerTypes.d.ts +8 -8
- package/dist/cache/serializer/SerializerTypes.d.ts.map +1 -1
- package/dist/client/ClientApplication.d.ts +1 -1
- package/dist/client/ClientApplication.d.ts.map +1 -1
- package/dist/client/ClientApplication.esm.js +342 -0
- package/dist/client/ClientApplication.esm.js.map +1 -0
- package/dist/client/ClientApplication.js +344 -0
- package/dist/client/ClientApplication.js.map +1 -0
- package/dist/client/ClientAssertion.d.ts.map +1 -1
- package/dist/client/ClientAssertion.esm.js +126 -0
- package/dist/client/ClientAssertion.esm.js.map +1 -0
- package/dist/client/ClientAssertion.js +128 -0
- package/dist/client/ClientAssertion.js.map +1 -0
- package/dist/client/ClientCredentialClient.d.ts +34 -0
- package/dist/client/ClientCredentialClient.d.ts.map +1 -0
- package/dist/client/ClientCredentialClient.esm.js +164 -0
- package/dist/client/ClientCredentialClient.esm.js.map +1 -0
- package/dist/client/ClientCredentialClient.js +166 -0
- package/dist/client/ClientCredentialClient.js.map +1 -0
- package/dist/client/ConfidentialClientApplication.d.ts.map +1 -1
- package/dist/client/ConfidentialClientApplication.esm.js +175 -0
- package/dist/client/ConfidentialClientApplication.esm.js.map +1 -0
- package/dist/client/ConfidentialClientApplication.js +177 -0
- package/dist/client/ConfidentialClientApplication.js.map +1 -0
- package/dist/client/DeviceCodeClient.d.ts +54 -0
- package/dist/client/DeviceCodeClient.d.ts.map +1 -0
- package/dist/client/DeviceCodeClient.esm.js +214 -0
- package/dist/client/DeviceCodeClient.esm.js.map +1 -0
- package/dist/client/DeviceCodeClient.js +216 -0
- package/dist/client/DeviceCodeClient.js.map +1 -0
- package/dist/client/IConfidentialClientApplication.d.ts.map +1 -1
- package/dist/client/IPublicClientApplication.d.ts +1 -1
- package/dist/client/IPublicClientApplication.d.ts.map +1 -1
- package/dist/client/OnBehalfOfClient.d.ts +48 -0
- package/dist/client/OnBehalfOfClient.d.ts.map +1 -0
- package/dist/client/OnBehalfOfClient.esm.js +211 -0
- package/dist/client/OnBehalfOfClient.esm.js.map +1 -0
- package/dist/client/OnBehalfOfClient.js +213 -0
- package/dist/client/OnBehalfOfClient.js.map +1 -0
- package/dist/client/PublicClientApplication.d.ts +1 -1
- package/dist/client/PublicClientApplication.d.ts.map +1 -1
- package/dist/client/PublicClientApplication.esm.js +187 -0
- package/dist/client/PublicClientApplication.esm.js.map +1 -0
- package/dist/client/PublicClientApplication.js +189 -0
- package/dist/client/PublicClientApplication.js.map +1 -0
- package/dist/client/UsernamePasswordClient.d.ts +26 -0
- package/dist/client/UsernamePasswordClient.d.ts.map +1 -0
- package/dist/client/UsernamePasswordClient.esm.js +109 -0
- package/dist/client/UsernamePasswordClient.esm.js.map +1 -0
- package/dist/client/UsernamePasswordClient.js +111 -0
- package/dist/client/UsernamePasswordClient.js.map +1 -0
- package/dist/config/Configuration.d.ts +9 -8
- package/dist/config/Configuration.d.ts.map +1 -1
- package/dist/config/Configuration.esm.js +78 -0
- package/dist/config/Configuration.esm.js.map +1 -0
- package/dist/config/Configuration.js +80 -0
- package/dist/config/Configuration.js.map +1 -0
- package/dist/crypto/CryptoProvider.d.ts.map +1 -1
- package/dist/crypto/CryptoProvider.esm.js +85 -0
- package/dist/crypto/CryptoProvider.esm.js.map +1 -0
- package/dist/crypto/CryptoProvider.js +87 -0
- package/dist/crypto/CryptoProvider.js.map +1 -0
- package/dist/crypto/GuidGenerator.d.ts.map +1 -1
- package/dist/crypto/GuidGenerator.esm.js +29 -0
- package/dist/crypto/GuidGenerator.esm.js.map +1 -0
- package/dist/crypto/GuidGenerator.js +31 -0
- package/dist/crypto/GuidGenerator.js.map +1 -0
- package/dist/crypto/HashUtils.d.ts.map +1 -1
- package/dist/crypto/HashUtils.esm.js +21 -0
- package/dist/crypto/HashUtils.esm.js.map +1 -0
- package/dist/crypto/HashUtils.js +23 -0
- package/dist/crypto/HashUtils.js.map +1 -0
- package/dist/crypto/PkceGenerator.d.ts.map +1 -1
- package/dist/crypto/PkceGenerator.esm.js +60 -0
- package/dist/crypto/PkceGenerator.esm.js.map +1 -0
- package/dist/crypto/PkceGenerator.js +62 -0
- package/dist/crypto/PkceGenerator.js.map +1 -0
- package/dist/error/NodeAuthError.d.ts.map +1 -1
- package/dist/error/NodeAuthError.esm.js +92 -0
- package/dist/error/NodeAuthError.esm.js.map +1 -0
- package/dist/error/NodeAuthError.js +95 -0
- package/dist/error/NodeAuthError.js.map +1 -0
- package/dist/index.d.ts +13 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.esm.js +20 -0
- package/dist/index.esm.js.map +1 -0
- package/dist/index.js +101 -6
- package/dist/index.js.map +1 -0
- package/dist/internals.d.ts +7 -0
- package/dist/internals.d.ts.map +1 -0
- package/dist/internals.esm.js +10 -0
- package/dist/internals.esm.js.map +1 -0
- package/dist/internals.js +15 -0
- package/dist/internals.js.map +1 -0
- package/dist/network/HttpClient.d.ts +1 -0
- package/dist/network/HttpClient.d.ts.map +1 -1
- package/dist/network/HttpClient.esm.js +286 -0
- package/dist/network/HttpClient.esm.js.map +1 -0
- package/dist/network/HttpClient.js +288 -0
- package/dist/network/HttpClient.js.map +1 -0
- package/dist/network/ILoopbackClient.d.ts.map +1 -1
- package/dist/network/LoopbackClient.d.ts.map +1 -1
- package/dist/network/LoopbackClient.esm.js +94 -0
- package/dist/network/LoopbackClient.esm.js.map +1 -0
- package/dist/network/LoopbackClient.js +96 -0
- package/dist/network/LoopbackClient.js.map +1 -0
- package/dist/packageMetadata.d.ts +1 -1
- package/dist/packageMetadata.d.ts.map +1 -1
- package/dist/packageMetadata.esm.js +8 -0
- package/dist/packageMetadata.esm.js.map +1 -0
- package/dist/packageMetadata.js +11 -0
- package/dist/packageMetadata.js.map +1 -0
- package/dist/request/AuthorizationCodeRequest.d.ts +1 -1
- package/dist/request/AuthorizationCodeRequest.d.ts.map +1 -1
- package/dist/request/AuthorizationUrlRequest.d.ts +1 -1
- package/dist/request/AuthorizationUrlRequest.d.ts.map +1 -1
- package/dist/request/ClientCredentialRequest.d.ts +1 -1
- package/dist/request/ClientCredentialRequest.d.ts.map +1 -1
- package/dist/request/DeviceCodeRequest.d.ts +1 -1
- package/dist/request/DeviceCodeRequest.d.ts.map +1 -1
- package/dist/request/InteractiveRequest.d.ts +1 -1
- package/dist/request/InteractiveRequest.d.ts.map +1 -1
- package/dist/request/OnBehalfOfRequest.d.ts +1 -1
- package/dist/request/OnBehalfOfRequest.d.ts.map +1 -1
- package/dist/request/RefreshTokenRequest.d.ts +1 -1
- package/dist/request/RefreshTokenRequest.d.ts.map +1 -1
- package/dist/request/SignOutRequest.d.ts +1 -1
- package/dist/request/SignOutRequest.d.ts.map +1 -1
- package/dist/request/SilentFlowRequest.d.ts +1 -1
- package/dist/request/SilentFlowRequest.d.ts.map +1 -1
- package/dist/request/UsernamePasswordRequest.d.ts +1 -1
- package/dist/request/UsernamePasswordRequest.d.ts.map +1 -1
- package/dist/utils/Constants.d.ts.map +1 -1
- package/dist/utils/Constants.esm.js +98 -0
- package/dist/utils/Constants.esm.js.map +1 -0
- package/dist/utils/Constants.js +106 -0
- package/dist/utils/Constants.js.map +1 -0
- package/dist/utils/EncodingUtils.d.ts.map +1 -1
- package/dist/utils/EncodingUtils.esm.js +51 -0
- package/dist/utils/EncodingUtils.esm.js.map +1 -0
- package/dist/utils/EncodingUtils.js +53 -0
- package/dist/utils/EncodingUtils.js.map +1 -0
- package/dist/utils/NetworkUtils.d.ts.map +1 -1
- package/dist/utils/NetworkUtils.esm.js +43 -0
- package/dist/utils/NetworkUtils.esm.js.map +1 -0
- package/dist/utils/NetworkUtils.js +45 -0
- package/dist/utils/NetworkUtils.js.map +1 -0
- package/node_modules/@azure/msal-common/LICENSE +21 -0
- package/node_modules/@azure/msal-common/README.md +62 -0
- package/node_modules/@azure/msal-common/dist/account/AccountInfo.d.ts +32 -0
- package/node_modules/@azure/msal-common/dist/account/AccountInfo.d.ts.map +1 -0
- package/node_modules/@azure/msal-common/dist/account/AuthToken.d.ts +21 -0
- package/node_modules/@azure/msal-common/dist/account/AuthToken.d.ts.map +1 -0
- package/node_modules/@azure/msal-common/dist/account/AuthToken.js +56 -0
- package/node_modules/@azure/msal-common/dist/account/AuthToken.js.map +1 -0
- package/node_modules/@azure/msal-common/dist/account/CcsCredential.d.ts +9 -0
- package/node_modules/@azure/msal-common/dist/account/CcsCredential.d.ts.map +1 -0
- package/node_modules/@azure/msal-common/dist/account/CcsCredential.js +14 -0
- package/node_modules/@azure/msal-common/dist/account/CcsCredential.js.map +1 -0
- package/node_modules/@azure/msal-common/dist/account/ClientCredentials.d.ts +15 -0
- package/node_modules/@azure/msal-common/dist/account/ClientCredentials.d.ts.map +1 -0
- package/node_modules/@azure/msal-common/dist/account/ClientInfo.d.ts +20 -0
- package/node_modules/@azure/msal-common/dist/account/ClientInfo.d.ts.map +1 -0
- package/node_modules/@azure/msal-common/dist/account/ClientInfo.js +46 -0
- package/node_modules/@azure/msal-common/dist/account/ClientInfo.js.map +1 -0
- package/node_modules/@azure/msal-common/dist/account/DecodedAuthToken.d.ts +9 -0
- package/node_modules/@azure/msal-common/dist/account/DecodedAuthToken.d.ts.map +1 -0
- package/node_modules/@azure/msal-common/dist/account/TokenClaims.d.ts +66 -0
- package/node_modules/@azure/msal-common/dist/account/TokenClaims.d.ts.map +1 -0
- package/node_modules/@azure/msal-common/dist/authority/Authority.d.ts +216 -0
- package/node_modules/@azure/msal-common/dist/authority/Authority.d.ts.map +1 -0
- package/node_modules/@azure/msal-common/dist/authority/Authority.js +688 -0
- package/node_modules/@azure/msal-common/dist/authority/Authority.js.map +1 -0
- package/node_modules/@azure/msal-common/dist/authority/AuthorityFactory.d.ts +31 -0
- package/node_modules/@azure/msal-common/dist/authority/AuthorityFactory.d.ts.map +1 -0
- package/node_modules/@azure/msal-common/dist/authority/AuthorityFactory.js +58 -0
- package/node_modules/@azure/msal-common/dist/authority/AuthorityFactory.js.map +1 -0
- package/node_modules/@azure/msal-common/dist/authority/AuthorityMetadata.d.ts +623 -0
- package/node_modules/@azure/msal-common/dist/authority/AuthorityMetadata.d.ts.map +1 -0
- package/node_modules/@azure/msal-common/dist/authority/AuthorityMetadata.js +881 -0
- package/node_modules/@azure/msal-common/dist/authority/AuthorityMetadata.js.map +1 -0
- package/node_modules/@azure/msal-common/dist/authority/AuthorityOptions.d.ts +19 -0
- package/node_modules/@azure/msal-common/dist/authority/AuthorityOptions.d.ts.map +1 -0
- package/node_modules/@azure/msal-common/dist/authority/AuthorityOptions.js +24 -0
- package/node_modules/@azure/msal-common/dist/authority/AuthorityOptions.js.map +1 -0
- package/node_modules/@azure/msal-common/dist/authority/AuthorityType.d.ts +10 -0
- package/node_modules/@azure/msal-common/dist/authority/AuthorityType.d.ts.map +1 -0
- package/node_modules/@azure/msal-common/dist/authority/AuthorityType.js +19 -0
- package/node_modules/@azure/msal-common/dist/authority/AuthorityType.js.map +1 -0
- package/node_modules/@azure/msal-common/dist/authority/AzureRegion.d.ts +2 -0
- package/node_modules/@azure/msal-common/dist/authority/AzureRegion.d.ts.map +1 -0
- package/node_modules/@azure/msal-common/dist/authority/AzureRegionConfiguration.d.ts +6 -0
- package/node_modules/@azure/msal-common/dist/authority/AzureRegionConfiguration.d.ts.map +1 -0
- package/node_modules/@azure/msal-common/dist/authority/CloudDiscoveryMetadata.d.ts +6 -0
- package/node_modules/@azure/msal-common/dist/authority/CloudDiscoveryMetadata.d.ts.map +1 -0
- package/node_modules/@azure/msal-common/dist/authority/CloudInstanceDiscoveryErrorResponse.d.ts +14 -0
- package/node_modules/@azure/msal-common/dist/authority/CloudInstanceDiscoveryErrorResponse.d.ts.map +1 -0
- package/node_modules/@azure/msal-common/dist/authority/CloudInstanceDiscoveryErrorResponse.js +13 -0
- package/node_modules/@azure/msal-common/dist/authority/CloudInstanceDiscoveryErrorResponse.js.map +1 -0
- package/node_modules/@azure/msal-common/dist/authority/CloudInstanceDiscoveryResponse.d.ts +10 -0
- package/node_modules/@azure/msal-common/dist/authority/CloudInstanceDiscoveryResponse.d.ts.map +1 -0
- package/node_modules/@azure/msal-common/dist/authority/CloudInstanceDiscoveryResponse.js +13 -0
- package/node_modules/@azure/msal-common/dist/authority/CloudInstanceDiscoveryResponse.js.map +1 -0
- package/node_modules/@azure/msal-common/dist/authority/ImdsOptions.d.ts +6 -0
- package/node_modules/@azure/msal-common/dist/authority/ImdsOptions.d.ts.map +1 -0
- package/node_modules/@azure/msal-common/dist/authority/OpenIdConfigResponse.d.ts +12 -0
- package/node_modules/@azure/msal-common/dist/authority/OpenIdConfigResponse.d.ts.map +1 -0
- package/node_modules/@azure/msal-common/dist/authority/OpenIdConfigResponse.js +15 -0
- package/node_modules/@azure/msal-common/dist/authority/OpenIdConfigResponse.js.map +1 -0
- package/node_modules/@azure/msal-common/dist/authority/ProtocolMode.d.ts +8 -0
- package/node_modules/@azure/msal-common/dist/authority/ProtocolMode.d.ts.map +1 -0
- package/node_modules/@azure/msal-common/dist/authority/ProtocolMode.js +17 -0
- package/node_modules/@azure/msal-common/dist/authority/ProtocolMode.js.map +1 -0
- package/node_modules/@azure/msal-common/dist/authority/RegionDiscovery.d.ts +31 -0
- package/node_modules/@azure/msal-common/dist/authority/RegionDiscovery.d.ts.map +1 -0
- package/node_modules/@azure/msal-common/dist/authority/RegionDiscovery.js +116 -0
- package/node_modules/@azure/msal-common/dist/authority/RegionDiscovery.js.map +1 -0
- package/node_modules/@azure/msal-common/dist/authority/RegionDiscoveryMetadata.d.ts +7 -0
- package/node_modules/@azure/msal-common/dist/authority/RegionDiscoveryMetadata.d.ts.map +1 -0
- package/node_modules/@azure/msal-common/dist/broker/nativeBroker/INativeBrokerPlugin.d.ts +16 -0
- package/node_modules/@azure/msal-common/dist/broker/nativeBroker/INativeBrokerPlugin.d.ts.map +1 -0
- package/node_modules/@azure/msal-common/dist/cache/CacheManager.d.ts +444 -0
- package/node_modules/@azure/msal-common/dist/cache/CacheManager.d.ts.map +1 -0
- package/node_modules/@azure/msal-common/dist/cache/CacheManager.js +1024 -0
- package/node_modules/@azure/msal-common/dist/cache/CacheManager.js.map +1 -0
- package/node_modules/@azure/msal-common/dist/cache/entities/AccessTokenEntity.d.ts +57 -0
- package/node_modules/@azure/msal-common/dist/cache/entities/AccessTokenEntity.d.ts.map +1 -0
- package/node_modules/@azure/msal-common/dist/cache/entities/AccessTokenEntity.js +123 -0
- package/node_modules/@azure/msal-common/dist/cache/entities/AccessTokenEntity.js.map +1 -0
- package/node_modules/@azure/msal-common/dist/cache/entities/AccountEntity.d.ts +100 -0
- package/node_modules/@azure/msal-common/dist/cache/entities/AccountEntity.d.ts.map +1 -0
- package/node_modules/@azure/msal-common/dist/cache/entities/AccountEntity.js +259 -0
- package/node_modules/@azure/msal-common/dist/cache/entities/AccountEntity.js.map +1 -0
- package/node_modules/@azure/msal-common/dist/cache/entities/AppMetadataEntity.d.ts +40 -0
- package/node_modules/@azure/msal-common/dist/cache/entities/AppMetadataEntity.d.ts.map +1 -0
- package/node_modules/@azure/msal-common/dist/cache/entities/AppMetadataEntity.js +73 -0
- package/node_modules/@azure/msal-common/dist/cache/entities/AppMetadataEntity.js.map +1 -0
- package/node_modules/@azure/msal-common/dist/cache/entities/AuthorityMetadataEntity.d.ts +48 -0
- package/node_modules/@azure/msal-common/dist/cache/entities/AuthorityMetadataEntity.d.ts.map +1 -0
- package/node_modules/@azure/msal-common/dist/cache/entities/AuthorityMetadataEntity.js +85 -0
- package/node_modules/@azure/msal-common/dist/cache/entities/AuthorityMetadataEntity.js.map +1 -0
- package/node_modules/@azure/msal-common/dist/cache/entities/CacheRecord.d.ts +14 -0
- package/node_modules/@azure/msal-common/dist/cache/entities/CacheRecord.d.ts.map +1 -0
- package/node_modules/@azure/msal-common/dist/cache/entities/CacheRecord.js +18 -0
- package/node_modules/@azure/msal-common/dist/cache/entities/CacheRecord.js.map +1 -0
- package/node_modules/@azure/msal-common/dist/cache/entities/CredentialEntity.d.ts +89 -0
- package/node_modules/@azure/msal-common/dist/cache/entities/CredentialEntity.d.ts.map +1 -0
- package/node_modules/@azure/msal-common/dist/cache/entities/CredentialEntity.js +144 -0
- package/node_modules/@azure/msal-common/dist/cache/entities/CredentialEntity.js.map +1 -0
- package/node_modules/@azure/msal-common/dist/cache/entities/IdTokenEntity.d.ts +35 -0
- package/node_modules/@azure/msal-common/dist/cache/entities/IdTokenEntity.d.ts.map +1 -0
- package/node_modules/@azure/msal-common/dist/cache/entities/IdTokenEntity.js +64 -0
- package/node_modules/@azure/msal-common/dist/cache/entities/IdTokenEntity.js.map +1 -0
- package/node_modules/@azure/msal-common/dist/cache/entities/RefreshTokenEntity.d.ts +37 -0
- package/node_modules/@azure/msal-common/dist/cache/entities/RefreshTokenEntity.d.ts.map +1 -0
- package/node_modules/@azure/msal-common/dist/cache/entities/RefreshTokenEntity.js +67 -0
- package/node_modules/@azure/msal-common/dist/cache/entities/RefreshTokenEntity.js.map +1 -0
- package/node_modules/@azure/msal-common/dist/cache/entities/ServerTelemetryEntity.d.ts +13 -0
- package/node_modules/@azure/msal-common/dist/cache/entities/ServerTelemetryEntity.d.ts.map +1 -0
- package/node_modules/@azure/msal-common/dist/cache/entities/ServerTelemetryEntity.js +34 -0
- package/node_modules/@azure/msal-common/dist/cache/entities/ServerTelemetryEntity.js.map +1 -0
- package/node_modules/@azure/msal-common/dist/cache/entities/ThrottlingEntity.d.ts +14 -0
- package/node_modules/@azure/msal-common/dist/cache/entities/ThrottlingEntity.d.ts.map +1 -0
- package/node_modules/@azure/msal-common/dist/cache/entities/ThrottlingEntity.js +30 -0
- package/node_modules/@azure/msal-common/dist/cache/entities/ThrottlingEntity.js.map +1 -0
- package/node_modules/@azure/msal-common/dist/cache/interface/ICacheManager.d.ts +166 -0
- package/node_modules/@azure/msal-common/dist/cache/interface/ICacheManager.d.ts.map +1 -0
- package/node_modules/@azure/msal-common/dist/cache/interface/ICachePlugin.d.ts +6 -0
- package/node_modules/@azure/msal-common/dist/cache/interface/ICachePlugin.d.ts.map +1 -0
- package/node_modules/@azure/msal-common/dist/cache/interface/ISerializableTokenCache.d.ts +5 -0
- package/node_modules/@azure/msal-common/dist/cache/interface/ISerializableTokenCache.d.ts.map +1 -0
- package/node_modules/@azure/msal-common/dist/cache/persistence/TokenCacheContext.d.ts +24 -0
- package/node_modules/@azure/msal-common/dist/cache/persistence/TokenCacheContext.d.ts.map +1 -0
- package/node_modules/@azure/msal-common/dist/cache/persistence/TokenCacheContext.js +30 -0
- package/node_modules/@azure/msal-common/dist/cache/persistence/TokenCacheContext.js.map +1 -0
- package/node_modules/@azure/msal-common/dist/cache/utils/CacheTypes.d.ts +63 -0
- package/node_modules/@azure/msal-common/dist/cache/utils/CacheTypes.d.ts.map +1 -0
- package/node_modules/@azure/msal-common/dist/client/AuthorizationCodeClient.d.ts +72 -0
- package/node_modules/@azure/msal-common/dist/client/AuthorizationCodeClient.d.ts.map +1 -0
- package/node_modules/@azure/msal-common/dist/client/AuthorizationCodeClient.js +453 -0
- package/node_modules/@azure/msal-common/dist/client/AuthorizationCodeClient.js.map +1 -0
- package/node_modules/@azure/msal-common/dist/client/BaseClient.d.ts +51 -0
- package/node_modules/@azure/msal-common/dist/client/BaseClient.d.ts.map +1 -0
- package/node_modules/@azure/msal-common/dist/client/BaseClient.js +107 -0
- package/node_modules/@azure/msal-common/dist/client/BaseClient.js.map +1 -0
- package/node_modules/@azure/msal-common/dist/client/RefreshTokenClient.d.ts +35 -0
- package/node_modules/@azure/msal-common/dist/client/RefreshTokenClient.d.ts.map +1 -0
- package/node_modules/@azure/msal-common/dist/client/RefreshTokenClient.js +260 -0
- package/node_modules/@azure/msal-common/dist/client/RefreshTokenClient.js.map +1 -0
- package/node_modules/@azure/msal-common/dist/client/SilentFlowClient.d.ts +25 -0
- package/node_modules/@azure/msal-common/dist/client/SilentFlowClient.d.ts.map +1 -0
- package/node_modules/@azure/msal-common/dist/client/SilentFlowClient.js +108 -0
- package/node_modules/@azure/msal-common/dist/client/SilentFlowClient.js.map +1 -0
- package/node_modules/@azure/msal-common/dist/config/AppTokenProvider.d.ts +39 -0
- package/node_modules/@azure/msal-common/dist/config/AppTokenProvider.d.ts.map +1 -0
- package/node_modules/@azure/msal-common/dist/config/ClientConfiguration.d.ts +134 -0
- package/node_modules/@azure/msal-common/dist/config/ClientConfiguration.d.ts.map +1 -0
- package/node_modules/@azure/msal-common/dist/config/ClientConfiguration.js +101 -0
- package/node_modules/@azure/msal-common/dist/config/ClientConfiguration.js.map +1 -0
- package/node_modules/@azure/msal-common/dist/crypto/ICrypto.d.ts +63 -0
- package/node_modules/@azure/msal-common/dist/crypto/ICrypto.d.ts.map +1 -0
- package/node_modules/@azure/msal-common/dist/crypto/ICrypto.js +49 -0
- package/node_modules/@azure/msal-common/dist/crypto/ICrypto.js.map +1 -0
- package/node_modules/@azure/msal-common/dist/crypto/IGuidGenerator.d.ts +5 -0
- package/node_modules/@azure/msal-common/dist/crypto/IGuidGenerator.d.ts.map +1 -0
- package/node_modules/@azure/msal-common/dist/crypto/JoseHeader.d.ts +22 -0
- package/node_modules/@azure/msal-common/dist/crypto/JoseHeader.d.ts.map +1 -0
- package/node_modules/@azure/msal-common/dist/crypto/JoseHeader.js +44 -0
- package/node_modules/@azure/msal-common/dist/crypto/JoseHeader.js.map +1 -0
- package/node_modules/@azure/msal-common/dist/crypto/PopTokenGenerator.d.ts +58 -0
- package/node_modules/@azure/msal-common/dist/crypto/PopTokenGenerator.d.ts.map +1 -0
- package/node_modules/@azure/msal-common/dist/crypto/PopTokenGenerator.js +92 -0
- package/node_modules/@azure/msal-common/dist/crypto/PopTokenGenerator.js.map +1 -0
- package/node_modules/@azure/msal-common/dist/crypto/SignedHttpRequest.d.ts +12 -0
- package/node_modules/@azure/msal-common/dist/crypto/SignedHttpRequest.d.ts.map +1 -0
- package/node_modules/@azure/msal-common/dist/error/AuthError.d.ts +48 -0
- package/node_modules/@azure/msal-common/dist/error/AuthError.d.ts.map +1 -0
- package/node_modules/@azure/msal-common/dist/error/AuthError.js +58 -0
- package/node_modules/@azure/msal-common/dist/error/AuthError.js.map +1 -0
- package/node_modules/@azure/msal-common/dist/error/ClientAuthError.d.ts +413 -0
- package/node_modules/@azure/msal-common/dist/error/ClientAuthError.d.ts.map +1 -0
- package/node_modules/@azure/msal-common/dist/error/ClientAuthError.js +526 -0
- package/node_modules/@azure/msal-common/dist/error/ClientAuthError.js.map +1 -0
- package/node_modules/@azure/msal-common/dist/error/ClientConfigurationError.d.ts +199 -0
- package/node_modules/@azure/msal-common/dist/error/ClientConfigurationError.d.ts.map +1 -0
- package/node_modules/@azure/msal-common/dist/error/ClientConfigurationError.js +256 -0
- package/node_modules/@azure/msal-common/dist/error/ClientConfigurationError.js.map +1 -0
- package/node_modules/@azure/msal-common/dist/error/InteractionRequiredAuthError.d.ts +60 -0
- package/node_modules/@azure/msal-common/dist/error/InteractionRequiredAuthError.d.ts.map +1 -0
- package/node_modules/@azure/msal-common/dist/error/InteractionRequiredAuthError.js +86 -0
- package/node_modules/@azure/msal-common/dist/error/InteractionRequiredAuthError.js.map +1 -0
- package/node_modules/@azure/msal-common/dist/error/JoseHeaderError.d.ts +29 -0
- package/node_modules/@azure/msal-common/dist/error/JoseHeaderError.d.ts.map +1 -0
- package/node_modules/@azure/msal-common/dist/error/JoseHeaderError.js +46 -0
- package/node_modules/@azure/msal-common/dist/error/JoseHeaderError.js.map +1 -0
- package/node_modules/@azure/msal-common/dist/error/ServerError.d.ts +8 -0
- package/node_modules/@azure/msal-common/dist/error/ServerError.d.ts.map +1 -0
- package/node_modules/@azure/msal-common/dist/error/ServerError.js +21 -0
- package/node_modules/@azure/msal-common/dist/error/ServerError.js.map +1 -0
- package/node_modules/@azure/msal-common/dist/index.cjs.js +8975 -0
- package/node_modules/@azure/msal-common/dist/index.cjs.js.map +1 -0
- package/node_modules/@azure/msal-common/dist/index.d.ts +94 -0
- package/node_modules/@azure/msal-common/dist/index.d.ts.map +1 -0
- package/node_modules/@azure/msal-common/dist/index.js +54 -0
- package/node_modules/@azure/msal-common/dist/index.js.map +1 -0
- package/node_modules/@azure/msal-common/dist/logger/Logger.d.ts +96 -0
- package/node_modules/@azure/msal-common/dist/logger/Logger.d.ts.map +1 -0
- package/node_modules/@azure/msal-common/dist/logger/Logger.js +205 -0
- package/node_modules/@azure/msal-common/dist/logger/Logger.js.map +1 -0
- package/node_modules/@azure/msal-common/dist/network/INetworkModule.d.ts +30 -0
- package/node_modules/@azure/msal-common/dist/network/INetworkModule.d.ts.map +1 -0
- package/node_modules/@azure/msal-common/dist/network/INetworkModule.js +21 -0
- package/node_modules/@azure/msal-common/dist/network/INetworkModule.js.map +1 -0
- package/node_modules/@azure/msal-common/dist/network/NetworkManager.d.ts +33 -0
- package/node_modules/@azure/msal-common/dist/network/NetworkManager.d.ts.map +1 -0
- package/node_modules/@azure/msal-common/dist/network/NetworkManager.js +42 -0
- package/node_modules/@azure/msal-common/dist/network/NetworkManager.js.map +1 -0
- package/node_modules/@azure/msal-common/dist/network/RequestThumbprint.d.ts +17 -0
- package/node_modules/@azure/msal-common/dist/network/RequestThumbprint.d.ts.map +1 -0
- package/node_modules/@azure/msal-common/dist/network/ThrottlingUtils.d.ts +42 -0
- package/node_modules/@azure/msal-common/dist/network/ThrottlingUtils.d.ts.map +1 -0
- package/node_modules/@azure/msal-common/dist/network/ThrottlingUtils.js +102 -0
- package/node_modules/@azure/msal-common/dist/network/ThrottlingUtils.js.map +1 -0
- package/node_modules/@azure/msal-common/dist/packageMetadata.d.ts +3 -0
- package/node_modules/@azure/msal-common/dist/packageMetadata.d.ts.map +1 -0
- package/node_modules/@azure/msal-common/dist/packageMetadata.js +8 -0
- package/node_modules/@azure/msal-common/dist/packageMetadata.js.map +1 -0
- package/node_modules/@azure/msal-common/dist/request/AuthenticationHeaderParser.d.ts +20 -0
- package/node_modules/@azure/msal-common/dist/request/AuthenticationHeaderParser.d.ts.map +1 -0
- package/node_modules/@azure/msal-common/dist/request/AuthenticationHeaderParser.js +63 -0
- package/node_modules/@azure/msal-common/dist/request/AuthenticationHeaderParser.js.map +1 -0
- package/node_modules/@azure/msal-common/dist/request/BaseAuthRequest.d.ts +38 -0
- package/node_modules/@azure/msal-common/dist/request/BaseAuthRequest.d.ts.map +1 -0
- package/node_modules/@azure/msal-common/dist/request/CommonAuthorizationCodeRequest.d.ts +28 -0
- package/node_modules/@azure/msal-common/dist/request/CommonAuthorizationCodeRequest.d.ts.map +1 -0
- package/node_modules/@azure/msal-common/dist/request/CommonAuthorizationUrlRequest.d.ts +51 -0
- package/node_modules/@azure/msal-common/dist/request/CommonAuthorizationUrlRequest.d.ts.map +1 -0
- package/node_modules/@azure/msal-common/dist/request/CommonClientCredentialRequest.d.ts +18 -0
- package/node_modules/@azure/msal-common/dist/request/CommonClientCredentialRequest.d.ts.map +1 -0
- package/node_modules/@azure/msal-common/dist/request/CommonDeviceCodeRequest.d.ts +22 -0
- package/node_modules/@azure/msal-common/dist/request/CommonDeviceCodeRequest.d.ts.map +1 -0
- package/node_modules/@azure/msal-common/dist/request/CommonEndSessionRequest.d.ts +22 -0
- package/node_modules/@azure/msal-common/dist/request/CommonEndSessionRequest.d.ts.map +1 -0
- package/node_modules/@azure/msal-common/dist/request/CommonOnBehalfOfRequest.d.ts +14 -0
- package/node_modules/@azure/msal-common/dist/request/CommonOnBehalfOfRequest.d.ts.map +1 -0
- package/node_modules/@azure/msal-common/dist/request/CommonRefreshTokenRequest.d.ts +20 -0
- package/node_modules/@azure/msal-common/dist/request/CommonRefreshTokenRequest.d.ts.map +1 -0
- package/node_modules/@azure/msal-common/dist/request/CommonSilentFlowRequest.d.ts +19 -0
- package/node_modules/@azure/msal-common/dist/request/CommonSilentFlowRequest.d.ts.map +1 -0
- package/node_modules/@azure/msal-common/dist/request/CommonUsernamePasswordRequest.d.ts +18 -0
- package/node_modules/@azure/msal-common/dist/request/CommonUsernamePasswordRequest.d.ts.map +1 -0
- package/node_modules/@azure/msal-common/dist/request/NativeRequest.d.ts +20 -0
- package/node_modules/@azure/msal-common/dist/request/NativeRequest.d.ts.map +1 -0
- package/node_modules/@azure/msal-common/dist/request/NativeSignOutRequest.d.ts +6 -0
- package/node_modules/@azure/msal-common/dist/request/NativeSignOutRequest.d.ts.map +1 -0
- package/node_modules/@azure/msal-common/dist/request/RequestParameterBuilder.d.ts +217 -0
- package/node_modules/@azure/msal-common/dist/request/RequestParameterBuilder.d.ts.map +1 -0
- package/node_modules/@azure/msal-common/dist/request/RequestParameterBuilder.js +385 -0
- package/node_modules/@azure/msal-common/dist/request/RequestParameterBuilder.js.map +1 -0
- package/node_modules/@azure/msal-common/dist/request/RequestValidator.d.ts +34 -0
- package/node_modules/@azure/msal-common/dist/request/RequestValidator.d.ts.map +1 -0
- package/node_modules/@azure/msal-common/dist/request/RequestValidator.js +92 -0
- package/node_modules/@azure/msal-common/dist/request/RequestValidator.js.map +1 -0
- package/node_modules/@azure/msal-common/dist/request/ScopeSet.d.ts +89 -0
- package/node_modules/@azure/msal-common/dist/request/ScopeSet.d.ts.map +1 -0
- package/node_modules/@azure/msal-common/dist/request/ScopeSet.js +207 -0
- package/node_modules/@azure/msal-common/dist/request/ScopeSet.js.map +1 -0
- package/node_modules/@azure/msal-common/dist/response/AuthenticationResult.d.ts +40 -0
- package/node_modules/@azure/msal-common/dist/response/AuthenticationResult.d.ts.map +1 -0
- package/node_modules/@azure/msal-common/dist/response/AuthorizationCodePayload.d.ts +14 -0
- package/node_modules/@azure/msal-common/dist/response/AuthorizationCodePayload.d.ts.map +1 -0
- package/node_modules/@azure/msal-common/dist/response/DeviceCodeResponse.d.ts +26 -0
- package/node_modules/@azure/msal-common/dist/response/DeviceCodeResponse.d.ts.map +1 -0
- package/node_modules/@azure/msal-common/dist/response/ExternalTokenResponse.d.ts +16 -0
- package/node_modules/@azure/msal-common/dist/response/ExternalTokenResponse.d.ts.map +1 -0
- package/node_modules/@azure/msal-common/dist/response/IMDSBadResponse.d.ts +5 -0
- package/node_modules/@azure/msal-common/dist/response/IMDSBadResponse.d.ts.map +1 -0
- package/node_modules/@azure/msal-common/dist/response/ResponseHandler.d.ts +73 -0
- package/node_modules/@azure/msal-common/dist/response/ResponseHandler.d.ts.map +1 -0
- package/node_modules/@azure/msal-common/dist/response/ResponseHandler.js +325 -0
- package/node_modules/@azure/msal-common/dist/response/ResponseHandler.js.map +1 -0
- package/node_modules/@azure/msal-common/dist/response/ServerAuthorizationCodeResponse.d.ts +26 -0
- package/node_modules/@azure/msal-common/dist/response/ServerAuthorizationCodeResponse.d.ts.map +1 -0
- package/node_modules/@azure/msal-common/dist/response/ServerAuthorizationTokenResponse.d.ts +45 -0
- package/node_modules/@azure/msal-common/dist/response/ServerAuthorizationTokenResponse.d.ts.map +1 -0
- package/node_modules/@azure/msal-common/dist/telemetry/performance/IPerformanceClient.d.ts +43 -0
- package/node_modules/@azure/msal-common/dist/telemetry/performance/IPerformanceClient.d.ts.map +1 -0
- package/node_modules/@azure/msal-common/dist/telemetry/performance/IPerformanceMeasurement.d.ts +6 -0
- package/node_modules/@azure/msal-common/dist/telemetry/performance/IPerformanceMeasurement.d.ts.map +1 -0
- package/node_modules/@azure/msal-common/dist/telemetry/performance/PerformanceClient.d.ts +190 -0
- package/node_modules/@azure/msal-common/dist/telemetry/performance/PerformanceClient.d.ts.map +1 -0
- package/node_modules/@azure/msal-common/dist/telemetry/performance/PerformanceClient.js +413 -0
- package/node_modules/@azure/msal-common/dist/telemetry/performance/PerformanceClient.js.map +1 -0
- package/node_modules/@azure/msal-common/dist/telemetry/performance/PerformanceEvent.d.ts +440 -0
- package/node_modules/@azure/msal-common/dist/telemetry/performance/PerformanceEvent.d.ts.map +1 -0
- package/node_modules/@azure/msal-common/dist/telemetry/performance/PerformanceEvent.js +232 -0
- package/node_modules/@azure/msal-common/dist/telemetry/performance/PerformanceEvent.js.map +1 -0
- package/node_modules/@azure/msal-common/dist/telemetry/performance/StubPerformanceClient.d.ts +20 -0
- package/node_modules/@azure/msal-common/dist/telemetry/performance/StubPerformanceClient.d.ts.map +1 -0
- package/node_modules/@azure/msal-common/dist/telemetry/performance/StubPerformanceClient.js +43 -0
- package/node_modules/@azure/msal-common/dist/telemetry/performance/StubPerformanceClient.js.map +1 -0
- package/node_modules/@azure/msal-common/dist/telemetry/server/ServerTelemetryManager.d.ts +66 -0
- package/node_modules/@azure/msal-common/dist/telemetry/server/ServerTelemetryManager.d.ts.map +1 -0
- package/node_modules/@azure/msal-common/dist/telemetry/server/ServerTelemetryManager.js +206 -0
- package/node_modules/@azure/msal-common/dist/telemetry/server/ServerTelemetryManager.js.map +1 -0
- package/node_modules/@azure/msal-common/dist/telemetry/server/ServerTelemetryRequest.d.ts +9 -0
- package/node_modules/@azure/msal-common/dist/telemetry/server/ServerTelemetryRequest.d.ts.map +1 -0
- package/node_modules/@azure/msal-common/dist/url/IUri.d.ts +13 -0
- package/node_modules/@azure/msal-common/dist/url/IUri.d.ts.map +1 -0
- package/node_modules/@azure/msal-common/dist/url/UrlString.d.ts +71 -0
- package/node_modules/@azure/msal-common/dist/url/UrlString.d.ts.map +1 -0
- package/node_modules/@azure/msal-common/dist/url/UrlString.js +252 -0
- package/node_modules/@azure/msal-common/dist/url/UrlString.js.map +1 -0
- package/node_modules/@azure/msal-common/dist/utils/Constants.d.ts +332 -0
- package/node_modules/@azure/msal-common/dist/utils/Constants.d.ts.map +1 -0
- package/node_modules/@azure/msal-common/dist/utils/Constants.js +378 -0
- package/node_modules/@azure/msal-common/dist/utils/Constants.js.map +1 -0
- package/node_modules/@azure/msal-common/dist/utils/MsalTypes.d.ts +7 -0
- package/node_modules/@azure/msal-common/dist/utils/MsalTypes.d.ts.map +1 -0
- package/node_modules/@azure/msal-common/dist/utils/ProtocolUtils.d.ts +43 -0
- package/node_modules/@azure/msal-common/dist/utils/ProtocolUtils.d.ts.map +1 -0
- package/node_modules/@azure/msal-common/dist/utils/ProtocolUtils.js +80 -0
- package/node_modules/@azure/msal-common/dist/utils/ProtocolUtils.js.map +1 -0
- package/node_modules/@azure/msal-common/dist/utils/StringUtils.d.ts +54 -0
- package/node_modules/@azure/msal-common/dist/utils/StringUtils.d.ts.map +1 -0
- package/node_modules/@azure/msal-common/dist/utils/StringUtils.js +131 -0
- package/node_modules/@azure/msal-common/dist/utils/StringUtils.js.map +1 -0
- package/node_modules/@azure/msal-common/dist/utils/TimeUtils.d.ts +28 -0
- package/node_modules/@azure/msal-common/dist/utils/TimeUtils.d.ts.map +1 -0
- package/node_modules/@azure/msal-common/dist/utils/TimeUtils.js +50 -0
- package/node_modules/@azure/msal-common/dist/utils/TimeUtils.js.map +1 -0
- package/node_modules/@azure/msal-common/package.json +79 -0
- package/package.json +27 -18
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { AuthenticationResult, BaseClient, ClientConfiguration, CommonClientCredentialRequest, IAppTokenProvider } from "@azure/msal-common";
|
|
2
|
+
/**
|
|
3
|
+
* OAuth2.0 client credential grant
|
|
4
|
+
*/
|
|
5
|
+
export declare class ClientCredentialClient extends BaseClient {
|
|
6
|
+
private scopeSet;
|
|
7
|
+
private readonly appTokenProvider?;
|
|
8
|
+
constructor(configuration: ClientConfiguration, appTokenProvider?: IAppTokenProvider);
|
|
9
|
+
/**
|
|
10
|
+
* Public API to acquire a token with ClientCredential Flow for Confidential clients
|
|
11
|
+
* @param request
|
|
12
|
+
*/
|
|
13
|
+
acquireToken(request: CommonClientCredentialRequest): Promise<AuthenticationResult | null>;
|
|
14
|
+
/**
|
|
15
|
+
* looks up cache if the tokens are cached already
|
|
16
|
+
*/
|
|
17
|
+
private getCachedAuthenticationResult;
|
|
18
|
+
/**
|
|
19
|
+
* Reads access token from the cache
|
|
20
|
+
*/
|
|
21
|
+
private readAccessTokenFromCache;
|
|
22
|
+
/**
|
|
23
|
+
* Makes a network call to request the token from the service
|
|
24
|
+
* @param request
|
|
25
|
+
* @param authority
|
|
26
|
+
*/
|
|
27
|
+
private executeTokenRequest;
|
|
28
|
+
/**
|
|
29
|
+
* generate the request to the server in the acceptable format
|
|
30
|
+
* @param request
|
|
31
|
+
*/
|
|
32
|
+
private createTokenRequestBody;
|
|
33
|
+
}
|
|
34
|
+
//# sourceMappingURL=ClientCredentialClient.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ClientCredentialClient.d.ts","sourceRoot":"","sources":["../../src/client/ClientCredentialClient.ts"],"names":[],"mappings":"AAKA,OAAO,EAEH,oBAAoB,EAGpB,UAAU,EAGV,mBAAmB,EACnB,6BAA6B,EAK7B,iBAAiB,EASpB,MAAM,oBAAoB,CAAC;AAE5B;;GAEG;AACH,qBAAa,sBAAuB,SAAQ,UAAU;IAClD,OAAO,CAAC,QAAQ,CAAW;IAC3B,OAAO,CAAC,QAAQ,CAAC,gBAAgB,CAAC,CAAoB;gBAGlD,aAAa,EAAE,mBAAmB,EAClC,gBAAgB,CAAC,EAAE,iBAAiB;IAMxC;;;OAGG;IACU,YAAY,CACrB,OAAO,EAAE,6BAA6B,GACvC,OAAO,CAAC,oBAAoB,GAAG,IAAI,CAAC;IAgBvC;;OAEG;YACW,6BAA6B;IAuC3C;;OAEG;IACH,OAAO,CAAC,wBAAwB;IAqBhC;;;;OAIG;YACW,mBAAmB;IAiFjC;;;OAGG;IACH,OAAO,CAAC,sBAAsB;CA0DjC"}
|
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
/*! @azure/msal-node v2.0.0-alpha.0 2023-05-03 */
|
|
2
|
+
'use strict';
|
|
3
|
+
import { BaseClient, ScopeSet, CacheOutcome, TimeUtils, ResponseHandler, Constants, CredentialType, ClientAuthError, UrlString, RequestParameterBuilder, GrantType, StringUtils, AuthenticationScheme } from '@azure/msal-common';
|
|
4
|
+
|
|
5
|
+
/*
|
|
6
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
7
|
+
* Licensed under the MIT License.
|
|
8
|
+
*/
|
|
9
|
+
/**
|
|
10
|
+
* OAuth2.0 client credential grant
|
|
11
|
+
*/
|
|
12
|
+
class ClientCredentialClient extends BaseClient {
|
|
13
|
+
constructor(configuration, appTokenProvider) {
|
|
14
|
+
super(configuration);
|
|
15
|
+
this.appTokenProvider = appTokenProvider;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Public API to acquire a token with ClientCredential Flow for Confidential clients
|
|
19
|
+
* @param request
|
|
20
|
+
*/
|
|
21
|
+
async acquireToken(request) {
|
|
22
|
+
this.scopeSet = new ScopeSet(request.scopes || []);
|
|
23
|
+
if (request.skipCache) {
|
|
24
|
+
return await this.executeTokenRequest(request, this.authority);
|
|
25
|
+
}
|
|
26
|
+
const cachedAuthenticationResult = await this.getCachedAuthenticationResult(request);
|
|
27
|
+
if (cachedAuthenticationResult) {
|
|
28
|
+
return cachedAuthenticationResult;
|
|
29
|
+
}
|
|
30
|
+
else {
|
|
31
|
+
return await this.executeTokenRequest(request, this.authority);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* looks up cache if the tokens are cached already
|
|
36
|
+
*/
|
|
37
|
+
async getCachedAuthenticationResult(request) {
|
|
38
|
+
const cachedAccessToken = this.readAccessTokenFromCache();
|
|
39
|
+
if (!cachedAccessToken) {
|
|
40
|
+
this.serverTelemetryManager?.setCacheOutcome(CacheOutcome.NO_CACHED_ACCESS_TOKEN);
|
|
41
|
+
return null;
|
|
42
|
+
}
|
|
43
|
+
if (TimeUtils.isTokenExpired(cachedAccessToken.expiresOn, this.config.systemOptions.tokenRenewalOffsetSeconds)) {
|
|
44
|
+
this.serverTelemetryManager?.setCacheOutcome(CacheOutcome.CACHED_ACCESS_TOKEN_EXPIRED);
|
|
45
|
+
return null;
|
|
46
|
+
}
|
|
47
|
+
return await ResponseHandler.generateAuthenticationResult(this.cryptoUtils, this.authority, {
|
|
48
|
+
account: null,
|
|
49
|
+
idToken: null,
|
|
50
|
+
accessToken: cachedAccessToken,
|
|
51
|
+
refreshToken: null,
|
|
52
|
+
appMetadata: null,
|
|
53
|
+
}, true, request);
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Reads access token from the cache
|
|
57
|
+
*/
|
|
58
|
+
readAccessTokenFromCache() {
|
|
59
|
+
const accessTokenFilter = {
|
|
60
|
+
homeAccountId: Constants.EMPTY_STRING,
|
|
61
|
+
environment: this.authority.canonicalAuthorityUrlComponents.HostNameAndPort,
|
|
62
|
+
credentialType: CredentialType.ACCESS_TOKEN,
|
|
63
|
+
clientId: this.config.authOptions.clientId,
|
|
64
|
+
realm: this.authority.tenant,
|
|
65
|
+
target: ScopeSet.createSearchScopes(this.scopeSet.asArray()),
|
|
66
|
+
};
|
|
67
|
+
const accessTokens = this.cacheManager.getAccessTokensByFilter(accessTokenFilter);
|
|
68
|
+
if (accessTokens.length < 1) {
|
|
69
|
+
return null;
|
|
70
|
+
}
|
|
71
|
+
else if (accessTokens.length > 1) {
|
|
72
|
+
throw ClientAuthError.createMultipleMatchingTokensInCacheError();
|
|
73
|
+
}
|
|
74
|
+
return accessTokens[0];
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Makes a network call to request the token from the service
|
|
78
|
+
* @param request
|
|
79
|
+
* @param authority
|
|
80
|
+
*/
|
|
81
|
+
async executeTokenRequest(request, authority) {
|
|
82
|
+
let serverTokenResponse;
|
|
83
|
+
let reqTimestamp;
|
|
84
|
+
if (this.appTokenProvider) {
|
|
85
|
+
this.logger.info("Using appTokenProvider extensibility.");
|
|
86
|
+
const appTokenPropviderParameters = {
|
|
87
|
+
correlationId: request.correlationId,
|
|
88
|
+
tenantId: this.config.authOptions.authority.tenant,
|
|
89
|
+
scopes: request.scopes,
|
|
90
|
+
claims: request.claims,
|
|
91
|
+
};
|
|
92
|
+
reqTimestamp = TimeUtils.nowSeconds();
|
|
93
|
+
const appTokenProviderResult = await this.appTokenProvider(appTokenPropviderParameters);
|
|
94
|
+
serverTokenResponse = {
|
|
95
|
+
access_token: appTokenProviderResult.accessToken,
|
|
96
|
+
expires_in: appTokenProviderResult.expiresInSeconds,
|
|
97
|
+
refresh_in: appTokenProviderResult.refreshInSeconds,
|
|
98
|
+
token_type: AuthenticationScheme.BEARER,
|
|
99
|
+
};
|
|
100
|
+
}
|
|
101
|
+
else {
|
|
102
|
+
const queryParametersString = this.createTokenQueryParameters(request);
|
|
103
|
+
const endpoint = UrlString.appendQueryString(authority.tokenEndpoint, queryParametersString);
|
|
104
|
+
const requestBody = this.createTokenRequestBody(request);
|
|
105
|
+
const headers = this.createTokenRequestHeaders();
|
|
106
|
+
const thumbprint = {
|
|
107
|
+
clientId: this.config.authOptions.clientId,
|
|
108
|
+
authority: request.authority,
|
|
109
|
+
scopes: request.scopes,
|
|
110
|
+
claims: request.claims,
|
|
111
|
+
authenticationScheme: request.authenticationScheme,
|
|
112
|
+
resourceRequestMethod: request.resourceRequestMethod,
|
|
113
|
+
resourceRequestUri: request.resourceRequestUri,
|
|
114
|
+
shrClaims: request.shrClaims,
|
|
115
|
+
sshKid: request.sshKid,
|
|
116
|
+
};
|
|
117
|
+
reqTimestamp = TimeUtils.nowSeconds();
|
|
118
|
+
const response = await this.executePostToTokenEndpoint(endpoint, requestBody, headers, thumbprint);
|
|
119
|
+
serverTokenResponse = response.body;
|
|
120
|
+
}
|
|
121
|
+
const responseHandler = new ResponseHandler(this.config.authOptions.clientId, this.cacheManager, this.cryptoUtils, this.logger, this.config.serializableCache, this.config.persistencePlugin);
|
|
122
|
+
responseHandler.validateTokenResponse(serverTokenResponse);
|
|
123
|
+
const tokenResponse = await responseHandler.handleServerTokenResponse(serverTokenResponse, this.authority, reqTimestamp, request);
|
|
124
|
+
return tokenResponse;
|
|
125
|
+
}
|
|
126
|
+
/**
|
|
127
|
+
* generate the request to the server in the acceptable format
|
|
128
|
+
* @param request
|
|
129
|
+
*/
|
|
130
|
+
createTokenRequestBody(request) {
|
|
131
|
+
const parameterBuilder = new RequestParameterBuilder();
|
|
132
|
+
parameterBuilder.addClientId(this.config.authOptions.clientId);
|
|
133
|
+
parameterBuilder.addScopes(request.scopes, false);
|
|
134
|
+
parameterBuilder.addGrantType(GrantType.CLIENT_CREDENTIALS_GRANT);
|
|
135
|
+
parameterBuilder.addLibraryInfo(this.config.libraryInfo);
|
|
136
|
+
parameterBuilder.addApplicationTelemetry(this.config.telemetry.application);
|
|
137
|
+
parameterBuilder.addThrottling();
|
|
138
|
+
if (this.serverTelemetryManager) {
|
|
139
|
+
parameterBuilder.addServerTelemetry(this.serverTelemetryManager);
|
|
140
|
+
}
|
|
141
|
+
const correlationId = request.correlationId ||
|
|
142
|
+
this.config.cryptoInterface.createNewGuid();
|
|
143
|
+
parameterBuilder.addCorrelationId(correlationId);
|
|
144
|
+
if (this.config.clientCredentials.clientSecret) {
|
|
145
|
+
parameterBuilder.addClientSecret(this.config.clientCredentials.clientSecret);
|
|
146
|
+
}
|
|
147
|
+
// Use clientAssertion from request, fallback to client assertion in base configuration
|
|
148
|
+
const clientAssertion = request.clientAssertion ||
|
|
149
|
+
this.config.clientCredentials.clientAssertion;
|
|
150
|
+
if (clientAssertion) {
|
|
151
|
+
parameterBuilder.addClientAssertion(clientAssertion.assertion);
|
|
152
|
+
parameterBuilder.addClientAssertionType(clientAssertion.assertionType);
|
|
153
|
+
}
|
|
154
|
+
if (!StringUtils.isEmptyObj(request.claims) ||
|
|
155
|
+
(this.config.authOptions.clientCapabilities &&
|
|
156
|
+
this.config.authOptions.clientCapabilities.length > 0)) {
|
|
157
|
+
parameterBuilder.addClaims(request.claims, this.config.authOptions.clientCapabilities);
|
|
158
|
+
}
|
|
159
|
+
return parameterBuilder.createQueryString();
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
export { ClientCredentialClient };
|
|
164
|
+
//# sourceMappingURL=ClientCredentialClient.esm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ClientCredentialClient.esm.js","sources":["../../src/client/ClientCredentialClient.ts"],"sourcesContent":[null],"names":[],"mappings":";;;;AAAA;;;AAGG;AA2BH;;AAEG;AACG,MAAO,sBAAuB,SAAQ,UAAU,CAAA;IAIlD,WACI,CAAA,aAAkC,EAClC,gBAAoC,EAAA;QAEpC,KAAK,CAAC,aAAa,CAAC,CAAC;AACrB,QAAA,IAAI,CAAC,gBAAgB,GAAG,gBAAgB,CAAC;KAC5C;AAED;;;AAGG;IACI,MAAM,YAAY,CACrB,OAAsC,EAAA;AAEtC,QAAA,IAAI,CAAC,QAAQ,G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use strict';
|
|
3
|
+
'use strict';
|
|
4
|
+
|
|
5
|
+
var msalCommon = require('@azure/msal-common');
|
|
6
|
+
|
|
7
|
+
/*
|
|
8
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
9
|
+
* Licensed under the MIT License.
|
|
10
|
+
*/
|
|
11
|
+
/**
|
|
12
|
+
* OAuth2.0 client credential grant
|
|
13
|
+
*/
|
|
14
|
+
class ClientCredentialClient extends msalCommon.BaseClient {
|
|
15
|
+
constructor(configuration, appTokenProvider) {
|
|
16
|
+
super(configuration);
|
|
17
|
+
this.appTokenProvider = appTokenProvider;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Public API to acquire a token with ClientCredential Flow for Confidential clients
|
|
21
|
+
* @param request
|
|
22
|
+
*/
|
|
23
|
+
async acquireToken(request) {
|
|
24
|
+
this.scopeSet = new msalCommon.ScopeSet(request.scopes || []);
|
|
25
|
+
if (request.skipCache) {
|
|
26
|
+
return await this.executeTokenRequest(request, this.authority);
|
|
27
|
+
}
|
|
28
|
+
const cachedAuthenticationResult = await this.getCachedAuthenticationResult(request);
|
|
29
|
+
if (cachedAuthenticationResult) {
|
|
30
|
+
return cachedAuthenticationResult;
|
|
31
|
+
}
|
|
32
|
+
else {
|
|
33
|
+
return await this.executeTokenRequest(request, this.authority);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* looks up cache if the tokens are cached already
|
|
38
|
+
*/
|
|
39
|
+
async getCachedAuthenticationResult(request) {
|
|
40
|
+
const cachedAccessToken = this.readAccessTokenFromCache();
|
|
41
|
+
if (!cachedAccessToken) {
|
|
42
|
+
this.serverTelemetryManager?.setCacheOutcome(msalCommon.CacheOutcome.NO_CACHED_ACCESS_TOKEN);
|
|
43
|
+
return null;
|
|
44
|
+
}
|
|
45
|
+
if (msalCommon.TimeUtils.isTokenExpired(cachedAccessToken.expiresOn, this.config.systemOptions.tokenRenewalOffsetSeconds)) {
|
|
46
|
+
this.serverTelemetryManager?.setCacheOutcome(msalCommon.CacheOutcome.CACHED_ACCESS_TOKEN_EXPIRED);
|
|
47
|
+
return null;
|
|
48
|
+
}
|
|
49
|
+
return await msalCommon.ResponseHandler.generateAuthenticationResult(this.cryptoUtils, this.authority, {
|
|
50
|
+
account: null,
|
|
51
|
+
idToken: null,
|
|
52
|
+
accessToken: cachedAccessToken,
|
|
53
|
+
refreshToken: null,
|
|
54
|
+
appMetadata: null,
|
|
55
|
+
}, true, request);
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Reads access token from the cache
|
|
59
|
+
*/
|
|
60
|
+
readAccessTokenFromCache() {
|
|
61
|
+
const accessTokenFilter = {
|
|
62
|
+
homeAccountId: msalCommon.Constants.EMPTY_STRING,
|
|
63
|
+
environment: this.authority.canonicalAuthorityUrlComponents.HostNameAndPort,
|
|
64
|
+
credentialType: msalCommon.CredentialType.ACCESS_TOKEN,
|
|
65
|
+
clientId: this.config.authOptions.clientId,
|
|
66
|
+
realm: this.authority.tenant,
|
|
67
|
+
target: msalCommon.ScopeSet.createSearchScopes(this.scopeSet.asArray()),
|
|
68
|
+
};
|
|
69
|
+
const accessTokens = this.cacheManager.getAccessTokensByFilter(accessTokenFilter);
|
|
70
|
+
if (accessTokens.length < 1) {
|
|
71
|
+
return null;
|
|
72
|
+
}
|
|
73
|
+
else if (accessTokens.length > 1) {
|
|
74
|
+
throw msalCommon.ClientAuthError.createMultipleMatchingTokensInCacheError();
|
|
75
|
+
}
|
|
76
|
+
return accessTokens[0];
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* Makes a network call to request the token from the service
|
|
80
|
+
* @param request
|
|
81
|
+
* @param authority
|
|
82
|
+
*/
|
|
83
|
+
async executeTokenRequest(request, authority) {
|
|
84
|
+
let serverTokenResponse;
|
|
85
|
+
let reqTimestamp;
|
|
86
|
+
if (this.appTokenProvider) {
|
|
87
|
+
this.logger.info("Using appTokenProvider extensibility.");
|
|
88
|
+
const appTokenPropviderParameters = {
|
|
89
|
+
correlationId: request.correlationId,
|
|
90
|
+
tenantId: this.config.authOptions.authority.tenant,
|
|
91
|
+
scopes: request.scopes,
|
|
92
|
+
claims: request.claims,
|
|
93
|
+
};
|
|
94
|
+
reqTimestamp = msalCommon.TimeUtils.nowSeconds();
|
|
95
|
+
const appTokenProviderResult = await this.appTokenProvider(appTokenPropviderParameters);
|
|
96
|
+
serverTokenResponse = {
|
|
97
|
+
access_token: appTokenProviderResult.accessToken,
|
|
98
|
+
expires_in: appTokenProviderResult.expiresInSeconds,
|
|
99
|
+
refresh_in: appTokenProviderResult.refreshInSeconds,
|
|
100
|
+
token_type: msalCommon.AuthenticationScheme.BEARER,
|
|
101
|
+
};
|
|
102
|
+
}
|
|
103
|
+
else {
|
|
104
|
+
const queryParametersString = this.createTokenQueryParameters(request);
|
|
105
|
+
const endpoint = msalCommon.UrlString.appendQueryString(authority.tokenEndpoint, queryParametersString);
|
|
106
|
+
const requestBody = this.createTokenRequestBody(request);
|
|
107
|
+
const headers = this.createTokenRequestHeaders();
|
|
108
|
+
const thumbprint = {
|
|
109
|
+
clientId: this.config.authOptions.clientId,
|
|
110
|
+
authority: request.authority,
|
|
111
|
+
scopes: request.scopes,
|
|
112
|
+
claims: request.claims,
|
|
113
|
+
authenticationScheme: request.authenticationScheme,
|
|
114
|
+
resourceRequestMethod: request.resourceRequestMethod,
|
|
115
|
+
resourceRequestUri: request.resourceRequestUri,
|
|
116
|
+
shrClaims: request.shrClaims,
|
|
117
|
+
sshKid: request.sshKid,
|
|
118
|
+
};
|
|
119
|
+
reqTimestamp = msalCommon.TimeUtils.nowSeconds();
|
|
120
|
+
const response = await this.executePostToTokenEndpoint(endpoint, requestBody, headers, thumbprint);
|
|
121
|
+
serverTokenResponse = response.body;
|
|
122
|
+
}
|
|
123
|
+
const responseHandler = new msalCommon.ResponseHandler(this.config.authOptions.clientId, this.cacheManager, this.cryptoUtils, this.logger, this.config.serializableCache, this.config.persistencePlugin);
|
|
124
|
+
responseHandler.validateTokenResponse(serverTokenResponse);
|
|
125
|
+
const tokenResponse = await responseHandler.handleServerTokenResponse(serverTokenResponse, this.authority, reqTimestamp, request);
|
|
126
|
+
return tokenResponse;
|
|
127
|
+
}
|
|
128
|
+
/**
|
|
129
|
+
* generate the request to the server in the acceptable format
|
|
130
|
+
* @param request
|
|
131
|
+
*/
|
|
132
|
+
createTokenRequestBody(request) {
|
|
133
|
+
const parameterBuilder = new msalCommon.RequestParameterBuilder();
|
|
134
|
+
parameterBuilder.addClientId(this.config.authOptions.clientId);
|
|
135
|
+
parameterBuilder.addScopes(request.scopes, false);
|
|
136
|
+
parameterBuilder.addGrantType(msalCommon.GrantType.CLIENT_CREDENTIALS_GRANT);
|
|
137
|
+
parameterBuilder.addLibraryInfo(this.config.libraryInfo);
|
|
138
|
+
parameterBuilder.addApplicationTelemetry(this.config.telemetry.application);
|
|
139
|
+
parameterBuilder.addThrottling();
|
|
140
|
+
if (this.serverTelemetryManager) {
|
|
141
|
+
parameterBuilder.addServerTelemetry(this.serverTelemetryManager);
|
|
142
|
+
}
|
|
143
|
+
const correlationId = request.correlationId ||
|
|
144
|
+
this.config.cryptoInterface.createNewGuid();
|
|
145
|
+
parameterBuilder.addCorrelationId(correlationId);
|
|
146
|
+
if (this.config.clientCredentials.clientSecret) {
|
|
147
|
+
parameterBuilder.addClientSecret(this.config.clientCredentials.clientSecret);
|
|
148
|
+
}
|
|
149
|
+
// Use clientAssertion from request, fallback to client assertion in base configuration
|
|
150
|
+
const clientAssertion = request.clientAssertion ||
|
|
151
|
+
this.config.clientCredentials.clientAssertion;
|
|
152
|
+
if (clientAssertion) {
|
|
153
|
+
parameterBuilder.addClientAssertion(clientAssertion.assertion);
|
|
154
|
+
parameterBuilder.addClientAssertionType(clientAssertion.assertionType);
|
|
155
|
+
}
|
|
156
|
+
if (!msalCommon.StringUtils.isEmptyObj(request.claims) ||
|
|
157
|
+
(this.config.authOptions.clientCapabilities &&
|
|
158
|
+
this.config.authOptions.clientCapabilities.length > 0)) {
|
|
159
|
+
parameterBuilder.addClaims(request.claims, this.config.authOptions.clientCapabilities);
|
|
160
|
+
}
|
|
161
|
+
return parameterBuilder.createQueryString();
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
exports.ClientCredentialClient = ClientCredentialClient;
|
|
166
|
+
//# sourceMappingURL=ClientCredentialClient.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ClientCredentialClient.js","sources":["../../src/client/ClientCredentialClient.ts"],"sourcesContent":[null],"names":["BaseClient","ScopeSet","CacheOutcome","TimeUtils","ResponseHandler","Constants","CredentialType","ClientAuthError","AuthenticationScheme","UrlString","RequestParameterBuilder","GrantType","StringUtils"],"mappings":";;;;;;AAAA;;;AAGG;AA2BH;;AAEG;AACG,MAAO,sBAAuB,SAAQA,qBAAU,CAAA;IAIlD,WACI,CAAA,aAAkC,EAClC,gBAAoC,EAAA;QAEpC,KAAK,CAAC,aAAa,CAAC,CAAC;AACrB,QAAA,IAAI,CAAC,gBAAgB,GAAG,gBAAgB,CAAC;KAC5C;AAED;;;AAGG;IACI,MAAM,YAAY,CACrB,OAAsC,EAAA;AAEtC,QAAA,IAAI,CAAC,QAAQ,GAAG,IAAIC,mBAAQ,CAAC,OAAO,CAAC,MAAM,IAAI,EAAE,CAAC,CAAC;QAEnD,IAAI,OAAO,CAAC,SAAS,EAAE;YACnB,OAAO,MAAM,IAAI,CAAC,mBAAmB,CAAC,OAAO,EAAE,IAAI,CAAC,SAAS,CAAC,CAAC;AAClE,SAAA;QAED,MAAM,0BAA0B,GAC5B,MAAM,IAAI,CAAC,6BAA6B,CAAC,OAAO,CAAC,CAAC;AACtD,QAAA,IAAI,0BAA0B,EAAE;AAC5B,YAAA,OAAO,0BAA0B,CAAC;AACrC,SAAA;AAAM,aAAA;YACH,OAAO,MAAM,IAAI,CAAC,mBAAmB,CAAC,OAAO,EAAE,IAAI,CAAC,SAAS,CAAC,CAAC;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;AACL,SAAA;;AAGD,QAAA,MAAM,eAAe,GACjB,OAAO,CAAC,eAAe;AACvB,YAAA,IAAI,CAAC,MAAM,CAAC,iBAAiB,CAAC,eAAe,CAAC;AAElD,QAAA,IAAI,eAAe,EAAE;AACjB,YAAA,gBAAgB,CAAC,kBAAkB,CAAC,eAAe,CAAC,SAAS,CAAC,CAAC;AAC/D,YAAA,gBAAgB,CAAC,sBAAsB,CACnC,eAAe,CAAC,aAAa,CAChC,CAAC;AACL,SAAA;QAED,IACI,CAACC,sBAAW,CAAC,UAAU,CAAC,OAAO,CAAC,MAAM,CAAC;AACvC,aAAC,IAAI,CAAC,MAAM,CAAC,WAAW,CAAC,kBAAkB;gBACvC,IAAI,CAAC,MAAM,CAAC,WAAW,CAAC,kBAAkB,CAAC,MAAM,GAAG,CAAC,CAAC,EAC5D;AACE,YAAA,gBAAgB,CAAC,SAAS,CACtB,OAAO,CAAC,MAAM,EACd,IAAI,CAAC,MAAM,CAAC,WAAW,CAAC,kBAAkB,CAC7C,CAAC;AACL,SAAA;AAED,QAAA,OAAO,gBAAgB,CAAC,iBAAiB,EAAE,CAAC;KAC/C;AACJ;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ConfidentialClientApplication.d.ts","sourceRoot":"","sources":["
|
|
1
|
+
{"version":3,"file":"ConfidentialClientApplication.d.ts","sourceRoot":"","sources":["../../src/client/ConfidentialClientApplication.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAOxD,OAAO,EAGH,oBAAoB,EAMpB,iBAAiB,EAIpB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,8BAA8B,EAAE,MAAM,kCAAkC,CAAC;AAClF,OAAO,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AACjE,OAAO,EAAE,uBAAuB,EAAE,MAAM,oCAAoC,CAAC;AAI7E;;;;GAIG;AACH,qBAAa,6BACT,SAAQ,iBACR,YAAW,8BAA8B;IAEzC,OAAO,CAAC,gBAAgB,CAAC,CAAoB;IAE7C;;;;;;;;;;;;;;;;;;OAkBG;gBACS,aAAa,EAAE,aAAa;IAMxC;;;;;OAKG;IACH,mBAAmB,CAAC,QAAQ,EAAE,iBAAiB,GAAG,IAAI;IAItD;;OAEG;IACU,8BAA8B,CACvC,OAAO,EAAE,uBAAuB,GACjC,OAAO,CAAC,oBAAoB,GAAG,IAAI,CAAC;IAkFvC;;;;;;;;;;OAUG;IACU,sBAAsB,CAC/B,OAAO,EAAE,iBAAiB,GAC3B,OAAO,CAAC,oBAAoB,GAAG,IAAI,CAAC;IA+BvC,OAAO,CAAC,mBAAmB;CAsD9B"}
|
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
/*! @azure/msal-node v2.0.0-alpha.0 2023-05-03 */
|
|
2
|
+
'use strict';
|
|
3
|
+
import { ClientApplication } from './ClientApplication.esm.js';
|
|
4
|
+
import { ClientAssertion } from './ClientAssertion.esm.js';
|
|
5
|
+
import { REGION_ENVIRONMENT_VARIABLE, ApiId, Constants as Constants$1 } from '../utils/Constants.esm.js';
|
|
6
|
+
import { OIDC_DEFAULT_SCOPES, UrlString, AADAuthorityConstants, ClientAuthError, AuthError, StringUtils, Constants } from '@azure/msal-common';
|
|
7
|
+
import { ClientCredentialClient } from './ClientCredentialClient.esm.js';
|
|
8
|
+
import { OnBehalfOfClient } from './OnBehalfOfClient.esm.js';
|
|
9
|
+
|
|
10
|
+
/*
|
|
11
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
12
|
+
* Licensed under the MIT License.
|
|
13
|
+
*/
|
|
14
|
+
/**
|
|
15
|
+
* This class is to be used to acquire tokens for confidential client applications (webApp, webAPI). Confidential client applications
|
|
16
|
+
* will configure application secrets, client certificates/assertions as applicable
|
|
17
|
+
* @public
|
|
18
|
+
*/
|
|
19
|
+
class ConfidentialClientApplication extends ClientApplication {
|
|
20
|
+
/**
|
|
21
|
+
* Constructor for the ConfidentialClientApplication
|
|
22
|
+
*
|
|
23
|
+
* Required attributes in the Configuration object are:
|
|
24
|
+
* - clientID: the application ID of your application. You can obtain one by registering your application with our application registration portal
|
|
25
|
+
* - authority: the authority URL for your application.
|
|
26
|
+
* - client credential: Must set either client secret, certificate, or assertion for confidential clients. You can obtain a client secret from the application registration portal.
|
|
27
|
+
*
|
|
28
|
+
* In Azure AD, authority is a URL indicating of the form https://login.microsoftonline.com/\{Enter_the_Tenant_Info_Here\}.
|
|
29
|
+
* If your application supports Accounts in one organizational directory, replace "Enter_the_Tenant_Info_Here" value with the Tenant Id or Tenant name (for example, contoso.microsoft.com).
|
|
30
|
+
* If your application supports Accounts in any organizational directory, replace "Enter_the_Tenant_Info_Here" value with organizations.
|
|
31
|
+
* If your application supports Accounts in any organizational directory and personal Microsoft accounts, replace "Enter_the_Tenant_Info_Here" value with common.
|
|
32
|
+
* To restrict support to Personal Microsoft accounts only, replace "Enter_the_Tenant_Info_Here" value with consumers.
|
|
33
|
+
*
|
|
34
|
+
* In Azure B2C, authority is of the form https://\{instance\}/tfp/\{tenant\}/\{policyName\}/
|
|
35
|
+
* Full B2C functionality will be available in this library in future versions.
|
|
36
|
+
*
|
|
37
|
+
* @param Configuration - configuration object for the MSAL ConfidentialClientApplication instance
|
|
38
|
+
*/
|
|
39
|
+
constructor(configuration) {
|
|
40
|
+
super(configuration);
|
|
41
|
+
this.setClientCredential(this.config);
|
|
42
|
+
this.appTokenProvider = undefined;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* This extensibility point only works for the client_credential flow, i.e. acquireTokenByClientCredential and
|
|
46
|
+
* is meant for Azure SDK to enhance Managed Identity support.
|
|
47
|
+
*
|
|
48
|
+
* @param IAppTokenProvider - Extensibility interface, which allows the app developer to return a token from a custom source.
|
|
49
|
+
*/
|
|
50
|
+
SetAppTokenProvider(provider) {
|
|
51
|
+
this.appTokenProvider = provider;
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Acquires tokens from the authority for the application (not for an end user).
|
|
55
|
+
*/
|
|
56
|
+
async acquireTokenByClientCredential(request) {
|
|
57
|
+
this.logger.info("acquireTokenByClientCredential called", request.correlationId);
|
|
58
|
+
// If there is a client assertion present in the request, it overrides the one present in the client configuration
|
|
59
|
+
let clientAssertion;
|
|
60
|
+
if (request.clientAssertion) {
|
|
61
|
+
clientAssertion = {
|
|
62
|
+
assertion: request.clientAssertion,
|
|
63
|
+
assertionType: Constants$1.JWT_BEARER_ASSERTION_TYPE,
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
const baseRequest = await this.initializeBaseRequest(request);
|
|
67
|
+
// valid base request should not contain oidc scopes in this grant type
|
|
68
|
+
const validBaseRequest = {
|
|
69
|
+
...baseRequest,
|
|
70
|
+
scopes: baseRequest.scopes.filter((scope) => !OIDC_DEFAULT_SCOPES.includes(scope)),
|
|
71
|
+
};
|
|
72
|
+
const validRequest = {
|
|
73
|
+
...request,
|
|
74
|
+
...validBaseRequest,
|
|
75
|
+
clientAssertion,
|
|
76
|
+
};
|
|
77
|
+
/*
|
|
78
|
+
* valid request should not have "common" or "organizations" in lieu of the tenant_id in the authority in the auth configuration
|
|
79
|
+
* example authority: "https://login.microsoftonline.com/TenantId",
|
|
80
|
+
*/
|
|
81
|
+
const authority = new UrlString(validRequest.authority);
|
|
82
|
+
const tenantId = authority.getUrlComponents().PathSegments[0];
|
|
83
|
+
if (Object.values(AADAuthorityConstants).includes(tenantId)) {
|
|
84
|
+
throw ClientAuthError.createMissingTenantIdError();
|
|
85
|
+
}
|
|
86
|
+
const azureRegionConfiguration = {
|
|
87
|
+
azureRegion: validRequest.azureRegion,
|
|
88
|
+
environmentRegion: process.env[REGION_ENVIRONMENT_VARIABLE],
|
|
89
|
+
};
|
|
90
|
+
const serverTelemetryManager = this.initializeServerTelemetryManager(ApiId.acquireTokenByClientCredential, validRequest.correlationId, validRequest.skipCache);
|
|
91
|
+
try {
|
|
92
|
+
const clientCredentialConfig = await this.buildOauthClientConfiguration(validRequest.authority, validRequest.correlationId, serverTelemetryManager, azureRegionConfiguration, request.azureCloudOptions);
|
|
93
|
+
const clientCredentialClient = new ClientCredentialClient(clientCredentialConfig, this.appTokenProvider);
|
|
94
|
+
this.logger.verbose("Client credential client created", validRequest.correlationId);
|
|
95
|
+
return clientCredentialClient.acquireToken(validRequest);
|
|
96
|
+
}
|
|
97
|
+
catch (e) {
|
|
98
|
+
if (e instanceof AuthError) {
|
|
99
|
+
e.setCorrelationId(validRequest.correlationId);
|
|
100
|
+
}
|
|
101
|
+
serverTelemetryManager.cacheFailedRequest(e);
|
|
102
|
+
throw e;
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
/**
|
|
106
|
+
* Acquires tokens from the authority for the application.
|
|
107
|
+
*
|
|
108
|
+
* Used in scenarios where the current app is a middle-tier service which was called with a token
|
|
109
|
+
* representing an end user. The current app can use the token (oboAssertion) to request another
|
|
110
|
+
* token to access downstream web API, on behalf of that user.
|
|
111
|
+
*
|
|
112
|
+
* The current middle-tier app has no user interaction to obtain consent.
|
|
113
|
+
* See how to gain consent upfront for your middle-tier app from this article.
|
|
114
|
+
* https://docs.microsoft.com/en-us/azure/active-directory/develop/v2-oauth2-on-behalf-of-flow#gaining-consent-for-the-middle-tier-application
|
|
115
|
+
*/
|
|
116
|
+
async acquireTokenOnBehalfOf(request) {
|
|
117
|
+
this.logger.info("acquireTokenOnBehalfOf called", request.correlationId);
|
|
118
|
+
const validRequest = {
|
|
119
|
+
...request,
|
|
120
|
+
...(await this.initializeBaseRequest(request)),
|
|
121
|
+
};
|
|
122
|
+
try {
|
|
123
|
+
const onBehalfOfConfig = await this.buildOauthClientConfiguration(validRequest.authority, validRequest.correlationId, undefined, undefined, request.azureCloudOptions);
|
|
124
|
+
const oboClient = new OnBehalfOfClient(onBehalfOfConfig);
|
|
125
|
+
this.logger.verbose("On behalf of client created", validRequest.correlationId);
|
|
126
|
+
return oboClient.acquireToken(validRequest);
|
|
127
|
+
}
|
|
128
|
+
catch (e) {
|
|
129
|
+
if (e instanceof AuthError) {
|
|
130
|
+
e.setCorrelationId(validRequest.correlationId);
|
|
131
|
+
}
|
|
132
|
+
throw e;
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
setClientCredential(configuration) {
|
|
136
|
+
const clientSecretNotEmpty = !StringUtils.isEmpty(configuration.auth.clientSecret);
|
|
137
|
+
const clientAssertionNotEmpty = !StringUtils.isEmpty(configuration.auth.clientAssertion);
|
|
138
|
+
const certificate = configuration.auth.clientCertificate || {
|
|
139
|
+
thumbprint: Constants.EMPTY_STRING,
|
|
140
|
+
privateKey: Constants.EMPTY_STRING,
|
|
141
|
+
};
|
|
142
|
+
const certificateNotEmpty = !StringUtils.isEmpty(certificate.thumbprint) ||
|
|
143
|
+
!StringUtils.isEmpty(certificate.privateKey);
|
|
144
|
+
/*
|
|
145
|
+
* If app developer configures this callback, they don't need a credential
|
|
146
|
+
* i.e. AzureSDK can get token from Managed Identity without a cert / secret
|
|
147
|
+
*/
|
|
148
|
+
if (this.appTokenProvider) {
|
|
149
|
+
return;
|
|
150
|
+
}
|
|
151
|
+
// Check that at most one credential is set on the application
|
|
152
|
+
if ((clientSecretNotEmpty && clientAssertionNotEmpty) ||
|
|
153
|
+
(clientAssertionNotEmpty && certificateNotEmpty) ||
|
|
154
|
+
(clientSecretNotEmpty && certificateNotEmpty)) {
|
|
155
|
+
throw ClientAuthError.createInvalidCredentialError();
|
|
156
|
+
}
|
|
157
|
+
if (configuration.auth.clientSecret) {
|
|
158
|
+
this.clientSecret = configuration.auth.clientSecret;
|
|
159
|
+
return;
|
|
160
|
+
}
|
|
161
|
+
if (configuration.auth.clientAssertion) {
|
|
162
|
+
this.clientAssertion = ClientAssertion.fromAssertion(configuration.auth.clientAssertion);
|
|
163
|
+
return;
|
|
164
|
+
}
|
|
165
|
+
if (!certificateNotEmpty) {
|
|
166
|
+
throw ClientAuthError.createInvalidCredentialError();
|
|
167
|
+
}
|
|
168
|
+
else {
|
|
169
|
+
this.clientAssertion = ClientAssertion.fromCertificate(certificate.thumbprint, certificate.privateKey, configuration.auth.clientCertificate?.x5c);
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
export { ConfidentialClientApplication };
|
|
175
|
+
//# sourceMappingURL=ConfidentialClientApplication.esm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ConfidentialClientApplication.esm.js","sources":["../../src/client/ConfidentialClientApplication.ts"],"sourcesContent":[null],"names":["NodeConstants"],"mappings":";;;;;;;;;AAAA;;;AAGG;AAgCH;;;;AAIG;AACG,MAAO,6BACT,SAAQ,iBAAiB,CAAA;AAKzB;;;;;;;;;;;;;;;;;;AAkBG;AACH,IAAA,WAAA,CAAY,aAA4B,EAAA;QACpC,KAAK,CAAC,aAAa,CAAC,CAAC;AACrB,QAAA,IAAI,CAAC,mBAAmB,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;AACtC,QAAA,IAAI,CAAC,gBAAgB,GAAG,SAAS,CAAC;KACrC;AAED;;;;;AAKG;AACH,IAAA,mBAAmB,CAAC,QAA2B,EAAA;AAC3C,QAAA,IAAI,CAAC,gBAAgB,GAAG,QAAQ,CAAC;KACpC;AAED;;AAEG;IACI,MAAM,8BAA8B,CACvC,OAAgC,EAAA;QAEhC,IAAI,CAAC,MAAM,CAAC,IAAI,CACZ,uCAAuC,EACvC,OAAO,CAAC,aAAa,CACxB,CAAC;;AAGF,QAAA,IAAI,eAAe,CAAC;QACpB,IAAI,OAAO,CAAC,eAAe,EAAE;AACzB,YAAA,eAAe,GAAG;gBACd,SAAS,EAAE,OAAO,CAAC,eAAe;gBAClC,aAAa,EAAEA,WAAa,CAAC,yBAAyB;aACzD,CAAC;AACL,SAAA;QAED,MAAM,WAAW,GAAG,MAAM,IAAI,CAAC,qBAAqB,CAAC,OAAO,CAAC,CAAC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