AspNetCore.Authentication.SK.IdCard 1.0.0-alpha2

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 and Polyglot Notebooks. 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 Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
.NET Core netcoreapp3.1 is compatible. 
Compatible target framework(s)
Included target framework(s) (in package)
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 239 1/22/2021
1.0.0-alpha1 196 1/19/2021