Skip to main content

Overview

The JwtTemplateListResponse struct represents the response returned when fetching a list of JWT templates.

Definition

pub struct JwtTemplateListResponse {
    pub data: Vec<JwtTemplate>,
}

Fields

data
Vec<JwtTemplate>
required
A vector containing all JWT templates. Each template is represented by a JwtTemplate struct.

Usage Example

use wacht::api::settings::fetch_jwt_templates;

let response = fetch_jwt_templates().await?;

println!("Found {} JWT templates", response.data.len());

for template in response.data {
    println!("Template: {} ({})", template.name, template.id);
    println!("  Algorithm: {}", template.algorithm);
    println!("  Lifetime: {} seconds", template.lifetime_seconds);
    println!("  Claims: {:?}", template.custom_claims);

    if template.is_default {
        println!("  This is the default template");
    }
}

// Find a specific template by name
let api_template = response.data.iter()
    .find(|t| t.name == "api-access")
    .expect("API access template not found");

println!("API template uses {} algorithm", api_template.algorithm);

See Also