- add: join server handler

- add: validate session function to validate the session status
This commit is contained in:
2024-12-21 15:39:51 -05:00
parent 069a471bbb
commit f55ca79410
3 changed files with 36 additions and 6 deletions

View File

@@ -1,5 +1,5 @@
use crate::auth::auth_service_client::AuthServiceClient;
use crate::auth::{Empty, LoginRequest, LoginResponse, LogoutRequest, ValidateTokenRequest, ValidateTokenResponse};
use crate::auth::{Empty, LoginRequest, LoginResponse, LogoutRequest, ValidateSessionRequest, ValidateSessionResponse, ValidateTokenRequest, ValidateTokenResponse};
use tonic::transport::Channel;
pub struct AuthClient {
@@ -32,6 +32,15 @@ impl AuthClient {
Ok(response.into_inner())
}
pub async fn validate_session(&mut self, session_id: &str) -> Result<ValidateSessionResponse, Box<dyn std::error::Error + Send + Sync>> {
let request = ValidateSessionRequest {
session_id: session_id.to_string()
};
let response = self.client.validate_session(request).await?;
Ok(response.into_inner())
}
pub async fn logout(&mut self, session_id: &str) -> Result<Empty, Box<dyn std::error::Error + Send + Sync>> {
let request = LogoutRequest {
session_id: session_id.to_string(),