Skip to content

Support Swedish BankID (svenskt BankID) authentication in .NET. Unofficial package, not created by BankID.

License

Notifications You must be signed in to change notification settings

ActiveLogin/ActiveLogin.Authentication

Repository files navigation

ActiveLogin.Authentication

License: MIT Build Status Live demo Docs Discussion Twitter Follow

ActiveLogin.Authentication enables an application to support Swedish BankID (svenskt BankID) authentication in .NET.

Active Login is licensed is provided under the very permissive MIT license for you to be able to use it in commercial or non-commercial applications without many restrictions. Active Login is provided "as is", without any warrany of any kind. If you need support, commercial support and training is available.

Active Login is not a product created by BankID. It is an unofficial project that was developed by Active Solution. All trademarks are the property of their respective owners.

Features

  • 🆔 Supports BankID Auth (API, Flow and UI)
  • 📝 Supports BankID Sign (API, Flow and UI)
  • ☎️🆔 Supports BankID Phone Auth (API)
  • ☎️📝 Supports BankID Phone Sign (API)
  • ☺️ Supports BankID Verify digital ID card (API)
  • 🐧 Cross platform: Targets .NET Standard 2.0 and .NET 8
  • 6️⃣ Built on V6.0 (the latest) BankID JSON API
  • 🏁 Supports BankID animated QR code (Secure start)
  • ☁️ Designed with Microsoft Azure in mind (KeyVault, Monitor, Application Insights, AD B2C etc.)
  • 🌎 Multi language support with English and Swedish out of the box
  • 🔧 Customizable and extensible
  • 💠 Can be used as a Custom Identity Provider for Azure AD B2C

Screenshots

Screenshots on how the default UI for Native BankID looks on different devices.

Active Login Screenshots

Screenshot on monitoring dashboard.

Active Login Monitor

Table of contents

Note: This Readme reflects the state of our main branch and the code documented here might not be released as packages on NuGet.org yet. For early access, see our CI builds.

Projects & Packages overview

CI-builds from main of all packages are available in our GitHub Packages feed.

Project Description NuGet Downloads
BankId.Api API client for the Swedish BankID REST API. NuGet NuGet (Pre)
BankId.Core Core functionality for the BankID flow. NuGet NuGet (Pre)
BankId.AspNetCore ASP.NET authentication module for Swedish BankID. NuGet NuGet (Pre)
BankId.AzureKeyVault Azure KeyVault integrations for the AspNetCore package. NuGet NuGet (Pre)
BankId.AzureMonitor Azure Monitor (Application Insights) integrations for the AspNetCore package. NuGet NuGet (Pre)
BankId.QRCoder QR code generation using QRCoder the AspNetCore package. NuGet NuGet (Pre)
BankId.UAParser Device and browser detection using UAParser. NuGet NuGet (Pre)

Usage & Docs

Full documentation with step by step instructions, samples, customization and details on how to configure the options is available here:

Documentation for ActiveLogin.Authentication.BankID

Active Login is designed to make it easy to get started with BankID in .NET. The most basic setup looks like this:

// Common
services
    .AddBankId(bankId =>
    {
        bankId.UseTestEnvironment();
    });

// Auth
services
    .AddAuthentication()
    .AddBankIdAuth(bankId =>
    {
        bankId.AddSameDevice();
    });

// Sign
services
    .AddBankIdSign(bankId =>
    {
        bankId.AddSameDevice();
    });

Samples

For more use cases, samples and inspiration; feel free to browse our unit tests and samples.

Note: These are samples on how to use Active Login in different situations and might not represent optimal way of setting up ASP.NET MVC, IdentityServer or other components. Please see them as inspiration.

Project Description
IdentityServer.ClientSample ASP.NET MVC site using the IdentityServer.ServerSample as auth provider.
IdentityServer.ServerSample IdentityServer with Active Login as auth provider for BankID.
Standalone.MvcSample ASP.NET MVC with Active Login as auth provider for BankID. Also demo of Sign.
AzureProvisioningSample ARM template with Azure KeyVault, Azure App Service, Azure Monitor / Application Insights etc.
Phone.ConsoleSample Console application with a simple Phone Auth/Sign example

Please note that IdentityServer.ClientSample uses IdentityServer.ServerSample as the IdentityProvider, so the IdentityServer.ClientSample is a good place to start.

A live demo is available at https://demo.activelogin.net/.

Tests


FAQ

Here is a summary of common, general technical questions.

The docs for ActiveLogin.Authentication.BankId contains an FAQ specific to BankID.

For commercial / business related questions, see the FAQ at ActiveLogin.net.

What version of .NET is supported?

The API-wrapper (ActiveLogin.Authentication.BankId.Api) target .NET Standard 2.0, so it can be used from .NET >= 5.0, .NET Core >= 2.0 and .NET Framework >= 4.6.1, see full reference here. The package that target .NET Standard is strong named as it can be used from .NET Framework where strong naming can be relevant.

The authentication module (.AspNetCore), depend on ASP.NET 8 and therefore requires .NET 8. The core module (.Core), and related packages, depend on and requires .NET 8.

Our samples target .NET 8 and follow the conventions used there.

How do I build the solution locally?

Active Login is built using .NET, make sure you have the relevant version of the SDK and runtime installed.

Run the following command in the root to build all projects:

dotnet build

Run the following command in the root to run all tests:

dotnet test

Devcontainer and GitHub Codespaces

We also support devcontainer.json so that you can build the solution in a container and use GitHub Codespaces.

How do I run the samples locally?

The samples are configured to run for the test environment (no BankID certificate required as it's bundled with the library) by default. The Standalone.MvcSample is using the the most basic sample and is a good start.

To run the sample: Navigate to /Samples/Standalone.MvcSample/ and run:

dotnet run

How do I use Active Login to get support for BankID in Azure AD (Active Directory) B2C?

Azure AD B2C supports using custom identity providers that supports Open ID Connect. If you deploy Active Login as part of IdentityServer (see our samples) you can configure your Azure AD B2C to federate to that instance and by doing so get BankID support.

Active Login with Azure AD B2C


Active Login

Active Login is an Open Source project built on .NET that makes it easy to integrate with leading Swedish authentication services like BankID.

Security

In our Security Policy you can read about how to report a vulnerability, how to subscribe to security alerts and what packages we currently support.

Contribute

We are very open to community contributions to Active Login. Please see our contribution guidelines before getting started.

Contributors

Thank you to all who have and are contributing to this project!

Contributors

Stay updated and join the discussion

The three primary ways to interact and stay updated with Active Login are:

License

Active Login is licensed under the very permissive MIT license for you to be able to use it in commercial or non-commercial applications without many restrictions.

The BankID certificates from the BankID documentation are released as part of Active Login with the permission from BankID (Finansiell ID-Teknik BID AB).

All trademarks are the property of their respective owners.

Acknowledgements

Active Login is built on or uses the following great open source products:

For samples, these great products are used:

Sponsors

Active Solution is the main sponsor of Active Login. Active Solution is located in Sweden and provides IT consulting with focus on web, Azure and AI.

Active Solution

Bright cloud solutions - System development that shines. Together, we create systems that will rocket your business.

And yes, we are hiring 👩‍💻 :)

https://www.activesolution.se/

Support & Training

If you need help with implementing Active Login, there are commercial support & training options available.

We can help you out with:

  • Education and training on:
    • Active Login
    • IdentityServer
    • Azure AD B2C
    • Authentication on the .NET platform in general
  • Hands on implementing BankID using Active Login
  • Implement BankID as a custom Identity Provider for Azure AD B2C
  • Continuous support for Active Login

See ActiveLogin.net for more details on how to get in touch with us 📞.