/// <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); this.AppTokenCacheProvider = appTokenCacheProvider; this.UserTokenCacheProvider = userTokenCacheProvider; }
/// <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) { if (configuration == null) { throw new ArgumentNullException(nameof(configuration)); } azureAdOptions = new AzureADOptions(); configuration.Bind("AzureAD", azureAdOptions); _applicationOptions = new ConfidentialClientApplicationOptions(); configuration.Bind("AzureAD", _applicationOptions); this.AppTokenCacheProvider = appTokenCacheProvider; this.UserTokenCacheProvider = userTokenCacheProvider; }