garrison 0.9.0

Garrison - 面向 Rust 生态的一站式身份认证鉴权框架
Documentation
<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Request Processing Chain</title>
  <link href="https://fonts.googleapis.com/css2?family=Instrument+Serif:ital@0;1&family=Geist:wght@400;500;600&family=Geist+Mono:wght@400;500;600&family=Noto+Sans+TC:wght@400;500;600&display=swap" rel="stylesheet">
  <style>
    *, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
    :root {
      --color-paper: #f5f5f5;
      --color-ink: #1a2332;
      --color-muted: #4a5568;
      --color-accent: #c0392b;
      --color-link: #2c5282;
      --font-sans: 'Geist', 'Noto Sans TC', 'PingFang TC', 'Microsoft Jhei', sans-serif;
      --font-serif: 'Instrument Serif', 'Noto Serif TC', serif;
      --font-mono: 'Geist Mono', ui-monospace, monospace;
    }
    body {
      font-family: var(--font-sans);
      background: var(--color-paper);
      color: var(--color-ink);
      min-height: 100vh;
      display: flex;
      align-items: center;
      justify-content: center;
      padding: 3rem 2rem;
    }
    .frame { max-width: 1100px; width: 100%; }
    .diagram-container { width: 100%; overflow-x: auto; }
    .eyebrow {
      font-family: var(--font-mono);
      font-size: 0.66rem;
      font-weight: 500;
      letter-spacing: 0.18em;
      text-transform: uppercase;
      color: var(--color-muted);
      margin-bottom: 0.5rem;
    }
    h1 {
      font-family: var(--font-serif);
      font-size: clamp(1.5rem, 2.4vw + 0.75rem, 2rem);
      font-weight: 400;
      letter-spacing: -0.02em;
      line-height: 1.15;
      color: var(--color-ink);
      margin-bottom: 1.5rem;
    }
    svg { width: 100%; min-width: 960px; display: block; }
    @media print {
      .diagram-container { overflow-x: visible; }
      svg { min-width: 0; }
    }
  </style>
</head>
<body>
  <div class="frame">
    <p class="eyebrow">Sequence · Diagram Design</p>
    <h1>请求处理链路</h1>
    <div class="diagram-container">
      <svg viewBox="0 0 960 560" xmlns="http://www.w3.org/2000/svg" role="img" aria-labelledby="req-flow-title req-flow-desc">
        <title id="req-flow-title">Request Processing Chain</title>
        <desc id="req-flow-desc">Sequence diagram showing token extraction, session lookup through L1/L2 cache, validation, and response in the Garrison request pipeline.</desc>
        <defs>
          <marker id="arrow" markerWidth="8" markerHeight="6" refX="7" refY="3" orient="auto"><polygon points="0 0, 8 3, 0 6" fill="#4a5568"/></marker>
          <marker id="arrow-accent" markerWidth="8" markerHeight="6" refX="7" refY="3" orient="auto"><polygon points="0 0, 8 3, 0 6" fill="#c0392b"/></marker>
          <marker id="arrow-link" markerWidth="8" markerHeight="6" refX="7" refY="3" orient="auto"><polygon points="0 0, 8 3, 0 6" fill="#2c5282"/></marker>
        </defs>
        <rect width="100%" height="100%" fill="#f5f5f5"/>
        <!-- Lifelines -->
        <line x1="96" y1="80" x2="96" y2="520" stroke="rgba(26,35,50,0.20)" stroke-width="1" stroke-dasharray="3,3"/>
        <line x1="288" y1="80" x2="288" y2="520" stroke="rgba(26,35,50,0.20)" stroke-width="1" stroke-dasharray="3,3"/>
        <line x1="480" y1="80" x2="480" y2="520" stroke="rgba(26,35,50,0.20)" stroke-width="1" stroke-dasharray="3,3"/>
        <line x1="672" y1="80" x2="672" y2="520" stroke="rgba(26,35,50,0.20)" stroke-width="1" stroke-dasharray="3,3"/>
        <line x1="864" y1="80" x2="864" y2="520" stroke="rgba(26,35,50,0.20)" stroke-width="1" stroke-dasharray="3,3"/>
        <!-- Participant boxes -->
        <rect x="36" y="32" width="120" height="44" rx="6" fill="#f5f5f5"/>
        <rect x="36" y="32" width="120" height="44" rx="6" fill="rgba(26,35,50,0.03)" stroke="rgba(26,35,50,0.30)" stroke-width="1"/>
        <text x="96" y="59" fill="#1a2332" font-size="12" font-weight="600" font-family="'Geist', 'Noto Sans TC', 'PingFang TC', 'Microsoft Jhei', sans-serif" text-anchor="middle">Client</text>
        <rect x="228" y="32" width="120" height="44" rx="6" fill="#f5f5f5"/>
        <rect x="228" y="32" width="120" height="44" rx="6" fill="rgba(26,35,50,0.03)" stroke="rgba(26,35,50,0.30)" stroke-width="1"/>
        <text x="288" y="59" fill="#1a2332" font-size="12" font-weight="600" font-family="'Geist', 'Noto Sans TC', 'PingFang TC', 'Microsoft Jhei', sans-serif" text-anchor="middle">axum middleware</text>
        <rect x="400" y="32" width="160" height="44" rx="6" fill="#f5f5f5"/>
        <rect x="400" y="32" width="160" height="44" rx="6" fill="#ffffff" stroke="#1a2332" stroke-width="1"/>
        <text x="480" y="59" fill="#1a2332" font-size="12" font-weight="600" font-family="'Geist', 'Noto Sans TC', 'PingFang TC', 'Microsoft Jhei', sans-serif" text-anchor="middle">GarrisonUtil</text>
        <rect x="572" y="32" width="200" height="44" rx="6" fill="#f5f5f5"/>
        <rect x="572" y="32" width="200" height="44" rx="6" fill="rgba(192,57,43,0.08)" stroke="#c0392b" stroke-width="1.2"/>
        <text x="672" y="59" fill="#1a2332" font-size="12" font-weight="600" font-family="'Geist', 'Noto Sans TC', 'PingFang TC', 'Microsoft Jhei', sans-serif" text-anchor="middle">GarrisonLogicDefault</text>
        <rect x="804" y="32" width="120" height="44" rx="6" fill="#f5f5f5"/>
        <rect x="804" y="32" width="120" height="44" rx="6" fill="rgba(26,35,50,0.05)" stroke="#4a5568" stroke-width="1"/>
        <text x="864" y="59" fill="#1a2332" font-size="12" font-weight="600" font-family="'Geist', 'Noto Sans TC', 'PingFang TC', 'Microsoft Jhei', sans-serif" text-anchor="middle">Cache + DB</text>
        <!-- Messages -->
        <!-- 1. Client → axum: HTTP request -->
        <line x1="96" y1="120" x2="284" y2="120" stroke="#4a5568" stroke-width="1.2" marker-end="url(#arrow)"/>
        <rect x="148" y="100" width="88" height="12" rx="2" fill="#f5f5f5"/>
        <text x="192" y="109" fill="#4a5568" font-size="8" font-family="'Geist Mono', monospace" text-anchor="middle" letter-spacing="0.06em">HTTP + TOKEN</text>
        <!-- 2. axum → GarrisonUtil: check_login -->
        <line x1="288" y1="160" x2="476" y2="160" stroke="#4a5568" stroke-width="1.2" marker-end="url(#arrow)"/>
        <rect x="340" y="140" width="88" height="12" rx="2" fill="#f5f5f5"/>
        <text x="384" y="149" fill="#4a5568" font-size="8" font-family="'Geist Mono', monospace" text-anchor="middle" letter-spacing="0.06em">CHECK_LOGIN</text>
        <!-- 3. GarrisonUtil → GarrisonLogicDefault: logic.check_login -->
        <line x1="480" y1="200" x2="668" y2="200" stroke="#4a5568" stroke-width="1.2" marker-end="url(#arrow)"/>
        <rect x="532" y="180" width="88" height="12" rx="2" fill="#f5f5f5"/>
        <text x="576" y="189" fill="#4a5568" font-size="8" font-family="'Geist Mono', monospace" text-anchor="middle" letter-spacing="0.06em">CHECK_LOGIN</text>
        <!-- 4. GarrisonLogicDefault → Cache+DB: get_session -->
        <line x1="672" y1="240" x2="860" y2="240" stroke="#2c5282" stroke-width="1.2" marker-end="url(#arrow-link)"/>
        <rect x="724" y="220" width="88" height="12" rx="2" fill="#f5f5f5"/>
        <text x="768" y="229" fill="#2c5282" font-size="8" font-family="'Geist Mono', monospace" text-anchor="middle" letter-spacing="0.06em">GET_SESSION</text>
        <!-- 5. Cache+DB → GarrisonLogicDefault: session data (return) -->
        <line x1="864" y1="280" x2="676" y2="280" stroke="#4a5568" stroke-width="1" stroke-dasharray="5,4" marker-end="url(#arrow)"/>
        <rect x="724" y="260" width="88" height="12" rx="2" fill="#f5f5f5"/>
        <text x="768" y="269" fill="#4a5568" font-size="8" font-family="'Geist Mono', monospace" text-anchor="middle" letter-spacing="0.06em">SESSION DATA</text>
        <!-- 6. GarrisonLogicDefault self: validate -->
        <path d="M 672,320 H 660 Q 652,320 652,328 V 352 Q 652,360 660,360 H 672" fill="none" stroke="#4a5568" stroke-width="1.2" marker-end="url(#arrow)"/>
        <rect x="680" y="336" width="64" height="12" rx="2" fill="#f5f5f5"/>
        <text x="712" y="345" fill="#4a5568" font-size="8" font-family="'Geist Mono', monospace" text-anchor="middle" letter-spacing="0.06em">VALIDATE</text>
        <!-- 7. GarrisonLogicDefault → GarrisonUtil: Ok (headline) -->
        <line x1="672" y1="400" x2="484" y2="400" stroke="#c0392b" stroke-width="1.2" stroke-dasharray="5,4" marker-end="url(#arrow-accent)"/>
        <rect x="532" y="380" width="88" height="12" rx="2" fill="#f5f5f5"/>
        <text x="576" y="389" fill="#c0392b" font-size="8" font-family="'Geist Mono', monospace" text-anchor="middle" letter-spacing="0.06em">OK + CONTEXT</text>
        <!-- 8. GarrisonUtil → axum: result (return) -->
        <line x1="480" y1="440" x2="292" y2="440" stroke="#4a5568" stroke-width="1" stroke-dasharray="5,4" marker-end="url(#arrow)"/>
        <rect x="340" y="420" width="88" height="12" rx="2" fill="#f5f5f5"/>
        <text x="384" y="429" fill="#4a5568" font-size="8" font-family="'Geist Mono', monospace" text-anchor="middle" letter-spacing="0.06em">AUTH RESULT</text>
        <!-- 9. axum → Client: 200 (headline) -->
        <line x1="288" y1="480" x2="100" y2="480" stroke="#c0392b" stroke-width="1.2" marker-end="url(#arrow-accent)"/>
        <rect x="148" y="460" width="88" height="12" rx="2" fill="#f5f5f5"/>
        <text x="192" y="469" fill="#c0392b" font-size="8" font-family="'Geist Mono', monospace" text-anchor="middle" letter-spacing="0.06em">200 RESPONSE</text>
        <!-- Activation bars -->
        <rect x="284" y="120" width="8" height="160" fill="rgba(26,35,50,0.06)" stroke="#4a5568" stroke-width="0.8"/>
        <rect x="476" y="160" width="8" height="240" fill="rgba(26,35,50,0.06)" stroke="#4a5568" stroke-width="0.8"/>
        <rect x="668" y="200" width="8" height="200" fill="rgba(26,35,50,0.06)" stroke="#4a5568" stroke-width="0.8"/>
        <rect x="860" y="240" width="8" height="40" fill="rgba(26,35,50,0.06)" stroke="#4a5568" stroke-width="0.8"/>
      </svg>
    </div>
  </div>
</body>
</html>