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

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.

Related

How to implement mailing server with Next.js?

I am pretty new to Next.js and I want to implement a mailing feature for a contact form which I have on the site. Since Next.js is SSR, if we need to use a mailer I wonder: do we still need to have a separate backend environment where we then need to install the mailer (for example Node.js and Nodemailer) or we can install the mailer (for example Nodemailer) directly into the Next.js setup?
I know there is an option for having separate Node.js server, proving an API endpoint and using this endpoint for triggering the method where we will send emails (and probably send all the values from the contact form as a parameters in the endpoint), but I wonder if the Next.js allows direct implementation of a mailer nested directly into it's setup.
Next.js allows for creating custom API routes right within the project.
Here are the Docs:
https://nextjs.org/docs/api-routes/introduction
You need to create files in pages/api and the endpoint will be mapped to /api/*

Blazor WebAssembly with IdentityServer 4 Customize Identity

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.

How to add a new client to IdentityServer4 in the database?

During the first tests I always used the AddInMemoryClients configuration of IdentityServer4 as described in their documentation.
However I'm in the process of deploying it to our test environment and want to get rid off the configuration file so I've setup the Entity Framework integration.
Now all client ID's, client secrets, scopes, ... are persisted in the database in an encrypted way.
However, it's more difficult to add a new client.
What's the appropriate way to configure this?
Using Entity Framework migrations?
I know there's a UI available on top of IdentityServer4 but is that the only "easy" way?

DotNetNuke (DNN) 8 Built In Web Services API

Does DotNetNuke have a built in web services API I can call or do I have to create my own end point? All the documentation I can find about the services framework talks about creating your own module with a service to extend theirs. What I would like to do is authenticate against an existing / built in web service that will allow me to create users from an external application. A similar example would be me calling the built in SharePoint web services to retrieve list information with an external application. I don't have to write anything in SharePoint to call the built in web services. They are just there.
If this built in service(s) does exist do you have a link or some sample code about how to call it without writing my own web service module?
Thanks,
Bill
DNN does not (as of version 9.1) have a (supported) external API. There are web services designed to the internal modules to use, but you have to get a little hacky in order to make them usable outside of the site. There has been talk of creating a more standard API like this, but until the happens the scenario requires that you create specific APIs for your exact purposes.

.net core, angular and application settings

We currently have our API set up in azure and use deployment slots which each have their own app settings. For example, on our live slot we set our connection string to the live database. On our dev slot we set the connection string to the test database.
So, I have been tasked with doing something similar with our SPA. I created it using .net core and angular. Currently it has a constant set up:
.constant('apiUrl', 'https://ourlive.api.com')
I have a few set up and I just comment out the ones I am not using. What I have been tasked with, is putting these into the application settings and using deployment slots for different URLs. For example, the live slot will use the Live URL and the Dev slot will use the Dev URL.
I read that you can do this using npm but this isn't an option for us because we are using .net and the npm doesn't seem to work like that. Is there another way we can read the application settings?
Per my understanding, your scenario is a purely HTML + angularjs SPA, although they are running in a .NET core runtime. And your requirement is that you want to get the slot application settings in your SPA application. If I have any misunderstanding about your structure, please feel free to let me know.
You can try to leverage the .net core runtime to get the application settings in slot, and expose as an RESTful API for your SPA application.
And in your SPA application, you can create a server, to call your .net core's API, and you can inject this server and call this api when your SPA bootstrap in and keep the settings in $rootscope for your entire SPA application.
For slot application settings, you can refer to https://learn.microsoft.com/en-us/azure/app-service-web/web-sites-staged-publishing#configuration-for-deployment-slots for more info.

Resources