@travetto/auth-web-passport 7.0.0-rc.3 → 7.0.0-rc.5
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 +6 -6
- package/src/util.ts +4 -4
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@travetto/auth-web-passport",
|
|
3
|
-
"version": "7.0.0-rc.
|
|
3
|
+
"version": "7.0.0-rc.5",
|
|
4
4
|
"description": "Web authentication integration support for the Travetto framework",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"authentication",
|
|
@@ -26,11 +26,11 @@
|
|
|
26
26
|
"directory": "module/auth-web-passport"
|
|
27
27
|
},
|
|
28
28
|
"dependencies": {
|
|
29
|
-
"@travetto/auth": "^7.0.0-rc.
|
|
30
|
-
"@travetto/auth-web": "^7.0.0-rc.
|
|
31
|
-
"@travetto/config": "^7.0.0-rc.
|
|
32
|
-
"@travetto/web": "^7.0.0-rc.
|
|
33
|
-
"@travetto/web-connect": "^7.0.0-rc.
|
|
29
|
+
"@travetto/auth": "^7.0.0-rc.4",
|
|
30
|
+
"@travetto/auth-web": "^7.0.0-rc.5",
|
|
31
|
+
"@travetto/config": "^7.0.0-rc.4",
|
|
32
|
+
"@travetto/web": "^7.0.0-rc.5",
|
|
33
|
+
"@travetto/web-connect": "^7.0.0-rc.5",
|
|
34
34
|
"@types/passport": "^1.0.17",
|
|
35
35
|
"passport": "^0.7.0"
|
|
36
36
|
},
|
package/src/util.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { WebFilterContext, WebRequest } from '@travetto/web';
|
|
2
|
-
import { castTo,
|
|
2
|
+
import { castTo, JSONUtil } from '@travetto/runtime';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* Passport utilities
|
|
@@ -16,7 +16,7 @@ export class PassportUtil {
|
|
|
16
16
|
input?.context.httpQuery?.state : ''));
|
|
17
17
|
if (state) {
|
|
18
18
|
try {
|
|
19
|
-
return
|
|
19
|
+
return JSONUtil.parseBase64(state);
|
|
20
20
|
} catch { }
|
|
21
21
|
}
|
|
22
22
|
}
|
|
@@ -28,7 +28,7 @@ export class PassportUtil {
|
|
|
28
28
|
*/
|
|
29
29
|
static writeState(state?: Record<string, unknown>): string | undefined {
|
|
30
30
|
if (state) {
|
|
31
|
-
return
|
|
31
|
+
return JSONUtil.stringifyBase64(state);
|
|
32
32
|
}
|
|
33
33
|
}
|
|
34
34
|
|
|
@@ -41,7 +41,7 @@ export class PassportUtil {
|
|
|
41
41
|
*/
|
|
42
42
|
static addToState(state: string | Record<string, unknown>, current?: string | WebRequest, key?: string): string {
|
|
43
43
|
const original = this.readState(current) ?? {};
|
|
44
|
-
const toAdd = typeof state === 'string' ?
|
|
44
|
+
const toAdd: Record<string, unknown> = typeof state === 'string' ? JSONUtil.parseSafe(state) : state;
|
|
45
45
|
const base: Record<string, unknown> = key ? castTo(original[key] ??= {}) : original;
|
|
46
46
|
for (const property of Object.keys(toAdd)) {
|
|
47
47
|
if (property === '__proto__' || property === 'constructor' || property === 'prototype') {
|