From dc710aef26031df6b1bf18c81b930f9e755634af Mon Sep 17 00:00:00 2001 From: Marnik Van Hileghem Date: Sun, 17 Oct 2021 17:17:25 +0200 Subject: [PATCH 1/2] Migrate Microsoft.Graph.Auth to Azure.Identity --- src/FluentEmail.Graph/FluentEmail.Graph.csproj | 3 ++- src/FluentEmail.Graph/GraphSender.cs | 10 +++------- 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/src/FluentEmail.Graph/FluentEmail.Graph.csproj b/src/FluentEmail.Graph/FluentEmail.Graph.csproj index 4fb43fd..44ed771 100644 --- a/src/FluentEmail.Graph/FluentEmail.Graph.csproj +++ b/src/FluentEmail.Graph/FluentEmail.Graph.csproj @@ -36,11 +36,12 @@ + all - + runtime; build; native; contentfiles; analyzers; buildtransitive diff --git a/src/FluentEmail.Graph/GraphSender.cs b/src/FluentEmail.Graph/GraphSender.cs index c164b41..69e1a34 100644 --- a/src/FluentEmail.Graph/GraphSender.cs +++ b/src/FluentEmail.Graph/GraphSender.cs @@ -6,6 +6,7 @@ using System.Linq; using System.Threading; using System.Threading.Tasks; + using Azure.Identity; using FluentEmail.Core; using FluentEmail.Core.Interfaces; using FluentEmail.Core.Models; @@ -28,14 +29,9 @@ public GraphSender(GraphSenderOptions options) { this.saveSent = options.SaveSentItems ?? true; - var clientApp = ConfidentialClientApplicationBuilder - .Create(options.ClientId) - .WithTenantId(options.TenantId) - .WithClientSecret(options.Secret) - .Build(); + ClientSecretCredential spn = new ClientSecretCredential(options.TenantId, options.ClientId, options.Secret); - var authProvider = new ClientCredentialProvider(clientApp); - this.graphClient = new GraphServiceClient(authProvider); + this.graphClient = new (spn); } public SendResponse Send(IFluentEmail email, CancellationToken? token = null) From e68e8157c8ee4859f34bdd668f585aa141fd17e6 Mon Sep 17 00:00:00 2001 From: Marnik Van Hileghem Date: Tue, 19 Oct 2021 09:16:57 +0200 Subject: [PATCH 2/2] remove Microsoft.Graph.Auth package Cleanup using statements --- src/FluentEmail.Graph/FluentEmail.Graph.csproj | 1 - src/FluentEmail.Graph/GraphSender.cs | 2 -- 2 files changed, 3 deletions(-) diff --git a/src/FluentEmail.Graph/FluentEmail.Graph.csproj b/src/FluentEmail.Graph/FluentEmail.Graph.csproj index 44ed771..30fdb60 100644 --- a/src/FluentEmail.Graph/FluentEmail.Graph.csproj +++ b/src/FluentEmail.Graph/FluentEmail.Graph.csproj @@ -42,7 +42,6 @@ all - runtime; build; native; contentfiles; analyzers; buildtransitive all diff --git a/src/FluentEmail.Graph/GraphSender.cs b/src/FluentEmail.Graph/GraphSender.cs index 69e1a34..2056e66 100644 --- a/src/FluentEmail.Graph/GraphSender.cs +++ b/src/FluentEmail.Graph/GraphSender.cs @@ -12,8 +12,6 @@ using FluentEmail.Core.Models; using JetBrains.Annotations; using Microsoft.Graph; - using Microsoft.Graph.Auth; - using Microsoft.Identity.Client; /// /// Implementation of ISender for the Microsoft Graph API.