@seamless-auth/express 0.3.5 → 0.3.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/createServer.d.ts.map +1 -1
- package/dist/getSeamlessUser.d.ts.map +1 -1
- package/dist/handlers/admin.d.ts.map +1 -1
- package/dist/handlers/bootstrapAdmininvite.d.ts.map +1 -1
- package/dist/handlers/finishLogin.d.ts.map +1 -1
- package/dist/handlers/finishRegister.d.ts.map +1 -1
- package/dist/handlers/internalMetrics.d.ts.map +1 -1
- package/dist/handlers/login.d.ts.map +1 -1
- package/dist/handlers/logout.d.ts.map +1 -1
- package/dist/handlers/me.d.ts.map +1 -1
- package/dist/handlers/pollMagicLinkConfirmation.d.ts.map +1 -1
- package/dist/handlers/register.d.ts.map +1 -1
- package/dist/handlers/requestMagicLink.d.ts.map +1 -1
- package/dist/handlers/requestOtp.d.ts.map +1 -1
- package/dist/handlers/sessions.d.ts.map +1 -1
- package/dist/handlers/systemConfig.d.ts.map +1 -1
- package/dist/index.js +82 -32
- package/dist/internal/buildForwardedClientIp.d.ts +3 -0
- package/dist/internal/buildForwardedClientIp.d.ts.map +1 -0
- package/dist/middleware/ensureCookies.d.ts.map +1 -1
- package/package.json +2 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createServer.d.ts","sourceRoot":"","sources":["../src/createServer.ts"],"names":[],"mappings":"AAAA,OAAgB,EAAqB,MAAM,EAAE,MAAM,SAAS,CAAC;AAI7D,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"createServer.d.ts","sourceRoot":"","sources":["../src/createServer.ts"],"names":[],"mappings":"AAAA,OAAgB,EAAqB,MAAM,EAAE,MAAM,SAAS,CAAC;AAI7D,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,aAAa,CAAC;AAsDhE,MAAM,MAAM,yBAAyB,GAAG;IACtC,aAAa,EAAE,MAAM,CAAC;IACtB,YAAY,EAAE,MAAM,CAAC;IACrB,aAAa,EAAE,MAAM,CAAC;IACtB,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,sBAAsB,CAAC,EAAE,MAAM,CAAC;IAChC,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,SAAS,CAAC,EAAE,4BAA4B,CAAC;CAC1C,CAAC;AAEF,MAAM,WAAW,gBAAgB;IAC/B,EAAE,EAAE,MAAM,CAAC;IACX,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,GAAG,CAAC,EAAE,MAAM,CAAC;CACd;AACD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkDG;AACH,wBAAgB,wBAAwB,CACtC,IAAI,EAAE,yBAAyB,GAC9B,MAAM,CAuPR"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getSeamlessUser.d.ts","sourceRoot":"","sources":["../src/getSeamlessUser.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAMvC,OAAO,EAAE,yBAAyB,EAAE,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"getSeamlessUser.d.ts","sourceRoot":"","sources":["../src/getSeamlessUser.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAMvC,OAAO,EAAE,yBAAyB,EAAE,MAAM,gBAAgB,CAAC;AAG3D,wBAAsB,eAAe,CACnC,GAAG,EAAE,OAAO,EACZ,IAAI,EAAE,yBAAyB,gBAWhC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"admin.d.ts","sourceRoot":"","sources":["../../src/handlers/admin.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"admin.d.ts","sourceRoot":"","sources":["../../src/handlers/admin.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAiB5C,OAAO,EAAE,yBAAyB,EAAE,MAAM,iBAAiB,CAAC;AAS5D,eAAO,MAAM,QAAQ,GACnB,KAAK,OAAO,EACZ,KAAK,QAAQ,EACb,MAAM,yBAAyB,gDAS9B,CAAC;AAEJ,eAAO,MAAM,UAAU,GACrB,KAAK,OAAO,EACZ,KAAK,QAAQ,EACb,MAAM,yBAAyB,gDAU9B,CAAC;AAEJ,eAAO,MAAM,UAAU,GACrB,KAAK,OAAO,EACZ,KAAK,QAAQ,EACb,MAAM,yBAAyB,gDAS9B,CAAC;AAEJ,eAAO,MAAM,UAAU,GACrB,KAAK,OAAO,EACZ,KAAK,QAAQ,EACb,MAAM,yBAAyB,gDAU9B,CAAC;AAEJ,eAAO,MAAM,aAAa,GACxB,KAAK,OAAO,EACZ,KAAK,QAAQ,EACb,MAAM,yBAAyB,gDAS9B,CAAC;AAEJ,eAAO,MAAM,gBAAgB,GAC3B,KAAK,OAAO,EACZ,KAAK,QAAQ,EACb,MAAM,yBAAyB,gDAS9B,CAAC;AAEJ,eAAO,MAAM,aAAa,GACxB,KAAK,OAAO,EACZ,KAAK,QAAQ,EACb,MAAM,yBAAyB,gDAU9B,CAAC;AAEJ,eAAO,MAAM,kBAAkB,GAC7B,KAAK,OAAO,EACZ,KAAK,QAAQ,EACb,MAAM,yBAAyB,gDAS9B,CAAC;AAEJ,eAAO,MAAM,eAAe,GAC1B,KAAK,OAAO,EACZ,KAAK,QAAQ,EACb,MAAM,yBAAyB,gDAU9B,CAAC;AAEJ,eAAO,MAAM,gBAAgB,GAC3B,KAAK,OAAO,EACZ,KAAK,QAAQ,EACb,MAAM,yBAAyB,gDAS9B,CAAC;AAEJ,eAAO,MAAM,qBAAqB,GAChC,KAAK,OAAO,EACZ,KAAK,QAAQ,EACb,MAAM,yBAAyB,gDAS9B,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bootstrapAdmininvite.d.ts","sourceRoot":"","sources":["../../src/handlers/bootstrapAdmininvite.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"bootstrapAdmininvite.d.ts","sourceRoot":"","sources":["../../src/handlers/bootstrapAdmininvite.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAI5C,OAAO,EAAE,yBAAyB,EAAE,MAAM,iBAAiB,CAAC;AAE5D,wBAAsB,oBAAoB,CACxC,GAAG,EAAE,OAAO,EACZ,GAAG,EAAE,QAAQ,EACb,IAAI,EAAE,yBAAyB,2DAuBhC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"finishLogin.d.ts","sourceRoot":"","sources":["../../src/handlers/finishLogin.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"finishLogin.d.ts","sourceRoot":"","sources":["../../src/handlers/finishLogin.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAK5C,OAAO,EAAE,yBAAyB,EAAE,MAAM,iBAAiB,CAAC;AAE5D,wBAAsB,WAAW,CAC/B,GAAG,EAAE,OAAO,GAAG;IAAE,aAAa,CAAC,EAAE,GAAG,CAAA;CAAE,EACtC,GAAG,EAAE,QAAQ,EACb,IAAI,EAAE,yBAAyB,2DAmDhC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"finishRegister.d.ts","sourceRoot":"","sources":["../../src/handlers/finishRegister.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"finishRegister.d.ts","sourceRoot":"","sources":["../../src/handlers/finishRegister.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAK5C,OAAO,EAAE,yBAAyB,EAAE,MAAM,iBAAiB,CAAC;AAG5D,wBAAsB,cAAc,CAClC,GAAG,EAAE,OAAO,GAAG;IAAE,aAAa,CAAC,EAAE,GAAG,CAAA;CAAE,EACtC,GAAG,EAAE,QAAQ,EACb,IAAI,EAAE,yBAAyB,2DAmEhC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"internalMetrics.d.ts","sourceRoot":"","sources":["../../src/handlers/internalMetrics.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"internalMetrics.d.ts","sourceRoot":"","sources":["../../src/handlers/internalMetrics.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAY5C,OAAO,EAAE,yBAAyB,EAAE,MAAM,iBAAiB,CAAC;AAS5D,wBAAsB,mBAAmB,CACvC,GAAG,EAAE,OAAO,EACZ,GAAG,EAAE,QAAQ,EACb,IAAI,EAAE,yBAAyB,+CAYhC;AAED,wBAAsB,sBAAsB,CAC1C,GAAG,EAAE,OAAO,EACZ,GAAG,EAAE,QAAQ,EACb,IAAI,EAAE,yBAAyB,+CAYhC;AAED,wBAAsB,aAAa,CACjC,GAAG,EAAE,OAAO,EACZ,GAAG,EAAE,QAAQ,EACb,IAAI,EAAE,yBAAyB,+CAWhC;AAED,wBAAsB,oBAAoB,CACxC,GAAG,EAAE,OAAO,EACZ,GAAG,EAAE,QAAQ,EACb,IAAI,EAAE,yBAAyB,+CAWhC;AAED,wBAAsB,mBAAmB,CACvC,GAAG,EAAE,OAAO,EACZ,GAAG,EAAE,QAAQ,EACb,IAAI,EAAE,yBAAyB,+CAWhC;AAED,wBAAsB,sBAAsB,CAC1C,GAAG,EAAE,OAAO,EACZ,GAAG,EAAE,QAAQ,EACb,IAAI,EAAE,yBAAyB,+CAWhC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"login.d.ts","sourceRoot":"","sources":["../../src/handlers/login.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"login.d.ts","sourceRoot":"","sources":["../../src/handlers/login.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAI5C,OAAO,EAAE,yBAAyB,EAAE,MAAM,iBAAiB,CAAC;AAE5D,wBAAsB,KAAK,CACzB,GAAG,EAAE,OAAO,EACZ,GAAG,EAAE,QAAQ,EACb,IAAI,EAAE,yBAAyB,2DA6ChC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"logout.d.ts","sourceRoot":"","sources":["../../src/handlers/logout.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"logout.d.ts","sourceRoot":"","sources":["../../src/handlers/logout.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAI5C,OAAO,EAAE,yBAAyB,EAAE,MAAM,iBAAiB,CAAC;AAE5D,wBAAsB,MAAM,CAC1B,GAAG,EAAE,OAAO,EACZ,GAAG,EAAE,QAAQ,EACb,IAAI,EAAE,yBAAyB,iBAahC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"me.d.ts","sourceRoot":"","sources":["../../src/handlers/me.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"me.d.ts","sourceRoot":"","sources":["../../src/handlers/me.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAK5C,OAAO,EAAE,yBAAyB,EAAE,MAAM,iBAAiB,CAAC;AAE5D,wBAAsB,EAAE,CACtB,GAAG,EAAE,OAAO,GAAG;IAAE,aAAa,CAAC,EAAE,GAAG,CAAA;CAAE,EACtC,GAAG,EAAE,QAAQ,EACb,IAAI,EAAE,yBAAyB,2DAqBhC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pollMagicLinkConfirmation.d.ts","sourceRoot":"","sources":["../../src/handlers/pollMagicLinkConfirmation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"pollMagicLinkConfirmation.d.ts","sourceRoot":"","sources":["../../src/handlers/pollMagicLinkConfirmation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAK5C,OAAO,EAAE,yBAAyB,EAAE,MAAM,iBAAiB,CAAC;AAE5D,wBAAsB,yBAAyB,CAC7C,GAAG,EAAE,OAAO,GAAG;IAAE,aAAa,CAAC,EAAE,GAAG,CAAA;CAAE,EACtC,GAAG,EAAE,QAAQ,EACb,IAAI,EAAE,yBAAyB,2DAmDhC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"register.d.ts","sourceRoot":"","sources":["../../src/handlers/register.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"register.d.ts","sourceRoot":"","sources":["../../src/handlers/register.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAK5C,OAAO,EAAE,yBAAyB,EAAE,MAAM,iBAAiB,CAAC;AAE5D,wBAAsB,QAAQ,CAC5B,GAAG,EAAE,OAAO,EACZ,GAAG,EAAE,QAAQ,EACb,IAAI,EAAE,yBAAyB,2DAsDhC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"requestMagicLink.d.ts","sourceRoot":"","sources":["../../src/handlers/requestMagicLink.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"requestMagicLink.d.ts","sourceRoot":"","sources":["../../src/handlers/requestMagicLink.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAK5C,OAAO,EAAE,yBAAyB,EAAE,MAAM,iBAAiB,CAAC;AAE5D,wBAAsB,gBAAgB,CACpC,GAAG,EAAE,OAAO,GAAG;IAAE,aAAa,CAAC,EAAE,GAAG,CAAC;IAAC,IAAI,CAAC,EAAE,GAAG,CAAA;CAAE,EAClD,GAAG,EAAE,QAAQ,EACb,IAAI,EAAE,yBAAyB,+CA0BhC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"requestOtp.d.ts","sourceRoot":"","sources":["../../src/handlers/requestOtp.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"requestOtp.d.ts","sourceRoot":"","sources":["../../src/handlers/requestOtp.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAK5C,OAAO,EAAE,yBAAyB,EAAE,MAAM,iBAAiB,CAAC;AAE5D,wBAAsB,UAAU,CAC9B,GAAG,EAAE,OAAO,GAAG;IAAE,aAAa,CAAC,EAAE,GAAG,CAAC;IAAC,IAAI,CAAC,EAAE,GAAG,CAAA;CAAE,EAClD,GAAG,EAAE,QAAQ,EACb,IAAI,EAAE,yBAAyB,EAC/B,IAAI,EAAE,OAAO,GAAG,OAAO,+CA2BxB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sessions.d.ts","sourceRoot":"","sources":["../../src/handlers/sessions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"sessions.d.ts","sourceRoot":"","sources":["../../src/handlers/sessions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAS5C,OAAO,EAAE,yBAAyB,EAAE,MAAM,iBAAiB,CAAC;AAS5D,wBAAsB,YAAY,CAChC,GAAG,EAAE,OAAO,EACZ,GAAG,EAAE,QAAQ,EACb,IAAI,EAAE,yBAAyB,+CAWhC;AAED,wBAAsB,aAAa,CACjC,GAAG,EAAE,OAAO,EACZ,GAAG,EAAE,QAAQ,EACb,IAAI,EAAE,yBAAyB,+CAWhC;AAED,wBAAsB,iBAAiB,CACrC,GAAG,EAAE,OAAO,EACZ,GAAG,EAAE,QAAQ,EACb,IAAI,EAAE,yBAAyB,+CAWhC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"systemConfig.d.ts","sourceRoot":"","sources":["../../src/handlers/systemConfig.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"systemConfig.d.ts","sourceRoot":"","sources":["../../src/handlers/systemConfig.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAS5C,OAAO,EAAE,yBAAyB,EAAE,MAAM,iBAAiB,CAAC;AAE5D,wBAAsB,iBAAiB,CACrC,GAAG,EAAE,OAAO,EACZ,GAAG,EAAE,QAAQ,EACb,IAAI,EAAE,yBAAyB,2DAehC;AAED,wBAAsB,oBAAoB,CACxC,GAAG,EAAE,OAAO,EACZ,GAAG,EAAE,QAAQ,EACb,IAAI,EAAE,yBAAyB,2DAehC;AAED,wBAAsB,kBAAkB,CACtC,GAAG,EAAE,OAAO,EACZ,GAAG,EAAE,QAAQ,EACb,IAAI,EAAE,yBAAyB,2DAgBhC"}
|
package/dist/index.js
CHANGED
|
@@ -5,6 +5,11 @@ import cookieParser from "cookie-parser";
|
|
|
5
5
|
// src/middleware/ensureCookies.ts
|
|
6
6
|
import { ensureCookies } from "@seamless-auth/core";
|
|
7
7
|
|
|
8
|
+
// src/internal/buildForwardedClientIp.ts
|
|
9
|
+
function buildForwardedClientIp(req) {
|
|
10
|
+
return req.ip || void 0;
|
|
11
|
+
}
|
|
12
|
+
|
|
8
13
|
// src/internal/cookie.ts
|
|
9
14
|
import jwt from "jsonwebtoken";
|
|
10
15
|
function setSessionCookie(res, opts, signer) {
|
|
@@ -60,7 +65,8 @@ function createEnsureCookiesMiddleware(opts) {
|
|
|
60
65
|
serviceSecret: opts.serviceSecret,
|
|
61
66
|
issuer: opts.issuer,
|
|
62
67
|
audience: opts.audience,
|
|
63
|
-
keyId: opts.keyId
|
|
68
|
+
keyId: opts.keyId,
|
|
69
|
+
forwardedClientIp: buildForwardedClientIp(req)
|
|
64
70
|
}
|
|
65
71
|
);
|
|
66
72
|
applyResult(res, req, result, opts, cookieSigner);
|
|
@@ -107,7 +113,8 @@ async function login(req, res, opts) {
|
|
|
107
113
|
{
|
|
108
114
|
authServerUrl: opts.authServerUrl,
|
|
109
115
|
cookieDomain: opts.cookieDomain,
|
|
110
|
-
preAuthCookieName: opts.preAuthCookieName
|
|
116
|
+
preAuthCookieName: opts.preAuthCookieName,
|
|
117
|
+
forwardedClientIp: buildForwardedClientIp(req)
|
|
111
118
|
}
|
|
112
119
|
);
|
|
113
120
|
if (!cookieSigner.secret) {
|
|
@@ -162,7 +169,11 @@ async function finishLogin(req, res, opts) {
|
|
|
162
169
|
};
|
|
163
170
|
const authorization = buildServiceAuthorization(req, opts);
|
|
164
171
|
const result = await finishLoginHandler(
|
|
165
|
-
{
|
|
172
|
+
{
|
|
173
|
+
body: req.body,
|
|
174
|
+
authorization,
|
|
175
|
+
forwardedClientIp: buildForwardedClientIp(req)
|
|
176
|
+
},
|
|
166
177
|
{
|
|
167
178
|
authServerUrl: opts.authServerUrl,
|
|
168
179
|
cookieDomain: opts.cookieDomain,
|
|
@@ -375,7 +386,8 @@ async function register(req, res, opts) {
|
|
|
375
386
|
authServerUrl: opts.authServerUrl,
|
|
376
387
|
cookieDomain: opts.cookieDomain,
|
|
377
388
|
registrationCookieName: opts.registrationCookieName,
|
|
378
|
-
externalDelivery: Boolean(opts.messaging)
|
|
389
|
+
externalDelivery: Boolean(opts.messaging),
|
|
390
|
+
forwardedClientIp: buildForwardedClientIp(req)
|
|
379
391
|
}
|
|
380
392
|
);
|
|
381
393
|
if (!cookieSigner.secret) {
|
|
@@ -418,7 +430,8 @@ async function requestOtp(req, res, opts, kind) {
|
|
|
418
430
|
},
|
|
419
431
|
{
|
|
420
432
|
authServerUrl: opts.authServerUrl,
|
|
421
|
-
externalDelivery: Boolean(opts.messaging)
|
|
433
|
+
externalDelivery: Boolean(opts.messaging),
|
|
434
|
+
forwardedClientIp: buildForwardedClientIp(req)
|
|
422
435
|
}
|
|
423
436
|
);
|
|
424
437
|
if (result.error) {
|
|
@@ -460,7 +473,8 @@ async function finishRegister(req, res, opts) {
|
|
|
460
473
|
{
|
|
461
474
|
body: req.body,
|
|
462
475
|
authorization,
|
|
463
|
-
headers
|
|
476
|
+
headers,
|
|
477
|
+
forwardedClientIp: buildForwardedClientIp(req)
|
|
464
478
|
},
|
|
465
479
|
{
|
|
466
480
|
authServerUrl: opts.authServerUrl,
|
|
@@ -499,7 +513,8 @@ async function me(req, res, opts) {
|
|
|
499
513
|
const result = await meHandler({
|
|
500
514
|
authServerUrl: opts.authServerUrl,
|
|
501
515
|
preAuthCookieName: opts.preAuthCookieName,
|
|
502
|
-
authorization
|
|
516
|
+
authorization,
|
|
517
|
+
forwardedClientIp: buildForwardedClientIp(req)
|
|
503
518
|
});
|
|
504
519
|
if (result.clearCookies) {
|
|
505
520
|
for (const name of result.clearCookies) {
|
|
@@ -519,7 +534,8 @@ async function logout(req, res, opts) {
|
|
|
519
534
|
authServerUrl: opts.authServerUrl,
|
|
520
535
|
accessCookieName: opts.accessCookieName,
|
|
521
536
|
registrationCookieName: opts.registrationCookieName,
|
|
522
|
-
refreshCookieName: opts.refreshCookieName
|
|
537
|
+
refreshCookieName: opts.refreshCookieName,
|
|
538
|
+
forwardedClientIp: buildForwardedClientIp(req)
|
|
523
539
|
});
|
|
524
540
|
clearAllCookies(res, opts.cookieDomain || "", ...result.clearCookies);
|
|
525
541
|
res.status(result.status).end();
|
|
@@ -535,7 +551,10 @@ async function pollMagicLinkConfirmation(req, res, opts) {
|
|
|
535
551
|
};
|
|
536
552
|
const authorization = buildServiceAuthorization(req, opts);
|
|
537
553
|
const result = await pollMagicLinkConfirmationHandler(
|
|
538
|
-
{
|
|
554
|
+
{
|
|
555
|
+
authorization,
|
|
556
|
+
forwardedClientIp: buildForwardedClientIp(req)
|
|
557
|
+
},
|
|
539
558
|
{
|
|
540
559
|
authServerUrl: opts.authServerUrl,
|
|
541
560
|
cookieDomain: opts.cookieDomain,
|
|
@@ -575,7 +594,8 @@ async function requestMagicLink(req, res, opts) {
|
|
|
575
594
|
},
|
|
576
595
|
{
|
|
577
596
|
authServerUrl: opts.authServerUrl,
|
|
578
|
-
externalDelivery: Boolean(opts.messaging)
|
|
597
|
+
externalDelivery: Boolean(opts.messaging),
|
|
598
|
+
forwardedClientIp: buildForwardedClientIp(req)
|
|
579
599
|
}
|
|
580
600
|
);
|
|
581
601
|
if (result.error) {
|
|
@@ -615,7 +635,8 @@ var getUsers = async (req, res, opts) => handle(
|
|
|
615
635
|
res,
|
|
616
636
|
await getUsersHandler({
|
|
617
637
|
authServerUrl: opts.authServerUrl,
|
|
618
|
-
authorization: buildServiceAuthorization(req, opts)
|
|
638
|
+
authorization: buildServiceAuthorization(req, opts),
|
|
639
|
+
forwardedClientIp: buildForwardedClientIp(req)
|
|
619
640
|
})
|
|
620
641
|
);
|
|
621
642
|
var createUser = async (req, res, opts) => handle(
|
|
@@ -623,6 +644,7 @@ var createUser = async (req, res, opts) => handle(
|
|
|
623
644
|
await createUserHandler({
|
|
624
645
|
authServerUrl: opts.authServerUrl,
|
|
625
646
|
authorization: buildServiceAuthorization(req, opts),
|
|
647
|
+
forwardedClientIp: buildForwardedClientIp(req),
|
|
626
648
|
body: req.body
|
|
627
649
|
})
|
|
628
650
|
);
|
|
@@ -630,7 +652,8 @@ var deleteUser = async (req, res, opts) => handle(
|
|
|
630
652
|
res,
|
|
631
653
|
await deleteUserHandler({
|
|
632
654
|
authServerUrl: opts.authServerUrl,
|
|
633
|
-
authorization: buildServiceAuthorization(req, opts)
|
|
655
|
+
authorization: buildServiceAuthorization(req, opts),
|
|
656
|
+
forwardedClientIp: buildForwardedClientIp(req)
|
|
634
657
|
})
|
|
635
658
|
);
|
|
636
659
|
var updateUser = async (req, res, opts) => handle(
|
|
@@ -638,6 +661,7 @@ var updateUser = async (req, res, opts) => handle(
|
|
|
638
661
|
await updateUserHandler(req.params.userId, {
|
|
639
662
|
authServerUrl: opts.authServerUrl,
|
|
640
663
|
authorization: buildServiceAuthorization(req, opts),
|
|
664
|
+
forwardedClientIp: buildForwardedClientIp(req),
|
|
641
665
|
body: req.body
|
|
642
666
|
})
|
|
643
667
|
);
|
|
@@ -645,14 +669,16 @@ var getUserDetail = async (req, res, opts) => handle(
|
|
|
645
669
|
res,
|
|
646
670
|
await getUserDetailHandler(req.params.userId, {
|
|
647
671
|
authServerUrl: opts.authServerUrl,
|
|
648
|
-
authorization: buildServiceAuthorization(req, opts)
|
|
672
|
+
authorization: buildServiceAuthorization(req, opts),
|
|
673
|
+
forwardedClientIp: buildForwardedClientIp(req)
|
|
649
674
|
})
|
|
650
675
|
);
|
|
651
676
|
var getUserAnomalies = async (req, res, opts) => handle(
|
|
652
677
|
res,
|
|
653
678
|
await getUserAnomaliesHandler(req.params.userId, {
|
|
654
679
|
authServerUrl: opts.authServerUrl,
|
|
655
|
-
authorization: buildServiceAuthorization(req, opts)
|
|
680
|
+
authorization: buildServiceAuthorization(req, opts),
|
|
681
|
+
forwardedClientIp: buildForwardedClientIp(req)
|
|
656
682
|
})
|
|
657
683
|
);
|
|
658
684
|
var getAuthEvents = async (req, res, opts) => handle(
|
|
@@ -660,6 +686,7 @@ var getAuthEvents = async (req, res, opts) => handle(
|
|
|
660
686
|
await getAuthEventsHandler({
|
|
661
687
|
authServerUrl: opts.authServerUrl,
|
|
662
688
|
authorization: buildServiceAuthorization(req, opts),
|
|
689
|
+
forwardedClientIp: buildForwardedClientIp(req),
|
|
663
690
|
query: req.query
|
|
664
691
|
})
|
|
665
692
|
);
|
|
@@ -667,7 +694,8 @@ var getCredentialCount = async (req, res, opts) => handle(
|
|
|
667
694
|
res,
|
|
668
695
|
await getCredentialCountHandler({
|
|
669
696
|
authServerUrl: opts.authServerUrl,
|
|
670
|
-
authorization: buildServiceAuthorization(req, opts)
|
|
697
|
+
authorization: buildServiceAuthorization(req, opts),
|
|
698
|
+
forwardedClientIp: buildForwardedClientIp(req)
|
|
671
699
|
})
|
|
672
700
|
);
|
|
673
701
|
var listAllSessions = async (req, res, opts) => handle(
|
|
@@ -675,6 +703,7 @@ var listAllSessions = async (req, res, opts) => handle(
|
|
|
675
703
|
await listAllSessionsHandler({
|
|
676
704
|
authServerUrl: opts.authServerUrl,
|
|
677
705
|
authorization: buildServiceAuthorization(req, opts),
|
|
706
|
+
forwardedClientIp: buildForwardedClientIp(req),
|
|
678
707
|
query: req.query
|
|
679
708
|
})
|
|
680
709
|
);
|
|
@@ -682,14 +711,16 @@ var listUserSessions = async (req, res, opts) => handle(
|
|
|
682
711
|
res,
|
|
683
712
|
await listUserSessionsHandler(req.params.userId, {
|
|
684
713
|
authServerUrl: opts.authServerUrl,
|
|
685
|
-
authorization: buildServiceAuthorization(req, opts)
|
|
714
|
+
authorization: buildServiceAuthorization(req, opts),
|
|
715
|
+
forwardedClientIp: buildForwardedClientIp(req)
|
|
686
716
|
})
|
|
687
717
|
);
|
|
688
718
|
var revokeAllUserSessions = async (req, res, opts) => handle(
|
|
689
719
|
res,
|
|
690
720
|
await revokeAllUserSessionsHandler(req.params.userId, {
|
|
691
721
|
authServerUrl: opts.authServerUrl,
|
|
692
|
-
authorization: buildServiceAuthorization(req, opts)
|
|
722
|
+
authorization: buildServiceAuthorization(req, opts),
|
|
723
|
+
forwardedClientIp: buildForwardedClientIp(req)
|
|
693
724
|
})
|
|
694
725
|
);
|
|
695
726
|
|
|
@@ -705,7 +736,8 @@ async function bootstrapAdminInvite(req, res, opts) {
|
|
|
705
736
|
authServerUrl: opts.authServerUrl,
|
|
706
737
|
email: req.body.email,
|
|
707
738
|
authorization: req.headers["authorization"],
|
|
708
|
-
externalDelivery: Boolean(opts.messaging)
|
|
739
|
+
externalDelivery: Boolean(opts.messaging),
|
|
740
|
+
forwardedClientIp: buildForwardedClientIp(req)
|
|
709
741
|
});
|
|
710
742
|
if (result.error) {
|
|
711
743
|
return res.status(result.status).json({ error: result.error });
|
|
@@ -730,7 +762,8 @@ async function getAvailableRoles(req, res, opts) {
|
|
|
730
762
|
const authorization = buildServiceAuthorization(req, opts);
|
|
731
763
|
const result = await getAvailableRolesHandler({
|
|
732
764
|
authServerUrl: opts.authServerUrl,
|
|
733
|
-
authorization
|
|
765
|
+
authorization,
|
|
766
|
+
forwardedClientIp: buildForwardedClientIp(req)
|
|
734
767
|
});
|
|
735
768
|
if (result.error) {
|
|
736
769
|
return res.status(result.status).json({ error: result.error });
|
|
@@ -741,7 +774,8 @@ async function getSystemConfigAdmin(req, res, opts) {
|
|
|
741
774
|
const authorization = buildServiceAuthorization(req, opts);
|
|
742
775
|
const result = await getSystemConfigAdminHandler({
|
|
743
776
|
authServerUrl: opts.authServerUrl,
|
|
744
|
-
authorization
|
|
777
|
+
authorization,
|
|
778
|
+
forwardedClientIp: buildForwardedClientIp(req)
|
|
745
779
|
});
|
|
746
780
|
if (result.error) {
|
|
747
781
|
return res.status(result.status).json({ error: result.error });
|
|
@@ -753,7 +787,8 @@ async function updateSystemConfig(req, res, opts) {
|
|
|
753
787
|
const result = await updateSystemConfigHandler({
|
|
754
788
|
authServerUrl: opts.authServerUrl,
|
|
755
789
|
authorization,
|
|
756
|
-
payload: req.body
|
|
790
|
+
payload: req.body,
|
|
791
|
+
forwardedClientIp: buildForwardedClientIp(req)
|
|
757
792
|
});
|
|
758
793
|
if (result.error) {
|
|
759
794
|
return res.status(result.status).json({ error: result.error });
|
|
@@ -781,6 +816,7 @@ async function getAuthEventSummary(req, res, opts) {
|
|
|
781
816
|
const result = await getAuthEventSummaryHandler({
|
|
782
817
|
authServerUrl: opts.authServerUrl,
|
|
783
818
|
authorization,
|
|
819
|
+
forwardedClientIp: buildForwardedClientIp(req),
|
|
784
820
|
query: req.query
|
|
785
821
|
});
|
|
786
822
|
return handle2(res, result);
|
|
@@ -790,6 +826,7 @@ async function getAuthEventTimeseries(req, res, opts) {
|
|
|
790
826
|
const result = await getAuthEventTimeseriesHandler({
|
|
791
827
|
authServerUrl: opts.authServerUrl,
|
|
792
828
|
authorization,
|
|
829
|
+
forwardedClientIp: buildForwardedClientIp(req),
|
|
793
830
|
query: req.query
|
|
794
831
|
});
|
|
795
832
|
return handle2(res, result);
|
|
@@ -798,7 +835,8 @@ async function getLoginStats(req, res, opts) {
|
|
|
798
835
|
const authorization = buildServiceAuthorization(req, opts);
|
|
799
836
|
const result = await getLoginStatsHandler({
|
|
800
837
|
authServerUrl: opts.authServerUrl,
|
|
801
|
-
authorization
|
|
838
|
+
authorization,
|
|
839
|
+
forwardedClientIp: buildForwardedClientIp(req)
|
|
802
840
|
});
|
|
803
841
|
return handle2(res, result);
|
|
804
842
|
}
|
|
@@ -806,7 +844,8 @@ async function getSecurityAnomalies(req, res, opts) {
|
|
|
806
844
|
const authorization = buildServiceAuthorization(req, opts);
|
|
807
845
|
const result = await getSecurityAnomaliesHandler({
|
|
808
846
|
authServerUrl: opts.authServerUrl,
|
|
809
|
-
authorization
|
|
847
|
+
authorization,
|
|
848
|
+
forwardedClientIp: buildForwardedClientIp(req)
|
|
810
849
|
});
|
|
811
850
|
return handle2(res, result);
|
|
812
851
|
}
|
|
@@ -814,7 +853,8 @@ async function getDashboardMetrics(req, res, opts) {
|
|
|
814
853
|
const authorization = buildServiceAuthorization(req, opts);
|
|
815
854
|
const result = await getDashboardMetricsHandler({
|
|
816
855
|
authServerUrl: opts.authServerUrl,
|
|
817
|
-
authorization
|
|
856
|
+
authorization,
|
|
857
|
+
forwardedClientIp: buildForwardedClientIp(req)
|
|
818
858
|
});
|
|
819
859
|
return handle2(res, result);
|
|
820
860
|
}
|
|
@@ -822,7 +862,8 @@ async function getGroupedEventSummary(req, res, opts) {
|
|
|
822
862
|
const authorization = buildServiceAuthorization(req, opts);
|
|
823
863
|
const result = await getGroupedEventSummaryHandler({
|
|
824
864
|
authServerUrl: opts.authServerUrl,
|
|
825
|
-
authorization
|
|
865
|
+
authorization,
|
|
866
|
+
forwardedClientIp: buildForwardedClientIp(req)
|
|
826
867
|
});
|
|
827
868
|
return handle2(res, result);
|
|
828
869
|
}
|
|
@@ -843,7 +884,8 @@ async function listSessions(req, res, opts) {
|
|
|
843
884
|
const authorization = buildServiceAuthorization(req, opts);
|
|
844
885
|
const result = await listSessionsHandler({
|
|
845
886
|
authServerUrl: opts.authServerUrl,
|
|
846
|
-
authorization
|
|
887
|
+
authorization,
|
|
888
|
+
forwardedClientIp: buildForwardedClientIp(req)
|
|
847
889
|
});
|
|
848
890
|
return handle3(res, result);
|
|
849
891
|
}
|
|
@@ -851,7 +893,8 @@ async function revokeSession(req, res, opts) {
|
|
|
851
893
|
const authorization = buildServiceAuthorization(req, opts);
|
|
852
894
|
const result = await revokeSessionHandler(req.params.id, {
|
|
853
895
|
authServerUrl: opts.authServerUrl,
|
|
854
|
-
authorization
|
|
896
|
+
authorization,
|
|
897
|
+
forwardedClientIp: buildForwardedClientIp(req)
|
|
855
898
|
});
|
|
856
899
|
return handle3(res, result);
|
|
857
900
|
}
|
|
@@ -859,7 +902,8 @@ async function revokeAllSessions(req, res, opts) {
|
|
|
859
902
|
const authorization = buildServiceAuthorization(req, opts);
|
|
860
903
|
const result = await revokeAllSessionsHandler({
|
|
861
904
|
authServerUrl: opts.authServerUrl,
|
|
862
|
-
authorization
|
|
905
|
+
authorization,
|
|
906
|
+
forwardedClientIp: buildForwardedClientIp(req)
|
|
863
907
|
});
|
|
864
908
|
return handle3(res, result);
|
|
865
909
|
}
|
|
@@ -905,7 +949,8 @@ function createSeamlessAuthServer(opts) {
|
|
|
905
949
|
return;
|
|
906
950
|
}
|
|
907
951
|
const authorization = buildServiceAuthorization(req, resolvedOpts);
|
|
908
|
-
const
|
|
952
|
+
const forwardedClientIp = buildForwardedClientIp(req);
|
|
953
|
+
const options = method == "GET" ? { method, authorization, forwardedClientIp } : { method, authorization, forwardedClientIp, body: req.body };
|
|
909
954
|
const upstream = await authFetch(
|
|
910
955
|
`${resolvedOpts.authServerUrl}/${path}`,
|
|
911
956
|
options
|
|
@@ -925,7 +970,8 @@ function createSeamlessAuthServer(opts) {
|
|
|
925
970
|
serviceSecret: resolvedOpts.serviceSecret,
|
|
926
971
|
issuer: resolvedOpts.issuer,
|
|
927
972
|
audience: resolvedOpts.authServerUrl,
|
|
928
|
-
keyId: resolvedOpts.jwksKid
|
|
973
|
+
keyId: resolvedOpts.jwksKid,
|
|
974
|
+
forwardedClientIp: void 0
|
|
929
975
|
})
|
|
930
976
|
);
|
|
931
977
|
r.post(
|
|
@@ -983,7 +1029,10 @@ function createSeamlessAuthServer(opts) {
|
|
|
983
1029
|
r.get("/magic-link/verify/:token", async (req, res) => {
|
|
984
1030
|
const upstream = await authFetch(
|
|
985
1031
|
`${resolvedOpts.authServerUrl}/magic-link/verify/${req.params.token}`,
|
|
986
|
-
{
|
|
1032
|
+
{
|
|
1033
|
+
method: "GET",
|
|
1034
|
+
forwardedClientIp: buildForwardedClientIp(req)
|
|
1035
|
+
}
|
|
987
1036
|
);
|
|
988
1037
|
const data = await upstream.json();
|
|
989
1038
|
res.status(upstream.status).json(data);
|
|
@@ -1166,7 +1215,8 @@ async function getSeamlessUser(req, opts) {
|
|
|
1166
1215
|
authServerUrl: opts.authServerUrl,
|
|
1167
1216
|
cookieSecret: opts.cookieSecret,
|
|
1168
1217
|
cookieName: opts.accessCookieName ?? "seamless-access",
|
|
1169
|
-
authorization
|
|
1218
|
+
authorization,
|
|
1219
|
+
forwardedClientIp: buildForwardedClientIp(req)
|
|
1170
1220
|
});
|
|
1171
1221
|
}
|
|
1172
1222
|
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"buildForwardedClientIp.d.ts","sourceRoot":"","sources":["../../src/internal/buildForwardedClientIp.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAElC,wBAAgB,sBAAsB,CAAC,GAAG,EAAE,OAAO,GAAG,MAAM,GAAG,SAAS,CAEvE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ensureCookies.d.ts","sourceRoot":"","sources":["../../src/middleware/ensureCookies.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"ensureCookies.d.ts","sourceRoot":"","sources":["../../src/middleware/ensureCookies.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAM1D,MAAM,WAAW,8BAA8B;IAC7C,aAAa,EAAE,MAAM,CAAC;IACtB,YAAY,CAAC,EAAE,MAAM,CAAC;IAEtB,gBAAgB,EAAE,MAAM,CAAC;IACzB,sBAAsB,EAAE,MAAM,CAAC;IAC/B,iBAAiB,EAAE,MAAM,CAAC;IAC1B,iBAAiB,EAAE,MAAM,CAAC;IAC1B,YAAY,EAAE,MAAM,CAAC;IACrB,aAAa,EAAE,MAAM,CAAC;IACtB,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;CACf;AAED,wBAAgB,6BAA6B,CAC3C,IAAI,EAAE,8BAA8B,IAmBlC,KAAK,OAAO,EACZ,KAAK,QAAQ,EACb,MAAM,YAAY,mBA2BrB"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@seamless-auth/express",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.6",
|
|
4
4
|
"description": "Express adapter for Seamless Auth passwordless authentication",
|
|
5
5
|
"license": "AGPL-3.0-only",
|
|
6
6
|
"type": "module",
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
"express": ">=4.18.0"
|
|
40
40
|
},
|
|
41
41
|
"dependencies": {
|
|
42
|
-
"@seamless-auth/core": "^0.4.
|
|
42
|
+
"@seamless-auth/core": "^0.4.6",
|
|
43
43
|
"cookie-parser": "^1.4.6",
|
|
44
44
|
"jsonwebtoken": "^9.0.3"
|
|
45
45
|
},
|