Merge pull request #3197 from stianst/KEYCLOAK-3475
KEYCLOAK-3475 Call event handlers when initialized with tokens
This commit is contained in:
commit
a49a288bbe
1 changed files with 13 additions and 3 deletions
|
@ -160,15 +160,25 @@
|
||||||
if (loginIframe.enable) {
|
if (loginIframe.enable) {
|
||||||
setupCheckLoginIframe().success(function() {
|
setupCheckLoginIframe().success(function() {
|
||||||
checkLoginIframe().success(function () {
|
checkLoginIframe().success(function () {
|
||||||
|
kc.onAuthSuccess && kc.onAuthSuccess();
|
||||||
initPromise.setSuccess();
|
initPromise.setSuccess();
|
||||||
}).error(function () {
|
}).error(function () {
|
||||||
|
kc.onAuthError && kc.onAuthError();
|
||||||
if (initOptions.onLoad) {
|
if (initOptions.onLoad) {
|
||||||
onLoad();
|
onLoad();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
|
kc.updateToken(-1).success(function() {
|
||||||
|
kc.onAuthSuccess && kc.onAuthSuccess();
|
||||||
initPromise.setSuccess();
|
initPromise.setSuccess();
|
||||||
|
}).error(function() {
|
||||||
|
kc.onAuthError && kc.onAuthError();
|
||||||
|
if (initOptions.onLoad) {
|
||||||
|
onLoad();
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
} else if (initOptions.onLoad) {
|
} else if (initOptions.onLoad) {
|
||||||
onLoad();
|
onLoad();
|
||||||
|
@ -368,7 +378,7 @@
|
||||||
minValidity = minValidity || 5;
|
minValidity = minValidity || 5;
|
||||||
|
|
||||||
var exec = function() {
|
var exec = function() {
|
||||||
if (!kc.isTokenExpired(minValidity)) {
|
if (minValidity >= 0 && !kc.isTokenExpired(minValidity)) {
|
||||||
promise.setSuccess(false);
|
promise.setSuccess(false);
|
||||||
} else {
|
} else {
|
||||||
var params = 'grant_type=refresh_token&' + 'refresh_token=' + kc.refreshToken;
|
var params = 'grant_type=refresh_token&' + 'refresh_token=' + kc.refreshToken;
|
||||||
|
|
Loading…
Reference in a new issue