@valtimo/keycloak 0.0.0

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.
Files changed (33) hide show
  1. package/fesm2022/valtimo-keycloak.mjs +571 -0
  2. package/fesm2022/valtimo-keycloak.mjs.map +1 -0
  3. package/index.d.ts +6 -0
  4. package/lib/callback.component.d.ts +14 -0
  5. package/lib/callback.component.d.ts.map +1 -0
  6. package/lib/constants/index.d.ts +2 -0
  7. package/lib/constants/index.d.ts.map +1 -0
  8. package/lib/constants/storage-keys.d.ts +8 -0
  9. package/lib/constants/storage-keys.d.ts.map +1 -0
  10. package/lib/keycloak-routing.module.d.ts +9 -0
  11. package/lib/keycloak-routing.module.d.ts.map +1 -0
  12. package/lib/keycloak.init.d.ts +3 -0
  13. package/lib/keycloak.init.d.ts.map +1 -0
  14. package/lib/keycloak.module.d.ts +11 -0
  15. package/lib/keycloak.module.d.ts.map +1 -0
  16. package/lib/models/index.d.ts +2 -0
  17. package/lib/models/index.d.ts.map +1 -0
  18. package/lib/models/keycloak.config.d.ts +6 -0
  19. package/lib/models/keycloak.config.d.ts.map +1 -0
  20. package/lib/services/index.d.ts +5 -0
  21. package/lib/services/index.d.ts.map +1 -0
  22. package/lib/services/keycloak-auth-guard.service.d.ts +14 -0
  23. package/lib/services/keycloak-auth-guard.service.d.ts.map +1 -0
  24. package/lib/services/keycloak-options.service.d.ts +12 -0
  25. package/lib/services/keycloak-options.service.d.ts.map +1 -0
  26. package/lib/services/keycloak-storage.service.d.ts +11 -0
  27. package/lib/services/keycloak-storage.service.d.ts.map +1 -0
  28. package/lib/services/keycloak-user.service.d.ts +50 -0
  29. package/lib/services/keycloak-user.service.d.ts.map +1 -0
  30. package/package.json +27 -0
  31. package/public_api.d.ts +9 -0
  32. package/public_api.d.ts.map +1 -0
  33. package/valtimo-keycloak.d.ts.map +1 -0
@@ -0,0 +1,571 @@
1
+ import * as i0 from '@angular/core';
2
+ import { Injectable, Component, NgModule } from '@angular/core';
3
+ import * as i2 from 'keycloak-angular';
4
+ import { KeycloakAuthGuard, KeycloakEventTypeLegacy, KeycloakAngularModule, KeycloakService } from 'keycloak-angular';
5
+ import * as i1 from '@angular/router';
6
+ import { RouterModule } from '@angular/router';
7
+ import * as i3 from 'ngx-logger';
8
+ import { NGXLogger } from 'ngx-logger';
9
+ import * as i1$1 from '@valtimo/shared';
10
+ import { ValtimoUserIdentity } from '@valtimo/shared';
11
+ import { Subject, ReplaySubject, timer, switchMap, combineLatest } from 'rxjs';
12
+ import { jwtDecode } from 'jwt-decode';
13
+ import { take } from 'rxjs/operators';
14
+ import * as i4 from '@valtimo/components';
15
+ import * as i5 from '@ngx-translate/core';
16
+ import { TranslateModule } from '@ngx-translate/core';
17
+ import * as i6 from '@angular/common';
18
+ import { CommonModule, DatePipe } from '@angular/common';
19
+
20
+ /*
21
+ * Copyright 2015-2025 Ritense BV, the Netherlands.
22
+ *
23
+ * Licensed under EUPL, Version 1.2 (the "License");
24
+ * you may not use this file except in compliance with the License.
25
+ * You may obtain a copy of the License at
26
+ *
27
+ * https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12
28
+ *
29
+ * Unless required by applicable law or agreed to in writing, software
30
+ * distributed under the License is distributed on an "AS IS" basis,
31
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
32
+ * See the License for the specific language governing permissions and
33
+ * limitations under the License.
34
+ */
35
+
36
+ /*
37
+ * Copyright 2015-2025 Ritense BV, the Netherlands.
38
+ *
39
+ * Licensed under EUPL, Version 1.2 (the "License");
40
+ * you may not use this file except in compliance with the License.
41
+ * You may obtain a copy of the License at
42
+ *
43
+ * https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12
44
+ *
45
+ * Unless required by applicable law or agreed to in writing, software
46
+ * distributed under the License is distributed on an "AS IS" basis,
47
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
48
+ * See the License for the specific language governing permissions and
49
+ * limitations under the License.
50
+ */
51
+
52
+ /*
53
+ * Copyright 2015-2025 Ritense BV, the Netherlands.
54
+ *
55
+ * Licensed under EUPL, Version 1.2 (the "License");
56
+ * you may not use this file except in compliance with the License.
57
+ * You may obtain a copy of the License at
58
+ *
59
+ * https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12
60
+ *
61
+ * Unless required by applicable law or agreed to in writing, software
62
+ * distributed under the License is distributed on an "AS IS" basis,
63
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
64
+ * See the License for the specific language governing permissions and
65
+ * limitations under the License.
66
+ */
67
+ const STORAGE_KEYS = {
68
+ urlBeforeExpiration: 'urlBeforeExpiration',
69
+ urlBeforeExpirationParams: 'urlBeforeExpirationParams',
70
+ redirectTo: 'redirectTo',
71
+ redirectToParams: 'redirectToParams',
72
+ };
73
+
74
+ /*
75
+ * Copyright 2015-2025 Ritense BV, the Netherlands.
76
+ *
77
+ * Licensed under EUPL, Version 1.2 (the "License");
78
+ * you may not use this file except in compliance with the License.
79
+ * You may obtain a copy of the License at
80
+ *
81
+ * https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12
82
+ *
83
+ * Unless required by applicable law or agreed to in writing, software
84
+ * distributed under the License is distributed on an "AS IS" basis,
85
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
86
+ * See the License for the specific language governing permissions and
87
+ * limitations under the License.
88
+ */
89
+
90
+ /*
91
+ * Copyright 2015-2025 Ritense BV, the Netherlands.
92
+ *
93
+ * Licensed under EUPL, Version 1.2 (the "License");
94
+ * you may not use this file except in compliance with the License.
95
+ * You may obtain a copy of the License at
96
+ *
97
+ * https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12
98
+ *
99
+ * Unless required by applicable law or agreed to in writing, software
100
+ * distributed under the License is distributed on an "AS IS" basis,
101
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
102
+ * See the License for the specific language governing permissions and
103
+ * limitations under the License.
104
+ */
105
+ class KeycloakAuthGuardService extends KeycloakAuthGuard {
106
+ constructor(router, keycloakAngular, logger) {
107
+ super(router, keycloakAngular);
108
+ this.router = router;
109
+ this.keycloakAngular = keycloakAngular;
110
+ this.logger = logger;
111
+ this.logger.debug('KeycloakAuthGuardService: ctor');
112
+ }
113
+ isAccessAllowed(route, state) {
114
+ this.logger.debug('KeycloakAuthGuardService: isAccessAllowed');
115
+ return new Promise((resolve, reject) => {
116
+ this.logger.debug('KeycloakAuthGuardService: isAccessAllowed checking access');
117
+ if (!this.authenticated) {
118
+ this.keycloakAngular
119
+ .login()
120
+ .catch(e => `KeycloakAuthGuardService error: ${this.logger.error(e)}`);
121
+ return reject(false);
122
+ }
123
+ const requiredRoles = route.data.roles;
124
+ if (!requiredRoles || requiredRoles.length === 0) {
125
+ return resolve(true);
126
+ }
127
+ if (!this.roles || this.roles.length === 0) {
128
+ resolve(false);
129
+ }
130
+ resolve(requiredRoles.some(role => this.roles.includes(role)));
131
+ });
132
+ }
133
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.17", ngImport: i0, type: KeycloakAuthGuardService, deps: [{ token: i1.Router }, { token: i2.KeycloakService }, { token: i3.NGXLogger }], target: i0.ɵɵFactoryTarget.Injectable }); }
134
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.17", ngImport: i0, type: KeycloakAuthGuardService, providedIn: 'root' }); }
135
+ }
136
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.17", ngImport: i0, type: KeycloakAuthGuardService, decorators: [{
137
+ type: Injectable,
138
+ args: [{
139
+ providedIn: 'root',
140
+ }]
141
+ }], ctorParameters: () => [{ type: i1.Router }, { type: i2.KeycloakService }, { type: i3.NGXLogger }] });
142
+
143
+ class KeycloakOptionsService {
144
+ constructor(configService) {
145
+ this.configService = configService;
146
+ this.valtimoKeycloakOptions = configService.config.authentication.options;
147
+ }
148
+ get keycloakOptions() {
149
+ return this.valtimoKeycloakOptions.keycloakOptions;
150
+ }
151
+ get logoutRedirectUri() {
152
+ return this.valtimoKeycloakOptions.logoutRedirectUri;
153
+ }
154
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.17", ngImport: i0, type: KeycloakOptionsService, deps: [{ token: i1$1.ConfigService }], target: i0.ɵɵFactoryTarget.Injectable }); }
155
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.17", ngImport: i0, type: KeycloakOptionsService, providedIn: 'root' }); }
156
+ }
157
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.17", ngImport: i0, type: KeycloakOptionsService, decorators: [{
158
+ type: Injectable,
159
+ args: [{
160
+ providedIn: 'root',
161
+ }]
162
+ }], ctorParameters: () => [{ type: i1$1.ConfigService }] });
163
+
164
+ /*
165
+ * Copyright 2015-2025 Ritense BV, the Netherlands.
166
+ *
167
+ * Licensed under EUPL, Version 1.2 (the "License");
168
+ * you may not use this file except in compliance with the License.
169
+ * You may obtain a copy of the License at
170
+ *
171
+ * https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12
172
+ *
173
+ * Unless required by applicable law or agreed to in writing, software
174
+ * distributed under the License is distributed on an "AS IS" basis,
175
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
176
+ * See the License for the specific language governing permissions and
177
+ * limitations under the License.
178
+ */
179
+ class KeycloakStorageService {
180
+ getCurrentUrlParams() {
181
+ const urlSearchParams = new URLSearchParams(window.location.search);
182
+ const params = Object.fromEntries(urlSearchParams.entries());
183
+ return JSON.stringify(params);
184
+ }
185
+ getCurrentUrl() {
186
+ return window.location.pathname;
187
+ }
188
+ parseSavedParams(savedParams) {
189
+ return ((savedParams &&
190
+ typeof savedParams === 'string' &&
191
+ savedParams.length > 2 &&
192
+ JSON.parse(savedParams)) ||
193
+ {});
194
+ }
195
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.17", ngImport: i0, type: KeycloakStorageService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
196
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.17", ngImport: i0, type: KeycloakStorageService, providedIn: 'root' }); }
197
+ }
198
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.17", ngImport: i0, type: KeycloakStorageService, decorators: [{
199
+ type: Injectable,
200
+ args: [{
201
+ providedIn: 'root',
202
+ }]
203
+ }] });
204
+
205
+ /*
206
+ * Copyright 2015-2025 Ritense BV, the Netherlands.
207
+ *
208
+ * Licensed under EUPL, Version 1.2 (the "License");
209
+ * you may not use this file except in compliance with the License.
210
+ * You may obtain a copy of the License at
211
+ *
212
+ * https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12
213
+ *
214
+ * Unless required by applicable law or agreed to in writing, software
215
+ * distributed under the License is distributed on an "AS IS" basis,
216
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
217
+ * See the License for the specific language governing permissions and
218
+ * limitations under the License.
219
+ */
220
+ class KeycloakUserService {
221
+ constructor(keycloakService, keycloakOptionsService, logger, promptService, translateService, datePipe, configService, router, keycloakStorageService) {
222
+ this.keycloakService = keycloakService;
223
+ this.keycloakOptionsService = keycloakOptionsService;
224
+ this.logger = logger;
225
+ this.promptService = promptService;
226
+ this.translateService = translateService;
227
+ this.datePipe = datePipe;
228
+ this.configService = configService;
229
+ this.router = router;
230
+ this.keycloakStorageService = keycloakStorageService;
231
+ this._refreshToken$ = new Subject();
232
+ this.FIVE_MINUTES_MS = 300000;
233
+ this.EXPIRE_TOKEN_CONFIRMATION = 'EXPIRE_TOKEN_CONFIRMATION';
234
+ this.openTokenRefreshSubscription();
235
+ this.openRefreshTokenSubscription();
236
+ }
237
+ ngOnDestroy() {
238
+ this.tokenRefreshSubscription?.unsubscribe();
239
+ this.refreshTokenSubscription?.unsubscribe();
240
+ this.closeExpiryTimerSubscription();
241
+ }
242
+ init() {
243
+ this.userIdentity = new ReplaySubject();
244
+ this.keycloakService.loadUserProfile().then(user => {
245
+ this.logger.debug('KeycloakUserService: loadUserProfile = ', user);
246
+ const roles = [];
247
+ this.keycloakService.getUserRoles(true).forEach(role => roles.push(role));
248
+ const valtimoUserIdentity = new ValtimoUserIdentity(user.email, user.firstName, user.lastName, roles, user.username, user.id);
249
+ this.logger.debug('KeycloakUserService: loaded user identity', valtimoUserIdentity);
250
+ this.userIdentity.next(valtimoUserIdentity);
251
+ });
252
+ this.setRefreshToken();
253
+ }
254
+ getUserSubject() {
255
+ this.logger.debug('KeycloakUserService: getUserIdentity');
256
+ return this.userIdentity;
257
+ }
258
+ logout() {
259
+ this.logger.debug('KeycloakUserService: logout');
260
+ this.keycloakService.logout(this.keycloakOptionsService.logoutRedirectUri);
261
+ }
262
+ async getToken() {
263
+ this.logger.debug('KeycloakUserService: getToken');
264
+ return this.keycloakService.getToken();
265
+ }
266
+ async updateToken(minValidity) {
267
+ this.logger.debug('KeycloakUserService: updateToken');
268
+ return this.keycloakService.updateToken(minValidity);
269
+ }
270
+ openTokenRefreshSubscription() {
271
+ this.tokenRefreshSubscription = this.keycloakService.keycloakEvents$.subscribe(keycloakEvent => {
272
+ if (keycloakEvent.type === KeycloakEventTypeLegacy.OnAuthRefreshSuccess) {
273
+ this.setRefreshToken();
274
+ }
275
+ });
276
+ }
277
+ get _expiryTimeMs() {
278
+ return this._tokenExp - Date.now() - 1000;
279
+ }
280
+ openRefreshTokenSubscription() {
281
+ this.refreshTokenSubscription = this._refreshToken$.subscribe(refreshToken => {
282
+ const decodedRefreshToken = jwtDecode(refreshToken);
283
+ this._tokenExp = decodedRefreshToken.exp * 1000;
284
+ this.closeExpiryTimerSubscription();
285
+ this.openExpiryTimerSubscription();
286
+ });
287
+ }
288
+ setRefreshToken() {
289
+ const refreshToken = this.keycloakService.getKeycloakInstance()?.refreshToken;
290
+ if (refreshToken)
291
+ this._refreshToken$.next(refreshToken);
292
+ }
293
+ openExpiryTimerSubscription() {
294
+ this.expiryTimerSubscription = timer(0, 1000)
295
+ .pipe(switchMap(() => {
296
+ if (this._expiryTimeMs <= this.FIVE_MINUTES_MS) {
297
+ this._counter = new Date(0, 0, 0, 0, 0, 0);
298
+ this._counter.setSeconds(this._expiryTimeMs / 1000);
299
+ }
300
+ return combineLatest([
301
+ this.promptService.promptVisible$,
302
+ this.translateService.stream('keycloak.expiryPromptTitle'),
303
+ this.translateService.stream('keycloak.expiryPromptDescription', {
304
+ expiryTime: this.datePipe.transform(this._counter, 'mm:ss'),
305
+ }),
306
+ this.translateService.stream('keycloak.expiryPromptCancel'),
307
+ this.translateService.stream('keycloak.expiryPromptConfirm'),
308
+ ]);
309
+ }))
310
+ .subscribe(([promptVisible, headerText, bodyText, cancelButtonText, confirmButtonText]) => {
311
+ this.promptService.identifier$.pipe(take(1)).subscribe(identifier => {
312
+ if ((!promptVisible || identifier !== this.EXPIRE_TOKEN_CONFIRMATION) &&
313
+ this._expiryTimeMs <= this.FIVE_MINUTES_MS) {
314
+ this.openConfirmationPrompt(headerText, bodyText, cancelButtonText, confirmButtonText);
315
+ }
316
+ if (promptVisible && identifier === this.EXPIRE_TOKEN_CONFIRMATION) {
317
+ this.promptService.setBodyText(bodyText);
318
+ }
319
+ });
320
+ if (this._expiryTimeMs < 2000) {
321
+ this.saveUrl();
322
+ this.logout();
323
+ }
324
+ });
325
+ }
326
+ closeExpiryTimerSubscription() {
327
+ this.expiryTimerSubscription?.unsubscribe();
328
+ }
329
+ openConfirmationPrompt(headerText, bodyText, cancelButtonText, confirmButtonText) {
330
+ this.promptService.openPrompt({
331
+ identifier: this.EXPIRE_TOKEN_CONFIRMATION,
332
+ headerText,
333
+ bodyText,
334
+ cancelButtonText,
335
+ confirmButtonText,
336
+ closeOnConfirm: true,
337
+ closeOnCancel: false,
338
+ cancelCallbackFunction: () => {
339
+ this.keycloakService.logout();
340
+ },
341
+ confirmCallBackFunction: () => {
342
+ this.closeExpiryTimerSubscription();
343
+ this.updateToken(20);
344
+ },
345
+ });
346
+ }
347
+ saveUrl() {
348
+ const returnToLastUrlAfterTokenExpiration = this.configService?.config?.featureToggles?.returnToLastUrlAfterTokenExpiration;
349
+ if (returnToLastUrlAfterTokenExpiration) {
350
+ sessionStorage.setItem(STORAGE_KEYS.urlBeforeExpiration, this.keycloakStorageService.getCurrentUrl());
351
+ sessionStorage.setItem(STORAGE_KEYS.urlBeforeExpirationParams, this.keycloakStorageService.getCurrentUrlParams());
352
+ }
353
+ }
354
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.17", ngImport: i0, type: KeycloakUserService, deps: [{ token: i2.KeycloakService }, { token: KeycloakOptionsService }, { token: i3.NGXLogger }, { token: i4.PromptService }, { token: i5.TranslateService }, { token: i6.DatePipe }, { token: i1$1.ConfigService }, { token: i1.Router }, { token: KeycloakStorageService }], target: i0.ɵɵFactoryTarget.Injectable }); }
355
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.17", ngImport: i0, type: KeycloakUserService, providedIn: 'root' }); }
356
+ }
357
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.17", ngImport: i0, type: KeycloakUserService, decorators: [{
358
+ type: Injectable,
359
+ args: [{
360
+ providedIn: 'root',
361
+ }]
362
+ }], ctorParameters: () => [{ type: i2.KeycloakService }, { type: KeycloakOptionsService }, { type: i3.NGXLogger }, { type: i4.PromptService }, { type: i5.TranslateService }, { type: i6.DatePipe }, { type: i1$1.ConfigService }, { type: i1.Router }, { type: KeycloakStorageService }] });
363
+
364
+ /*
365
+ * Copyright 2015-2025 Ritense BV, the Netherlands.
366
+ *
367
+ * Licensed under EUPL, Version 1.2 (the "License");
368
+ * you may not use this file except in compliance with the License.
369
+ * You may obtain a copy of the License at
370
+ *
371
+ * https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12
372
+ *
373
+ * Unless required by applicable law or agreed to in writing, software
374
+ * distributed under the License is distributed on an "AS IS" basis,
375
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
376
+ * See the License for the specific language governing permissions and
377
+ * limitations under the License.
378
+ */
379
+
380
+ /*
381
+ * Copyright 2015-2025 Ritense BV, the Netherlands.
382
+ *
383
+ * Licensed under EUPL, Version 1.2 (the "License");
384
+ * you may not use this file except in compliance with the License.
385
+ * You may obtain a copy of the License at
386
+ *
387
+ * https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12
388
+ *
389
+ * Unless required by applicable law or agreed to in writing, software
390
+ * distributed under the License is distributed on an "AS IS" basis,
391
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
392
+ * See the License for the specific language governing permissions and
393
+ * limitations under the License.
394
+ */
395
+ class CallbackComponent {
396
+ constructor(router, keycloakOptionsService, logger, keycloakStorageService) {
397
+ this.router = router;
398
+ this.keycloakOptionsService = keycloakOptionsService;
399
+ this.logger = logger;
400
+ this.keycloakStorageService = keycloakStorageService;
401
+ logger.debug('callback');
402
+ const savedRedirectTo = window.sessionStorage.getItem(STORAGE_KEYS.redirectTo);
403
+ const savedRedirectToParams = window.sessionStorage.getItem(STORAGE_KEYS.redirectToParams);
404
+ const parsedSavedRedirectToParams = this.keycloakStorageService.parseSavedParams(savedRedirectToParams);
405
+ const urlBeforeExpiration = sessionStorage.getItem(STORAGE_KEYS.urlBeforeExpiration);
406
+ const paramsBeforeExpiration = sessionStorage.getItem(STORAGE_KEYS.urlBeforeExpirationParams);
407
+ const parsedParamsBeforeExpiration = this.keycloakStorageService.parseSavedParams(paramsBeforeExpiration);
408
+ let redirectTo;
409
+ if (savedRedirectTo) {
410
+ redirectTo = savedRedirectTo;
411
+ }
412
+ else {
413
+ redirectTo = '/';
414
+ }
415
+ logger.debug('keycloak callback redirect =', redirectTo);
416
+ logger.debug('keycloak callback redirect params =', savedRedirectToParams);
417
+ if (STORAGE_KEYS.urlBeforeExpiration in sessionStorage) {
418
+ this.router.navigate([urlBeforeExpiration], { queryParams: parsedParamsBeforeExpiration });
419
+ sessionStorage.removeItem(STORAGE_KEYS.urlBeforeExpiration);
420
+ sessionStorage.removeItem(STORAGE_KEYS.urlBeforeExpirationParams);
421
+ }
422
+ else {
423
+ this.router.navigate([redirectTo], { queryParams: parsedSavedRedirectToParams });
424
+ }
425
+ }
426
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.17", ngImport: i0, type: CallbackComponent, deps: [{ token: i1.Router }, { token: KeycloakOptionsService }, { token: i3.NGXLogger }, { token: KeycloakStorageService }], target: i0.ɵɵFactoryTarget.Component }); }
427
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.17", type: CallbackComponent, isStandalone: false, selector: "valtimo-keycloak-callback", ngImport: i0, template: '', isInline: true }); }
428
+ }
429
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.17", ngImport: i0, type: CallbackComponent, decorators: [{
430
+ type: Component,
431
+ args: [{
432
+ standalone: false,
433
+ selector: 'valtimo-keycloak-callback',
434
+ template: '',
435
+ }]
436
+ }], ctorParameters: () => [{ type: i1.Router }, { type: KeycloakOptionsService }, { type: i3.NGXLogger }, { type: KeycloakStorageService }] });
437
+
438
+ /*
439
+ * Copyright 2015-2025 Ritense BV, the Netherlands.
440
+ *
441
+ * Licensed under EUPL, Version 1.2 (the "License");
442
+ * you may not use this file except in compliance with the License.
443
+ * You may obtain a copy of the License at
444
+ *
445
+ * https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12
446
+ *
447
+ * Unless required by applicable law or agreed to in writing, software
448
+ * distributed under the License is distributed on an "AS IS" basis,
449
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
450
+ * See the License for the specific language governing permissions and
451
+ * limitations under the License.
452
+ */
453
+ const routes = [
454
+ {
455
+ path: 'keycloak/callback',
456
+ component: CallbackComponent,
457
+ data: { title: 'Loading...' },
458
+ },
459
+ ];
460
+ class KeycloakRoutingModule {
461
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.17", ngImport: i0, type: KeycloakRoutingModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
462
+ static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "19.2.17", ngImport: i0, type: KeycloakRoutingModule, imports: [CommonModule, i1.RouterModule], exports: [RouterModule] }); }
463
+ static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "19.2.17", ngImport: i0, type: KeycloakRoutingModule, imports: [CommonModule, RouterModule.forChild(routes), RouterModule] }); }
464
+ }
465
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.17", ngImport: i0, type: KeycloakRoutingModule, decorators: [{
466
+ type: NgModule,
467
+ args: [{
468
+ imports: [CommonModule, RouterModule.forChild(routes)],
469
+ exports: [RouterModule],
470
+ }]
471
+ }] });
472
+
473
+ /*
474
+ * Copyright 2015-2025 Ritense BV, the Netherlands.
475
+ *
476
+ * Licensed under EUPL, Version 1.2 (the "License");
477
+ * you may not use this file except in compliance with the License.
478
+ * You may obtain a copy of the License at
479
+ *
480
+ * https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12
481
+ *
482
+ * Unless required by applicable law or agreed to in writing, software
483
+ * distributed under the License is distributed on an "AS IS" basis,
484
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
485
+ * See the License for the specific language governing permissions and
486
+ * limitations under the License.
487
+ */
488
+ class KeycloakModule {
489
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.17", ngImport: i0, type: KeycloakModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
490
+ static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "19.2.17", ngImport: i0, type: KeycloakModule, declarations: [CallbackComponent], imports: [KeycloakRoutingModule, KeycloakAngularModule, TranslateModule], exports: [CallbackComponent] }); }
491
+ static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "19.2.17", ngImport: i0, type: KeycloakModule, providers: [DatePipe], imports: [KeycloakRoutingModule, KeycloakAngularModule, TranslateModule] }); }
492
+ }
493
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.17", ngImport: i0, type: KeycloakModule, decorators: [{
494
+ type: NgModule,
495
+ args: [{
496
+ declarations: [CallbackComponent],
497
+ imports: [KeycloakRoutingModule, KeycloakAngularModule, TranslateModule],
498
+ exports: [CallbackComponent],
499
+ providers: [DatePipe],
500
+ }]
501
+ }] });
502
+
503
+ /*
504
+ * Copyright 2015-2025 Ritense BV, the Netherlands.
505
+ *
506
+ * Licensed under EUPL, Version 1.2 (the "License");
507
+ * you may not use this file except in compliance with the License.
508
+ * You may obtain a copy of the License at
509
+ *
510
+ * https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12
511
+ *
512
+ * Unless required by applicable law or agreed to in writing, software
513
+ * distributed under the License is distributed on an "AS IS" basis,
514
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
515
+ * See the License for the specific language governing permissions and
516
+ * limitations under the License.
517
+ */
518
+ function keycloakInitializer(injector) {
519
+ const keycloakService = injector.get(KeycloakService);
520
+ const keycloakUserService = injector.get(KeycloakUserService);
521
+ const optionsService = injector.get(KeycloakOptionsService); // TODO possible removal of abstraction
522
+ const storageService = injector.get(KeycloakStorageService);
523
+ const logger = injector.get(NGXLogger);
524
+ return async () => {
525
+ try {
526
+ logger.debug('Keycloak initializer before init');
527
+ const keycloakOptions = optionsService.keycloakOptions;
528
+ const currentUrl = window.location.href.split('#')[0];
529
+ if (keycloakOptions.initOptions.redirectUri !== currentUrl) {
530
+ const redirectTo = storageService.getCurrentUrl();
531
+ logger.debug('Setting redirectTo =', redirectTo);
532
+ window.sessionStorage.setItem(STORAGE_KEYS.redirectTo, redirectTo);
533
+ window.sessionStorage.setItem(STORAGE_KEYS.redirectToParams, storageService.getCurrentUrlParams());
534
+ }
535
+ const initResult = await keycloakService.init(keycloakOptions);
536
+ logger.debug('Keycloak initializer after init');
537
+ keycloakUserService.init();
538
+ return initResult;
539
+ }
540
+ catch (error) {
541
+ logger.debug('Keycloak initializer error', error);
542
+ throw error;
543
+ }
544
+ };
545
+ }
546
+
547
+ /*
548
+ * Copyright 2015-2025 Ritense BV, the Netherlands.
549
+ *
550
+ * Licensed under EUPL, Version 1.2 (the "License");
551
+ * you may not use this file except in compliance with the License.
552
+ * You may obtain a copy of the License at
553
+ *
554
+ * https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12
555
+ *
556
+ * Unless required by applicable law or agreed to in writing, software
557
+ * distributed under the License is distributed on an "AS IS" basis,
558
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
559
+ * See the License for the specific language governing permissions and
560
+ * limitations under the License.
561
+ */
562
+ /*
563
+ * Public API Surface of keycloak
564
+ */
565
+
566
+ /**
567
+ * Generated bundle index. Do not edit.
568
+ */
569
+
570
+ export { CallbackComponent, KeycloakAuthGuardService, KeycloakModule, KeycloakOptionsService, KeycloakUserService, STORAGE_KEYS, keycloakInitializer };
571
+ //# sourceMappingURL=valtimo-keycloak.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"valtimo-keycloak.mjs","sources":["../../../../projects/valtimo/keycloak/src/lib/models/keycloak.config.ts","../../../../projects/valtimo/keycloak/src/lib/models/index.ts","../../../../projects/valtimo/keycloak/src/lib/constants/storage-keys.ts","../../../../projects/valtimo/keycloak/src/lib/constants/index.ts","../../../../projects/valtimo/keycloak/src/lib/services/keycloak-auth-guard.service.ts","../../../../projects/valtimo/keycloak/src/lib/services/keycloak-options.service.ts","../../../../projects/valtimo/keycloak/src/lib/services/keycloak-storage.service.ts","../../../../projects/valtimo/keycloak/src/lib/services/keycloak-user.service.ts","../../../../projects/valtimo/keycloak/src/lib/services/index.ts","../../../../projects/valtimo/keycloak/src/lib/callback.component.ts","../../../../projects/valtimo/keycloak/src/lib/keycloak-routing.module.ts","../../../../projects/valtimo/keycloak/src/lib/keycloak.module.ts","../../../../projects/valtimo/keycloak/src/lib/keycloak.init.ts","../../../../projects/valtimo/keycloak/src/public_api.ts","../../../../projects/valtimo/keycloak/src/valtimo-keycloak.ts"],"sourcesContent":["/*\n * Copyright 2015-2025 Ritense BV, the Netherlands.\n *\n * Licensed under EUPL, Version 1.2 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" basis,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport {KeycloakOptions} from 'keycloak-angular';\n\nexport interface ValtimoKeycloakOptions {\n keycloakOptions: KeycloakOptions;\n logoutRedirectUri: string;\n}\n","/*\n * Copyright 2015-2025 Ritense BV, the Netherlands.\n *\n * Licensed under EUPL, Version 1.2 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" basis,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nexport * from './keycloak.config';\n","/*\n * Copyright 2015-2025 Ritense BV, the Netherlands.\n *\n * Licensed under EUPL, Version 1.2 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" basis,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nconst STORAGE_KEYS = {\n urlBeforeExpiration: 'urlBeforeExpiration',\n urlBeforeExpirationParams: 'urlBeforeExpirationParams',\n redirectTo: 'redirectTo',\n redirectToParams: 'redirectToParams',\n};\n\nexport {STORAGE_KEYS};\n","/*\n * Copyright 2015-2025 Ritense BV, the Netherlands.\n *\n * Licensed under EUPL, Version 1.2 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" basis,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nexport * from './storage-keys';\n","/*\n * Copyright 2015-2025 Ritense BV, the Netherlands.\n *\n * Licensed under EUPL, Version 1.2 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" basis,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport {Injectable} from '@angular/core';\nimport {KeycloakAuthGuard, KeycloakService} from 'keycloak-angular';\nimport {ActivatedRouteSnapshot, CanActivate, Router, RouterStateSnapshot} from '@angular/router';\nimport {NGXLogger} from 'ngx-logger';\n\n@Injectable({\n providedIn: 'root',\n})\nexport class KeycloakAuthGuardService extends KeycloakAuthGuard implements CanActivate {\n constructor(\n protected router: Router,\n protected keycloakAngular: KeycloakService,\n private logger: NGXLogger\n ) {\n super(router, keycloakAngular);\n this.logger.debug('KeycloakAuthGuardService: ctor');\n }\n\n isAccessAllowed(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): Promise<boolean> {\n this.logger.debug('KeycloakAuthGuardService: isAccessAllowed');\n return new Promise((resolve, reject) => {\n this.logger.debug('KeycloakAuthGuardService: isAccessAllowed checking access');\n if (!this.authenticated) {\n this.keycloakAngular\n .login()\n .catch(e => `KeycloakAuthGuardService error: ${this.logger.error(e)}`);\n return reject(false);\n }\n\n const requiredRoles: string[] = route.data.roles;\n\n if (!requiredRoles || requiredRoles.length === 0) {\n return resolve(true);\n }\n\n if (!this.roles || this.roles.length === 0) {\n resolve(false);\n }\n resolve(requiredRoles.some(role => this.roles.includes(role)));\n });\n }\n}\n","/*\n * Copyright 2015-2025 Ritense BV, the Netherlands.\n *\n * Licensed under EUPL, Version 1.2 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" basis,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport {ValtimoKeycloakOptions} from '../models';\nimport {Injectable} from '@angular/core';\nimport {ConfigService} from '@valtimo/shared';\n\n@Injectable({\n providedIn: 'root',\n})\nexport class KeycloakOptionsService {\n private readonly valtimoKeycloakOptions: ValtimoKeycloakOptions;\n\n constructor(private configService: ConfigService) {\n this.valtimoKeycloakOptions = configService.config.authentication.options;\n }\n\n get keycloakOptions() {\n return this.valtimoKeycloakOptions.keycloakOptions;\n }\n\n get logoutRedirectUri() {\n return this.valtimoKeycloakOptions.logoutRedirectUri;\n }\n}\n","/*\n * Copyright 2015-2025 Ritense BV, the Netherlands.\n *\n * Licensed under EUPL, Version 1.2 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" basis,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport {Injectable} from '@angular/core';\n\n@Injectable({\n providedIn: 'root',\n})\nexport class KeycloakStorageService {\n getCurrentUrlParams(): string {\n const urlSearchParams = new URLSearchParams(window.location.search);\n const params = Object.fromEntries(urlSearchParams.entries());\n return JSON.stringify(params);\n }\n\n getCurrentUrl(): string {\n return window.location.pathname;\n }\n\n parseSavedParams(savedParams: any): {[key: string]: string} {\n return (\n (savedParams &&\n typeof savedParams === 'string' &&\n savedParams.length > 2 &&\n JSON.parse(savedParams)) ||\n {}\n );\n }\n}\n","/*\n * Copyright 2015-2025 Ritense BV, the Netherlands.\n *\n * Licensed under EUPL, Version 1.2 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" basis,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport {Injectable, OnDestroy} from '@angular/core';\nimport {combineLatest, ReplaySubject, Subject, Subscription, switchMap, timer} from 'rxjs';\nimport {NGXLogger} from 'ngx-logger';\nimport {KeycloakEventTypeLegacy, KeycloakService} from 'keycloak-angular';\nimport {ConfigService, UserIdentity, UserService, ValtimoUserIdentity} from '@valtimo/shared';\nimport {KeycloakOptionsService} from './keycloak-options.service';\nimport {jwtDecode} from 'jwt-decode';\nimport {TranslateService} from '@ngx-translate/core';\nimport {DatePipe} from '@angular/common';\nimport {take} from 'rxjs/operators';\nimport {Router} from '@angular/router';\nimport {STORAGE_KEYS} from '../constants';\nimport {KeycloakStorageService} from './keycloak-storage.service';\nimport {PromptService} from '@valtimo/components';\n\n@Injectable({\n providedIn: 'root',\n})\nexport class KeycloakUserService implements UserService, OnDestroy {\n private userIdentity: ReplaySubject<UserIdentity>;\n\n private tokenRefreshSubscription!: Subscription;\n private refreshTokenSubscription!: Subscription;\n private expiryTimerSubscription!: Subscription;\n\n private readonly _refreshToken$ = new Subject<string>();\n\n private _tokenExp!: number;\n\n private readonly FIVE_MINUTES_MS = 300000;\n private readonly EXPIRE_TOKEN_CONFIRMATION = 'EXPIRE_TOKEN_CONFIRMATION';\n\n private _counter!: Date;\n\n constructor(\n private readonly keycloakService: KeycloakService,\n private readonly keycloakOptionsService: KeycloakOptionsService,\n private readonly logger: NGXLogger,\n private readonly promptService: PromptService,\n private readonly translateService: TranslateService,\n private readonly datePipe: DatePipe,\n private readonly configService: ConfigService,\n private readonly router: Router,\n private readonly keycloakStorageService: KeycloakStorageService\n ) {\n this.openTokenRefreshSubscription();\n this.openRefreshTokenSubscription();\n }\n\n ngOnDestroy(): void {\n this.tokenRefreshSubscription?.unsubscribe();\n this.refreshTokenSubscription?.unsubscribe();\n this.closeExpiryTimerSubscription();\n }\n\n init(): void {\n this.userIdentity = new ReplaySubject();\n this.keycloakService.loadUserProfile().then(user => {\n this.logger.debug('KeycloakUserService: loadUserProfile = ', user);\n const roles: Array<string> = [];\n this.keycloakService.getUserRoles(true).forEach(role => roles.push(role));\n const valtimoUserIdentity = new ValtimoUserIdentity(\n user.email,\n user.firstName,\n user.lastName,\n roles,\n user.username,\n user.id\n );\n this.logger.debug('KeycloakUserService: loaded user identity', valtimoUserIdentity);\n this.userIdentity.next(valtimoUserIdentity);\n });\n this.setRefreshToken();\n }\n\n getUserSubject(): ReplaySubject<UserIdentity> {\n this.logger.debug('KeycloakUserService: getUserIdentity');\n return this.userIdentity;\n }\n\n logout(): void {\n this.logger.debug('KeycloakUserService: logout');\n this.keycloakService.logout(this.keycloakOptionsService.logoutRedirectUri);\n }\n\n async getToken(): Promise<string> {\n this.logger.debug('KeycloakUserService: getToken');\n return this.keycloakService.getToken();\n }\n\n async updateToken(minValidity: number): Promise<boolean> {\n this.logger.debug('KeycloakUserService: updateToken');\n return this.keycloakService.updateToken(minValidity);\n }\n\n private openTokenRefreshSubscription(): void {\n this.tokenRefreshSubscription = this.keycloakService.keycloakEvents$.subscribe(\n keycloakEvent => {\n if (keycloakEvent.type === KeycloakEventTypeLegacy.OnAuthRefreshSuccess) {\n this.setRefreshToken();\n }\n }\n );\n }\n\n private get _expiryTimeMs() {\n return this._tokenExp - Date.now() - 1000;\n }\n\n private openRefreshTokenSubscription(): void {\n this.refreshTokenSubscription = this._refreshToken$.subscribe(refreshToken => {\n const decodedRefreshToken = jwtDecode(refreshToken);\n this._tokenExp = decodedRefreshToken.exp * 1000;\n\n this.closeExpiryTimerSubscription();\n this.openExpiryTimerSubscription();\n });\n }\n\n private setRefreshToken(): void {\n const refreshToken = this.keycloakService.getKeycloakInstance()?.refreshToken;\n if (refreshToken) this._refreshToken$.next(refreshToken);\n }\n\n private openExpiryTimerSubscription(): void {\n this.expiryTimerSubscription = timer(0, 1000)\n .pipe(\n switchMap(() => {\n if (this._expiryTimeMs <= this.FIVE_MINUTES_MS) {\n this._counter = new Date(0, 0, 0, 0, 0, 0);\n this._counter.setSeconds(this._expiryTimeMs / 1000);\n }\n\n return combineLatest([\n this.promptService.promptVisible$,\n this.translateService.stream('keycloak.expiryPromptTitle'),\n this.translateService.stream('keycloak.expiryPromptDescription', {\n expiryTime: this.datePipe.transform(this._counter, 'mm:ss'),\n }),\n this.translateService.stream('keycloak.expiryPromptCancel'),\n this.translateService.stream('keycloak.expiryPromptConfirm'),\n ]);\n })\n )\n .subscribe(([promptVisible, headerText, bodyText, cancelButtonText, confirmButtonText]) => {\n this.promptService.identifier$.pipe(take(1)).subscribe(identifier => {\n if (\n (!promptVisible || identifier !== this.EXPIRE_TOKEN_CONFIRMATION) &&\n this._expiryTimeMs <= this.FIVE_MINUTES_MS\n ) {\n this.openConfirmationPrompt(headerText, bodyText, cancelButtonText, confirmButtonText);\n }\n\n if (promptVisible && identifier === this.EXPIRE_TOKEN_CONFIRMATION) {\n this.promptService.setBodyText(bodyText);\n }\n });\n\n if (this._expiryTimeMs < 2000) {\n this.saveUrl();\n this.logout();\n }\n });\n }\n\n private closeExpiryTimerSubscription(): void {\n this.expiryTimerSubscription?.unsubscribe();\n }\n\n private openConfirmationPrompt(\n headerText: string,\n bodyText: string,\n cancelButtonText: string,\n confirmButtonText: string\n ): void {\n this.promptService.openPrompt({\n identifier: this.EXPIRE_TOKEN_CONFIRMATION,\n headerText,\n bodyText,\n cancelButtonText,\n confirmButtonText,\n closeOnConfirm: true,\n closeOnCancel: false,\n cancelCallbackFunction: () => {\n this.keycloakService.logout();\n },\n confirmCallBackFunction: () => {\n this.closeExpiryTimerSubscription();\n this.updateToken(20);\n },\n });\n }\n\n private saveUrl(): void {\n const returnToLastUrlAfterTokenExpiration =\n this.configService?.config?.featureToggles?.returnToLastUrlAfterTokenExpiration;\n\n if (returnToLastUrlAfterTokenExpiration) {\n sessionStorage.setItem(\n STORAGE_KEYS.urlBeforeExpiration,\n this.keycloakStorageService.getCurrentUrl()\n );\n sessionStorage.setItem(\n STORAGE_KEYS.urlBeforeExpirationParams,\n this.keycloakStorageService.getCurrentUrlParams()\n );\n }\n }\n}\n","/*\n * Copyright 2015-2025 Ritense BV, the Netherlands.\n *\n * Licensed under EUPL, Version 1.2 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" basis,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nexport * from './keycloak-auth-guard.service';\nexport * from './keycloak-options.service';\nexport * from './keycloak-user.service';\nexport * from './keycloak-storage.service';\n","/*\n * Copyright 2015-2025 Ritense BV, the Netherlands.\n *\n * Licensed under EUPL, Version 1.2 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" basis,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport {Component} from '@angular/core';\nimport {Router} from '@angular/router';\nimport {NGXLogger} from 'ngx-logger';\nimport {KeycloakOptionsService, KeycloakStorageService} from './services';\nimport {STORAGE_KEYS} from './constants';\n\n@Component({\n standalone: false,\n selector: 'valtimo-keycloak-callback',\n template: '',\n})\nexport class CallbackComponent {\n constructor(\n private router: Router,\n private keycloakOptionsService: KeycloakOptionsService,\n private logger: NGXLogger,\n private readonly keycloakStorageService: KeycloakStorageService\n ) {\n logger.debug('callback');\n const savedRedirectTo = window.sessionStorage.getItem(STORAGE_KEYS.redirectTo);\n const savedRedirectToParams = window.sessionStorage.getItem(STORAGE_KEYS.redirectToParams);\n const parsedSavedRedirectToParams =\n this.keycloakStorageService.parseSavedParams(savedRedirectToParams);\n\n const urlBeforeExpiration = sessionStorage.getItem(STORAGE_KEYS.urlBeforeExpiration);\n const paramsBeforeExpiration = sessionStorage.getItem(STORAGE_KEYS.urlBeforeExpirationParams);\n const parsedParamsBeforeExpiration =\n this.keycloakStorageService.parseSavedParams(paramsBeforeExpiration);\n\n let redirectTo!: string;\n\n if (savedRedirectTo) {\n redirectTo = savedRedirectTo;\n } else {\n redirectTo = '/';\n }\n\n logger.debug('keycloak callback redirect =', redirectTo);\n logger.debug('keycloak callback redirect params =', savedRedirectToParams);\n\n if (STORAGE_KEYS.urlBeforeExpiration in sessionStorage) {\n this.router.navigate([urlBeforeExpiration], {queryParams: parsedParamsBeforeExpiration});\n sessionStorage.removeItem(STORAGE_KEYS.urlBeforeExpiration);\n sessionStorage.removeItem(STORAGE_KEYS.urlBeforeExpirationParams);\n } else {\n this.router.navigate([redirectTo], {queryParams: parsedSavedRedirectToParams});\n }\n }\n}\n","/*\n * Copyright 2015-2025 Ritense BV, the Netherlands.\n *\n * Licensed under EUPL, Version 1.2 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" basis,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport {NgModule} from '@angular/core';\nimport {RouterModule, Routes} from '@angular/router';\nimport {CallbackComponent} from './callback.component';\nimport {CommonModule} from '@angular/common';\n\nconst routes: Routes = [\n {\n path: 'keycloak/callback',\n component: CallbackComponent,\n data: {title: 'Loading...'},\n },\n];\n\n@NgModule({\n imports: [CommonModule, RouterModule.forChild(routes)],\n exports: [RouterModule],\n})\nexport class KeycloakRoutingModule {}\n","/*\n * Copyright 2015-2025 Ritense BV, the Netherlands.\n *\n * Licensed under EUPL, Version 1.2 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" basis,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport {NgModule} from '@angular/core';\nimport {KeycloakAngularModule} from 'keycloak-angular';\nimport {CallbackComponent} from './callback.component';\nimport {KeycloakRoutingModule} from './keycloak-routing.module';\nimport {TranslateModule} from '@ngx-translate/core';\nimport {DatePipe} from '@angular/common';\n\n@NgModule({\n declarations: [CallbackComponent],\n imports: [KeycloakRoutingModule, KeycloakAngularModule, TranslateModule],\n exports: [CallbackComponent],\n providers: [DatePipe],\n})\nexport class KeycloakModule {}\n","/*\n * Copyright 2015-2025 Ritense BV, the Netherlands.\n *\n * Licensed under EUPL, Version 1.2 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" basis,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport {KeycloakService} from 'keycloak-angular';\nimport {KeycloakOptionsService, KeycloakStorageService, KeycloakUserService} from './services';\nimport {Injector} from '@angular/core';\nimport {NGXLogger} from 'ngx-logger';\nimport {STORAGE_KEYS} from './constants';\n\nexport function keycloakInitializer(injector: Injector): () => Promise<any> {\n const keycloakService = injector.get<KeycloakService>(KeycloakService);\n const keycloakUserService = injector.get<KeycloakUserService>(KeycloakUserService);\n const optionsService = injector.get<KeycloakOptionsService>(KeycloakOptionsService); // TODO possible removal of abstraction\n const storageService = injector.get<KeycloakStorageService>(KeycloakStorageService);\n const logger = injector.get<NGXLogger>(NGXLogger);\n\n return async (): Promise<any> => {\n try {\n logger.debug('Keycloak initializer before init');\n\n const keycloakOptions = optionsService.keycloakOptions;\n const currentUrl = window.location.href.split('#')[0];\n\n if (keycloakOptions.initOptions.redirectUri !== currentUrl) {\n const redirectTo = storageService.getCurrentUrl();\n logger.debug('Setting redirectTo =', redirectTo);\n window.sessionStorage.setItem(STORAGE_KEYS.redirectTo, redirectTo);\n window.sessionStorage.setItem(\n STORAGE_KEYS.redirectToParams,\n storageService.getCurrentUrlParams()\n );\n }\n\n const initResult = await keycloakService.init(keycloakOptions);\n logger.debug('Keycloak initializer after init');\n\n keycloakUserService.init();\n\n return initResult;\n } catch (error) {\n logger.debug('Keycloak initializer error', error);\n throw error;\n }\n };\n}\n","/*\n * Copyright 2015-2025 Ritense BV, the Netherlands.\n *\n * Licensed under EUPL, Version 1.2 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" basis,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/*\n * Public API Surface of keycloak\n */\n\nexport * from './lib/models';\nexport * from './lib/keycloak.module';\nexport * from './lib/services/keycloak-auth-guard.service';\nexport * from './lib/services/keycloak-user.service';\nexport * from './lib/keycloak.init';\nexport * from './lib/services/keycloak-options.service';\nexport * from './lib/callback.component';\nexport * from './lib/constants';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public_api';\n"],"names":["i1","i2.KeycloakOptionsService","i7","i8","i9.KeycloakStorageService","i2.KeycloakStorageService"],"mappings":";;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;;;;;AAcG;;ACdH;;;;;;;;;;;;;;AAcG;;ACdH;;;;;;;;;;;;;;AAcG;AAEH,MAAM,YAAY,GAAG;AACnB,IAAA,mBAAmB,EAAE,qBAAqB;AAC1C,IAAA,yBAAyB,EAAE,2BAA2B;AACtD,IAAA,UAAU,EAAE,YAAY;AACxB,IAAA,gBAAgB,EAAE,kBAAkB;;;ACpBtC;;;;;;;;;;;;;;AAcG;;ACdH;;;;;;;;;;;;;;AAcG;AAUG,MAAO,wBAAyB,SAAQ,iBAAiB,CAAA;AAC7D,IAAA,WAAA,CACY,MAAc,EACd,eAAgC,EAClC,MAAiB,EAAA;AAEzB,QAAA,KAAK,CAAC,MAAM,EAAE,eAAe,CAAC;QAJpB,IAAM,CAAA,MAAA,GAAN,MAAM;QACN,IAAe,CAAA,eAAA,GAAf,eAAe;QACjB,IAAM,CAAA,MAAA,GAAN,MAAM;AAGd,QAAA,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,gCAAgC,CAAC;;I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;AACjD,YAAA,MAAM,KAAK;;AAEf,KAAC;AACH;;ACzDA;;;;;;;;;;;;;;AAcG;AAEH;;AAEG;;AClBH;;AAEG;;;;"}
package/index.d.ts ADDED
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Generated bundle index. Do not edit.
3
+ */
4
+ /// <amd-module name="@valtimo/keycloak" />
5
+ export * from './public_api';
6
+ //# sourceMappingURL=valtimo-keycloak.d.ts.map
@@ -0,0 +1,14 @@
1
+ import { Router } from '@angular/router';
2
+ import { NGXLogger } from 'ngx-logger';
3
+ import { KeycloakOptionsService, KeycloakStorageService } from './services';
4
+ import * as i0 from "@angular/core";
5
+ export declare class CallbackComponent {
6
+ private router;
7
+ private keycloakOptionsService;
8
+ private logger;
9
+ private readonly keycloakStorageService;
10
+ constructor(router: Router, keycloakOptionsService: KeycloakOptionsService, logger: NGXLogger, keycloakStorageService: KeycloakStorageService);
11
+ static ɵfac: i0.ɵɵFactoryDeclaration<CallbackComponent, never>;
12
+ static ɵcmp: i0.ɵɵComponentDeclaration<CallbackComponent, "valtimo-keycloak-callback", never, {}, {}, never, never, false, never>;
13
+ }
14
+ //# sourceMappingURL=callback.component.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"callback.component.d.ts","sourceRoot":"","sources":["../../../../projects/valtimo/keycloak/src/lib/callback.component.ts"],"names":[],"mappings":"AAiBA,OAAO,EAAC,MAAM,EAAC,MAAM,iBAAiB,CAAC;AACvC,OAAO,EAAC,SAAS,EAAC,MAAM,YAAY,CAAC;AACrC,OAAO,EAAC,sBAAsB,EAAE,sBAAsB,EAAC,MAAM,YAAY,CAAC;;AAG1E,qBAKa,iBAAiB;IAE1B,OAAO,CAAC,MAAM;IACd,OAAO,CAAC,sBAAsB;IAC9B,OAAO,CAAC,MAAM;IACd,OAAO,CAAC,QAAQ,CAAC,sBAAsB;gBAH/B,MAAM,EAAE,MAAM,EACd,sBAAsB,EAAE,sBAAsB,EAC9C,MAAM,EAAE,SAAS,EACR,sBAAsB,EAAE,sBAAsB;yCALtD,iBAAiB;2CAAjB,iBAAiB;CAqC7B"}
@@ -0,0 +1,2 @@
1
+ export * from './storage-keys';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../projects/valtimo/keycloak/src/lib/constants/index.ts"],"names":[],"mappings":"AAgBA,cAAc,gBAAgB,CAAC"}
@@ -0,0 +1,8 @@
1
+ declare const STORAGE_KEYS: {
2
+ urlBeforeExpiration: string;
3
+ urlBeforeExpirationParams: string;
4
+ redirectTo: string;
5
+ redirectToParams: string;
6
+ };
7
+ export { STORAGE_KEYS };
8
+ //# sourceMappingURL=storage-keys.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"storage-keys.d.ts","sourceRoot":"","sources":["../../../../../projects/valtimo/keycloak/src/lib/constants/storage-keys.ts"],"names":[],"mappings":"AAgBA,QAAA,MAAM,YAAY;;;;;CAKjB,CAAC;AAEF,OAAO,EAAC,YAAY,EAAC,CAAC"}
@@ -0,0 +1,9 @@
1
+ import * as i0 from "@angular/core";
2
+ import * as i1 from "@angular/common";
3
+ import * as i2 from "@angular/router";
4
+ export declare class KeycloakRoutingModule {
5
+ static ɵfac: i0.ɵɵFactoryDeclaration<KeycloakRoutingModule, never>;
6
+ static ɵmod: i0.ɵɵNgModuleDeclaration<KeycloakRoutingModule, never, [typeof i1.CommonModule, typeof i2.RouterModule], [typeof i2.RouterModule]>;
7
+ static ɵinj: i0.ɵɵInjectorDeclaration<KeycloakRoutingModule>;
8
+ }
9
+ //# sourceMappingURL=keycloak-routing.module.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"keycloak-routing.module.d.ts","sourceRoot":"","sources":["../../../../projects/valtimo/keycloak/src/lib/keycloak-routing.module.ts"],"names":[],"mappings":";;;AA6BA,qBAIa,qBAAqB;yCAArB,qBAAqB;0CAArB,qBAAqB;0CAArB,qBAAqB;CAAG"}
@@ -0,0 +1,3 @@
1
+ import { Injector } from '@angular/core';
2
+ export declare function keycloakInitializer(injector: Injector): () => Promise<any>;
3
+ //# sourceMappingURL=keycloak.init.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"keycloak.init.d.ts","sourceRoot":"","sources":["../../../../projects/valtimo/keycloak/src/lib/keycloak.init.ts"],"names":[],"mappings":"AAkBA,OAAO,EAAC,QAAQ,EAAC,MAAM,eAAe,CAAC;AAIvC,wBAAgB,mBAAmB,CAAC,QAAQ,EAAE,QAAQ,GAAG,MAAM,OAAO,CAAC,GAAG,CAAC,CAmC1E"}
@@ -0,0 +1,11 @@
1
+ import * as i0 from "@angular/core";
2
+ import * as i1 from "./callback.component";
3
+ import * as i2 from "./keycloak-routing.module";
4
+ import * as i3 from "keycloak-angular";
5
+ import * as i4 from "@ngx-translate/core";
6
+ export declare class KeycloakModule {
7
+ static ɵfac: i0.ɵɵFactoryDeclaration<KeycloakModule, never>;
8
+ static ɵmod: i0.ɵɵNgModuleDeclaration<KeycloakModule, [typeof i1.CallbackComponent], [typeof i2.KeycloakRoutingModule, typeof i3.KeycloakAngularModule, typeof i4.TranslateModule], [typeof i1.CallbackComponent]>;
9
+ static ɵinj: i0.ɵɵInjectorDeclaration<KeycloakModule>;
10
+ }
11
+ //# sourceMappingURL=keycloak.module.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"keycloak.module.d.ts","sourceRoot":"","sources":["../../../../projects/valtimo/keycloak/src/lib/keycloak.module.ts"],"names":[],"mappings":";;;;;AAuBA,qBAMa,cAAc;yCAAd,cAAc;0CAAd,cAAc;0CAAd,cAAc;CAAG"}
@@ -0,0 +1,2 @@
1
+ export * from './keycloak.config';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../projects/valtimo/keycloak/src/lib/models/index.ts"],"names":[],"mappings":"AAgBA,cAAc,mBAAmB,CAAC"}
@@ -0,0 +1,6 @@
1
+ import { KeycloakOptions } from 'keycloak-angular';
2
+ export interface ValtimoKeycloakOptions {
3
+ keycloakOptions: KeycloakOptions;
4
+ logoutRedirectUri: string;
5
+ }
6
+ //# sourceMappingURL=keycloak.config.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"keycloak.config.d.ts","sourceRoot":"","sources":["../../../../../projects/valtimo/keycloak/src/lib/models/keycloak.config.ts"],"names":[],"mappings":"AAgBA,OAAO,EAAC,eAAe,EAAC,MAAM,kBAAkB,CAAC;AAEjD,MAAM,WAAW,sBAAsB;IACrC,eAAe,EAAE,eAAe,CAAC;IACjC,iBAAiB,EAAE,MAAM,CAAC;CAC3B"}
@@ -0,0 +1,5 @@
1
+ export * from './keycloak-auth-guard.service';
2
+ export * from './keycloak-options.service';
3
+ export * from './keycloak-user.service';
4
+ export * from './keycloak-storage.service';
5
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../projects/valtimo/keycloak/src/lib/services/index.ts"],"names":[],"mappings":"AAgBA,cAAc,+BAA+B,CAAC;AAC9C,cAAc,4BAA4B,CAAC;AAC3C,cAAc,yBAAyB,CAAC;AACxC,cAAc,4BAA4B,CAAC"}
@@ -0,0 +1,14 @@
1
+ import { KeycloakAuthGuard, KeycloakService } from 'keycloak-angular';
2
+ import { ActivatedRouteSnapshot, CanActivate, Router, RouterStateSnapshot } from '@angular/router';
3
+ import { NGXLogger } from 'ngx-logger';
4
+ import * as i0 from "@angular/core";
5
+ export declare class KeycloakAuthGuardService extends KeycloakAuthGuard implements CanActivate {
6
+ protected router: Router;
7
+ protected keycloakAngular: KeycloakService;
8
+ private logger;
9
+ constructor(router: Router, keycloakAngular: KeycloakService, logger: NGXLogger);
10
+ isAccessAllowed(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): Promise<boolean>;
11
+ static ɵfac: i0.ɵɵFactoryDeclaration<KeycloakAuthGuardService, never>;
12
+ static ɵprov: i0.ɵɵInjectableDeclaration<KeycloakAuthGuardService>;
13
+ }
14
+ //# sourceMappingURL=keycloak-auth-guard.service.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"keycloak-auth-guard.service.d.ts","sourceRoot":"","sources":["../../../../../projects/valtimo/keycloak/src/lib/services/keycloak-auth-guard.service.ts"],"names":[],"mappings":"AAiBA,OAAO,EAAC,iBAAiB,EAAE,eAAe,EAAC,MAAM,kBAAkB,CAAC;AACpE,OAAO,EAAC,sBAAsB,EAAE,WAAW,EAAE,MAAM,EAAE,mBAAmB,EAAC,MAAM,iBAAiB,CAAC;AACjG,OAAO,EAAC,SAAS,EAAC,MAAM,YAAY,CAAC;;AAErC,qBAGa,wBAAyB,SAAQ,iBAAkB,YAAW,WAAW;IAElF,SAAS,CAAC,MAAM,EAAE,MAAM;IACxB,SAAS,CAAC,eAAe,EAAE,eAAe;IAC1C,OAAO,CAAC,MAAM;gBAFJ,MAAM,EAAE,MAAM,EACd,eAAe,EAAE,eAAe,EAClC,MAAM,EAAE,SAAS;IAM3B,eAAe,CAAC,KAAK,EAAE,sBAAsB,EAAE,KAAK,EAAE,mBAAmB,GAAG,OAAO,CAAC,OAAO,CAAC;yCAVjF,wBAAwB;6CAAxB,wBAAwB;CAiCpC"}
@@ -0,0 +1,12 @@
1
+ import { ConfigService } from '@valtimo/shared';
2
+ import * as i0 from "@angular/core";
3
+ export declare class KeycloakOptionsService {
4
+ private configService;
5
+ private readonly valtimoKeycloakOptions;
6
+ constructor(configService: ConfigService);
7
+ get keycloakOptions(): import("keycloak-angular").KeycloakOptions;
8
+ get logoutRedirectUri(): string;
9
+ static ɵfac: i0.ɵɵFactoryDeclaration<KeycloakOptionsService, never>;
10
+ static ɵprov: i0.ɵɵInjectableDeclaration<KeycloakOptionsService>;
11
+ }
12
+ //# sourceMappingURL=keycloak-options.service.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"keycloak-options.service.d.ts","sourceRoot":"","sources":["../../../../../projects/valtimo/keycloak/src/lib/services/keycloak-options.service.ts"],"names":[],"mappings":"AAkBA,OAAO,EAAC,aAAa,EAAC,MAAM,iBAAiB,CAAC;;AAE9C,qBAGa,sBAAsB;IAGrB,OAAO,CAAC,aAAa;IAFjC,OAAO,CAAC,QAAQ,CAAC,sBAAsB,CAAyB;gBAE5C,aAAa,EAAE,aAAa;IAIhD,IAAI,eAAe,+CAElB;IAED,IAAI,iBAAiB,WAEpB;yCAbU,sBAAsB;6CAAtB,sBAAsB;CAclC"}
@@ -0,0 +1,11 @@
1
+ import * as i0 from "@angular/core";
2
+ export declare class KeycloakStorageService {
3
+ getCurrentUrlParams(): string;
4
+ getCurrentUrl(): string;
5
+ parseSavedParams(savedParams: any): {
6
+ [key: string]: string;
7
+ };
8
+ static ɵfac: i0.ɵɵFactoryDeclaration<KeycloakStorageService, never>;
9
+ static ɵprov: i0.ɵɵInjectableDeclaration<KeycloakStorageService>;
10
+ }
11
+ //# sourceMappingURL=keycloak-storage.service.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"keycloak-storage.service.d.ts","sourceRoot":"","sources":["../../../../../projects/valtimo/keycloak/src/lib/services/keycloak-storage.service.ts"],"names":[],"mappings":";AAkBA,qBAGa,sBAAsB;IACjC,mBAAmB,IAAI,MAAM;IAM7B,aAAa,IAAI,MAAM;IAIvB,gBAAgB,CAAC,WAAW,EAAE,GAAG,GAAG;QAAC,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAA;KAAC;yCAXhD,sBAAsB;6CAAtB,sBAAsB;CAoBlC"}
@@ -0,0 +1,50 @@
1
+ import { OnDestroy } from '@angular/core';
2
+ import { ReplaySubject } from 'rxjs';
3
+ import { NGXLogger } from 'ngx-logger';
4
+ import { KeycloakService } from 'keycloak-angular';
5
+ import { ConfigService, UserIdentity, UserService } from '@valtimo/shared';
6
+ import { KeycloakOptionsService } from './keycloak-options.service';
7
+ import { TranslateService } from '@ngx-translate/core';
8
+ import { DatePipe } from '@angular/common';
9
+ import { Router } from '@angular/router';
10
+ import { KeycloakStorageService } from './keycloak-storage.service';
11
+ import { PromptService } from '@valtimo/components';
12
+ import * as i0 from "@angular/core";
13
+ export declare class KeycloakUserService implements UserService, OnDestroy {
14
+ private readonly keycloakService;
15
+ private readonly keycloakOptionsService;
16
+ private readonly logger;
17
+ private readonly promptService;
18
+ private readonly translateService;
19
+ private readonly datePipe;
20
+ private readonly configService;
21
+ private readonly router;
22
+ private readonly keycloakStorageService;
23
+ private userIdentity;
24
+ private tokenRefreshSubscription;
25
+ private refreshTokenSubscription;
26
+ private expiryTimerSubscription;
27
+ private readonly _refreshToken$;
28
+ private _tokenExp;
29
+ private readonly FIVE_MINUTES_MS;
30
+ private readonly EXPIRE_TOKEN_CONFIRMATION;
31
+ private _counter;
32
+ constructor(keycloakService: KeycloakService, keycloakOptionsService: KeycloakOptionsService, logger: NGXLogger, promptService: PromptService, translateService: TranslateService, datePipe: DatePipe, configService: ConfigService, router: Router, keycloakStorageService: KeycloakStorageService);
33
+ ngOnDestroy(): void;
34
+ init(): void;
35
+ getUserSubject(): ReplaySubject<UserIdentity>;
36
+ logout(): void;
37
+ getToken(): Promise<string>;
38
+ updateToken(minValidity: number): Promise<boolean>;
39
+ private openTokenRefreshSubscription;
40
+ private get _expiryTimeMs();
41
+ private openRefreshTokenSubscription;
42
+ private setRefreshToken;
43
+ private openExpiryTimerSubscription;
44
+ private closeExpiryTimerSubscription;
45
+ private openConfirmationPrompt;
46
+ private saveUrl;
47
+ static ɵfac: i0.ɵɵFactoryDeclaration<KeycloakUserService, never>;
48
+ static ɵprov: i0.ɵɵInjectableDeclaration<KeycloakUserService>;
49
+ }
50
+ //# sourceMappingURL=keycloak-user.service.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"keycloak-user.service.d.ts","sourceRoot":"","sources":["../../../../../projects/valtimo/keycloak/src/lib/services/keycloak-user.service.ts"],"names":[],"mappings":"AAgBA,OAAO,EAAa,SAAS,E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AAC,QAAQ,CAAC,yBAAyB,CAA+B;IAEzE,OAAO,CAAC,QAAQ,CAAQ;gBAGL,eAAe,EAAE,eAAe,EAChC,sBAAsB,EAAE,sBAAsB,EAC9C,MAAM,EAAE,SAAS,EACjB,aAAa,EAAE,aAAa,EAC5B,gBAAgB,EAAE,gBAAgB,EAClC,QAAQ,EAAE,QAAQ,EAClB,aAAa,EAAE,aAAa,EAC5B,MAAM,EAAE,MAAM,EACd,sBAAsB,EAAE,sBAAsB;IAMjE,WAAW,IAAI,IAAI;IAMnB,IAAI,IAAI,IAAI;IAoBZ,cAAc,IAAI,aAAa,CAAC,YAAY,CAAC;IAK7C,MAAM,IAAI,IAAI;IAKR,QAAQ,IAAI,OAAO,CAAC,MAAM,CAAC;IAK3B,WAAW,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAKxD,OAAO,CAAC,4BAA4B;IAUpC,OAAO,KAAK,aAAa,GAExB;IAED,OAAO,CAAC,4BAA4B;IAUpC,OAAO,CAAC,eAAe;IAKvB,OAAO,CAAC,2BAA2B;IAyCnC,OAAO,CAAC,4BAA4B;IAIpC,OAAO,CAAC,sBAAsB;IAwB9B,OAAO,CAAC,OAAO;yCA/KJ,mBAAmB;6CAAnB,mBAAmB;CA8L/B"}
package/package.json ADDED
@@ -0,0 +1,27 @@
1
+ {
2
+ "name": "@valtimo/keycloak",
3
+ "license": "EUPL-1.2",
4
+ "version": "0.0.0",
5
+ "peerDependencies": {
6
+ "@angular/common": "^19.2.8",
7
+ "@angular/core": "^19.2.8"
8
+ },
9
+ "dependencies": {
10
+ "jwt-decode": "4.0.0",
11
+ "keycloak-angular": "19.0.2",
12
+ "keycloak-js": "26.1.5",
13
+ "tslib": "2.8.1"
14
+ },
15
+ "module": "fesm2022/valtimo-keycloak.mjs",
16
+ "typings": "index.d.ts",
17
+ "exports": {
18
+ "./package.json": {
19
+ "default": "./package.json"
20
+ },
21
+ ".": {
22
+ "types": "./index.d.ts",
23
+ "default": "./fesm2022/valtimo-keycloak.mjs"
24
+ }
25
+ },
26
+ "sideEffects": false
27
+ }
@@ -0,0 +1,9 @@
1
+ export * from './lib/models';
2
+ export * from './lib/keycloak.module';
3
+ export * from './lib/services/keycloak-auth-guard.service';
4
+ export * from './lib/services/keycloak-user.service';
5
+ export * from './lib/keycloak.init';
6
+ export * from './lib/services/keycloak-options.service';
7
+ export * from './lib/callback.component';
8
+ export * from './lib/constants';
9
+ //# sourceMappingURL=public_api.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"public_api.d.ts","sourceRoot":"","sources":["../../../projects/valtimo/keycloak/src/public_api.ts"],"names":[],"mappings":"AAoBA,cAAc,cAAc,CAAC;AAC7B,cAAc,uBAAuB,CAAC;AACtC,cAAc,4CAA4C,CAAC;AAC3D,cAAc,sCAAsC,CAAC;AACrD,cAAc,qBAAqB,CAAC;AACpC,cAAc,yCAAyC,CAAC;AACxD,cAAc,0BAA0B,CAAC;AACzC,cAAc,iBAAiB,CAAC"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"valtimo-keycloak.d.ts","sourceRoot":"","sources":["../../../projects/valtimo/keycloak/src/valtimo-keycloak.ts"],"names":[],"mappings":"AAAA;;GAEG;;AAEH,cAAc,cAAc,CAAC"}