NikiforovAll / keycloak-authorization-services-dotnet

Authentication and Authorization with Keycloak and ASP.NET Core 🔐
https://nikiforovall.github.io/keycloak-authorization-services-dotnet/
MIT License
471 stars 112 forks source link

Use Keycloak side by side with form login #95

Closed koureasstavros closed 5 months ago

koureasstavros commented 5 months ago

First of all, keep the nice work!

I have a Microsoft Blazor application where I have implemented a custom AuthenticationStateProvider and I am using Blazored Modal for pop up window to have login and logout forms. While trying to integrate this solution I see two problems:

  1. Under the Client's MainLayout.razor I should remove the AuthorizeView which is surrounding the @Body but this has as an effect that Not Authorized users can see the views if the know the links (of course will not be capable to do something as the authorize attribute of the controllers will protect the apis).
  2. Under Client's Program.cs keeping the registration of my custom authentication state provider makes the application to fail even from the start, so I wonder how to keep both ways for login, see the error below:

image

NikiforovAll commented 5 months ago

Hi @koureasstavros, SPA-like client applications support is out of the scope of this library.

koureasstavros commented 5 months ago

Hi, @NikiforovAll, not sure I understand your comment. I use Microsoft Blazor Hosted WebAssembly. You mean that your library is intended for the server part, right?

NikiforovAll commented 5 months ago

Yes, a client application is responsible for token retrieval and the SPA scenario is not supported.