public AccountController(IOptions<AzureAdSettings> adSettigsOption)
        {
            if (adSettigsOption == null)
                throw new ArgumentNullException(nameof(adSettigsOption));
            if (adSettigsOption.Value == null)
                throw new ArgumentNullException(nameof(adSettigsOption.Value));

            _adSettigs = adSettigsOption.Value;
        }
 public ProudctsController(ITokenAcquisition tokAcquisition,
                           IHttpClientFactory httpClientFactory,
                           IOptionsMonitor <AzureAdSettings> azureAdSettingsOptionsMonitor,
                           IOptionsMonitor <ProductApiSettings> productOptionsMonitor)
 {
     _tokenAcquisition   = tokAcquisition;
     _httpClient         = httpClientFactory.CreateClient(ProductClientName);
     _azureAdSettings    = azureAdSettingsOptionsMonitor.CurrentValue;
     _productApiSettings = productOptionsMonitor.CurrentValue;
 }
示例#3
0
        private static void InitializeAzureJwtSecurity(IServiceCollection services, AzureAdSettings azureAdSettings)
        {
            var authenticationBuidler = services.AddAuthentication(
                options =>
            {
                options.DefaultScheme             = JwtBearerDefaults.AuthenticationScheme;
                options.DefaultAuthenticateScheme = JwtBearerDefaults.AuthenticationScheme;
                options.DefaultChallengeScheme    = JwtBearerDefaults.AuthenticationScheme;
            }
                );

            authenticationBuidler.AddJwtBearer(
                options =>
            {
                options.IncludeErrorDetails  = true;
                options.Authority            = $"{azureAdSettings.Instance}{azureAdSettings.TenantId}";
                options.Audience             = azureAdSettings.AudienceId;
                options.RequireHttpsMetadata = false;
                options.SaveToken            = true;
            });
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="SettingsController"/> class.
 /// </summary>
 /// <param name="options">Azure ad configurations.</param>
 /// <param name="logger">Logger instance.</param>
 public SettingsController(IOptionsMonitor <AzureAdSettings> options, ILogger <SettingsController> logger)
 {
     this.azureAdSettings = options?.CurrentValue;
     this.logger          = logger;
 }
 public AuthenticationHandler(IOptions <AzureAdSettings> azureOptions, IOptions <PowerBiSettings> powerBiOptions)
 {
     _azureSettings   = azureOptions.Value;
     _powerBiSettings = powerBiOptions.Value;
 }
 public AccountController(IOptions <AzureAdSettings> options)
 {
     _config = options.Value;
 }
示例#7
0
 public AccountController(IOptions <AzureAdSettings> azureAdSettings)
 {
     _azureAdSettings = azureAdSettings.Value;
 }
示例#8
0
 public AuthController(ILogger <AuthController> logger, IOptions <AzureAdSettings> azureAdSettings)
 {
     _logger          = logger;
     _azureAdSettings = azureAdSettings.Value;
 }