/// import * as express from 'express'; import { MiddlewareOptions, ExtendedRequest, PrecedenceFunction, PrecedenceErrorHandler, PrecedenceOptions } from './types'; /** * Returns a function (express middleware) that validates the scopes against the user scopes * attached to the request (for example by `handleOAuthRequestMiddleware`). * If the the requested scopes are not matched request is rejected (with 403 Forbidden). * * Usage: * app.get('/path', requireScopesMiddleware['scopeA', 'scopeB'], (req, res) => { // Do route work }) * * @param scopes - array of scopes that are needed to access the endpoint * @param precedenceOptions - This options let consumers define a way to over rule scope checking. The parameter is optional. * * @returns { function(any, any, any): undefined } */ declare function requireScopesMiddleware(scopes: string[], precedenceOptions?: PrecedenceOptions): (req: ExtendedRequest, res: express.Response, next: express.NextFunction) => void; /** * Returns a function (middleware) to extract and validate an access token from a request. * Furthermore, it attaches the scopes granted by the token to the request for further usage. * If the token is not valid the request is rejected (with 401 Unauthorized). * * The options object can have the following properties: * - publicEndpoints string[] * - tokenInfoEndpoint string * * Usage: * app.use(handleOAuthRequestMiddleware(options)) * * @param options * @returns express middleware */ declare function handleOAuthRequestMiddleware(options: MiddlewareOptions): (req: ExtendedRequest, res: express.Response, next: express.NextFunction) => void; export { PrecedenceFunction, PrecedenceErrorHandler, PrecedenceOptions, requireScopesMiddleware, handleOAuthRequestMiddleware };