Skip to main content

manta_shared/shared/
auth.rs

1//! Wire types for the `POST /api/v1/auth/{token,validate}` endpoints.
2//!
3//! Carried over the wire by both `manta-cli` (sending requests via
4//! `MantaClient`) and `manta-server` (deserializing them in handlers).
5
6use serde::{Deserialize, Serialize};
7use utoipa::ToSchema;
8
9/// Request body for `POST /api/v1/auth/token`.
10#[derive(Debug, Deserialize, Serialize, ToSchema)]
11pub struct AuthTokenRequest {
12  pub username: String,
13  pub password: String,
14}
15
16/// Response body for `POST /api/v1/auth/token`.
17#[derive(Debug, Deserialize, Serialize, ToSchema)]
18pub struct AuthTokenResponse {
19  pub token: String,
20}
21
22/// Request body for `POST /api/v1/auth/validate`.
23#[derive(Debug, Deserialize, Serialize, ToSchema)]
24pub struct ValidateTokenRequest {
25  pub token: String,
26}