use super::responses::{
ListRolesResponse, OIDCAuthResponse, ReadConfigurationResponse, ReadRoleResponse,
};
use rustify_derive::Endpoint;
use std::{collections::HashMap, fmt::Debug};
#[derive(Builder, Debug, Default, Endpoint)]
#[endpoint(path = "/auth/{self.mount}/config", method = "POST", builder = "true")]
#[builder(setter(into, strip_option), default)]
pub struct SetConfigurationRequest {
#[endpoint(skip)]
pub mount: String,
pub bound_issuer: Option<String>,
pub default_role: Option<String>,
pub jwks_ca_pem: Option<String>,
pub jwt_supported_algs: Option<Vec<String>>,
pub jwks_url: Option<String>,
pub jwt_validation_pubkeys: Option<Vec<String>>,
pub namespace_in_state: Option<bool>,
pub oidc_discovery_ca_pem: Option<String>,
pub oidc_discovery_url: Option<String>,
pub oidc_client_id: Option<String>,
pub oidc_client_secret: Option<String>,
pub oidc_response_mode: Option<String>,
pub oidc_response_types: Option<Vec<String>>,
pub provider_config: Option<HashMap<String, String>>,
}
#[derive(Builder, Debug, Default, Endpoint)]
#[endpoint(
path = "/auth/{self.mount}/config",
response = "ReadConfigurationResponse",
builder = "true"
)]
#[builder(setter(into, strip_option), default)]
pub struct ReadConfigurationRequest {
#[endpoint(skip)]
pub mount: String,
}
#[derive(Builder, Debug, Default, Endpoint)]
#[endpoint(
path = "/auth/{self.mount}/role/{self.name}",
method = "POST",
builder = "true"
)]
#[builder(setter(into, strip_option), default)]
pub struct SetRoleRequest {
#[endpoint(skip)]
pub mount: String,
#[endpoint(skip)]
pub name: String,
pub allowed_redirect_uris: Vec<String>,
pub user_claim: String,
pub bound_subject: Option<String>,
pub bound_claims: Option<HashMap<String, String>>,
pub bound_claims_type: Option<String>,
pub bound_audiences: Option<Vec<String>>,
pub claim_mappings: Option<HashMap<String, String>>,
pub clock_skew_leeway: Option<String>,
pub expiration_leeway: Option<String>,
pub groups_claim: Option<String>,
pub max_age: Option<String>,
pub not_before_leeway: Option<String>,
pub oidc_scopes: Option<Vec<String>>,
pub role_type: Option<String>,
pub token_bound_cidrs: Option<Vec<String>>,
pub token_explicit_max_ttl: Option<String>,
pub token_no_default_policy: Option<bool>,
pub token_num_uses: Option<u64>,
pub token_period: Option<String>,
pub token_policies: Option<Vec<String>>,
pub token_ttl: Option<String>,
pub token_max_ttl: Option<String>,
pub token_type: Option<String>,
pub verbose_oidc_logging: Option<bool>,
}
#[derive(Builder, Debug, Default, Endpoint)]
#[endpoint(
path = "/auth/{self.mount}/role/{self.name}",
response = "ReadRoleResponse",
builder = "true"
)]
#[builder(setter(into, strip_option), default)]
pub struct ReadRoleRequest {
#[endpoint(skip)]
pub mount: String,
#[endpoint(skip)]
pub name: String,
}
#[derive(Builder, Debug, Default, Endpoint)]
#[endpoint(
path = "/auth/{self.mount}/role",
method = "LIST",
response = "ListRolesResponse",
builder = "true"
)]
#[builder(setter(into, strip_option), default)]
pub struct ListRolesRequest {
#[endpoint(skip)]
pub mount: String,
}
#[derive(Builder, Debug, Default, Endpoint)]
#[endpoint(
path = "/auth/{self.mount}/role/{self.name}",
method = "DELETE",
builder = "true"
)]
#[builder(setter(into, strip_option), default)]
pub struct DeleteRoleRequest {
#[endpoint(skip)]
pub mount: String,
#[endpoint(skip)]
pub name: String,
}
#[derive(Builder, Debug, Default, Endpoint)]
#[endpoint(
path = "/auth/{self.mount}/oidc/auth_url",
method = "POST",
response = "OIDCAuthResponse",
builder = "true"
)]
#[builder(setter(into, strip_option), default)]
pub struct OIDCAuthRequest {
#[endpoint(skip)]
pub mount: String,
pub redirect_uri: String,
pub role: Option<String>,
}
#[derive(Builder, Debug, Default, Endpoint)]
#[endpoint(path = "/auth/{self.mount}/oidc/callback", builder = "true")]
#[builder(setter(into, strip_option), default)]
pub struct OIDCCallbackRequest {
#[endpoint(skip)]
pub mount: String,
#[endpoint(query)]
#[endpoint(skip)]
pub state: String,
#[endpoint(query)]
#[endpoint(skip)]
pub nonce: String,
#[endpoint(query)]
#[endpoint(skip)]
pub code: String,
}
#[derive(Builder, Debug, Default, Endpoint)]
#[endpoint(path = "/auth/{self.mount}/login", method = "POST", builder = "true")]
#[builder(setter(into, strip_option), default)]
pub struct JWTLoginRequest {
#[endpoint(skip)]
pub mount: String,
pub jwt: String,
pub role: Option<String>,
}