aboutsummaryrefslogtreecommitdiffstats
path: root/vespalib/src/vespa/vespalib/net/tls/tls_context.cpp
blob: 436722224d2fd835cf74248e3fe96b762d1e865e (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#include "tls_context.h"
#include <vespa/vespalib/net/tls/impl/openssl_tls_context_impl.h>
#include <vespa/vespalib/net/tls/policy_checking_certificate_verifier.h>
#include <vespa/vespalib/net/tls/transport_security_options.h>

namespace vespalib::net::tls {

std::shared_ptr<TlsContext> TlsContext::create_default_context(const TransportSecurityOptions& opts,
                                                               AuthorizationMode authz_mode) {
    auto verifier = create_verify_callback_from(opts.authorized_peers());
    return std::make_shared<impl::OpenSslTlsContextImpl>(opts, std::move(verifier), authz_mode);
}

std::shared_ptr<TlsContext> TlsContext::create_default_context(
        const TransportSecurityOptions& opts,
        std::shared_ptr<CertificateVerificationCallback> cert_verify_callback,
        AuthorizationMode authz_mode) {
    return std::make_shared<impl::OpenSslTlsContextImpl>(opts, std::move(cert_verify_callback), authz_mode);
}

}