Identity server 4 with .Net core - asp.net-core

I am trying to use Identity server with .Net Core 2.0 and I am following this guide for that: http://docs.identityserver.io/en/release/quickstarts/6_aspnet_identity.html
I created the Identity server application as per the above link and hosted with 5000 port and also registered a user.
I took client application from the samples and when I click on Secure, it is showing me the Login page of the application which is hosted on 5000 but after clicking on Login nothing is happening.
It is throwing 404 error. Can anyone suggest what am I missing?

As determined in the comments, you need to add Consent related code to your project. The docs are here and sample codebase in QuickStarts is here.

Related

Windows Authentication in Blazor WASM

I am implementing a WebApp in our company's intranet with Blazor WebAssembly. I need to make API-Calls to our DevOps Server hosted in our intranet and need to use Windows Authentication to access the API. In the former used WPF Client it was enough to just add the UseDefaultCredentials-Flag on the HttpClient, but that does not work in WebAssembly anymore since the App is running in the browser. The Microsoft Docs state We don't recommend using Windows Authentication with Blazor Webassembly, but not recommend does not mean not support, so it has to be possible somehow, to attach the current App-User's Windows Credentials(Token) to the API Call. Unfortunately there exists no example on the docs page on how to implement this and I have not found any code on how to tackle this, although on some forums people wrote that it is possible, but did not include the How in their comments.
I am using .NET5 for both Server and Client and need to make the Api-Call with Windows Authentication from the Client, not the Server as most examples are using it, as my Server-Project uses the same User for all Requests but I need the User of the Client-Project.
Any kind of help is appreciated.

ASP.NET Core Microsoft authentication callbackpage page not found

I have implemented Microsoft authentication using IIS Express and everything worked as expected (like the one from https://learn.microsoft.com/en-us/aspnet/core/security/authentication/social/microsoft-logins?view=aspnetcore-5.0).
However after I publish it to IIS, when a user tries to access the application, instead of the Microsoft login page, I get a page with the message
No webpage was found for the web address: <redirecturl>?code=...
I should mention that there is no other way to login. Only the Microsoft one has to be supported.
After further investigation I found out from where the problem was.
The server was protected and the IIS did not have access to the internet and a proxy was required. Hence the reason on IIS Express was working on the development machine but on the server IIS did not.

Is it possible to have two (multiple) clients hosted on the same server in a Blazor WebAssembly app

I created a Blazor WebAssembly App named "BlazorWebApp" and checked the box for "ASP.NET Core hosted". Now, can I add another client app to access the same server? I tried by adding another Blazor WebAssembly named Client2 and unchecked the box for "Core hosted" , but now it doesn't work, displaying an empty browser. I would like to know how to set the server to select the client that will show after the build and what changes the newly added client needs to communicate with the server.
I found this link here but it only solved the conflict error.
It's eminently possible. Blazor sites aren't really websites per se, but Single Page Applications. The web site is just the launch platform, so you can run as many as you like from the same host site. The trick to making it work is in the configuration. The detailed explanation of how to do it is too much to put in an answer here, so I've provided links below to:
A demo site called Hydra which runs a whole host of Server and WASM SPAs The Mongrel (dog) section is 4 template sites - two Server and two WASM - differentiated by their main colour scheme.
An article on my personal Github site that explains how to do it.
Hydra Site - the Mongrel
Hydra Article
Well, you can host multiple WASM files. HOWEVER, the problem occurs with the path/route mapping. When you fetch a WASM page (say "/site1/page1") the host will not find it locally and fall-back to a certain path (set in Startup.cs: e.g. "endpoints.MapFallbackToPage("/Index");"). From there it will download the WASM to the client and next resolve the mapping within the WASM.
So you can now imagine the problem when hosting two WASM clients: say you have a second site "/site2/page1", the default fallback will just always download the first WASM, and not find the page within that.
You will probably have to write your own "FallbackTo..." which maps specific path/routes to specific WASM clients. Likely possible, but also likely it will take some effort.
edit: I just found that Microsoft Docs actually have an entrie on this topic: Hosted deployment with multiple Blazor WebAssembly apps

How can I make a SIMPLE net core authentication api using Angular?

I'm looking on internet and try to find a simple way to do an authentification for my connection page with Angular using net core as my backend, I created a table user with microsoft sql server manager, did the connection between net core and the database and want to do a simple connection page without a registration (It's a website with only a few accounts), but every tutorials on internet seems to work with net core Identity when I just need to connect Angular services with the net core API to look if the username and the password matches in the database and then if yes return true or otherwise send an error message via the api...
Sorry if it's a basic question, I'm kinda new to net core and I have difficulties to understand everything from it.
I think auth0 will be best for u.
they have good documentation for u to get started in asp.net core and angular
and their free plan will be more than enough for u
using this u will not have to write identity code.

Asp.net MVC Web Api Http put and delete requests failing

I am using Asp.net MVC 4 Web Api project. MY application uses mvc to implement a web site. It makes http requests to the web api to implement server functionality.
Regular page requests to controllers work fine and it is able to display web pages. The application is able to make get and post requests to the api. But when it tries to to put or delete web requests it gets
"Failed to load resource: the server responded with a status of 501 (Not Implemented) "
The application is hosted on iis 6.
The application works when running a local cassani server instance and is able to make put and delete requests, but as soon as the application is executed from iis it doesn't work as expected.
I tried all the suggestions from the comment above and none of them worked.
I had to add the ASP.NET 4.0 dll to the Wildcard mappings in the Configuration area on the Home Directory tab. That worked for me. Remember to uncheck the "Verify file exists" checkbox.
EDIT: I posted a blog on the exact process to make this happen here: http://www.proworks.com/blog/2012/11/14/how-to-fix-aspnet-mvc-web-api-http-put-and-delete-requests-failing/