ssxhttpmiddleware

Home > @spruceid/ssx-server > SSXHttpMiddleware

SSXHttpMiddleware variable

This middleware function does the following: 1. Checks for a ssx-session cookie and if it exists, it will manage and set the session on the request object. 2. Adds a ssx field to the request object with SSX authentication information in the object. 3. It adds a nonce, login, and logout route to the server

This function returns another function that can take an event listen as a parameter and calls it with the updated request object if none of the ssx routes are hit.

Signature:

SSXHttpMiddleware: (ssx: SSXServer, routes?: SSXServerRoutes) => (requestListener?: (req: any, res: any) => void) => (req: IncomingMessage, res: ServerResponse) => Promise<ServerResponse<IncomingMessage>>

Last updated