mirror of
https://github.com/JoshiCodes/knock.git
synced 2026-12-04 15:29:40 +01:00
Skeleton, REST core, variables and JSON editor (M0–M2)
- knock-core: YAML collection format with unknown-field round trip, variable resolution across scopes with secrets and dynamic values, HTTP engine with manual redirects, cookie jar and large-body spill, basic/bearer/API key auth with debug output, assertions and extracts - Tauri app: collection commands, file watcher, SQLite history, keyring-backed secrets - Svelte UI: sidebar tree, tabs, request editor, response viewer, JSON form/code editor with schema hints, environments, settings
This commit is contained in:
@@ -0,0 +1,59 @@
|
||||
//! OAuth glue between the core flow code and the app (browser, keyring,
|
||||
//! flow log). Filled in with the OAuth milestone.
|
||||
|
||||
use crate::state::AppState;
|
||||
use knock_core::auth::{AuthHost, OauthResult, Step, StepStatus};
|
||||
use knock_core::model::AuthConfig;
|
||||
use knock_core::vars::{OauthLookup, Resolver};
|
||||
use knock_core::Collection;
|
||||
use tauri::AppHandle;
|
||||
|
||||
pub struct Host {
|
||||
#[allow(dead_code)]
|
||||
app: AppHandle,
|
||||
#[allow(dead_code)]
|
||||
col: Option<String>,
|
||||
#[allow(dead_code)]
|
||||
env: Option<String>,
|
||||
#[allow(dead_code)]
|
||||
interactive: bool,
|
||||
}
|
||||
|
||||
impl Host {
|
||||
pub fn new(app: AppHandle, col: Option<String>, env: Option<String>) -> Self {
|
||||
Self { app, col, env, interactive: true }
|
||||
}
|
||||
pub fn preview(app: AppHandle, col: Option<String>, env: Option<String>) -> Self {
|
||||
Self { app, col, env, interactive: false }
|
||||
}
|
||||
}
|
||||
|
||||
impl AuthHost for Host {
|
||||
fn oauth2_token(
|
||||
&self,
|
||||
_cfg: &AuthConfig,
|
||||
_resolver: &Resolver,
|
||||
_force_refresh: bool,
|
||||
) -> futures_util::future::BoxFuture<'_, OauthResult> {
|
||||
Box::pin(async move {
|
||||
OauthResult {
|
||||
steps: vec![Step::new("token", "Get token", StepStatus::Error, "OAuth 2.0 is not wired up yet")],
|
||||
..Default::default()
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
pub struct TokenLookup;
|
||||
|
||||
impl TokenLookup {
|
||||
pub fn new(_state: &AppState, _c: &Collection, _env: Option<&str>) -> Self {
|
||||
Self
|
||||
}
|
||||
}
|
||||
|
||||
impl OauthLookup for TokenLookup {
|
||||
fn oauth_value(&self, _config: &str, _field: &str) -> Option<String> {
|
||||
None
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user