More work.
Added chat service Updated packet service to pass the tcp stream around in a Arc type. Updated character position data to not require multiplying the coords Added more debug logs Added an interceptor for gRPC comms with the chat server Updated build and push script for the chat server changes
This commit is contained in:
20
packet-service/src/interceptors/auth_interceptor.rs
Normal file
20
packet-service/src/interceptors/auth_interceptor.rs
Normal file
@@ -0,0 +1,20 @@
|
||||
use tonic::{Request, Status, service::Interceptor};
|
||||
|
||||
#[derive(Clone, Debug)]
|
||||
pub struct AuthInterceptor {
|
||||
pub client_id: String,
|
||||
pub session_id: String,
|
||||
}
|
||||
|
||||
impl Interceptor for AuthInterceptor {
|
||||
fn call(&mut self, mut request: Request<()>) -> Result<Request<()>, Status> {
|
||||
// Attach the authenticated client ID into the metadata.
|
||||
request
|
||||
.metadata_mut()
|
||||
.insert("x-client-id", self.client_id.parse().unwrap());
|
||||
request
|
||||
.metadata_mut()
|
||||
.insert("x-session-id", self.session_id.parse().unwrap());
|
||||
Ok(request)
|
||||
}
|
||||
}
|
||||
1
packet-service/src/interceptors/mod.rs
Normal file
1
packet-service/src/interceptors/mod.rs
Normal file
@@ -0,0 +1 @@
|
||||
pub mod auth_interceptor;
|
||||
Reference in New Issue
Block a user