UNPKG

@senacor/azure-function-middleware

Version:

Middleware for azure functions to handle authentication, authorization, error handling and logging

13 lines (12 loc) 562 B
import { HttpHandler } from '@azure/functions'; import { HttpRequestParams } from '@azure/functions/types/http'; import { BeforeExecutionFunction } from '../middleware'; export type Rule<T> = { parameterExtractor: (parameters: HttpRequestParams) => string; jwtExtractor: (jwt: T) => string; }; export type JwtAuthorizationOptions = { skipIfResultIsFaulty: boolean; }; declare const _default: <T>(rules: Rule<T>[], errorResponseBody?: unknown, opts?: Partial<JwtAuthorizationOptions>) => BeforeExecutionFunction<HttpHandler>; export default _default;