@ts-core/oauth 3.0.23 → 3.0.24
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/cjs/OAuthBase.d.ts +1 -1
- package/cjs/OAuthBase.js +11 -1
- package/cjs/external/backend.js +9 -1
- package/esm/OAuthBase.d.ts +1 -1
- package/esm/OAuthBase.js +12 -2
- package/esm/external/backend.js +9 -1
- package/package.json +1 -1
package/cjs/OAuthBase.d.ts
CHANGED
package/cjs/OAuthBase.js
CHANGED
|
@@ -25,7 +25,17 @@ class OAuthBase extends common_1.LoggerWrapper {
|
|
|
25
25
|
};
|
|
26
26
|
this.messageHandler = (event) => this.parsePopUpResult(this.popUpMessageParser(event));
|
|
27
27
|
this.browserInternalMessageHandler = (event) => {
|
|
28
|
-
|
|
28
|
+
if (event.origin !== this.getOriginUrl()) {
|
|
29
|
+
return null;
|
|
30
|
+
}
|
|
31
|
+
let data = event.data;
|
|
32
|
+
if (!_.isObject(data)) {
|
|
33
|
+
return null;
|
|
34
|
+
}
|
|
35
|
+
if (!common_1.ObjectUtil.hasOwnProperty(data, 'oAuthCodeOrToken') && !common_1.ObjectUtil.hasOwnProperty(data, 'oAuthError')) {
|
|
36
|
+
return null;
|
|
37
|
+
}
|
|
38
|
+
return data;
|
|
29
39
|
};
|
|
30
40
|
this.http = new common_1.TransportHttp(logger, { method: 'get' });
|
|
31
41
|
this.subject = new rxjs_1.Subject();
|
package/cjs/external/backend.js
CHANGED
|
@@ -10,11 +10,19 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
exports.OAuthBackendPropertiesSet = void 0;
|
|
13
|
+
const OAuthBase_1 = require("../OAuthBase");
|
|
13
14
|
const common_1 = require("@ts-core/common");
|
|
14
15
|
const rxjs_1 = require("rxjs");
|
|
16
|
+
const _ = require("lodash");
|
|
15
17
|
const OAuthBackendPropertiesSet = (item, redirectUri, method, timeout = common_1.DateUtil.MILLISECONDS_SECOND) => {
|
|
16
18
|
item.redirectUri = redirectUri;
|
|
17
19
|
item.isRejectWhenPopUpClosed = false;
|
|
18
|
-
item.popUpClosed.pipe((0, rxjs_1.delay)(timeout), (0, rxjs_1.takeUntil)(item.destroyed)).subscribe(() => __awaiter(void 0, void 0, void 0, function* () {
|
|
20
|
+
item.popUpClosed.pipe((0, rxjs_1.delay)(timeout), (0, rxjs_1.takeUntil)(item.destroyed)).subscribe(() => __awaiter(void 0, void 0, void 0, function* () {
|
|
21
|
+
let data = yield method(item.state);
|
|
22
|
+
if (_.isEmpty(data)) {
|
|
23
|
+
data = { oAuthError: OAuthBase_1.OAuthBase.ERROR_WINDOW_CLOSED, oAuthCodeOrToken: null };
|
|
24
|
+
}
|
|
25
|
+
item.parsePopUpResult(data);
|
|
26
|
+
}));
|
|
19
27
|
};
|
|
20
28
|
exports.OAuthBackendPropertiesSet = OAuthBackendPropertiesSet;
|
package/esm/OAuthBase.d.ts
CHANGED
package/esm/OAuthBase.js
CHANGED
|
@@ -7,7 +7,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
7
7
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
8
|
});
|
|
9
9
|
};
|
|
10
|
-
import { PromiseHandler, DateUtil, ObservableData, LoggerWrapper, TransportHttp, RandomUtil } from "@ts-core/common";
|
|
10
|
+
import { PromiseHandler, DateUtil, ObservableData, LoggerWrapper, TransportHttp, RandomUtil, ObjectUtil } from "@ts-core/common";
|
|
11
11
|
import * as _ from 'lodash';
|
|
12
12
|
import { filter, map, Subject } from "rxjs";
|
|
13
13
|
export class OAuthBase extends LoggerWrapper {
|
|
@@ -22,7 +22,17 @@ export class OAuthBase extends LoggerWrapper {
|
|
|
22
22
|
};
|
|
23
23
|
this.messageHandler = (event) => this.parsePopUpResult(this.popUpMessageParser(event));
|
|
24
24
|
this.browserInternalMessageHandler = (event) => {
|
|
25
|
-
|
|
25
|
+
if (event.origin !== this.getOriginUrl()) {
|
|
26
|
+
return null;
|
|
27
|
+
}
|
|
28
|
+
let data = event.data;
|
|
29
|
+
if (!_.isObject(data)) {
|
|
30
|
+
return null;
|
|
31
|
+
}
|
|
32
|
+
if (!ObjectUtil.hasOwnProperty(data, 'oAuthCodeOrToken') && !ObjectUtil.hasOwnProperty(data, 'oAuthError')) {
|
|
33
|
+
return null;
|
|
34
|
+
}
|
|
35
|
+
return data;
|
|
26
36
|
};
|
|
27
37
|
this.http = new TransportHttp(logger, { method: 'get' });
|
|
28
38
|
this.subject = new Subject();
|
package/esm/external/backend.js
CHANGED
|
@@ -7,10 +7,18 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
7
7
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
8
|
});
|
|
9
9
|
};
|
|
10
|
+
import { OAuthBase } from '../OAuthBase';
|
|
10
11
|
import { DateUtil } from '@ts-core/common';
|
|
11
12
|
import { delay, takeUntil } from 'rxjs';
|
|
13
|
+
import * as _ from 'lodash';
|
|
12
14
|
export const OAuthBackendPropertiesSet = (item, redirectUri, method, timeout = DateUtil.MILLISECONDS_SECOND) => {
|
|
13
15
|
item.redirectUri = redirectUri;
|
|
14
16
|
item.isRejectWhenPopUpClosed = false;
|
|
15
|
-
item.popUpClosed.pipe(delay(timeout), takeUntil(item.destroyed)).subscribe(() => __awaiter(void 0, void 0, void 0, function* () {
|
|
17
|
+
item.popUpClosed.pipe(delay(timeout), takeUntil(item.destroyed)).subscribe(() => __awaiter(void 0, void 0, void 0, function* () {
|
|
18
|
+
let data = yield method(item.state);
|
|
19
|
+
if (_.isEmpty(data)) {
|
|
20
|
+
data = { oAuthError: OAuthBase.ERROR_WINDOW_CLOSED, oAuthCodeOrToken: null };
|
|
21
|
+
}
|
|
22
|
+
item.parsePopUpResult(data);
|
|
23
|
+
}));
|
|
16
24
|
};
|