Ejemplo n.º 1
0
        public GraphAuthProvider(IConfiguration configuration)
        {
            var azureOptions = new Models.AzureADOptions();

            configuration.Bind("AzureAD", azureOptions);

            // More info about MSAL Client Applications: https://github.com/AzureAD/microsoft-authentication-library-for-dotnet/wiki/Client-Applications
            _app = ConfidentialClientApplicationBuilder.Create(azureOptions.ClientId)
                   .WithClientSecret(azureOptions.ClientSecret)
                   .WithAuthority(AzureCloudInstance.AzurePublic, AadAuthorityAudience.AzureAdAndPersonalMicrosoftAccount)
                   .WithRedirectUri(azureOptions.BaseUrl + azureOptions.CallbackPath)
                   .Build();

            Authority = _app.Authority;

            _scopes = azureOptions.GraphScopes.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);
        }
Ejemplo n.º 2
0
 public ConfidentialClientApplicationBuilderExtension(IOptions <Models.AzureADOptions> azureOptions)
 {
     _AzureADOptions = azureOptions.Value;
 }
Ejemplo n.º 3
0
 public ConfigureAzureOptions(IOptions <Models.AzureADOptions> azureOptions, IGraphAuthProvider authProvider)
 {
     _azureOptions = azureOptions.Value;
     _authProvider = authProvider;
 }