#pragma once #include "config.h" #include #include #if USE_SSL # include #endif namespace DB { class SSLCertificateSubjects { public: using container = boost::container::flat_set; enum class Type { CN, SAN }; private: std::array subjects; public: inline const container & at(Type type_) const { return subjects[static_cast(type_)]; } inline bool empty() { for (auto & subject_list : subjects) { if (!subject_list.empty()) return false; } return true; } void insert(const String & subject_type_, String && subject); void insert(Type type_, String && subject); friend bool operator==(const SSLCertificateSubjects & lhs, const SSLCertificateSubjects & rhs); }; String toString(SSLCertificateSubjects::Type type_); SSLCertificateSubjects::Type parseSSLCertificateSubjectType(const String & type_); #if USE_SSL SSLCertificateSubjects extractSSLCertificateSubjects(const Poco::Net::X509Certificate & certificate); #endif }