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) {
|
||||
setupCheckLoginIframe().success(function() {
|
||||
checkLoginIframe().success(function () {
|
||||
kc.onAuthSuccess && kc.onAuthSuccess();
|
||||
initPromise.setSuccess();
|
||||
}).error(function () {
|
||||
kc.onAuthError && kc.onAuthError();
|
||||
if (initOptions.onLoad) {
|
||||
onLoad();
|
||||
}
|
||||
});
|
||||
});
|
||||
} else {
|
||||
initPromise.setSuccess();
|
||||
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;
|
||||
|
@ -1056,7 +1066,7 @@
|
|||
if (!(this instanceof CookieStorage)) {
|
||||
return new CookieStorage();
|
||||
}
|
||||
|
||||
|
||||
var cs = this;
|
||||
|
||||
cs.get = function(state) {
|
||||
|
|
Loading…
Reference in a new issue