ActiveLogin.Authentication icon indicating copy to clipboard operation
ActiveLogin.Authentication copied to clipboard

Allow for easier usage of BankIdClient when used without the ASP.NET Core pipeline

Open PeterOrneholm opened this issue 5 years ago • 2 comments

Is your feature request related to a problem? Please describe. The BankID API wrapper is today a separate package, which allows for using it without the Active Login authentication flow / UI found in ActiveLogin.Authentication.BankId.AspNetCore. The BankIdClient takes a mandatory HttpClient in the constructor. For BankId to work, you need to configure this HttpClient with certificate(s) and BaseUri for it to work. This can be made easier.

I would like it to be easy to create an instance of the BankId client given that you have:

  • API Url (Production or test, already available as constants)
  • Client certificate
  • Optional: CA certificate to validate against

What area is it related to

  • ActiveLogin.Authentication.BankId.Api

Describe the solution you'd like Not exactly sure on the most optimal implementation, but I'm leaning towards an BankIdHttpClientBuilder. We could then add extension methods similar to what we already have for the AspNetCore package. Maybe we can even restructure that one to use the same builder. In addition we could add an extension method to the BankIdClient class to allow for creating it from there.

A solution could look something like this:

var bankIdClient = BankIdClient.Build(builder => {
  builder.UseProductionEnvironment()
             .UseClientCertificate(...)
             .UseRootCaCertificate(...)
 });

PeterOrneholm avatar May 07 '20 14:05 PeterOrneholm

The refactorings in 6.0.0 have made this possible, but we will have to push the docs/helpers to take it all the way to 7.0.0.

PeterOrneholm avatar Jun 03 '22 14:06 PeterOrneholm