summaryrefslogtreecommitdiff
path: root/src/authorization/check_service.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/authorization/check_service.rs')
-rw-r--r--src/authorization/check_service.rs33
1 files changed, 0 insertions, 33 deletions
diff --git a/src/authorization/check_service.rs b/src/authorization/check_service.rs
deleted file mode 100644
index f8c7577f..00000000
--- a/src/authorization/check_service.rs
+++ /dev/null
@@ -1,33 +0,0 @@
-use envoy_types::ext_authz::v3::CheckResponseExt;
-use envoy_types::ext_authz::v3::pb::{CheckRequest, CheckResponse};
-use std::sync::Arc;
-use tonic::{Request, Response, Status};
-
-use super::authorizer::Authorizer;
-
-#[derive(Debug)]
-pub struct CheckService {
- authorizer: Arc<dyn Authorizer + Send + Sync>,
-}
-
-impl CheckService {
- pub fn new(authorizer: Arc<dyn Authorizer + Send + Sync>) -> Self {
- Self { authorizer }
- }
-}
-
-#[tonic::async_trait]
-impl envoy_types::ext_authz::v3::pb::Authorization for CheckService {
- async fn check(
- &self,
- request: Request<CheckRequest>,
- ) -> Result<Response<CheckResponse>, Status> {
- if self.authorizer.authorize(request.into_inner()) {
- Ok(Response::new(CheckResponse::with_status(Status::ok("OK"))))
- } else {
- Ok(Response::new(CheckResponse::with_status(
- Status::unauthenticated("Unauthorized"),
- )))
- }
- }
-}