@valtimo/keycloak 4.23.0 → 5.2.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.
- package/esm2020/lib/callback.component.mjs +48 -0
- package/esm2020/lib/keycloak-auth-guard.service.mjs +61 -0
- package/esm2020/lib/keycloak-options.service.mjs +24 -0
- package/esm2020/lib/keycloak-routing.module.mjs +41 -0
- package/esm2020/lib/keycloak-user.service.mjs +65 -0
- package/esm2020/lib/keycloak.init.mjs +46 -0
- package/esm2020/lib/keycloak.module.mjs +34 -0
- package/esm2020/lib/models/index.mjs +19 -0
- package/esm2020/lib/models/keycloak.config.mjs +17 -0
- package/esm2020/public_api.mjs +26 -0
- package/esm2020/valtimo-keycloak.mjs +5 -0
- package/fesm2015/{valtimo-keycloak.js → valtimo-keycloak.mjs} +65 -93
- package/fesm2015/valtimo-keycloak.mjs.map +1 -0
- package/fesm2020/valtimo-keycloak.mjs +352 -0
- package/fesm2020/valtimo-keycloak.mjs.map +1 -0
- package/lib/callback.component.d.ts +4 -0
- package/lib/callback.component.d.ts.map +1 -0
- package/lib/keycloak-auth-guard.service.d.ts +4 -0
- package/lib/keycloak-auth-guard.service.d.ts.map +1 -0
- package/lib/keycloak-options.service.d.ts +4 -0
- package/lib/keycloak-options.service.d.ts.map +1 -0
- package/lib/keycloak-routing.module.d.ts +7 -0
- package/lib/keycloak-routing.module.d.ts.map +1 -0
- package/lib/keycloak-user.service.d.ts +4 -0
- package/lib/keycloak-user.service.d.ts.map +1 -0
- package/lib/keycloak.init.d.ts +1 -0
- package/lib/keycloak.init.d.ts.map +1 -0
- package/lib/keycloak.module.d.ts +8 -0
- package/lib/keycloak.module.d.ts.map +1 -0
- package/lib/models/index.d.ts +1 -0
- package/lib/models/index.d.ts.map +1 -0
- package/lib/models/keycloak.config.d.ts +1 -0
- package/lib/models/keycloak.config.d.ts.map +1 -0
- package/package.json +22 -10
- package/public_api.d.ts +2 -0
- package/public_api.d.ts.map +1 -0
- package/valtimo-keycloak.d.ts +2 -2
- package/valtimo-keycloak.d.ts.map +1 -0
- package/bundles/valtimo-keycloak.umd.js +0 -669
- package/bundles/valtimo-keycloak.umd.js.map +0 -1
- package/bundles/valtimo-keycloak.umd.min.js +0 -17
- package/bundles/valtimo-keycloak.umd.min.js.map +0 -1
- package/esm2015/lib/callback.component.js +0 -49
- package/esm2015/lib/keycloak-auth-guard.service.js +0 -66
- package/esm2015/lib/keycloak-options.service.js +0 -26
- package/esm2015/lib/keycloak-routing.module.js +0 -37
- package/esm2015/lib/keycloak-user.service.js +0 -76
- package/esm2015/lib/keycloak.init.js +0 -47
- package/esm2015/lib/keycloak.module.js +0 -29
- package/esm2015/lib/models/index.js +0 -19
- package/esm2015/lib/models/keycloak.config.js +0 -16
- package/esm2015/public_api.js +0 -25
- package/esm2015/valtimo-keycloak.js +0 -7
- package/fesm2015/valtimo-keycloak.js.map +0 -1
- package/valtimo-keycloak.metadata.json +0 -1
|
@@ -1,28 +1,17 @@
|
|
|
1
|
-
import
|
|
1
|
+
import * as i0 from '@angular/core';
|
|
2
|
+
import { Injectable, Component, NgModule } from '@angular/core';
|
|
3
|
+
import * as i2 from 'keycloak-angular';
|
|
2
4
|
import { KeycloakAngularModule, KeycloakAuthGuard, KeycloakService } from 'keycloak-angular';
|
|
3
|
-
import
|
|
5
|
+
import * as i1$1 from '@angular/router';
|
|
6
|
+
import { RouterModule } from '@angular/router';
|
|
7
|
+
import * as i1 from '@valtimo/config';
|
|
8
|
+
import { ValtimoUserIdentity } from '@valtimo/config';
|
|
9
|
+
import * as i3 from 'ngx-logger';
|
|
4
10
|
import { NGXLogger } from 'ngx-logger';
|
|
5
|
-
import { ConfigService, ValtimoUserIdentity } from '@valtimo/config';
|
|
6
11
|
import { CommonModule } from '@angular/common';
|
|
7
12
|
import { __awaiter } from 'tslib';
|
|
8
13
|
import { ReplaySubject } from 'rxjs';
|
|
9
14
|
|
|
10
|
-
/*
|
|
11
|
-
* Copyright 2015-2020 Ritense BV, the Netherlands.
|
|
12
|
-
*
|
|
13
|
-
* Licensed under EUPL, Version 1.2 (the "License");
|
|
14
|
-
* you may not use this file except in compliance with the License.
|
|
15
|
-
* You may obtain a copy of the License at
|
|
16
|
-
*
|
|
17
|
-
* https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12
|
|
18
|
-
*
|
|
19
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
20
|
-
* distributed under the License is distributed on an "AS IS" basis,
|
|
21
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
22
|
-
* See the License for the specific language governing permissions and
|
|
23
|
-
* limitations under the License.
|
|
24
|
-
*/
|
|
25
|
-
|
|
26
15
|
/*
|
|
27
16
|
*
|
|
28
17
|
* * Copyright 2015-2020 Ritense BV, the Netherlands.
|
|
@@ -53,15 +42,14 @@ class KeycloakOptionsService {
|
|
|
53
42
|
return this.valtimoKeycloakOptions.logoutRedirectUri;
|
|
54
43
|
}
|
|
55
44
|
}
|
|
56
|
-
KeycloakOptionsService.ɵ
|
|
57
|
-
KeycloakOptionsService
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
];
|
|
45
|
+
KeycloakOptionsService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.9", ngImport: i0, type: KeycloakOptionsService, deps: [{ token: i1.ConfigService }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
46
|
+
KeycloakOptionsService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.3.9", ngImport: i0, type: KeycloakOptionsService, providedIn: 'root' });
|
|
47
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.9", ngImport: i0, type: KeycloakOptionsService, decorators: [{
|
|
48
|
+
type: Injectable,
|
|
49
|
+
args: [{
|
|
50
|
+
providedIn: 'root',
|
|
51
|
+
}]
|
|
52
|
+
}], ctorParameters: function () { return [{ type: i1.ConfigService }]; } });
|
|
65
53
|
|
|
66
54
|
/*
|
|
67
55
|
* Copyright 2015-2020 Ritense BV, the Netherlands.
|
|
@@ -96,17 +84,15 @@ class CallbackComponent {
|
|
|
96
84
|
this.router.navigate([redirectTo]);
|
|
97
85
|
}
|
|
98
86
|
}
|
|
99
|
-
CallbackComponent
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
{ type: NGXLogger }
|
|
109
|
-
];
|
|
87
|
+
CallbackComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.9", ngImport: i0, type: CallbackComponent, deps: [{ token: i1$1.Router }, { token: KeycloakOptionsService }, { token: i3.NGXLogger }], target: i0.ɵɵFactoryTarget.Component });
|
|
88
|
+
CallbackComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3.9", type: CallbackComponent, selector: "valtimo-keycloak-callback", ngImport: i0, template: '', isInline: true });
|
|
89
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.9", ngImport: i0, type: CallbackComponent, decorators: [{
|
|
90
|
+
type: Component,
|
|
91
|
+
args: [{
|
|
92
|
+
selector: 'valtimo-keycloak-callback',
|
|
93
|
+
template: '',
|
|
94
|
+
}]
|
|
95
|
+
}], ctorParameters: function () { return [{ type: i1$1.Router }, { type: KeycloakOptionsService }, { type: i3.NGXLogger }]; } });
|
|
110
96
|
|
|
111
97
|
/*
|
|
112
98
|
* Copyright 2015-2020 Ritense BV, the Netherlands.
|
|
@@ -123,22 +109,25 @@ CallbackComponent.ctorParameters = () => [
|
|
|
123
109
|
* See the License for the specific language governing permissions and
|
|
124
110
|
* limitations under the License.
|
|
125
111
|
*/
|
|
126
|
-
const ɵ0 = { title: 'Loading...' };
|
|
127
112
|
const routes = [
|
|
128
113
|
{
|
|
129
114
|
path: 'keycloak/callback',
|
|
130
115
|
component: CallbackComponent,
|
|
131
|
-
data:
|
|
116
|
+
data: { title: 'Loading...' },
|
|
132
117
|
},
|
|
133
118
|
];
|
|
134
119
|
class KeycloakRoutingModule {
|
|
135
120
|
}
|
|
136
|
-
KeycloakRoutingModule
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
121
|
+
KeycloakRoutingModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.9", ngImport: i0, type: KeycloakRoutingModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
122
|
+
KeycloakRoutingModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.3.9", ngImport: i0, type: KeycloakRoutingModule, imports: [CommonModule, i1$1.RouterModule], exports: [RouterModule] });
|
|
123
|
+
KeycloakRoutingModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.3.9", ngImport: i0, type: KeycloakRoutingModule, imports: [[CommonModule, RouterModule.forChild(routes)], RouterModule] });
|
|
124
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.9", ngImport: i0, type: KeycloakRoutingModule, decorators: [{
|
|
125
|
+
type: NgModule,
|
|
126
|
+
args: [{
|
|
127
|
+
imports: [CommonModule, RouterModule.forChild(routes)],
|
|
128
|
+
exports: [RouterModule],
|
|
129
|
+
}]
|
|
130
|
+
}] });
|
|
142
131
|
|
|
143
132
|
/*
|
|
144
133
|
* Copyright 2015-2020 Ritense BV, the Netherlands.
|
|
@@ -157,13 +146,17 @@ KeycloakRoutingModule.decorators = [
|
|
|
157
146
|
*/
|
|
158
147
|
class KeycloakModule {
|
|
159
148
|
}
|
|
160
|
-
KeycloakModule
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
]
|
|
149
|
+
KeycloakModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.9", ngImport: i0, type: KeycloakModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
150
|
+
KeycloakModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.3.9", ngImport: i0, type: KeycloakModule, declarations: [CallbackComponent], imports: [KeycloakRoutingModule, KeycloakAngularModule], exports: [CallbackComponent] });
|
|
151
|
+
KeycloakModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.3.9", ngImport: i0, type: KeycloakModule, imports: [[KeycloakRoutingModule, KeycloakAngularModule]] });
|
|
152
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.9", ngImport: i0, type: KeycloakModule, decorators: [{
|
|
153
|
+
type: NgModule,
|
|
154
|
+
args: [{
|
|
155
|
+
declarations: [CallbackComponent],
|
|
156
|
+
imports: [KeycloakRoutingModule, KeycloakAngularModule],
|
|
157
|
+
exports: [CallbackComponent],
|
|
158
|
+
}]
|
|
159
|
+
}] });
|
|
167
160
|
|
|
168
161
|
/*
|
|
169
162
|
* Copyright 2015-2020 Ritense BV, the Netherlands.
|
|
@@ -211,17 +204,14 @@ class KeycloakAuthGuardService extends KeycloakAuthGuard {
|
|
|
211
204
|
});
|
|
212
205
|
}
|
|
213
206
|
}
|
|
214
|
-
KeycloakAuthGuardService.ɵ
|
|
215
|
-
KeycloakAuthGuardService
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
{ type: KeycloakService },
|
|
223
|
-
{ type: NGXLogger }
|
|
224
|
-
];
|
|
207
|
+
KeycloakAuthGuardService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.9", ngImport: i0, type: KeycloakAuthGuardService, deps: [{ token: i1$1.Router }, { token: i2.KeycloakService }, { token: i3.NGXLogger }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
208
|
+
KeycloakAuthGuardService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.3.9", ngImport: i0, type: KeycloakAuthGuardService, providedIn: 'root' });
|
|
209
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.9", ngImport: i0, type: KeycloakAuthGuardService, decorators: [{
|
|
210
|
+
type: Injectable,
|
|
211
|
+
args: [{
|
|
212
|
+
providedIn: 'root',
|
|
213
|
+
}]
|
|
214
|
+
}], ctorParameters: function () { return [{ type: i1$1.Router }, { type: i2.KeycloakService }, { type: i3.NGXLogger }]; } });
|
|
225
215
|
|
|
226
216
|
class KeycloakUserService {
|
|
227
217
|
constructor(keycloakService, keycloakOptionsService, logger) {
|
|
@@ -261,33 +251,15 @@ class KeycloakUserService {
|
|
|
261
251
|
});
|
|
262
252
|
}
|
|
263
253
|
}
|
|
264
|
-
KeycloakUserService.ɵ
|
|
265
|
-
KeycloakUserService
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
{ type: KeycloakOptionsService },
|
|
273
|
-
{ type: NGXLogger }
|
|
274
|
-
];
|
|
254
|
+
KeycloakUserService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.9", ngImport: i0, type: KeycloakUserService, deps: [{ token: i2.KeycloakService }, { token: KeycloakOptionsService }, { token: i3.NGXLogger }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
255
|
+
KeycloakUserService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.3.9", ngImport: i0, type: KeycloakUserService, providedIn: 'root' });
|
|
256
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.9", ngImport: i0, type: KeycloakUserService, decorators: [{
|
|
257
|
+
type: Injectable,
|
|
258
|
+
args: [{
|
|
259
|
+
providedIn: 'root',
|
|
260
|
+
}]
|
|
261
|
+
}], ctorParameters: function () { return [{ type: i2.KeycloakService }, { type: KeycloakOptionsService }, { type: i3.NGXLogger }]; } });
|
|
275
262
|
|
|
276
|
-
/*
|
|
277
|
-
* Copyright 2015-2020 Ritense BV, the Netherlands.
|
|
278
|
-
*
|
|
279
|
-
* Licensed under EUPL, Version 1.2 (the "License");
|
|
280
|
-
* you may not use this file except in compliance with the License.
|
|
281
|
-
* You may obtain a copy of the License at
|
|
282
|
-
*
|
|
283
|
-
* https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12
|
|
284
|
-
*
|
|
285
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
286
|
-
* distributed under the License is distributed on an "AS IS" basis,
|
|
287
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
288
|
-
* See the License for the specific language governing permissions and
|
|
289
|
-
* limitations under the License.
|
|
290
|
-
*/
|
|
291
263
|
function keycloakInitializer(injector) {
|
|
292
264
|
const keycloakService = injector.get(KeycloakService);
|
|
293
265
|
const keycloakUserService = injector.get(KeycloakUserService);
|
|
@@ -335,5 +307,5 @@ function keycloakInitializer(injector) {
|
|
|
335
307
|
* Generated bundle index. Do not edit.
|
|
336
308
|
*/
|
|
337
309
|
|
|
338
|
-
export { KeycloakAuthGuardService, KeycloakModule, KeycloakOptionsService, KeycloakUserService, keycloakInitializer
|
|
339
|
-
//# sourceMappingURL=valtimo-keycloak.
|
|
310
|
+
export { CallbackComponent, KeycloakAuthGuardService, KeycloakModule, KeycloakOptionsService, KeycloakUserService, keycloakInitializer };
|
|
311
|
+
//# sourceMappingURL=valtimo-keycloak.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"valtimo-keycloak.mjs","sources":["../../../../projects/valtimo/keycloak/src/lib/models/index.ts","../../../../projects/valtimo/keycloak/src/lib/keycloak-options.service.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-auth-guard.service.ts","../../../../projects/valtimo/keycloak/src/lib/keycloak-user.service.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 *\n * * Copyright 2015-2020 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\nexport * from './keycloak.config';\n","/*\n * Copyright 2015-2020 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/config';\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-2020 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} from './keycloak-options.service';\n\n@Component({\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 ) {\n logger.debug('callback');\n const savedRedirectTo = window.sessionStorage.getItem('redirectTo');\n let redirectTo;\n if (savedRedirectTo !== null) {\n redirectTo = window.sessionStorage.getItem('redirectTo');\n } else {\n redirectTo = '/';\n }\n logger.debug('keycloak callback redirect =', redirectTo);\n this.router.navigate([redirectTo]);\n }\n}\n","/*\n * Copyright 2015-2020 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-2020 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';\n\n@NgModule({\n declarations: [CallbackComponent],\n imports: [KeycloakRoutingModule, KeycloakAngularModule],\n exports: [CallbackComponent],\n})\nexport class KeycloakModule {}\n","/*\n * Copyright 2015-2020 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 if (!requiredRoles || requiredRoles.length === 0) {\n return resolve(true);\n } else {\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","/*\n * Copyright 2015-2020 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 {ReplaySubject} from 'rxjs';\nimport {NGXLogger} from 'ngx-logger';\nimport {KeycloakService} from 'keycloak-angular';\nimport {UserIdentity, UserService, ValtimoUserIdentity} from '@valtimo/config';\nimport {KeycloakOptionsService} from './keycloak-options.service';\n\n@Injectable({\n providedIn: 'root',\n})\nexport class KeycloakUserService implements UserService {\n private userIdentity: ReplaySubject<UserIdentity>;\n\n constructor(\n private keycloakService: KeycloakService,\n private keycloakOptionsService: KeycloakOptionsService,\n private logger: NGXLogger\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 );\n this.logger.debug('KeycloakUserService: loaded user identity', valtimoUserIdentity);\n this.userIdentity.next(valtimoUserIdentity);\n });\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","/*\n * Copyright 2015-2020 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} from './keycloak-options.service';\nimport {Injector} from '@angular/core';\nimport {NGXLogger} from 'ngx-logger';\nimport {KeycloakUserService} from './keycloak-user.service';\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 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 = window.location.pathname;\n logger.debug('Setting redirectTo =', redirectTo);\n window.sessionStorage.setItem('redirectTo', redirectTo);\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-2020 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/keycloak-auth-guard.service';\nexport * from './lib/keycloak-user.service';\nexport * from './lib/keycloak.init';\nexport * from './lib/keycloak-options.service';\nexport * from './lib/callback.component';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public_api';\n"],"names":["i1","i2.KeycloakOptionsService"],"mappings":";;;;;;;;;;;;;;AAAA;;;;;;;;;;;;;;;;AAgBG;;MCOU,sBAAsB,CAAA;AAGjC,IAAA,WAAA,CAAoB,aAA4B,EAAA;AAA5B,QAAA,IAAa,CAAA,aAAA,GAAb,aAAa,CAAe;QAC9C,IAAI,CAAC,sBAAsB,GAAG,aAAa,CAAC,MAAM,CAAC,cAAc,CAAC,OAAO,CAAC;KAC3E;AAED,IAAA,IAAI,eAAe,GAAA;AACjB,QAAA,OAAO,IAAI,CAAC,sBAAsB,CAAC,eAAe,CAAC;KACpD;AAED,IAAA,IAAI,iBAAiB,GAAA;AACnB,QAAA,OAAO,IAAI,CAAC,sBAAsB,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AAA,IAAI,eAAe,CAAC,WAAW,CAAC,WAAW,KAAK,UAAU,EAAE;AAC1D,gBAAA,MAAM,UAAU,GAAG,MAAM,CAAC,QAAQ,CAAC,QAAQ,CAAC;AAC5C,gBAAA,MAAM,CAAC,KAAK,CAAC,sBAAsB,EAAE,UAAU,CAAC,CAAC;gBACjD,MAAM,CAAC,cAAc,CAAC,OAAO,CAAC,YAAY,EAAE,UAAU,CAAC,CAAC;AACzD,aAAA;YAED,MAAM,UAAU,GAAG,MAAM,eAAe,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC;AAC/D,YAAA,MAAM,CAAC,KAAK,CAAC,iCAAiC,CAAC,CAAC;YAEhD,mBAAmB,CAAC,IAAI,EAAE,CAAC;AAE3B,YAAA,OAAO,UAAU,CAAC;AACnB,SAAA;AAAC,QAAA,OAAO,KAAK,EAAE;AACd,YAAA,MAAM,CAAC,KAAK,CAAC,4BAA4B,EAAE,KAAK,CAAC,CAAC;AAClD,YAAA,MAAM,KAAK,CAAC;AACb,SAAA;AACH,KAAC,CAAA,CAAC;AACJ;;ACpDA;;;;;;;;;;;;;;AAcG;;ACdH;;AAEG;;;;"}
|
|
@@ -0,0 +1,352 @@
|
|
|
1
|
+
import * as i0 from '@angular/core';
|
|
2
|
+
import { Injectable, Component, NgModule } from '@angular/core';
|
|
3
|
+
import * as i2 from 'keycloak-angular';
|
|
4
|
+
import { KeycloakAngularModule, KeycloakAuthGuard, KeycloakService } from 'keycloak-angular';
|
|
5
|
+
import * as i1$1 from '@angular/router';
|
|
6
|
+
import { RouterModule } from '@angular/router';
|
|
7
|
+
import * as i1 from '@valtimo/config';
|
|
8
|
+
import { ValtimoUserIdentity } from '@valtimo/config';
|
|
9
|
+
import * as i3 from 'ngx-logger';
|
|
10
|
+
import { NGXLogger } from 'ngx-logger';
|
|
11
|
+
import { CommonModule } from '@angular/common';
|
|
12
|
+
import { ReplaySubject } from 'rxjs';
|
|
13
|
+
|
|
14
|
+
/*
|
|
15
|
+
* Copyright 2015-2020 Ritense BV, the Netherlands.
|
|
16
|
+
*
|
|
17
|
+
* Licensed under EUPL, Version 1.2 (the "License");
|
|
18
|
+
* you may not use this file except in compliance with the License.
|
|
19
|
+
* You may obtain a copy of the License at
|
|
20
|
+
*
|
|
21
|
+
* https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12
|
|
22
|
+
*
|
|
23
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
24
|
+
* distributed under the License is distributed on an "AS IS" basis,
|
|
25
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
26
|
+
* See the License for the specific language governing permissions and
|
|
27
|
+
* limitations under the License.
|
|
28
|
+
*/
|
|
29
|
+
|
|
30
|
+
/*
|
|
31
|
+
*
|
|
32
|
+
* * Copyright 2015-2020 Ritense BV, the Netherlands.
|
|
33
|
+
* *
|
|
34
|
+
* * Licensed under EUPL, Version 1.2 (the "License");
|
|
35
|
+
* * you may not use this file except in compliance with the License.
|
|
36
|
+
* * You may obtain a copy of the License at
|
|
37
|
+
* *
|
|
38
|
+
* * https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12
|
|
39
|
+
* *
|
|
40
|
+
* * Unless required by applicable law or agreed to in writing, software
|
|
41
|
+
* * distributed under the License is distributed on an "AS IS" basis,
|
|
42
|
+
* * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
43
|
+
* * See the License for the specific language governing permissions and
|
|
44
|
+
* * limitations under the License.
|
|
45
|
+
*
|
|
46
|
+
*/
|
|
47
|
+
|
|
48
|
+
class KeycloakOptionsService {
|
|
49
|
+
constructor(configService) {
|
|
50
|
+
this.configService = configService;
|
|
51
|
+
this.valtimoKeycloakOptions = configService.config.authentication.options;
|
|
52
|
+
}
|
|
53
|
+
get keycloakOptions() {
|
|
54
|
+
return this.valtimoKeycloakOptions.keycloakOptions;
|
|
55
|
+
}
|
|
56
|
+
get logoutRedirectUri() {
|
|
57
|
+
return this.valtimoKeycloakOptions.logoutRedirectUri;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
KeycloakOptionsService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.9", ngImport: i0, type: KeycloakOptionsService, deps: [{ token: i1.ConfigService }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
61
|
+
KeycloakOptionsService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.3.9", ngImport: i0, type: KeycloakOptionsService, providedIn: 'root' });
|
|
62
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.9", ngImport: i0, type: KeycloakOptionsService, decorators: [{
|
|
63
|
+
type: Injectable,
|
|
64
|
+
args: [{
|
|
65
|
+
providedIn: 'root',
|
|
66
|
+
}]
|
|
67
|
+
}], ctorParameters: function () { return [{ type: i1.ConfigService }]; } });
|
|
68
|
+
|
|
69
|
+
/*
|
|
70
|
+
* Copyright 2015-2020 Ritense BV, the Netherlands.
|
|
71
|
+
*
|
|
72
|
+
* Licensed under EUPL, Version 1.2 (the "License");
|
|
73
|
+
* you may not use this file except in compliance with the License.
|
|
74
|
+
* You may obtain a copy of the License at
|
|
75
|
+
*
|
|
76
|
+
* https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12
|
|
77
|
+
*
|
|
78
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
79
|
+
* distributed under the License is distributed on an "AS IS" basis,
|
|
80
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
81
|
+
* See the License for the specific language governing permissions and
|
|
82
|
+
* limitations under the License.
|
|
83
|
+
*/
|
|
84
|
+
class CallbackComponent {
|
|
85
|
+
constructor(router, keycloakOptionsService, logger) {
|
|
86
|
+
this.router = router;
|
|
87
|
+
this.keycloakOptionsService = keycloakOptionsService;
|
|
88
|
+
this.logger = logger;
|
|
89
|
+
logger.debug('callback');
|
|
90
|
+
const savedRedirectTo = window.sessionStorage.getItem('redirectTo');
|
|
91
|
+
let redirectTo;
|
|
92
|
+
if (savedRedirectTo !== null) {
|
|
93
|
+
redirectTo = window.sessionStorage.getItem('redirectTo');
|
|
94
|
+
}
|
|
95
|
+
else {
|
|
96
|
+
redirectTo = '/';
|
|
97
|
+
}
|
|
98
|
+
logger.debug('keycloak callback redirect =', redirectTo);
|
|
99
|
+
this.router.navigate([redirectTo]);
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
CallbackComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.9", ngImport: i0, type: CallbackComponent, deps: [{ token: i1$1.Router }, { token: KeycloakOptionsService }, { token: i3.NGXLogger }], target: i0.ɵɵFactoryTarget.Component });
|
|
103
|
+
CallbackComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3.9", type: CallbackComponent, selector: "valtimo-keycloak-callback", ngImport: i0, template: '', isInline: true });
|
|
104
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.9", ngImport: i0, type: CallbackComponent, decorators: [{
|
|
105
|
+
type: Component,
|
|
106
|
+
args: [{
|
|
107
|
+
selector: 'valtimo-keycloak-callback',
|
|
108
|
+
template: '',
|
|
109
|
+
}]
|
|
110
|
+
}], ctorParameters: function () { return [{ type: i1$1.Router }, { type: KeycloakOptionsService }, { type: i3.NGXLogger }]; } });
|
|
111
|
+
|
|
112
|
+
/*
|
|
113
|
+
* Copyright 2015-2020 Ritense BV, the Netherlands.
|
|
114
|
+
*
|
|
115
|
+
* Licensed under EUPL, Version 1.2 (the "License");
|
|
116
|
+
* you may not use this file except in compliance with the License.
|
|
117
|
+
* You may obtain a copy of the License at
|
|
118
|
+
*
|
|
119
|
+
* https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12
|
|
120
|
+
*
|
|
121
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
122
|
+
* distributed under the License is distributed on an "AS IS" basis,
|
|
123
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
124
|
+
* See the License for the specific language governing permissions and
|
|
125
|
+
* limitations under the License.
|
|
126
|
+
*/
|
|
127
|
+
const routes = [
|
|
128
|
+
{
|
|
129
|
+
path: 'keycloak/callback',
|
|
130
|
+
component: CallbackComponent,
|
|
131
|
+
data: { title: 'Loading...' },
|
|
132
|
+
},
|
|
133
|
+
];
|
|
134
|
+
class KeycloakRoutingModule {
|
|
135
|
+
}
|
|
136
|
+
KeycloakRoutingModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.9", ngImport: i0, type: KeycloakRoutingModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
137
|
+
KeycloakRoutingModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.3.9", ngImport: i0, type: KeycloakRoutingModule, imports: [CommonModule, i1$1.RouterModule], exports: [RouterModule] });
|
|
138
|
+
KeycloakRoutingModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.3.9", ngImport: i0, type: KeycloakRoutingModule, imports: [[CommonModule, RouterModule.forChild(routes)], RouterModule] });
|
|
139
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.9", ngImport: i0, type: KeycloakRoutingModule, decorators: [{
|
|
140
|
+
type: NgModule,
|
|
141
|
+
args: [{
|
|
142
|
+
imports: [CommonModule, RouterModule.forChild(routes)],
|
|
143
|
+
exports: [RouterModule],
|
|
144
|
+
}]
|
|
145
|
+
}] });
|
|
146
|
+
|
|
147
|
+
/*
|
|
148
|
+
* Copyright 2015-2020 Ritense BV, the Netherlands.
|
|
149
|
+
*
|
|
150
|
+
* Licensed under EUPL, Version 1.2 (the "License");
|
|
151
|
+
* you may not use this file except in compliance with the License.
|
|
152
|
+
* You may obtain a copy of the License at
|
|
153
|
+
*
|
|
154
|
+
* https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12
|
|
155
|
+
*
|
|
156
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
157
|
+
* distributed under the License is distributed on an "AS IS" basis,
|
|
158
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
159
|
+
* See the License for the specific language governing permissions and
|
|
160
|
+
* limitations under the License.
|
|
161
|
+
*/
|
|
162
|
+
class KeycloakModule {
|
|
163
|
+
}
|
|
164
|
+
KeycloakModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.9", ngImport: i0, type: KeycloakModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
165
|
+
KeycloakModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.3.9", ngImport: i0, type: KeycloakModule, declarations: [CallbackComponent], imports: [KeycloakRoutingModule, KeycloakAngularModule], exports: [CallbackComponent] });
|
|
166
|
+
KeycloakModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.3.9", ngImport: i0, type: KeycloakModule, imports: [[KeycloakRoutingModule, KeycloakAngularModule]] });
|
|
167
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.9", ngImport: i0, type: KeycloakModule, decorators: [{
|
|
168
|
+
type: NgModule,
|
|
169
|
+
args: [{
|
|
170
|
+
declarations: [CallbackComponent],
|
|
171
|
+
imports: [KeycloakRoutingModule, KeycloakAngularModule],
|
|
172
|
+
exports: [CallbackComponent],
|
|
173
|
+
}]
|
|
174
|
+
}] });
|
|
175
|
+
|
|
176
|
+
/*
|
|
177
|
+
* Copyright 2015-2020 Ritense BV, the Netherlands.
|
|
178
|
+
*
|
|
179
|
+
* Licensed under EUPL, Version 1.2 (the "License");
|
|
180
|
+
* you may not use this file except in compliance with the License.
|
|
181
|
+
* You may obtain a copy of the License at
|
|
182
|
+
*
|
|
183
|
+
* https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12
|
|
184
|
+
*
|
|
185
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
186
|
+
* distributed under the License is distributed on an "AS IS" basis,
|
|
187
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
188
|
+
* See the License for the specific language governing permissions and
|
|
189
|
+
* limitations under the License.
|
|
190
|
+
*/
|
|
191
|
+
class KeycloakAuthGuardService extends KeycloakAuthGuard {
|
|
192
|
+
constructor(router, keycloakAngular, logger) {
|
|
193
|
+
super(router, keycloakAngular);
|
|
194
|
+
this.router = router;
|
|
195
|
+
this.keycloakAngular = keycloakAngular;
|
|
196
|
+
this.logger = logger;
|
|
197
|
+
this.logger.debug('KeycloakAuthGuardService: ctor');
|
|
198
|
+
}
|
|
199
|
+
isAccessAllowed(route, state) {
|
|
200
|
+
this.logger.debug('KeycloakAuthGuardService: isAccessAllowed');
|
|
201
|
+
return new Promise((resolve, reject) => {
|
|
202
|
+
this.logger.debug('KeycloakAuthGuardService: isAccessAllowed checking access');
|
|
203
|
+
if (!this.authenticated) {
|
|
204
|
+
this.keycloakAngular
|
|
205
|
+
.login()
|
|
206
|
+
.catch(e => `KeycloakAuthGuardService error: ${this.logger.error(e)}`);
|
|
207
|
+
return reject(false);
|
|
208
|
+
}
|
|
209
|
+
const requiredRoles = route.data.roles;
|
|
210
|
+
if (!requiredRoles || requiredRoles.length === 0) {
|
|
211
|
+
return resolve(true);
|
|
212
|
+
}
|
|
213
|
+
else {
|
|
214
|
+
if (!this.roles || this.roles.length === 0) {
|
|
215
|
+
resolve(false);
|
|
216
|
+
}
|
|
217
|
+
resolve(requiredRoles.some(role => this.roles.includes(role)));
|
|
218
|
+
}
|
|
219
|
+
});
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
KeycloakAuthGuardService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.9", ngImport: i0, type: KeycloakAuthGuardService, deps: [{ token: i1$1.Router }, { token: i2.KeycloakService }, { token: i3.NGXLogger }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
223
|
+
KeycloakAuthGuardService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.3.9", ngImport: i0, type: KeycloakAuthGuardService, providedIn: 'root' });
|
|
224
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.9", ngImport: i0, type: KeycloakAuthGuardService, decorators: [{
|
|
225
|
+
type: Injectable,
|
|
226
|
+
args: [{
|
|
227
|
+
providedIn: 'root',
|
|
228
|
+
}]
|
|
229
|
+
}], ctorParameters: function () { return [{ type: i1$1.Router }, { type: i2.KeycloakService }, { type: i3.NGXLogger }]; } });
|
|
230
|
+
|
|
231
|
+
/*
|
|
232
|
+
* Copyright 2015-2020 Ritense BV, the Netherlands.
|
|
233
|
+
*
|
|
234
|
+
* Licensed under EUPL, Version 1.2 (the "License");
|
|
235
|
+
* you may not use this file except in compliance with the License.
|
|
236
|
+
* You may obtain a copy of the License at
|
|
237
|
+
*
|
|
238
|
+
* https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12
|
|
239
|
+
*
|
|
240
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
241
|
+
* distributed under the License is distributed on an "AS IS" basis,
|
|
242
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
243
|
+
* See the License for the specific language governing permissions and
|
|
244
|
+
* limitations under the License.
|
|
245
|
+
*/
|
|
246
|
+
class KeycloakUserService {
|
|
247
|
+
constructor(keycloakService, keycloakOptionsService, logger) {
|
|
248
|
+
this.keycloakService = keycloakService;
|
|
249
|
+
this.keycloakOptionsService = keycloakOptionsService;
|
|
250
|
+
this.logger = logger;
|
|
251
|
+
}
|
|
252
|
+
init() {
|
|
253
|
+
this.userIdentity = new ReplaySubject();
|
|
254
|
+
this.keycloakService.loadUserProfile().then(user => {
|
|
255
|
+
this.logger.debug('KeycloakUserService: loadUserProfile = ', user);
|
|
256
|
+
const roles = [];
|
|
257
|
+
this.keycloakService.getUserRoles(true).forEach(role => roles.push(role));
|
|
258
|
+
const valtimoUserIdentity = new ValtimoUserIdentity(user.email, user.firstName, user.lastName, roles, user.username);
|
|
259
|
+
this.logger.debug('KeycloakUserService: loaded user identity', valtimoUserIdentity);
|
|
260
|
+
this.userIdentity.next(valtimoUserIdentity);
|
|
261
|
+
});
|
|
262
|
+
}
|
|
263
|
+
getUserSubject() {
|
|
264
|
+
this.logger.debug('KeycloakUserService: getUserIdentity');
|
|
265
|
+
return this.userIdentity;
|
|
266
|
+
}
|
|
267
|
+
logout() {
|
|
268
|
+
this.logger.debug('KeycloakUserService: logout');
|
|
269
|
+
this.keycloakService.logout(this.keycloakOptionsService.logoutRedirectUri);
|
|
270
|
+
}
|
|
271
|
+
async getToken() {
|
|
272
|
+
this.logger.debug('KeycloakUserService: getToken');
|
|
273
|
+
return this.keycloakService.getToken();
|
|
274
|
+
}
|
|
275
|
+
async updateToken(minValidity) {
|
|
276
|
+
this.logger.debug('KeycloakUserService: updateToken');
|
|
277
|
+
return this.keycloakService.updateToken(minValidity);
|
|
278
|
+
}
|
|
279
|
+
}
|
|
280
|
+
KeycloakUserService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.9", ngImport: i0, type: KeycloakUserService, deps: [{ token: i2.KeycloakService }, { token: KeycloakOptionsService }, { token: i3.NGXLogger }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
281
|
+
KeycloakUserService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.3.9", ngImport: i0, type: KeycloakUserService, providedIn: 'root' });
|
|
282
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.9", ngImport: i0, type: KeycloakUserService, decorators: [{
|
|
283
|
+
type: Injectable,
|
|
284
|
+
args: [{
|
|
285
|
+
providedIn: 'root',
|
|
286
|
+
}]
|
|
287
|
+
}], ctorParameters: function () { return [{ type: i2.KeycloakService }, { type: KeycloakOptionsService }, { type: i3.NGXLogger }]; } });
|
|
288
|
+
|
|
289
|
+
/*
|
|
290
|
+
* Copyright 2015-2020 Ritense BV, the Netherlands.
|
|
291
|
+
*
|
|
292
|
+
* Licensed under EUPL, Version 1.2 (the "License");
|
|
293
|
+
* you may not use this file except in compliance with the License.
|
|
294
|
+
* You may obtain a copy of the License at
|
|
295
|
+
*
|
|
296
|
+
* https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12
|
|
297
|
+
*
|
|
298
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
299
|
+
* distributed under the License is distributed on an "AS IS" basis,
|
|
300
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
301
|
+
* See the License for the specific language governing permissions and
|
|
302
|
+
* limitations under the License.
|
|
303
|
+
*/
|
|
304
|
+
function keycloakInitializer(injector) {
|
|
305
|
+
const keycloakService = injector.get(KeycloakService);
|
|
306
|
+
const keycloakUserService = injector.get(KeycloakUserService);
|
|
307
|
+
const optionsService = injector.get(KeycloakOptionsService); // TODO possible removal of abstraction
|
|
308
|
+
const logger = injector.get(NGXLogger);
|
|
309
|
+
return async () => {
|
|
310
|
+
try {
|
|
311
|
+
logger.debug('Keycloak initializer before init');
|
|
312
|
+
const keycloakOptions = optionsService.keycloakOptions;
|
|
313
|
+
const currentUrl = window.location.href.split('#')[0];
|
|
314
|
+
if (keycloakOptions.initOptions.redirectUri !== currentUrl) {
|
|
315
|
+
const redirectTo = window.location.pathname;
|
|
316
|
+
logger.debug('Setting redirectTo =', redirectTo);
|
|
317
|
+
window.sessionStorage.setItem('redirectTo', redirectTo);
|
|
318
|
+
}
|
|
319
|
+
const initResult = await keycloakService.init(keycloakOptions);
|
|
320
|
+
logger.debug('Keycloak initializer after init');
|
|
321
|
+
keycloakUserService.init();
|
|
322
|
+
return initResult;
|
|
323
|
+
}
|
|
324
|
+
catch (error) {
|
|
325
|
+
logger.debug('Keycloak initializer error', error);
|
|
326
|
+
throw error;
|
|
327
|
+
}
|
|
328
|
+
};
|
|
329
|
+
}
|
|
330
|
+
|
|
331
|
+
/*
|
|
332
|
+
* Copyright 2015-2020 Ritense BV, the Netherlands.
|
|
333
|
+
*
|
|
334
|
+
* Licensed under EUPL, Version 1.2 (the "License");
|
|
335
|
+
* you may not use this file except in compliance with the License.
|
|
336
|
+
* You may obtain a copy of the License at
|
|
337
|
+
*
|
|
338
|
+
* https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12
|
|
339
|
+
*
|
|
340
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
341
|
+
* distributed under the License is distributed on an "AS IS" basis,
|
|
342
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
343
|
+
* See the License for the specific language governing permissions and
|
|
344
|
+
* limitations under the License.
|
|
345
|
+
*/
|
|
346
|
+
|
|
347
|
+
/**
|
|
348
|
+
* Generated bundle index. Do not edit.
|
|
349
|
+
*/
|
|
350
|
+
|
|
351
|
+
export { CallbackComponent, KeycloakAuthGuardService, KeycloakModule, KeycloakOptionsService, KeycloakUserService, keycloakInitializer };
|
|
352
|
+
//# sourceMappingURL=valtimo-keycloak.mjs.map
|