| #ifndef THIRD_PARTY_MILOTIC_INTERNAL_CC_PROXY_RESOURCE_AUTHZ_H_ |
| #define THIRD_PARTY_MILOTIC_INTERNAL_CC_PROXY_RESOURCE_AUTHZ_H_ |
| |
| #include "absl/status/status.h" |
| #include "absl/strings/string_view.h" |
| #include "grpcpp/security/auth_context.h" |
| #include "proxy_config.pb.h" |
| #include "redfish_plugin.h" |
| |
| namespace milotic { |
| struct AuthorizationContext; |
| class PermissionChecker { |
| public: |
| virtual ~PermissionChecker() = default; |
| virtual bool Check(const AuthorizationContext& context, |
| absl::string_view permission) = 0; |
| }; |
| |
| struct AuthorizationContext { |
| const grpc::AuthContext& grpc_context; |
| PermissionChecker* permission_checker; |
| }; |
| |
| absl::Status AuthorizeRequest( |
| const milotic_grpc_proxy::AuthorizationPolicy& authorization_policy, |
| RedfishPlugin::RequestVerb verb, absl::string_view redfish_id, |
| AuthorizationContext& auth_context); |
| |
| } // namespace milotic |
| |
| #endif // THIRD_PARTY_MILOTIC_INTERNAL_CC_PROXY_RESOURCE_AUTHZ_H_ |