From ee586ae06fb89ef3331685a71330562c2752e9f1 Mon Sep 17 00:00:00 2001 From: Julian Freeman Date: Mon, 1 Dec 2025 08:41:44 -0400 Subject: [PATCH] add auth --- spec/feature-auth.md | 76 ++++++++++++++++ src-tauri/src/lib.rs | 55 ++++++++++++ src/components/AuthPanel.vue | 153 ++++++++++++++++++++++++++++++++ src/components/RequestPanel.vue | 11 ++- src/stores/requestStore.ts | 24 +++++ 5 files changed, 317 insertions(+), 2 deletions(-) create mode 100644 spec/feature-auth.md create mode 100644 src/components/AuthPanel.vue diff --git a/spec/feature-auth.md b/spec/feature-auth.md new file mode 100644 index 0000000..0f016ed --- /dev/null +++ b/spec/feature-auth.md @@ -0,0 +1,76 @@ +# Feature Request: Authentication Support + +**Context:** +We are upgrading the "LiteRequest" Tauri + Vue application. Currently, it supports Headers, Params, and Body. +**Goal:** Add a dedicated **"Auth"** tab in the Request Configuration area to support common authentication methods. + +## 1. Functional Requirements + +### 1.1 Supported Auth Types +The user should be able to select one of the following from a dropdown: +1. **No Auth** (Default) +2. **Basic Auth**: Inputs for `Username` and `Password`. +3. **Bearer Token**: Input for `Token` (e.g., JWT). +4. **API Key**: Inputs for `Key`, `Value`, and a selection for `Add To` ("Header" or "Query Params"). + +### 1.2 State Management +* Update `stores/requestStore.ts` to include an `auth` state object. +* **Structure:** + ```typescript + state: { + // ... existing state + auth: { + type: 'none', // 'none' | 'basic' | 'bearer' | 'api_key' + basic: { username: '', password: '' }, + bearer: { token: '' }, + apiKey: { key: '', value: '', addTo: 'header' } // addTo: 'header' | 'query' + } + } + ``` +* **Persistence:** These values should be saved to `localStorage` along with the request history (careful note: in a real app we would encrypt this, but for this local MVP, plain text storage is acceptable). + +## 2. UI/UX Design + +### 2.1 Request Panel Update +* In `RequestPanel.vue`, add a new Tab labeled **"Auth"** (place it first, before "Params"). +* **Layout:** + * **Type Selector:** A styled `