Merge pull request #3197 from stianst/KEYCLOAK-3475

KEYCLOAK-3475 Call event handlers when initialized with tokens
This commit is contained in:
Stian Thorgersen 2016-09-06 11:32:03 +02:00 committed by GitHub
commit a49a288bbe

View file

@ -160,15 +160,25 @@
if (loginIframe.enable) {
setupCheckLoginIframe().success(function() {
checkLoginIframe().success(function () {
kc.onAuthSuccess && kc.onAuthSuccess();
initPromise.setSuccess();
}).error(function () {
kc.onAuthError && kc.onAuthError();
if (initOptions.onLoad) {
onLoad();
}
});
});
} else {
kc.updateToken(-1).success(function() {
kc.onAuthSuccess && kc.onAuthSuccess();
initPromise.setSuccess();
}).error(function() {
kc.onAuthError && kc.onAuthError();
if (initOptions.onLoad) {
onLoad();
}
});
}
} else if (initOptions.onLoad) {
onLoad();
@ -368,7 +378,7 @@
minValidity = minValidity || 5;
var exec = function() {
if (!kc.isTokenExpired(minValidity)) {
if (minValidity >= 0 && !kc.isTokenExpired(minValidity)) {
promise.setSuccess(false);
} else {
var params = 'grant_type=refresh_token&' + 'refresh_token=' + kc.refreshToken;