public static BankIdAuthenticationBuilder AddBankIdRootCaCertificate(this BankIdAuthenticationBuilder builder, Func <X509Certificate2> configureRootCaCertificate) { builder.ConfigureBankIdHttpClientHandler(httpClientHandler => { var rootCaCertificate = configureRootCaCertificate(); var validator = new X509CertificateChainValidator(rootCaCertificate); httpClientHandler.ServerCertificateCustomValidationCallback = validator.Validate; }); return(builder); }
public static BankIdAuthenticationBuilder AddBankIdClientCertificate(this BankIdAuthenticationBuilder builder, Func <X509Certificate2> configureClientCertificate) { builder.ConfigureBankIdHttpClientHandler(httpClientHandler => { var clientCertificate = configureClientCertificate(); httpClientHandler.ClientCertificateOptions = ClientCertificateOption.Manual; httpClientHandler.ClientCertificates.Add(clientCertificate); }); return(builder); }