Пример #1
0
        protected MsalClientBase(CredentialPipeline pipeline, string tenantId, string clientId, ITokenCacheOptions cacheOptions)
        {
            // This validation is preformed as a backstop. Validation in TokenCredentialOptions.AuthorityHost prevents users from explicitly
            // setting AuthorityHost to a non TLS endpoint. However, the AuthorityHost can also be set by the AZURE_AUTHORITY_HOST environment
            // variable rather than in code. In this case we need to validate the endpoint before we use it. However, we can't validate in
            // CredentialPipeline as this is also used by the ManagedIdentityCredential which allows non TLS endpoints. For this reason
            // we validate here as all other credentials will create an MSAL client.
            Validations.ValidateAuthorityHost(pipeline.AuthorityHost);

            Pipeline = pipeline;

            TenantId = tenantId;

            ClientId = clientId;

            TokenCache = cacheOptions?.TokenCachePersistenceOptions == null ? null : new TokenCache(cacheOptions?.TokenCachePersistenceOptions);

            _clientAsyncLock = new AsyncLockWithValue <TClient>();
        }
Пример #2
0
 /// <summary>
 /// Resets the <see cref="cacheHelperLock"/> so that tests can validate multiple calls to <see cref="RegisterCache"/>
 /// This should only be used for testing.
 /// </summary>
 internal static void ResetWrapperCache()
 {
     cacheHelperLock = new AsyncLockWithValue <MsalCacheHelperWrapper>();
 }