use serde::{Deserialize, Serialize}; use super::InstanceAuthenticated; #[derive(Clone, Serialize, Deserialize)] pub enum AuthenticationMessage { Request(AuthenticationRequest), Response(AuthenticationResponse), } #[derive(Clone, Serialize, Deserialize)] pub enum AuthenticationRequest { AuthenticationToken(AuthenticationTokenRequest), TokenExtension(InstanceAuthenticated), } #[derive(Clone, Serialize, Deserialize)] pub enum AuthenticationResponse { AuthenticationToken(AuthenticationTokenResponse), TokenExtension(TokenExtensionResponse), } #[derive(Clone, Serialize, Deserialize)] pub struct AuthenticationTokenRequest { pub secret_key: String, pub username: String, pub password: String, } #[derive(Clone, Serialize, Deserialize)] pub struct AuthenticationTokenResponse { pub token: String, } #[derive(Clone, Serialize, Deserialize)] pub struct TokenExtensionRequest { pub secret_key: String, pub token: String, } #[derive(Clone, Serialize, Deserialize)] pub struct TokenExtensionResponse { pub new_token: Option, }