mirror of
https://github.com/wassname/talk.git
synced 2026-09-09 11:38:08 +08:00
[next] Permit (#1899)
* feat: replaced custom auth extraction logic with permit * fix: fixed tests
This commit is contained in:
Vendored
+31
@@ -0,0 +1,31 @@
|
||||
// TODO: (wyattjoh) following https://github.com/DefinitelyTyped/DefinitelyTyped/pull/29061 to merge then replace this with @types/permit.
|
||||
declare module "permit" {
|
||||
import { IncomingMessage, ServerResponse } from "http";
|
||||
|
||||
export interface PermitOptions {
|
||||
scheme?: string;
|
||||
proxy?: string;
|
||||
realm?: string;
|
||||
}
|
||||
|
||||
export interface BearerOptions extends PermitOptions {
|
||||
basic?: string;
|
||||
header?: string;
|
||||
query?: string;
|
||||
}
|
||||
|
||||
export class Permit {
|
||||
constructor(options: PermitOptions);
|
||||
check(req: IncomingMessage): void;
|
||||
fail(res: ServerResponse): void;
|
||||
}
|
||||
|
||||
export class Bearer extends Permit {
|
||||
constructor(options: BearerOptions);
|
||||
check(req: IncomingMessage): string;
|
||||
}
|
||||
|
||||
export class Basic extends Permit {
|
||||
check(req: IncomingMessage): [string, string];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user