1.0.41 • Published 6 months ago

@types/passport-http-bearer v1.0.41

Weekly downloads
24,828
License
MIT
Repository
github
Last release
6 months ago

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

// Type definitions for passport-http-bearer 1.0.1
// Project: https://github.com/jaredhanson/passport-http-bearer
// Definitions by: Isman Usoh <https://github.com/isman-usoh>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.3

/// <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 | Array<string> | undefined;
    realm?: string | undefined;
    passReqToCallback?: boolean | undefined;
}
interface IVerifyOptions {
    message?: string | undefined;
    scope: string | Array<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.

1.0.39

7 months ago

1.0.38

7 months ago

1.0.40

6 months ago

1.0.41

6 months ago

1.0.37

3 years ago

1.0.36

4 years ago

1.0.35

4 years ago

1.0.34

5 years ago

1.0.33

6 years ago

1.0.32

6 years ago

1.0.31

7 years ago

1.0.30

8 years ago

1.0.29

8 years ago

1.0.28-alpha

8 years ago

1.0.26-alpha

8 years ago

1.0.25-alpha

8 years ago

1.0.24-alpha

8 years ago

1.0.23-alpha

8 years ago

1.0.22-alpha

8 years ago

1.0.21-alpha

8 years ago

1.0.16-alpha

8 years ago

1.0.15-alpha

8 years ago