mirror of
https://github.com/JoshiCodes/knock.git
synced 2026-12-04 15:29:40 +01:00
Auth types and OAuth 2.0 / OpenID Connect (M3, M4)
- Digest (MD5/SHA-256, -sess, auth/auth-int) with challenge round trip, self-signed JWT, AWS SigV4 (header and presigned), OAuth 1.0a, PKCS#12 client certificates; every type explains its computation - OAuth: discovery, authorization code with PKCE over a loopback listener (knock:// and paste-by-hand as alternatives), client credentials, device code, password; tokens per issuer/client/scopes/ environment in the keyring with auto refresh and one retry after 401 - Flow log with step timeline, raw exchanges, cURL export, plain-language diagnosis of provider errors, ID token validation incl. JWKS signature - OAuth panel with redirect URI on top, token inspector, refresh, userinfo, introspection, revocation, logout and connection test
This commit is contained in:
@@ -109,3 +109,38 @@ export function errorText(e: unknown): string {
|
||||
if (e instanceof Error) return e.message;
|
||||
return JSON.stringify(e);
|
||||
}
|
||||
|
||||
export interface TokenSet {
|
||||
access_token: string;
|
||||
refresh_token?: string | null;
|
||||
id_token?: string | null;
|
||||
token_type?: string | null;
|
||||
scope?: string | null;
|
||||
expires_at?: number | null;
|
||||
obtained_at: number;
|
||||
skew?: number | null;
|
||||
}
|
||||
export interface FlowRecord {
|
||||
id: string;
|
||||
at: string;
|
||||
kind: string;
|
||||
ok: boolean;
|
||||
steps: import('./types').Step[];
|
||||
warnings: string[];
|
||||
}
|
||||
export interface OauthStatus {
|
||||
key: string;
|
||||
redirect_uri: string;
|
||||
token: TokenSet | null;
|
||||
flows: FlowRecord[];
|
||||
logout_url: string | null;
|
||||
}
|
||||
export type OauthArgs = ScopeArgs & { cfg: import('./types').AuthConfig };
|
||||
|
||||
export const oauthApi = {
|
||||
status: (args: OauthArgs) => invoke<OauthStatus>('oauth_status', { args }),
|
||||
run: (args: OauthArgs, what: 'login' | 'test' | 'logout' | 'refresh' | 'userinfo' | 'introspect' | 'revoke' | 'discovery') =>
|
||||
invoke<{ steps: import('./types').Step[]; warnings: string[]; ok: boolean }>('oauth_run', { args, what }),
|
||||
callback: (url: string) => invoke<boolean>('oauth_callback', { url }),
|
||||
cancel: () => invoke<void>('oauth_cancel')
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user