JonPSmith / AuthPermissions.AspNetCore

This library provides extra authorization and multi-tenant features to an ASP.NET Core application.
https://www.thereformedprogrammer.net/finally-a-library-that-improves-role-authorization-in-asp-net-core/
MIT License
806 stars 161 forks source link

Is this library works with Azure B2C #7

Closed mabouchalkha closed 3 years ago

mabouchalkha commented 3 years ago

Hi, I found your library very interesting, I would like to know if it works on net core api api with Azure B2C out of the box. Thank you

JonPSmith commented 3 years ago

Yes, AuthP has built-in support for Azure AD. See

Enjoy!

mabouchalkha commented 3 years ago

Hi @JonPSmith, Thank you for quick response. Yes it works perfect with netcore web app. In my case i have a blazor app and netcore api project don't know how to plug your library in the api project. May be i need to re implement the .AzureAdAuthentication(AzureAdSettings.AzureAdDefaultSettings(false)) because the never called in the api server. options.Events = new OpenIdConnectEvents { OnTokenValidated = async ctx => { string userId = ctx.Principal.FindFirstValue(settings.UserIdClaimName); var email = ctx.Principal.FindFirstValue(settings.EmailClaimName);

Sorry, I don't quite understand this part Thank you

JonPSmith commented 3 years ago

I haven't used Blazor, but I think using Blazor WebAssembly doesn't have a startup section. That means you can't easily use this library.

I suggest you look at Secure an ASP.NET Core Blazor WebAssembly hosted app with Azure Active Directory instead.