Beispiel #1
0
 /// <summary>
 /// Constructor of the TokenAcquisition service. This requires the Azure AD Options to
 /// configure the confidential client application and a token cache provider.
 /// This constructor is called by ASP.NET Core dependency injection
 /// </summary>
 /// <param name="configuration"></param>
 /// <param name="appTokenCacheProvider">The App token cache provider</param>
 /// <param name="userTokenCacheProvider">The User token cache provider</param>
 public TokenAcquisition(
     IMsalAppTokenCacheProvider appTokenCacheProvider,
     IMsalUserTokenCacheProvider userTokenCacheProvider,
     IHttpContextAccessor httpContextAccessor,
     IOptions <AzureADOptions> azureAdOptions,
     IOptions <ConfidentialClientApplicationOptions> applicationOptions)
 {
     _httpContextAccessor    = httpContextAccessor;
     _azureAdOptions         = azureAdOptions.Value;
     _applicationOptions     = applicationOptions.Value;
     _appTokenCacheProvider  = appTokenCacheProvider;
     _userTokenCacheProvider = userTokenCacheProvider;
 }
Beispiel #2
0
        /// <summary>
        /// Constructor of the TokenAcquisition service. This requires the Azure AD Options to
        /// configure the confidential client application and a token cache provider.
        /// This constructor is called by ASP.NET Core dependency injection
        /// </summary>
        /// <param name="appTokenCacheProvider">The App token cache provider</param>
        /// <param name="userTokenCacheProvider">The User token cache provider</param>
        /// <param name="configuration"></param>
        public TokenAcquisition(
            IConfiguration configuration,
            IMsalAppTokenCacheProvider appTokenCacheProvider,
            IMsalUserTokenCacheProvider userTokenCacheProvider)
        {
            _azureAdOptions = new AzureADOptions();
            configuration.Bind("AzureAD", _azureAdOptions);

            _applicationOptions = new ConfidentialClientApplicationOptions();
            configuration.Bind("AzureAD", _applicationOptions);

            _appTokenCacheProvider  = appTokenCacheProvider;
            _userTokenCacheProvider = userTokenCacheProvider;
        }
 public MSALTokenHandler(IMsalUserTokenCacheProvider msalUserTokenCacheProvider)
 {
     _msalUserTokenCacheProvider = msalUserTokenCacheProvider;
 }