/proc/self/cwd/source/extensions/filters/common/rbac/utility.cc
Line | Count | Source |
1 | | #include "source/extensions/filters/common/rbac/utility.h" |
2 | | |
3 | | #include <string> |
4 | | |
5 | | #include "absl/strings/str_replace.h" |
6 | | |
7 | | namespace Envoy { |
8 | | namespace Extensions { |
9 | | namespace Filters { |
10 | | namespace Common { |
11 | | namespace RBAC { |
12 | | |
13 | | RoleBasedAccessControlFilterStats |
14 | 3.32k | generateStats(const std::string& prefix, const std::string& shadow_prefix, Stats::Scope& scope) { |
15 | 3.32k | const std::string final_prefix = prefix + "rbac."; |
16 | 3.32k | return {ENFORCE_RBAC_FILTER_STATS(POOL_COUNTER_PREFIX(scope, final_prefix)) |
17 | 3.32k | SHADOW_RBAC_FILTER_STATS(POOL_COUNTER_PREFIX(scope, final_prefix + shadow_prefix))}; |
18 | 3.32k | } |
19 | | |
20 | 1.05k | std::string responseDetail(const std::string& policy_id) { |
21 | | // Replace whitespaces in policy_id with '_' to avoid breaking the access log (inconsistent number |
22 | | // of segments between log entries when the separator is whitespace). |
23 | 1.05k | std::string sanitized = StringUtil::replaceAllEmptySpace(policy_id); |
24 | 1.05k | return fmt::format("rbac_access_denied_matched_policy[{}]", sanitized); |
25 | 1.05k | } |
26 | | |
27 | | } // namespace RBAC |
28 | | } // namespace Common |
29 | | } // namespace Filters |
30 | | } // namespace Extensions |
31 | | } // namespace Envoy |