Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

UseWindowsAzureActiveDirectoryBearerAuthentication does not exist in ASP.NET 5 RC1-Final

Earlier we used

app.UseWindowsAzureActiveDirectoryBearerAuthentication(
            new WindowsAzureActiveDirectoryBearerAuthenticationOptions
            {
                Audience = ConfigurationManager.AppSettings["ida:Audience"],
                Tenant = ConfigurationManager.AppSettings["ida:Tenant"],

            });

to authenticate with Azure. Problem is that today we did an upgrade to ASP.NET 5 RC1-FINAL and now this method does not exist anymore.

I have searched the net for other solutions, but the ones I have found is using some 3rd part identity service or .UseOAuthBearerAuthentication which is not available in RC1-Final.

like image 635
n3tx Avatar asked Dec 02 '15 12:12

n3tx


1 Answers

This extension method - specific to AAD - has not been ported to vNext. Instead, you're encouraged to directly use the JWT bearer middleware:

app.UseJwtBearerAuthentication(options => {
    options.AutomaticAuthenticate = true;
    options.AutomaticChallenge = true;
    options.Authority = "https://login.windows.net/tratcheroutlook.onmicrosoft.com";
    options.Audience = "63a87a83-64b9-4ac1-b2c5-092126f8474f";
});
like image 190
Kévin Chalet Avatar answered Oct 23 '22 12:10

Kévin Chalet