Couchbase C++ SDK 1.0.1 (rev. 58d46d7)
Loading...
Searching...
No Matches
security_options.hxx
Go to the documentation of this file.
1/* -*- Mode: C++; tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*- */
2/*
3 * Copyright 2020-Present Couchbase, Inc.
4 *
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
8 *
9 * http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 */
17
18#pragma once
19
21
22#include <optional>
23#include <string>
24
25namespace couchbase
26{
28{
29public:
31 {
32 enabled_ = enabled;
33 return *this;
34 }
35
37 {
38 tls_verify_ = mode;
39 return *this;
40 }
41
42 auto trust_certificate(std::string certificate_path) -> security_options&
43 {
44 trust_certificate_ = certificate_path;
45 return *this;
46 }
47
48 auto trust_certificate_value(std::string certificate_value) -> security_options&
49 {
50 trust_certificate_value_ = certificate_value;
51 return *this;
52 }
53
63
64 [[nodiscard]] auto build() const -> built
65 {
66 return {
67 enabled_,
68 tls_verify_,
69 trust_certificate_,
70 trust_certificate_value_,
71 disable_mozilla_ca_certificates_,
72 disable_deprecated_protocols,
73 disable_tls_v1_2,
74 };
75 }
76
77private:
78 bool enabled_{ true };
80 std::optional<std::string> trust_certificate_{};
81 std::optional<std::string> trust_certificate_value_{};
82 bool disable_mozilla_ca_certificates_{ false };
83 bool disable_deprecated_protocols{ true };
84 bool disable_tls_v1_2{ false };
85};
86} // namespace couchbase
Definition security_options.hxx:28
auto trust_certificate(std::string certificate_path) -> security_options &
Definition security_options.hxx:42
auto tls_verify(tls_verify_mode mode) -> security_options &
Definition security_options.hxx:36
auto trust_certificate_value(std::string certificate_value) -> security_options &
Definition security_options.hxx:48
auto build() const -> built
Definition security_options.hxx:64
auto enabled(bool enabled) -> security_options &
Definition security_options.hxx:30
Represents a single item from the result of collection::scan()
Definition allow_querying_search_index_options.hxx:28
tls_verify_mode
Definition tls_verify_mode.hxx:22
Definition security_options.hxx:54
bool disable_deprecated_protocols
Definition security_options.hxx:60
std::optional< std::string > trust_certificate_value
Definition security_options.hxx:58
bool disable_tls_v1_2
Definition security_options.hxx:61
bool enabled
Definition security_options.hxx:55
bool disable_mozilla_ca_certificates
Definition security_options.hxx:59
std::optional< std::string > trust_certificate
Definition security_options.hxx:57
tls_verify_mode tls_verify
Definition security_options.hxx:56