@things-factory/auth-base 6.2.38 → 6.2.44

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@things-factory/auth-base",
3
- "version": "6.2.38",
3
+ "version": "6.2.44",
4
4
  "main": "dist-server/index.js",
5
5
  "browser": "dist-client/index.js",
6
6
  "things-factory": true,
@@ -30,10 +30,10 @@
30
30
  "migration:create": "node ../../node_modules/typeorm/cli.js migration:create -d ./server/migrations"
31
31
  },
32
32
  "dependencies": {
33
- "@things-factory/email-base": "^6.2.34",
33
+ "@things-factory/email-base": "^6.2.44",
34
34
  "@things-factory/env": "^6.2.33",
35
- "@things-factory/i18n-base": "^6.2.34",
36
- "@things-factory/shell": "^6.2.34",
35
+ "@things-factory/i18n-base": "^6.2.44",
36
+ "@things-factory/shell": "^6.2.44",
37
37
  "@things-factory/utils": "^6.2.33",
38
38
  "jsonwebtoken": "^9.0.0",
39
39
  "koa-passport": "^6.0.0",
@@ -43,5 +43,5 @@
43
43
  "passport-local": "^1.0.0",
44
44
  "popsicle-cookie-jar": "^1.0.0"
45
45
  },
46
- "gitHead": "df14ab133528fadeb146f3dc2652f499df30a918"
46
+ "gitHead": "a2a1ebf823f6b1315e751b12a01372e9a867d7af"
47
47
  }
@@ -75,9 +75,24 @@ export class ApplicationQuery {
75
75
  }
76
76
 
77
77
  function buildAuthURL(pathname: string, context: ResolverContext): string {
78
- const { origin } = context.request
79
- let url: URL = new URL(origin)
80
- url.protocol = protocol || url.protocol
78
+ const originalProtocol = context.headers['x-forwarded-proto']
79
+ const originalHost = context.headers['x-forwarded-host']
80
+ const originalPort = context.headers['x-forwarded-port']
81
+
82
+ if (originalProtocol && originalHost) {
83
+ var url: URL = new URL(`${originalProtocol}://${originalHost}`)
84
+ if (originalPort) {
85
+ url.port = originalPort
86
+ }
87
+ } else {
88
+ var url: URL = new URL(context.request.origin)
89
+ }
90
+
91
+ if (protocol) {
92
+ url.protocol = protocol
93
+ }
94
+
81
95
  url.pathname = pathname
96
+
82
97
  return url.href
83
98
  }