Blazor WebAssembly with IdentityServer 4 Customize Identity - identityserver4

I created a Blazor WebAssembly Hosted App with Identity Server4 and ASP.Net Core Identity using this Template:
dotnet new blazorwasm -au Individual -ho -o {APP NAME}
I followed and read this documentation:
https://learn.microsoft.com/en-us/aspnet/core/blazor/security/webassembly/hosted-with-identity-server?view=aspnetcore-5.0&tabs=visual-studio-code
Can somebody explain how to customize Identity Login and Register Pages and Logic?
In MVC you scaffold the Identity Pages you want and they replace those from the dll.
If I try to add some Pages on the Server project, how do I have to serve them? Do I need to create
a Pages/Shared/_Layout like in a normal Razor Pages App or can I serve them with BlazorServer SignalR ?
The Layout from the Client App should be the same for Identity. Or is this something you have to configure with IdentityServer4 ? Maybe somebody can explain how exactly IdentityServer4 and ASP.NET Core Identity are coupled in this template scenario. I also read some blogs about using only Core Identity for securing BlazorWasm Hosted, can you tell me the difference?

In this model when you scaffold the Identity pages you'll get the vanilla design.
The thing is that as you noticed you're going from the blazor to a "razor" site .
What I've done is adapt the design to those pages.
The other way is to have an Identity server independent and implement a fully SPA for login and user management.

Related

Access ABP Application Service from Xamarin Forms

On Abp community site there are a few articles on how to access an Abp endpoint from Xamarin/Maui. Basically it boils down to:
create mobile client
login with user name and password
obtain access token
use this token as bearer for API calls.
However, in the microservices samples there is a Console app sample which has services injected and used. Now that would be quite awesome to use inside xamarin.
My question is: can abp application services be used directly in xamarin forms? I see no way of injecting the services.
I can share a couple of articles about it, I think those might help:
https://community.abp.io/posts/consume-abp-api-from-xamarin-app-3by6fdz6
MAUI, but they'll work on Xamarin too:
https://community.abp.io/posts/integrating-maui-client-via-using-openid-connect-aqjjwsdf
https://community.abp.io/posts/abp-framework-consumed-by-a-.net-maui-app-e74fmblw

How to use multitenancy with Blazor application in ABP Framework

I'm trying to create a multi-tenanted blazor application using ABP Framework and i'm struggling to figure out how to implement as the documentation is very limited.
My application needs to resolve the tenant based on the url. A tenant can have multiple urls, so therefore need to create a custom tenant resolver which looks up a url table for the tenant and returns the correct id. I have tried this in the HttpApi.Host project and its working fine but the issue is that it doesnt know anything about the URL that the blazor application was loaded on.
I'm now thinking about adding an http header to the api requests with the url, so that the tenant resolver can pull it. Before i head down this path, i'm concerned there is much easier and better way to accomplish this problem i'm tackling?
the documentation is very limited.
The documentation is rich, and the code is open source.
https://docs.abp.io/en/abp/latest/Multi-Tenancy#tenant-resolvers
https://github.com/abpframework/abp/tree/dev/framework/src/Volo.Abp.AspNetCore.MultiTenancy/Volo/Abp/AspNetCore/MultiTenancy

Add custom client to Microsoft.AspNetCore.ApiAuthorization.IdentityServer;

I am using the asp.net core SPA template with identity to create a react SPA with a web api backend. Authentication is provided by a wrapper for Identity Server 4 Wrapper. This wrapper provides a couple of useful config profiles Config docs. These are really useful for getting my SPA to work out of the box. It seems that any other config to define possible clients that is not in the supported docs is ignored and not passed down to the underlying Identify server. Wrapper config builder
I would really like to be able to use the config and integrations provided by the asp.net core identity library but also be able to provide my own clients defined in the appsettings.json. This is so I can add another client to the identity server for a mobile application.
You can create the same template i am using with this line.
dotnet new react -o <output_directory_name> -au Individual
Any help is greatly appreciated.

Map asp.net core 2.0 Identity to existing DB schema

I have built a small web application with asp.net core 2.0 MVC. In this web application, I did not implement any authentication methods so far.
Right now I have an MSSQL database running in the background and I can add/view/edit/delete users from the database.
I adapted this tutorial and followed it pretty closely. However I also added some functionality like localization and stuff, and everything is running pretty smoothly.
My next goal is to enable authentication and authorization. The authentication part shall be straightforward. The goal is that the application will be running as an intranet solution. This means the authentication method just shall check if the Windows User is existing in the previously mentioned database. I don't want to create a separate login. However, it might be that there is a Windows user in the active directory, which is not part of the database. This User should just be able to see a default error page.
I made quite a huge research and I also tried a lot of different stuff, however, I do absolutely not find any "database first" tutorial for this part or any other documentation which explains what to do.
I actually "just" want to teach the asp.net core 2.0 identity framework that it shall look into my user-table and check if the current windows user is existent and if not to forward him to the error page.
A second step would be to load all the roles which this user is assigned to from the mapping table.
Any kind of help would be highly appreciated.
Dosc Microsoft has a lot of posts regarding authentication for ASP.NET Core. Here are some of the links to get you started:
ASP.NET Core Authentication
ASP.NET Core Authentication Identity
and a lot more.

How to use Active Directory in MVC5 Web application

In the past, my web applications use a MembershipProvider inherited from ActiveDirectoryMembershipProvider. With OWIN in place in MVC5, I understand we are not supposed to do it the old way.
The problem came when I tried to create a new application. It asks for "On-Premises Authority" and "App ID URI"!
In the past, our custom membership provider just make queries directly from the database. No WS service is in place. Is there a way we can do the same for an MVC5 application?

Resources