コード例 #1
0
        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);
        }
コード例 #2
0
        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);
        }