KEYCLOAK-2617 Ignore postmessages if not initiated by keycloak.js
This commit is contained in:
parent
450b57c76a
commit
f3a780cc2d
1 changed files with 16 additions and 2 deletions
|
@ -39,7 +39,7 @@
|
||||||
storage = new PersistentStorage();
|
storage = new PersistentStorage();
|
||||||
|
|
||||||
if (initOptions && initOptions.adapter === 'cordova') {
|
if (initOptions && initOptions.adapter === 'cordova') {
|
||||||
adapter = loadAdapter('cordova');
|
adapter = loadAdapter('cordova');
|
||||||
} else if (initOptions && initOptions.adapter === 'default') {
|
} else if (initOptions && initOptions.adapter === 'default') {
|
||||||
adapter = loadAdapter();
|
adapter = loadAdapter();
|
||||||
} else {
|
} else {
|
||||||
|
@ -792,8 +792,22 @@
|
||||||
if (event.origin !== loginIframe.iframeOrigin) {
|
if (event.origin !== loginIframe.iframeOrigin) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
var data = JSON.parse(event.data);
|
|
||||||
|
try {
|
||||||
|
var data = JSON.parse(event.data);
|
||||||
|
} catch (err) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!data.callbackId) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
var promise = loginIframe.callbackMap[data.callbackId];
|
var promise = loginIframe.callbackMap[data.callbackId];
|
||||||
|
if (!promise) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
delete loginIframe.callbackMap[data.callbackId];
|
delete loginIframe.callbackMap[data.callbackId];
|
||||||
|
|
||||||
if ((!kc.sessionId || kc.sessionId == data.session) && data.loggedIn) {
|
if ((!kc.sessionId || kc.sessionId == data.session) && data.loggedIn) {
|
||||||
|
|
Loading…
Reference in a new issue