C# - Svet Paregov https://paregov.net Svetoslav (Svet) Paregov's Personal Web Site Tue, 11 Jan 2022 14:21:03 +0000 en-US hourly 1 https://wordpress.org/?v=6.9.4 https://paregov.net/wp-content/uploads/2019/11/cropped-site_icon_512x512-32x32.png C# - Svet Paregov https://paregov.net 32 32 169379028 Add custom claims to access token in IdentityServer4 https://paregov.net/add-custom-claims-to-access-token-in-identityserver4/?utm_source=rss&utm_medium=rss&utm_campaign=add-custom-claims-to-access-token-in-identityserver4 Tue, 11 Jan 2022 14:07:40 +0000 https://paregov.net/?p=9598 All identity providers are flexible and allow you to add custom claims in the issued access token. IdentityServer4 is no different in this scenario. Here is a short manual how to add custom claims in IdentityServer4 access token response.

You need to implement a ProfileService:

public class ProfileService : IProfileService
{
	public ProfileService(
		UserManager<PafUseruserManager)
	{
		_userManager = userManager;
	}

	public async Task GetProfileDataAsync(ProfileDataRequestContext context)
	{
		var user = await _userManager.GetUserAsync(context.Subject);

		var claims = new List<Claim{
			new Claim("custom_claim1", user.CustomClaim1),
			

…

The post Add custom claims to access token in IdentityServer4 first appeared on Svet Paregov.

]]>
All identity providers are flexible and allow you to add custom claims in the issued access token. IdentityServer4 is no different in this scenario. Here is a short manual how to add custom claims in IdentityServer4 access token response.

You need to implement a ProfileService:

public class ProfileService : IProfileService
{
	public ProfileService(
		UserManager<PafUseruserManager)
	{
		_userManager = userManager;
	}

	public async Task GetProfileDataAsync(ProfileDataRequestContext context)
	{
		var user = await _userManager.GetUserAsync(context.Subject);

		var claims = new List<Claim{
			new Claim("custom_claim1", user.CustomClaim1),
			
…

The post Add custom claims to access token in IdentityServer4 first appeared on Svet Paregov.

]]>
9598
Issue access token to IdentityServer 4 from IdentityServer 4 https://paregov.net/issue-access-token-to-identityserver-4-from-identityserver-4/?utm_source=rss&utm_medium=rss&utm_campaign=issue-access-token-to-identityserver-4-from-identityserver-4 Tue, 11 Jan 2022 13:54:05 +0000 https://paregov.net/?p=9594 You need sometimes IdentityServer 4 to interact with other services and to need information from them. And in many cases the same instance of the IdentityServer is the one that authorizes the access to those other services. Wee need to issue an access token to our-self in order to get/post the necessary information.

In my case I needed to create a corresponding object in another service on new user registration. To get the access token needed I have used IdentityServerTooks …

The post Issue access token to IdentityServer 4 from IdentityServer 4 first appeared on Svet Paregov.

]]>
You need sometimes IdentityServer 4 to interact with other services and to need information from them. And in many cases the same instance of the IdentityServer is the one that authorizes the access to those other services. Wee need to issue an access token to our-self in order to get/post the necessary information.

In my case I needed to create a corresponding object in another service on new user registration. To get the access token needed I have used IdentityServerTooks …

The post Issue access token to IdentityServer 4 from IdentityServer 4 first appeared on Svet Paregov.

]]>
9594
First look at .NET Interactive and Jupyter https://paregov.net/first-look-at-net-interactive-and-jupyter/?utm_source=rss&utm_medium=rss&utm_campaign=first-look-at-net-interactive-and-jupyter Tue, 11 Feb 2020 04:24:46 +0000 https://paregov.net/?p=8369 Wouldn’t be nice to have a place to test some quick things with C# in Jupyter Notebook?
You can do it now!

In the beginning of February 2020, Microsoft announced the second preview of .NET Notebooks experience.

What is .NET Interactive. It is a group of CLI tools and APIs that allow the users to create interactive experience across the web, markdown and notebooks.

.NET Interactive components.

…

The post First look at .NET Interactive and Jupyter first appeared on Svet Paregov.

]]>
Wouldn’t be nice to have a place to test some quick things with C# in Jupyter Notebook?
You can do it now!

In the beginning of February 2020, Microsoft announced the second preview of .NET Notebooks experience.

What is .NET Interactive. It is a group of CLI tools and APIs that allow the users to create interactive experience across the web, markdown and notebooks.

.NET Interactive components.

…

The post First look at .NET Interactive and Jupyter first appeared on Svet Paregov.

]]>
8369
Selecting local NuGet server https://paregov.net/selecting-local-nuget-server/?utm_source=rss&utm_medium=rss&utm_campaign=selecting-local-nuget-server Mon, 06 Jan 2020 00:39:55 +0000 https://paregov.net/?p=6669 Doesn’t matter if you are a big corporation, small company, a team of people or even a single person writing software it is worth organizing your code in modules and reuse it.

Using .NET (Standard/Core/Framework …) has the advantage of NuGet. It is open source package manager for .NET. You can use the public feed on https://www.nuget.org/, run your own NuGet server or create a local feed.

Let’s start with the simplest one – Local Feed.
Local NuGet package …

The post Selecting local NuGet server first appeared on Svet Paregov.

]]>
Doesn’t matter if you are a big corporation, small company, a team of people or even a single person writing software it is worth organizing your code in modules and reuse it.

Using .NET (Standard/Core/Framework …) has the advantage of NuGet. It is open source package manager for .NET. You can use the public feed on https://www.nuget.org/, run your own NuGet server or create a local feed.

Let’s start with the simplest one – Local Feed.
Local NuGet package …

The post Selecting local NuGet server first appeared on Svet Paregov.

]]>
6669
How to create .NET Core NuGet Package in Visual Studio 2019 https://paregov.net/how-to-create-net-core-nuget-package-in-visual-studio-2019/?utm_source=rss&utm_medium=rss&utm_campaign=how-to-create-net-core-nuget-package-in-visual-studio-2019 Sat, 04 Jan 2020 01:31:21 +0000 https://paregov.net/?p=7210 What is .NET Core?
.NET Core is an open source platform supported by Microsoft that can run on Windows, Windows, macOS and Linux operating systems and across multiple architectures including x64, x86 and ARM.
You can use multiple languages to write applications and libraries for .NET Core – C#, Visual Basic and F#.

In order to create a NuGet package with Visual Studio 2019 – select new Class Library (.NET Core) project.

I am going to call the project LoggingLib. …

The post How to create .NET Core NuGet Package in Visual Studio 2019 first appeared on Svet Paregov.

]]>
What is .NET Core?
.NET Core is an open source platform supported by Microsoft that can run on Windows, Windows, macOS and Linux operating systems and across multiple architectures including x64, x86 and ARM.
You can use multiple languages to write applications and libraries for .NET Core – C#, Visual Basic and F#.

In order to create a NuGet package with Visual Studio 2019 – select new Class Library (.NET Core) project.

I am going to call the project LoggingLib. …

The post How to create .NET Core NuGet Package in Visual Studio 2019 first appeared on Svet Paregov.

]]>
7210