From 4c5d3edb4297f6fcfc105869a75b319a077c206b Mon Sep 17 00:00:00 2001 From: Kacper Polak Date: Thu, 19 Jan 2017 11:23:27 +0100 Subject: [PATCH 1/2] Add user object to Express.Request The JWT authentication middleware authenticates callers using a JWT. If the token is valid, req.user will be set with the JSON object decoded to be used by later middleware for authorization and access control. --- express-jwt/index.d.ts | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/express-jwt/index.d.ts b/express-jwt/index.d.ts index e721094edc..edffeb9632 100644 --- a/express-jwt/index.d.ts +++ b/express-jwt/index.d.ts @@ -37,3 +37,10 @@ declare namespace jwt { unless?: typeof unless; } } +declare global { + namespace Express { + export interface Request { + user?: any + } + } +} From c068a82a50914328790a6f0fcaadd900a19eb899 Mon Sep 17 00:00:00 2001 From: Kacper Polak Date: Fri, 27 Jan 2017 16:58:47 +0100 Subject: [PATCH 2/2] Add contributor --- express-jwt/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/express-jwt/index.d.ts b/express-jwt/index.d.ts index edffeb9632..4b6883a258 100644 --- a/express-jwt/index.d.ts +++ b/express-jwt/index.d.ts @@ -1,6 +1,6 @@ // Type definitions for express-jwt // Project: https://www.npmjs.org/package/express-jwt -// Definitions by: Wonshik Kim +// Definitions by: Wonshik Kim , Kacper Polak // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped import express = require('express');