Skip to content

Commit

Permalink
security: create config-specific header
Browse files Browse the repository at this point in the history
The security_config library contains specific bits that are shared
between security module and configuration. However, the header
declarations for those bits are in headers that aren't easily included
in configuration system because of all the additional things brought
along.

So this commit splits these out into a specific config.h header that is
intended to be included by configuration system.

Signed-off-by: Noah Watkins <noahwatkins@gmail.com>
  • Loading branch information
dotnwat committed May 24, 2024
1 parent 9dc3767 commit 7379eb3
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 10 deletions.
3 changes: 1 addition & 2 deletions src/v/config/configuration.cc
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,8 @@
#include "config/validators.h"
#include "model/metadata.h"
#include "model/namespace.h"
#include "security/config.h"
#include "security/gssapi_principal_mapper.h"
#include "security/mtls.h"
#include "security/oidc_principal_mapping.h"
#include "security/oidc_url_parser.h"
#include "ssx/sformat.h"
#include "storage/config.h"
Expand Down
32 changes: 32 additions & 0 deletions src/v/security/config.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
/*
* Copyright 2024 Redpanda Data, Inc.
*
* Use of this software is governed by the Business Source License
* included in the file licenses/BSL.md
*
* As of the Change Date specified in that file, in accordance with
* the Business Source License, use of this software will be governed
* by the Apache License, Version 2.0
*/
#pragma once

#include "base/seastarx.h"

#include <seastar/core/sstring.hh>

#include <optional>
#include <vector>

namespace security::tls {

std::optional<ss::sstring>
validate_rules(const std::optional<std::vector<ss::sstring>>& r) noexcept;

}

namespace security::oidc {

std::optional<ss::sstring>
validate_principal_mapping_rule(ss::sstring const& rule);

}
3 changes: 0 additions & 3 deletions src/v/security/mtls.cc
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,6 @@ parse_rules(std::optional<std::vector<ss::sstring>> unparsed_rules);

} // namespace detail

std::optional<ss::sstring>
validate_rules(const std::optional<std::vector<ss::sstring>>& r) noexcept;

std::ostream& operator<<(std::ostream& os, const rule& r) {
fmt::print(os, "{}", r);
return os;
Expand Down
3 changes: 0 additions & 3 deletions src/v/security/mtls.h
Original file line number Diff line number Diff line change
Expand Up @@ -86,9 +86,6 @@ class mtls_state {
std::optional<ss::sstring> _subject;
};

std::optional<ss::sstring>
validate_rules(const std::optional<std::vector<ss::sstring>>& r) noexcept;

} // namespace security::tls

template<>
Expand Down
2 changes: 0 additions & 2 deletions src/v/security/oidc_principal_mapping.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,5 @@ class principal_mapping_rule {
};

result<principal_mapping_rule> parse_principal_mapping_rule(std::string_view);
std::optional<ss::sstring>
validate_principal_mapping_rule(ss::sstring const& rule);

} // namespace security::oidc

0 comments on commit 7379eb3

Please sign in to comment.