- add: join server handler
- add: validate session function to validate the session status
This commit is contained in:
@@ -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(),
|
||||
|
||||
Reference in New Issue
Block a user