@types/passport-http-bearer
TypeScript icon, indicating that this package has built-in type declarations

1.0.41 • Public • Published

Installation

npm install --save @types/passport-http-bearer

Summary

This package contains type definitions for passport-http-bearer (https://github.com/jaredhanson/passport-http-bearer).

Details

Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/passport-http-bearer.

index.d.ts

/// <reference types="passport"/>
/// <reference types="express" />
/// <reference types="koa" />

import passport = require("passport");
import express = require("express");
import koa = require("koa");

interface IStrategyOptions {
    scope?: string | string[] | undefined;
    realm?: string | undefined;
    passReqToCallback?: boolean | undefined;
}
interface IVerifyOptions {
    message?: string | undefined;
    scope: string | string[];
}

interface VerifyFunction {
    (token: string, done: (error: any, user?: any, options?: IVerifyOptions | string) => void): void;
}

interface IKoaContextContainer {
    ctx: koa.Context;
}
type KoaPassportExpressRequestMock = Partial<express.Request> & IKoaContextContainer;

interface VerifyFunctionWithRequest {
    (
        req: express.Request,
        token: string,
        done: (error: any, user?: any, options?: IVerifyOptions | string) => void,
    ): void;
}
interface VerifyFunctionWithContext {
    (
        req: KoaPassportExpressRequestMock,
        token: string,
        done: (error: any, user?: any, options?: IVerifyOptions | string) => void,
    ): void;
}

type VerifyFunctions =
    | VerifyFunction
    | VerifyFunctionWithRequest
    | VerifyFunctionWithContext;

declare class Strategy<T extends VerifyFunctions> implements passport.Strategy {
    constructor(verify: VerifyFunction);
    constructor(options: IStrategyOptions, verify: T);

    name: string;
    authenticate(req: express.Request, options?: Object): void;
}

Additional Details

Credits

These definitions were written by Isman Usoh.

Readme

Keywords

none

Package Sidebar

Install

npm i @types/passport-http-bearer

Weekly Downloads

87,389

Version

1.0.41

License

MIT

Unpacked Size

5.91 kB

Total Files

5

Last publish

Collaborators

  • types