Skip to main content

Posts

C# Source Generators - a key to metaprogramming !!

C# Source generators - finally you are real !! Guys, if you are interested in compile time metaprogramming then this blog is a good place to land. Source code generator is a much awaited feature and now a reality in .Net 5 preview version. If you are not aware of what is source generator then don't worry, I expect most of the developers at the time when this blog is published are not aware of this feature. Take a deep breadth and relax!! Source code generators are the new feature of C# compiler or you can say the compiler capability that can inspect a program at the compile time and generate new source files that can be added to source code while compiling the code. This functionality is a piece of code in .Net Standard 2.0 assembly. So C# developers now you can inspect the user code and generate C#
Recent posts

Window authentication with Identity Server 4 - Part 1 (hybrid client)

Before reading this post, you must be aware of basics of identity server and oauth terms. We will not delve into the basics of identity server here. Setting up identity server 4 Setup a .Net Core 3.x project and add the nuget package reference for Identity server 4. Important point here is to have a project with a flexibility to add new views/pages. Once we add the nuget reference of Identity server 4, we will add a few lines of code in ConfigureServices method of our Startup.cs file Here is a look at our Config.cs class This way we have added a client with a custom grant type "iwa" representing integrated window authentication. This will be used in part 2 when we will protect our API resources for a SPA. Window authentication with hybrid flow i.e. MVC client Next we will create a MVC project (you can create any web project). We need to ensure that the client parameters used in this project should be same as registered in Identity Server setup. Here is t