AspNetCore.Authentication.SK.IdCard 1.0.0-alpha2

.NET Core 3.1
This is a prerelease version of AspNetCore.Authentication.SK.IdCard.
dotnet add package AspNetCore.Authentication.SK.IdCard --version 1.0.0-alpha2
NuGet\Install-Package AspNetCore.Authentication.SK.IdCard -Version 1.0.0-alpha2
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="AspNetCore.Authentication.SK.IdCard" Version="1.0.0-alpha2" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add AspNetCore.Authentication.SK.IdCard --version 1.0.0-alpha2
#r "nuget: AspNetCore.Authentication.SK.IdCard, 1.0.0-alpha2"
#r directive can be used in F# Interactive, C# scripting and .NET Interactive. Copy this into the interactive tool or source code of the script to reference the package.
// Install AspNetCore.Authentication.SK.IdCard as a Cake Addin
#addin nuget:?package=AspNetCore.Authentication.SK.IdCard&version=1.0.0-alpha2&prerelease

// Install AspNetCore.Authentication.SK.IdCard as a Cake Tool
#tool nuget:?package=AspNetCore.Authentication.SK.IdCard&version=1.0.0-alpha2&prerelease

AspNetCore.Authentication.SK.IDCard

AspNetCore.Authentication.SK.IDCard is a ID-card security middleware that you can use in your ASP.NET Core application to support SK ID-card authentication. It is inspired by Microsoft Certificate authentication. It is not perfect, but functional as external authentication.

The latest alpha release can be found on NuGet.

Getting started

Install SK root CA and intermediate certificates to your running computer or server from SK site. They have to be installed in propriate stores or received user certifiactes are not validated.

Authentication flow requires to redirect user to host that requires client certificate in TLS level. For that sample uses same application on different port, but it is also possible to use subdomain instead.

Configure your hosting environenment with additionally listen https with client certificate. Eg. add following lines to your CreateHostBuilder:

public static IHostBuilder CreateHostBuilder(string[] args) =>
    Host.CreateDefaultBuilder(args)
        .ConfigureWebHostDefaults(webBuilder =>
        {
            webBuilder.UseStartup<Startup>();
            webBuilder.ConfigureKestrel(options =>
            {
                options.ListenLocalhost(5000);
                options.ListenLocalhost(5001, listenOptions => listenOptions.UseHttps());
                options.ListenLocalhost(5002, listenOptions =>
                {
                    listenOptions.UseHttps(adapterOptions =>
                    {
                        adapterOptions.ClientCertificateMode = ClientCertificateMode.RequireCertificate;
                    });
                });
            });
        });

Add following lines to your Startup class:

public void ConfigureServices(IServiceCollection services)
{
    services.AddAuthentication()
        .AddIdCard(options =>
        {
            options.MainSite = "https://localhost:5001";
            options.AuthenticationSite = "https://localhost:5002";
        })
}

public void Configure(IApplicationBuilder app)
{
    app.UseAuthentication();
    app.UseAuthorization();
    app.UseIdCardAuthentication();
}

See the /sample directory for a complete sample using ASP.NET Core MVC.

Product Versions
.NET net5.0 net5.0-windows net6.0 net6.0-android net6.0-ios net6.0-maccatalyst net6.0-macos net6.0-tvos net6.0-windows net7.0 net7.0-android net7.0-ios net7.0-maccatalyst net7.0-macos net7.0-tvos net7.0-windows
.NET Core netcoreapp3.1
Compatible target framework(s)
Additional computed target framework(s)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.0.0-alpha2 177 1/22/2021
1.0.0-alpha1 143 1/19/2021