@alfabit/keycloak 0.0.8 → 0.0.9
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/package.json
CHANGED
|
@@ -45,20 +45,17 @@ const getUrl = (dontChangeRedirectUri = false, keycloakRedirectUriIsLogout: stri
|
|
|
45
45
|
const url = new URL(window.location.href);
|
|
46
46
|
const searchParams = new URLSearchParams(window.location.search);
|
|
47
47
|
|
|
48
|
-
console.log('getUrl', {
|
|
49
|
-
dontChangeRedirectUri,
|
|
50
|
-
keycloakRedirectUriIsLogout,
|
|
51
|
-
redirect_uri: searchParams.get('redirect_uri'),
|
|
52
|
-
});
|
|
53
|
-
|
|
54
48
|
if (searchParams.has('redirect_uri')) {
|
|
55
49
|
const redirectUri = searchParams.get('redirect_uri');
|
|
56
50
|
if (!!redirectUri) return redirectUri;
|
|
57
51
|
}
|
|
58
52
|
|
|
59
53
|
// если в роуте в meta есть параметр keycloakRedirectUriIsLogout - возвращаем его
|
|
60
|
-
if (!!keycloakRedirectUriIsLogout && typeof keycloakRedirectUriIsLogout === 'string') return keycloakRedirectUriIsLogout
|
|
54
|
+
if (!!keycloakRedirectUriIsLogout && typeof keycloakRedirectUriIsLogout === 'string') return `${locale.value}/${keycloakRedirectUriIsLogout}`;
|
|
61
55
|
|
|
56
|
+
console.log({
|
|
57
|
+
dontChangeRedirectUri,
|
|
58
|
+
});
|
|
62
59
|
// если в $route.meta (который передаем из родительского приложения) есть параметр dontChangeRedirectUri - то из адреса ну нужно удалять или добавлять /user
|
|
63
60
|
// если нет - то ничего не делать
|
|
64
61
|
|
|
@@ -176,6 +173,12 @@ export const getAuthMethods = ({ dontChangeRedirectUri = ref(false), keycloakRed
|
|
|
176
173
|
if (keycloak.value) {
|
|
177
174
|
clearTokens();
|
|
178
175
|
setTimeout(() => {
|
|
176
|
+
console.log('logout', {
|
|
177
|
+
keycloakRedirectUriIsLogout: keycloakRedirectUriIsLogout.value,
|
|
178
|
+
dontChangeRedirectUri: dontChangeRedirectUri.value,
|
|
179
|
+
redirectUri: redirectUri ?? getUrl(dontChangeRedirectUri.value, keycloakRedirectUriIsLogout.value),
|
|
180
|
+
});
|
|
181
|
+
|
|
179
182
|
keycloak.value &&
|
|
180
183
|
keycloak.value.logout({
|
|
181
184
|
redirectUri: redirectUri ?? getUrl(dontChangeRedirectUri.value, keycloakRedirectUriIsLogout.value),
|
|
@@ -347,6 +350,10 @@ export async function initKeycloak() {
|
|
|
347
350
|
clientId: OPENID_CLIENT_ID,
|
|
348
351
|
});
|
|
349
352
|
|
|
353
|
+
console.log({
|
|
354
|
+
keycloak: keycloak.value,
|
|
355
|
+
});
|
|
356
|
+
|
|
350
357
|
const isNeedAuth = !!getToken() && !isRtExp();
|
|
351
358
|
|
|
352
359
|
// window.opener - если находимся в popup (но не в passport), то 100% уже авторизованы и можно поставить login-required
|