summaryrefslogtreecommitdiff
path: root/src/lib.rs
diff options
context:
space:
mode:
authormo khan <mo@mokhan.ca>2025-06-27 16:45:17 -0600
committermo khan <mo@mokhan.ca>2025-06-27 16:45:17 -0600
commitcce3e0f170dfacb6b626a8777255c3183c5c5eb3 (patch)
tree788d88c028001d435b7f03685f4cf675a2fdacc0 /src/lib.rs
parent7bda8947c80fc507b722f321977522bd50377c17 (diff)
refactor: extract authorization::Server type
Diffstat (limited to 'src/lib.rs')
-rw-r--r--src/lib.rs22
1 files changed, 1 insertions, 21 deletions
diff --git a/src/lib.rs b/src/lib.rs
index a82c2ace..3bd8fbd1 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -1,22 +1,2 @@
pub mod authorization;
-pub use authorization::{Authorizer, CedarAuthorizer, CheckService};
-
-use envoy_types::ext_authz::v3::pb::AuthorizationServer;
-use std::sync::Arc;
-use tonic::transport::Server;
-
-pub fn create_server() -> Result<tonic::transport::server::Router, Box<dyn std::error::Error>> {
- let (_health_reporter, health_service) = tonic_health::server::health_reporter();
- let authorizer = Arc::new(authorization::CedarAuthorizer::default());
- let check_service = authorization::CheckService::new(authorizer);
- let server = Server::builder()
- .add_service(AuthorizationServer::new(check_service))
- .add_service(health_service)
- .add_service(
- tonic_reflection::server::Builder::configure()
- .register_encoded_file_descriptor_set(tonic_health::pb::FILE_DESCRIPTOR_SET)
- .build_v1()
- .unwrap(),
- );
- Ok(server)
-}
+pub use authorization::{Authorizer, CedarAuthorizer, CheckService, Server};