- add: redis cache refresh function sets the ttl for a key
- update: session service refresh session function now just updates the ttl of the session instead of calling set
This commit is contained in:
@@ -1,8 +1,8 @@
|
||||
use crate::auth::auth_service_server::AuthService;
|
||||
use crate::auth::{
|
||||
LoginRequest, LoginResponse, LogoutRequest, PasswordResetRequest, PasswordResetResponse,
|
||||
RegisterRequest, RegisterResponse, ResetPasswordRequest, ResetPasswordResponse,
|
||||
ValidateSessionRequest, ValidateSessionResponse, ValidateTokenRequest, ValidateTokenResponse,
|
||||
RefreshSessionResponse, RegisterRequest, RegisterResponse, ResetPasswordRequest,
|
||||
ResetPasswordResponse, ValidateSessionRequest, ValidateSessionResponse, ValidateTokenRequest, ValidateTokenResponse,
|
||||
};
|
||||
use crate::common::Empty;
|
||||
use crate::database_client::{DatabaseClient, DatabaseClientTrait};
|
||||
@@ -160,7 +160,7 @@ impl AuthService for MyAuthService {
|
||||
async fn refresh_session(
|
||||
&self,
|
||||
request: Request<ValidateSessionRequest>,
|
||||
) -> Result<Response<ValidateSessionResponse>, Status> {
|
||||
) -> Result<Response<RefreshSessionResponse>, Status> {
|
||||
let req = request.into_inner();
|
||||
let response = self
|
||||
.session_client
|
||||
@@ -175,11 +175,11 @@ impl AuthService for MyAuthService {
|
||||
Ok(res) => {
|
||||
let res = res.into_inner();
|
||||
debug!("Session valid: {:?}", res);
|
||||
Ok(Response::new(ValidateSessionResponse { valid: true, session_id: res.session_id.to_string(), user_id: res.user_id.to_string() }))
|
||||
Ok(Response::new(RefreshSessionResponse { valid: res.valid }))
|
||||
}
|
||||
Err(_) => {
|
||||
debug!("Session invalid or not found");
|
||||
Ok(Response::new(ValidateSessionResponse { valid: false, session_id: "".to_string(), user_id: "".to_string() }))
|
||||
Ok(Response::new(RefreshSessionResponse { valid: false }))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user