/src/kea/src/lib/cc/default_credentials.h
Line | Count | Source |
1 | | // Copyright (C) 2024-2025 Internet Systems Consortium, Inc. ("ISC") |
2 | | // |
3 | | // This Source Code Form is subject to the terms of the Mozilla Public |
4 | | // License, v. 2.0. If a copy of the MPL was not distributed with this |
5 | | // file, You can obtain one at http://mozilla.org/MPL/2.0/. |
6 | | |
7 | | #ifndef DEFAULT_CREDENTIALS_H |
8 | | #define DEFAULT_CREDENTIALS_H |
9 | | |
10 | | #include <exceptions/exceptions.h> |
11 | | #include <unordered_set> |
12 | | #include <string> |
13 | | |
14 | | namespace isc { |
15 | | namespace data { |
16 | | |
17 | | /// @brief Exception thrown on attempt to use a default credential. |
18 | | class DefaultCredential : public Exception { |
19 | | public: |
20 | | DefaultCredential(const char* file, size_t line, const char* what) : |
21 | 0 | isc::Exception(file, line, what) { } |
22 | | }; |
23 | | |
24 | | /// @brief Base class for default credentials. |
25 | | struct DefaultCredentials { |
26 | | /// @brief Default credentials. |
27 | | static const std::unordered_set<std::string> DEFAULT_CREDENTIALS; |
28 | | |
29 | | /// @brief Check if the value is a default credential. |
30 | | /// |
31 | | /// @param value The value to check. |
32 | | /// @throw DefaultCredential if the value is in default credentials. |
33 | | static void check(const std::string& value); |
34 | | }; |
35 | | |
36 | | } // end of isc::dhcp namespace |
37 | | } // end of isc namespace |
38 | | |
39 | | |
40 | | #endif // DEFAULT_CREDENTIALS_H |