0.3.11 • Published 6 months ago

@types/passport-http v0.3.11

Weekly downloads
11,369
License
MIT
Repository
github
Last release
6 months ago

Installation

npm install --save @types/passport-http

Summary

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

Details

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

index.d.ts

// Type definitions for passport-http 0.3
// Project: https://github.com/jaredhanson/passport-http
// Definitions by: Christophe Vidal <https://github.com/krizalys>
//                 Tomek Łaziuk <https://github.com/tlaziuk>
//                 Chris Barth <https://github.com/cjbarth>
//                 James Adarich <https://github.com/jamesadarich>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.3

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

export interface BasicStrategyOptions<req extends boolean = boolean> {
    realm?: string | undefined;
    passReqToCallback?: req | undefined;
}

export interface DigestStrategyOptions {
    realm?: string | undefined;
    domain?: string | string[] | undefined;
    opaque?: string | undefined;
    algorithm?: string | undefined;
    qop?: string | string[] | undefined;
}

export interface DigestValidateOptions {
    nonce: string;
    cnonce: string;
    nc: number;
    opaque: string;
}

export type BasicVerifyFunction = (
    username: string,
    password: string,
    done: (error: any, user?: any) => void,
) => any;

export type BasicVerifyFunctionWithRequest = (
    req: express.Request,
    username: string,
    password: string,
    done: (error: any, user?: any) => void,
) => any;

export type DigestSecretFunction = (
    username: string,
    done: (error: any, user?: any, password?: any) => void,
) => any;

export type DigestValidateFunction = (
    params: DigestValidateOptions,
    done: (error: any, valid: boolean) => void,
) => any;

export class BasicStrategy implements passport.Strategy {
    constructor(verify: BasicVerifyFunction);
    constructor(options: BasicStrategyOptions<false>, verify: BasicVerifyFunction);
    constructor(options: BasicStrategyOptions<true>, verify: BasicVerifyFunctionWithRequest);

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

export class DigestStrategy implements passport.Strategy {
    constructor(secret: DigestSecretFunction, validate?: DigestValidateFunction);
    constructor(options: DigestStrategyOptions, secret: DigestSecretFunction, validate?: DigestValidateFunction);

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

Additional Details

Credits

These definitions were written by Christophe Vidal, Tomek Łaziuk, Chris Barth, and James Adarich.