scimmy-routers
Version:
SCIMMY Express Routers
39 lines (38 loc) • 2.14 kB
TypeScript
declare module "scimmy-routers" {
import express, { Router } from "express";
import SCIMMY from "scimmy";
export { SCIMMY };
export default SCIMMYRouters;
export interface SCIMMYRouters extends Router {
}
export class SCIMMYRouters {
/**
* Construct a new instance of SCIMMYRouters, validate authentication scheme, and set SCIM Service Provider Configuration
* @param authScheme Details of the means of authenticating SCIM requests
* @param authScheme.type SCIM service provider authentication scheme type
* @param authScheme.handler Method to invoke to authenticate SCIM requests
* @param authScheme.context Method to invoke to evaluate context passed to SCIMMY handlers
* @param authScheme.baseUri Method to invoke to determine the URL to use as the base URI for any location properties in responses
* @param authScheme.docUri URL to use as documentation URI for service provider authentication scheme
*/
constructor(authScheme: { type: string; handler: AuthenticationHandler; context?: AuthenticationContext; baseUri?: AuthenticationBaseUri; docUri?: string; });
}
/**
* Method invoked to authenticate a SCIM request
* @param req The express request to be authenticated
* @returns The ID of the currently authenticated user, to be consumed by the /Me endpoint
*/
type AuthenticationHandler = (req: express.Request) => string | Promise<string>;
/**
* Method invoked to provide authentication context to a SCIM request
* @param req The express request to provide authentication context for
* @returns Any information to pass through to a Resource's handler methods
*/
type AuthenticationContext = (req: express.Request) => any;
/**
* Method invoked to determine a base URI for location properties in a SCIM response
* @param req The express request to provide the base URI for
* @returns The base URI to use for location properties in SCIM responses
*/
type AuthenticationBaseUri = (req: express.Request) => string | Promise<string>;
}