@rxap/oauth 15.0.0 → 16.0.0-dev.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 (65) hide show
  1. package/esm2022/lib/container/container.component.mjs +39 -0
  2. package/esm2022/lib/container/container.component.module.mjs +21 -0
  3. package/esm2022/lib/get-o-auth-profile.method.mjs +41 -0
  4. package/esm2022/lib/loading/loading.component.mjs +13 -0
  5. package/esm2022/lib/loading/loading.component.module.mjs +25 -0
  6. package/esm2022/lib/o-auth-extract.guard.mjs +56 -0
  7. package/esm2022/lib/o-auth-redirect.guard.mjs +32 -0
  8. package/esm2022/lib/o-auth-routing.module.mjs +26 -0
  9. package/esm2022/lib/o-auth.method.mjs +117 -0
  10. package/esm2022/lib/o-auth.module.mjs +28 -0
  11. package/esm2022/lib/o-auth.service.mjs +321 -0
  12. package/esm2022/lib/profile.resolve.mjs +38 -0
  13. package/esm2022/lib/sign-in-with-redirect/sign-in-with-redirect.component.mjs +48 -0
  14. package/esm2022/lib/sign-in-with-redirect/sign-in-with-redirect.component.module.mjs +37 -0
  15. package/{esm2020 → esm2022}/single-sign-on/lib/continue/continue.component.mjs +15 -14
  16. package/esm2022/single-sign-on/lib/continue/continue.component.module.mjs +41 -0
  17. package/esm2022/single-sign-on/lib/error/error.component.mjs +45 -0
  18. package/esm2022/single-sign-on/lib/error/error.component.module.mjs +29 -0
  19. package/esm2022/single-sign-on/lib/o-auth-single-sign-on-routing.module.mjs +51 -0
  20. package/esm2022/single-sign-on/lib/o-auth-single-sign-on.guard.mjs +70 -0
  21. package/esm2022/single-sign-on/lib/o-auth-single-sign-on.service.mjs +78 -0
  22. package/{fesm2020 → fesm2022}/rxap-oauth-single-sign-on.mjs +60 -61
  23. package/fesm2022/rxap-oauth-single-sign-on.mjs.map +1 -0
  24. package/{fesm2020 → fesm2022}/rxap-oauth.mjs +96 -97
  25. package/fesm2022/rxap-oauth.mjs.map +1 -0
  26. package/lib/o-auth-extract.guard.d.ts +2 -2
  27. package/lib/o-auth-redirect.guard.d.ts +2 -2
  28. package/lib/o-auth.method.d.ts +1 -1
  29. package/lib/profile.resolve.d.ts +2 -2
  30. package/package.json +27 -35
  31. package/single-sign-on/lib/o-auth-single-sign-on.guard.d.ts +2 -2
  32. package/esm2020/lib/container/container.component.mjs +0 -38
  33. package/esm2020/lib/container/container.component.module.mjs +0 -20
  34. package/esm2020/lib/get-o-auth-profile.method.mjs +0 -40
  35. package/esm2020/lib/loading/loading.component.mjs +0 -12
  36. package/esm2020/lib/loading/loading.component.module.mjs +0 -24
  37. package/esm2020/lib/o-auth-extract.guard.mjs +0 -55
  38. package/esm2020/lib/o-auth-redirect.guard.mjs +0 -31
  39. package/esm2020/lib/o-auth-routing.module.mjs +0 -25
  40. package/esm2020/lib/o-auth.method.mjs +0 -116
  41. package/esm2020/lib/o-auth.module.mjs +0 -27
  42. package/esm2020/lib/o-auth.service.mjs +0 -320
  43. package/esm2020/lib/profile.resolve.mjs +0 -37
  44. package/esm2020/lib/sign-in-with-redirect/sign-in-with-redirect.component.mjs +0 -47
  45. package/esm2020/lib/sign-in-with-redirect/sign-in-with-redirect.component.module.mjs +0 -36
  46. package/esm2020/single-sign-on/lib/continue/continue.component.module.mjs +0 -40
  47. package/esm2020/single-sign-on/lib/error/error.component.mjs +0 -44
  48. package/esm2020/single-sign-on/lib/error/error.component.module.mjs +0 -28
  49. package/esm2020/single-sign-on/lib/o-auth-single-sign-on-routing.module.mjs +0 -50
  50. package/esm2020/single-sign-on/lib/o-auth-single-sign-on.guard.mjs +0 -69
  51. package/esm2020/single-sign-on/lib/o-auth-single-sign-on.service.mjs +0 -77
  52. package/fesm2015/rxap-oauth-single-sign-on.mjs +0 -405
  53. package/fesm2015/rxap-oauth-single-sign-on.mjs.map +0 -1
  54. package/fesm2015/rxap-oauth.mjs +0 -853
  55. package/fesm2015/rxap-oauth.mjs.map +0 -1
  56. package/fesm2020/rxap-oauth-single-sign-on.mjs.map +0 -1
  57. package/fesm2020/rxap-oauth.mjs.map +0 -1
  58. /package/{esm2020 → esm2022}/index.mjs +0 -0
  59. /package/{esm2020 → esm2022}/lib/routes.mjs +0 -0
  60. /package/{esm2020 → esm2022}/lib/tokens.mjs +0 -0
  61. /package/{esm2020 → esm2022}/rxap-oauth.mjs +0 -0
  62. /package/{esm2020 → esm2022}/single-sign-on/lib/routes.mjs +0 -0
  63. /package/{esm2020 → esm2022}/single-sign-on/lib/tokens.mjs +0 -0
  64. /package/{esm2020 → esm2022}/single-sign-on/public_api.mjs +0 -0
  65. /package/{esm2020 → esm2022}/single-sign-on/rxap-oauth-single-sign-on.mjs +0 -0
@@ -1,853 +0,0 @@
1
- import * as i0 from '@angular/core';
2
- import { InjectionToken, Injectable, Inject, Optional, NgModule, Component, ChangeDetectionStrategy } from '@angular/core';
3
- import * as i1 from '@angular/common/http';
4
- import { HttpClient, HttpHeaders } from '@angular/common/http';
5
- import { __awaiter } from 'tslib';
6
- import * as i1$1 from '@angular/router';
7
- import { Router, RouterModule } from '@angular/router';
8
- import { ReplaySubject } from 'rxjs';
9
- import { AuthenticationEventType } from '@rxap/authentication';
10
- import { trigger, transition, style, animate, state } from '@angular/animations';
11
- import * as i1$2 from '@angular/material/legacy-progress-bar';
12
- import { MatLegacyProgressBarModule } from '@angular/material/legacy-progress-bar';
13
- import * as i2 from '@angular/material/legacy-button';
14
- import { MatLegacyButtonModule } from '@angular/material/legacy-button';
15
- import * as i3 from '@angular/flex-layout/flex';
16
- import * as i4 from '@angular/material/icon';
17
- import { MatIconModule } from '@angular/material/icon';
18
- import { CommonModule } from '@angular/common';
19
- import { MatLegacyCardModule } from '@angular/material/legacy-card';
20
- import { FlexLayoutModule } from '@angular/flex-layout';
21
-
22
- const PROFILE_AUTH_ENDPOINT = new InjectionToken('PROFILE_AUTH_ENDPOINT');
23
- class GetOAuthProfileMethod {
24
- constructor(http, profileEndpoint = null) {
25
- this.http = http;
26
- this.profileEndpoint = profileEndpoint;
27
- }
28
- call(parameters) {
29
- var _a, _b;
30
- const profileEndpoint = (_a = parameters.profileEndpoint) !== null && _a !== void 0 ? _a : this.profileEndpoint;
31
- if (!profileEndpoint) {
32
- throw new Error('The profile endpoint is not defined');
33
- }
34
- return this.http
35
- .get(profileEndpoint, {
36
- headers: {
37
- Authorization: `Bearer ${parameters.accessToken}`,
38
- },
39
- withCredentials: (_b = parameters.withCredentials) !== null && _b !== void 0 ? _b : true,
40
- })
41
- .toPromise();
42
- }
43
- }
44
- GetOAuthProfileMethod.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.3", ngImport: i0, type: GetOAuthProfileMethod, deps: [{ token: HttpClient }, { token: PROFILE_AUTH_ENDPOINT, optional: true }], target: i0.ɵɵFactoryTarget.Injectable });
45
- GetOAuthProfileMethod.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.0.3", ngImport: i0, type: GetOAuthProfileMethod, providedIn: 'root' });
46
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.3", ngImport: i0, type: GetOAuthProfileMethod, decorators: [{
47
- type: Injectable,
48
- args: [{ providedIn: 'root' }]
49
- }], ctorParameters: function () {
50
- return [{ type: i1.HttpClient, decorators: [{
51
- type: Inject,
52
- args: [HttpClient]
53
- }] }, { type: undefined, decorators: [{
54
- type: Optional
55
- }, {
56
- type: Inject,
57
- args: [PROFILE_AUTH_ENDPOINT]
58
- }] }];
59
- } });
60
-
61
- function IsOAuthMethodWithRefreshTokenParameters(parameters) {
62
- // eslint-disable-next-line no-prototype-builtins
63
- return parameters.hasOwnProperty('refreshToken');
64
- }
65
- function IsOAuthMethodWithUsernamePasswordParameters(parameters) {
66
- // eslint-disable-next-line no-prototype-builtins
67
- return (parameters.hasOwnProperty('username') &&
68
- parameters.hasOwnProperty('password'));
69
- }
70
- function AssertOAuthMethodWithUsernamePasswordParameters(parameters) {
71
- if (!IsOAuthMethodWithUsernamePasswordParameters(parameters)) {
72
- throw new Error('The grant type password requires the parameters username and password');
73
- }
74
- }
75
- function AssertOAuthMethodWithRefreshTokenParameters(parameters) {
76
- if (!IsOAuthMethodWithRefreshTokenParameters(parameters)) {
77
- throw new Error('The grant type refresh token requires the parameters refreshToken');
78
- }
79
- }
80
- function AssertOAuthMethodParameters(parameters) {
81
- if (!parameters.authEndpoint) {
82
- throw new Error('The authEndpoint parameter must be defined');
83
- }
84
- if (!parameters.secret) {
85
- throw new Error('The secret parameter must be defined');
86
- }
87
- if (parameters.grantType) {
88
- switch (parameters.grantType) {
89
- case 'password':
90
- AssertOAuthMethodWithUsernamePasswordParameters(parameters);
91
- break;
92
- case 'refresh_token':
93
- AssertOAuthMethodWithRefreshTokenParameters(parameters);
94
- break;
95
- default:
96
- throw new Error(`The grant type '${parameters.grantType}' is not supported`);
97
- }
98
- }
99
- else {
100
- if (!IsOAuthMethodWithRefreshTokenParameters(parameters) &&
101
- !IsOAuthMethodWithUsernamePasswordParameters(parameters)) {
102
- throw new Error('Either the refresh token or the username and password must be defined');
103
- }
104
- }
105
- }
106
- class OAuthMethod {
107
- constructor(http) {
108
- this.http = http;
109
- }
110
- call(parameters) {
111
- var _a;
112
- return __awaiter(this, void 0, void 0, function* () {
113
- AssertOAuthMethodParameters(parameters);
114
- const params = new URLSearchParams();
115
- const grantType = this.getGrantType(parameters);
116
- params.append('grant_type', grantType);
117
- switch (grantType) {
118
- case 'password':
119
- AssertOAuthMethodWithUsernamePasswordParameters(parameters);
120
- params.append('username', parameters.username);
121
- params.append('password', parameters.password);
122
- break;
123
- case 'refresh_token':
124
- AssertOAuthMethodWithRefreshTokenParameters(parameters);
125
- params.append('refresh_token', parameters.refreshToken);
126
- break;
127
- default:
128
- throw new Error('Not supported grant type');
129
- }
130
- let headers = new HttpHeaders();
131
- headers = headers.append('Content-type', 'application/x-www-form-urlencoded; charset=utf-8');
132
- if (parameters.secret && parameters.clientId) {
133
- params.append('client_id', parameters.clientId);
134
- params.append('client_secret', parameters.secret);
135
- }
136
- else {
137
- headers = headers.append('Authorization', `Basic ${parameters.secret}`);
138
- }
139
- const response = yield this.http
140
- .post(parameters.authEndpoint, params.toString(), {
141
- headers,
142
- withCredentials: (_a = parameters.withCredentials) !== null && _a !== void 0 ? _a : true,
143
- })
144
- .toPromise();
145
- return {
146
- accessToken: response.access_token,
147
- refreshToken: response.refresh_token,
148
- expiresIn: response.expires_in,
149
- expiresAt: new Date(Date.now() + response.expires_in * 1000),
150
- };
151
- });
152
- }
153
- getGrantType(parameters) {
154
- if (parameters.grantType) {
155
- return parameters.grantType;
156
- }
157
- if (IsOAuthMethodWithRefreshTokenParameters(parameters)) {
158
- return 'refresh_token';
159
- }
160
- if (IsOAuthMethodWithUsernamePasswordParameters(parameters)) {
161
- return 'password';
162
- }
163
- throw new Error('Could not guess the grant type');
164
- }
165
- }
166
- OAuthMethod.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.3", ngImport: i0, type: OAuthMethod, deps: [{ token: HttpClient }], target: i0.ɵɵFactoryTarget.Injectable });
167
- OAuthMethod.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.0.3", ngImport: i0, type: OAuthMethod, providedIn: 'root' });
168
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.3", ngImport: i0, type: OAuthMethod, decorators: [{
169
- type: Injectable,
170
- args: [{ providedIn: 'root' }]
171
- }], ctorParameters: function () {
172
- return [{ type: i1.HttpClient, decorators: [{
173
- type: Inject,
174
- args: [HttpClient]
175
- }] }];
176
- } });
177
-
178
- function DefaultRedirectSignInFactory() {
179
- return ['/', 'authentication', 'login'];
180
- }
181
- const RXAP_O_AUTH_REDIRECT_SIGN_IN = new InjectionToken('rxap/o-auth/redirect-sign-in', {
182
- providedIn: 'root',
183
- factory: DefaultRedirectSignInFactory
184
- });
185
- const RXAP_O_AUTH_REDIRECT_SIGN_OUT = new InjectionToken('rxap/o-auth/redirect-sign-out');
186
- function DefaultRedirectUrl() {
187
- return location.origin + '/oauth';
188
- }
189
- const RXAP_O_AUTH_REDIRECT_URL = new InjectionToken('rxap/o-auth/redirect-url', {
190
- providedIn: 'root',
191
- factory: DefaultRedirectUrl
192
- });
193
-
194
- const OAUTH_SECRET = new InjectionToken('OAUTH_SECRET');
195
- const OAUTH_AUTH_ENDPOINT = new InjectionToken('OAUTH_AUTH_ENDPOINT');
196
- const OAUTH_SSO_URL = new InjectionToken('OAUTH_SSO_URL');
197
- const OAUTH_CLIENT_ID = new InjectionToken('OAUTH_CLIENT_ID');
198
- const ACCESS_TOKEN_LOCAL_STORAGE_KEY = 'access_token';
199
- const REFRESH_TOKEN_LOCAL_STORAGE_KEY = 'refresh_token';
200
- const EXPIRES_AT_LOCAL_STORAGE_KEY = 'expires_at';
201
- const REMEMBER_LOCAL_STORAGE_KEY = 'remember';
202
- class OAuthService {
203
- constructor(oAuthMethod, getOAuthProfileMethod, router, profileEndpoint = null, authEndpoint = null, secret = null, ssoUrl = null, redirectSignOut = null, redirectUrl = null, clientId = null) {
204
- this.oAuthMethod = oAuthMethod;
205
- this.getOAuthProfileMethod = getOAuthProfileMethod;
206
- this.router = router;
207
- this.profileEndpoint = profileEndpoint;
208
- this.authEndpoint = authEndpoint;
209
- this.secret = secret;
210
- this.ssoUrl = ssoUrl;
211
- this.redirectSignOut = redirectSignOut;
212
- this.redirectUrl = redirectUrl;
213
- this.clientId = clientId;
214
- this.events$ = new ReplaySubject();
215
- this._isAuthenticated = null;
216
- }
217
- get expiresAt() {
218
- const expiresAt = this.getItem(EXPIRES_AT_LOCAL_STORAGE_KEY);
219
- if (expiresAt) {
220
- return new Date(parseInt(this.getItem(EXPIRES_AT_LOCAL_STORAGE_KEY), 10));
221
- }
222
- return null;
223
- }
224
- set expiresAt(value) {
225
- if (value) {
226
- this.setItem(EXPIRES_AT_LOCAL_STORAGE_KEY, value.getTime().toFixed(0));
227
- }
228
- else {
229
- this.removeItem(EXPIRES_AT_LOCAL_STORAGE_KEY);
230
- }
231
- }
232
- get refreshToken() {
233
- return this.getItem(REFRESH_TOKEN_LOCAL_STORAGE_KEY);
234
- }
235
- set refreshToken(value) {
236
- if (value) {
237
- this.setItem(REFRESH_TOKEN_LOCAL_STORAGE_KEY, value);
238
- }
239
- else {
240
- this.removeItem(REFRESH_TOKEN_LOCAL_STORAGE_KEY);
241
- }
242
- }
243
- get accessToken() {
244
- return this.getItem(ACCESS_TOKEN_LOCAL_STORAGE_KEY);
245
- }
246
- set accessToken(value) {
247
- if (value) {
248
- this.setItem(ACCESS_TOKEN_LOCAL_STORAGE_KEY, value);
249
- }
250
- else {
251
- this.removeItem(ACCESS_TOKEN_LOCAL_STORAGE_KEY);
252
- }
253
- }
254
- /**
255
- * The time until the access token expires in seconds
256
- */
257
- get expiresIn() {
258
- const expiresAt = this.expiresAt;
259
- if (expiresAt) {
260
- return Math.round((expiresAt.getTime() - Date.now()) / 1000);
261
- }
262
- return null;
263
- }
264
- get remember() {
265
- return !!this.getItem(REMEMBER_LOCAL_STORAGE_KEY);
266
- }
267
- set remember(value) {
268
- if (value) {
269
- this.setItem(REMEMBER_LOCAL_STORAGE_KEY, 'true');
270
- }
271
- else {
272
- this.removeItem(REMEMBER_LOCAL_STORAGE_KEY);
273
- }
274
- }
275
- get profile() {
276
- return this._profile;
277
- }
278
- signInWithRedirect(lastUrl) {
279
- if (!this.redirectUrl) {
280
- throw new Error('Redirect url is not defined');
281
- }
282
- location.replace(`${this.ssoUrl}?redirect=${btoa(this.redirectUrl)}&secret=${this.secret}&payload=${btoa(JSON.stringify({ lastUrl }))}`);
283
- }
284
- isAuthenticated() {
285
- var _a;
286
- return __awaiter(this, void 0, void 0, function* () {
287
- if (!this.secret) {
288
- throw new Error('The oauth secret is not defined');
289
- }
290
- if (!this.authEndpoint) {
291
- throw new Error('The oauth auth endpoint is not defined');
292
- }
293
- if (this._isAuthenticated !== null) {
294
- return this._isAuthenticated;
295
- }
296
- if (this.accessToken) {
297
- console.debug('Access token is defined: ' + this.accessToken);
298
- if (this.expiresIn && this.expiresIn > 60) {
299
- const profile = yield this.getProfile();
300
- if (!profile) {
301
- console.log('profile is not defined');
302
- return (this._isAuthenticated = false);
303
- }
304
- this.authenticated({
305
- refreshToken: this.refreshToken,
306
- accessToken: this.accessToken,
307
- expiresAt: (_a = this.expiresAt) !== null && _a !== void 0 ? _a : new Date(Date.now() + 60 * 1000),
308
- expiresIn: this.expiresIn,
309
- }, this.remember);
310
- return (this._isAuthenticated = true);
311
- }
312
- else {
313
- this.accessToken = null;
314
- this.expiresAt = null;
315
- console.warn('The access token expires soon. Use refresh token instead.');
316
- }
317
- }
318
- if (this.refreshToken) {
319
- console.debug('Refresh token is defined: ' + this.refreshToken);
320
- try {
321
- yield this.signInWithRefreshToken(this.refreshToken);
322
- return (this._isAuthenticated = true);
323
- }
324
- catch (e) {
325
- if (![401, 403, 400].includes(e.status)) {
326
- console.error('Could not sign in with refresh token', e.message);
327
- throw e;
328
- }
329
- console.warn('Refresh token is expired');
330
- }
331
- }
332
- console.warn('Unauthenticated');
333
- return (this._isAuthenticated = false);
334
- });
335
- }
336
- signInWithEmailAndPassword(email, password, remember) {
337
- var _a;
338
- return __awaiter(this, void 0, void 0, function* () {
339
- if (!this.secret) {
340
- throw new Error('The oauth secret is not defined');
341
- }
342
- if (!this.authEndpoint) {
343
- throw new Error('The oauth auth endpoint is not defined');
344
- }
345
- const response = yield this.oAuthMethod.call({
346
- username: email,
347
- password: password,
348
- authEndpoint: this.authEndpoint,
349
- secret: this.secret,
350
- clientId: (_a = this.clientId) !== null && _a !== void 0 ? _a : undefined
351
- }).catch(e => {
352
- this.events$.next({ type: AuthenticationEventType.OnAuthError });
353
- throw e;
354
- });
355
- this.authenticated(response, remember);
356
- return response;
357
- });
358
- }
359
- getProfile() {
360
- return __awaiter(this, void 0, void 0, function* () {
361
- let profile = null;
362
- if (!this.accessToken) {
363
- throw new Error('The access token is not defined');
364
- }
365
- if (this.profileEndpoint) {
366
- try {
367
- profile = yield this.getOAuthProfileMethod.call({
368
- accessToken: this.accessToken,
369
- profileEndpoint: this.profileEndpoint
370
- });
371
- }
372
- catch (e) {
373
- console.error('Could not request the user profile', e.message);
374
- }
375
- }
376
- else {
377
- console.warn('The profile endpoint is not defined!');
378
- }
379
- return (this._profile = profile);
380
- });
381
- }
382
- signOut() {
383
- return __awaiter(this, void 0, void 0, function* () {
384
- this.clearStorage();
385
- this.accessToken = null;
386
- this.refreshToken = null;
387
- this.expiresAt = null;
388
- this._isAuthenticated = false;
389
- if (this.redirectSignOut) {
390
- yield this.router.navigate(this.redirectSignOut);
391
- }
392
- else {
393
- if (!this.redirectUrl) {
394
- throw new Error('Redirect url is not defined');
395
- }
396
- location.replace(`${this.ssoUrl}?redirect=${btoa(this.redirectUrl)}&secret=${this.secret}&action=signOut`);
397
- }
398
- this.events$.next({ type: AuthenticationEventType.OnLogout });
399
- });
400
- }
401
- authenticated(response, remember) {
402
- var _a, _b;
403
- if (remember === void 0) { remember = (_a = this.remember) !== null && _a !== void 0 ? _a : false; }
404
- this.accessToken = response.accessToken;
405
- this.refreshToken = (_b = response.refreshToken) !== null && _b !== void 0 ? _b : null;
406
- this.expiresAt = response.expiresAt;
407
- console.log(`Authenticated until ${this.expiresAt.toISOString()}`);
408
- this.remember = remember;
409
- if (remember) {
410
- this.setItem(ACCESS_TOKEN_LOCAL_STORAGE_KEY, response.accessToken);
411
- if (response.refreshToken) {
412
- this.setItem(REFRESH_TOKEN_LOCAL_STORAGE_KEY, response.refreshToken);
413
- }
414
- this.setItem(REMEMBER_LOCAL_STORAGE_KEY, 'true');
415
- if (response.expiresAt) {
416
- console.log(`Authenticated until ${response.expiresAt.toISOString()}`);
417
- this.setItem(EXPIRES_AT_LOCAL_STORAGE_KEY, response.expiresAt.getTime().toFixed(0));
418
- }
419
- }
420
- else {
421
- this.removeItem(ACCESS_TOKEN_LOCAL_STORAGE_KEY);
422
- this.removeItem(REFRESH_TOKEN_LOCAL_STORAGE_KEY);
423
- this.removeItem(REMEMBER_LOCAL_STORAGE_KEY);
424
- this.removeItem(EXPIRES_AT_LOCAL_STORAGE_KEY);
425
- }
426
- this._isAuthenticated = true;
427
- this.events$.next({ type: AuthenticationEventType.OnAuthSuccess });
428
- }
429
- getKey(key) {
430
- return [this.secret, key].join('__');
431
- }
432
- getItem(key) {
433
- return localStorage.getItem(this.getKey(key));
434
- }
435
- setItem(key, value) {
436
- localStorage.setItem(this.getKey(key), value);
437
- }
438
- removeItem(key) {
439
- localStorage.removeItem(this.getKey(key));
440
- }
441
- clearStorage() {
442
- this.removeItem(ACCESS_TOKEN_LOCAL_STORAGE_KEY);
443
- this.removeItem(REFRESH_TOKEN_LOCAL_STORAGE_KEY);
444
- this.removeItem(REMEMBER_LOCAL_STORAGE_KEY);
445
- this.removeItem(EXPIRES_AT_LOCAL_STORAGE_KEY);
446
- }
447
- signInWithRefreshToken(refreshToken) {
448
- var _a;
449
- return __awaiter(this, void 0, void 0, function* () {
450
- if (!this.secret) {
451
- throw new Error('The oauth secret is not defined');
452
- }
453
- if (!this.authEndpoint) {
454
- throw new Error('The oauth auth endpoint is not defined');
455
- }
456
- const response = yield this.oAuthMethod.call({
457
- refreshToken,
458
- authEndpoint: this.authEndpoint,
459
- secret: this.secret,
460
- clientId: (_a = this.clientId) !== null && _a !== void 0 ? _a : undefined,
461
- });
462
- this.authenticated(response);
463
- return response;
464
- });
465
- }
466
- }
467
- OAuthService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.3", ngImport: i0, type: OAuthService, deps: [{ token: OAuthMethod }, { token: GetOAuthProfileMethod }, { token: Router }, { token: PROFILE_AUTH_ENDPOINT, optional: true }, { token: OAUTH_AUTH_ENDPOINT, optional: true }, { token: OAUTH_SECRET, optional: true }, { token: OAUTH_SSO_URL, optional: true }, { token: RXAP_O_AUTH_REDIRECT_SIGN_OUT, optional: true }, { token: RXAP_O_AUTH_REDIRECT_URL, optional: true }, { token: OAUTH_CLIENT_ID, optional: true }], target: i0.ɵɵFactoryTarget.Injectable });
468
- OAuthService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.0.3", ngImport: i0, type: OAuthService, providedIn: 'root' });
469
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.3", ngImport: i0, type: OAuthService, decorators: [{
470
- type: Injectable,
471
- args: [{ providedIn: 'root' }]
472
- }], ctorParameters: function () {
473
- return [{ type: OAuthMethod, decorators: [{
474
- type: Inject,
475
- args: [OAuthMethod]
476
- }] }, { type: GetOAuthProfileMethod, decorators: [{
477
- type: Inject,
478
- args: [GetOAuthProfileMethod]
479
- }] }, { type: i1$1.Router, decorators: [{
480
- type: Inject,
481
- args: [Router]
482
- }] }, { type: undefined, decorators: [{
483
- type: Optional
484
- }, {
485
- type: Inject,
486
- args: [PROFILE_AUTH_ENDPOINT]
487
- }] }, { type: undefined, decorators: [{
488
- type: Optional
489
- }, {
490
- type: Inject,
491
- args: [OAUTH_AUTH_ENDPOINT]
492
- }] }, { type: undefined, decorators: [{
493
- type: Optional
494
- }, {
495
- type: Inject,
496
- args: [OAUTH_SECRET]
497
- }] }, { type: undefined, decorators: [{
498
- type: Optional
499
- }, {
500
- type: Inject,
501
- args: [OAUTH_SSO_URL]
502
- }] }, { type: undefined, decorators: [{
503
- type: Optional
504
- }, {
505
- type: Inject,
506
- args: [RXAP_O_AUTH_REDIRECT_SIGN_OUT]
507
- }] }, { type: undefined, decorators: [{
508
- type: Optional
509
- }, {
510
- type: Inject,
511
- args: [RXAP_O_AUTH_REDIRECT_URL]
512
- }] }, { type: undefined, decorators: [{
513
- type: Optional
514
- }, {
515
- type: Inject,
516
- args: [OAUTH_CLIENT_ID]
517
- }] }];
518
- } });
519
-
520
- class OAuthExtractGuard {
521
- constructor(router, oAuthService) {
522
- this.router = router;
523
- this.oAuthService = oAuthService;
524
- }
525
- canActivate(route) {
526
- if (route.queryParamMap.has('accessToken') && route.queryParamMap.has('refreshToken') && route.queryParamMap.has('expiresIn')) {
527
- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
528
- const accessToken = route.queryParamMap.get('accessToken');
529
- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
530
- const refreshToken = route.queryParamMap.get('refreshToken');
531
- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
532
- const expiresIn = parseInt(route.queryParamMap.get('expiresIn'), 10);
533
- const payloadBase64 = route.queryParamMap.get('payload');
534
- const expiresAt = new Date(Date.now() + expiresIn * 1000);
535
- this.oAuthService.authenticated({
536
- accessToken,
537
- refreshToken,
538
- expiresIn,
539
- expiresAt
540
- }, true);
541
- let redirectUrl = '/';
542
- if (payloadBase64) {
543
- try {
544
- const payload = JSON.parse(atob(payloadBase64));
545
- console.debug('sso redirect payload', payload);
546
- if (payload.lastUrl) {
547
- redirectUrl = payload.lastUrl;
548
- }
549
- }
550
- catch (e) {
551
- console.error('Could not parse redirect payload', e.message);
552
- }
553
- }
554
- return this.router.createUrlTree([redirectUrl]);
555
- }
556
- else {
557
- console.warn('Not every query parameter is defined!');
558
- }
559
- return this.router.createUrlTree([...route.url.map(url => url.path), 'redirect']);
560
- }
561
- }
562
- OAuthExtractGuard.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.3", ngImport: i0, type: OAuthExtractGuard, deps: [{ token: i1$1.Router }, { token: OAuthService }], target: i0.ɵɵFactoryTarget.Injectable });
563
- OAuthExtractGuard.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.0.3", ngImport: i0, type: OAuthExtractGuard, providedIn: 'root' });
564
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.3", ngImport: i0, type: OAuthExtractGuard, decorators: [{
565
- type: Injectable,
566
- args: [{ providedIn: 'root' }]
567
- }], ctorParameters: function () { return [{ type: i1$1.Router }, { type: OAuthService }]; } });
568
-
569
- class OAuthRedirectGuard {
570
- constructor(oAuthService) {
571
- this.oAuthService = oAuthService;
572
- }
573
- canActivate(route, state) {
574
- return __awaiter(this, void 0, void 0, function* () {
575
- const isAuthenticated = yield this.oAuthService.isAuthenticated();
576
- console.log(`isAuthenticated: ${isAuthenticated}`);
577
- if (isAuthenticated) {
578
- return true;
579
- }
580
- this.oAuthService.signInWithRedirect(state.url);
581
- return false;
582
- });
583
- }
584
- canActivateChild(childRoute, state) {
585
- return this.canActivate(childRoute, state);
586
- }
587
- }
588
- OAuthRedirectGuard.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.3", ngImport: i0, type: OAuthRedirectGuard, deps: [{ token: OAuthService }], target: i0.ɵɵFactoryTarget.Injectable });
589
- OAuthRedirectGuard.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.0.3", ngImport: i0, type: OAuthRedirectGuard, providedIn: 'root' });
590
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.3", ngImport: i0, type: OAuthRedirectGuard, decorators: [{
591
- type: Injectable,
592
- args: [{ providedIn: 'root' }]
593
- }], ctorParameters: function () {
594
- return [{ type: OAuthService, decorators: [{
595
- type: Inject,
596
- args: [OAuthService]
597
- }] }];
598
- } });
599
-
600
- class OAuthModule {
601
- static forRoot(options = {}) {
602
- var _a, _b;
603
- return {
604
- ngModule: OAuthModule,
605
- providers: [
606
- {
607
- provide: RXAP_O_AUTH_REDIRECT_SIGN_IN,
608
- useValue: (_a = options.signInPath) !== null && _a !== void 0 ? _a : ['/', 'oauth', 'redirect']
609
- },
610
- {
611
- provide: RXAP_O_AUTH_REDIRECT_SIGN_OUT,
612
- useValue: (_b = options.signOutPath) !== null && _b !== void 0 ? _b : null
613
- }
614
- ]
615
- };
616
- }
617
- }
618
- OAuthModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.3", ngImport: i0, type: OAuthModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
619
- OAuthModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.0.3", ngImport: i0, type: OAuthModule });
620
- OAuthModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.0.3", ngImport: i0, type: OAuthModule });
621
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.3", ngImport: i0, type: OAuthModule, decorators: [{
622
- type: NgModule
623
- }] });
624
-
625
- class ContainerComponent {
626
- prepareRoute(outlet) {
627
- return outlet.isActivated ? outlet.activatedRoute : 'true';
628
- }
629
- }
630
- ContainerComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.3", ngImport: i0, type: ContainerComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
631
- ContainerComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.0.3", type: ContainerComponent, selector: "rxap-container", host: { classAttribute: "rxap-container" }, ngImport: i0, template: "<div [@routeAnimations]=\"prepareRoute(outlet)\" class=\"container\">\n\n <div class=\"split mat-elevation-z3\"></div>\n\n <router-outlet #outlet=\"outlet\"></router-outlet>\n\n</div>\n", styles: [".container{height:100vh;width:100vw;display:flex;align-items:center;justify-content:center}.container .split{position:absolute;top:0;left:0;right:0;bottom:65vh;z-index:-10}\n"], dependencies: [{ kind: "directive", type: i1$1.RouterOutlet, selector: "router-outlet", inputs: ["name"], outputs: ["activate", "deactivate", "attach", "detach"], exportAs: ["outlet"] }], animations: [
632
- trigger('routeAnimations', [
633
- transition(':enter', [
634
- style({ opacity: 0 }),
635
- animate('512ms', style({ opacity: 1 }))
636
- ]),
637
- transition(':leave', [
638
- style({ opacity: 1 }),
639
- animate('512ms', style({ opacity: 0 }))
640
- ])
641
- ])
642
- ], changeDetection: i0.ChangeDetectionStrategy.OnPush });
643
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.3", ngImport: i0, type: ContainerComponent, decorators: [{
644
- type: Component,
645
- args: [{ selector: 'rxap-container', changeDetection: ChangeDetectionStrategy.OnPush, host: { class: 'rxap-container' }, animations: [
646
- trigger('routeAnimations', [
647
- transition(':enter', [
648
- style({ opacity: 0 }),
649
- animate('512ms', style({ opacity: 1 }))
650
- ]),
651
- transition(':leave', [
652
- style({ opacity: 1 }),
653
- animate('512ms', style({ opacity: 0 }))
654
- ])
655
- ])
656
- ], template: "<div [@routeAnimations]=\"prepareRoute(outlet)\" class=\"container\">\n\n <div class=\"split mat-elevation-z3\"></div>\n\n <router-outlet #outlet=\"outlet\"></router-outlet>\n\n</div>\n", styles: [".container{height:100vh;width:100vw;display:flex;align-items:center;justify-content:center}.container .split{position:absolute;top:0;left:0;right:0;bottom:65vh;z-index:-10}\n"] }]
657
- }] });
658
-
659
- class LoadingComponent {
660
- }
661
- LoadingComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.3", ngImport: i0, type: LoadingComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
662
- LoadingComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.0.3", type: LoadingComponent, selector: "rxap-loading", host: { classAttribute: "rxap-loading" }, ngImport: i0, template: "<mat-progress-bar class=\"loading-bar\" mode=\"indeterminate\"></mat-progress-bar>\n", styles: [""], dependencies: [{ kind: "component", type: i1$2.MatLegacyProgressBar, selector: "mat-progress-bar", inputs: ["color", "value", "bufferValue", "mode"], outputs: ["animationEnd"], exportAs: ["matProgressBar"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
663
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.3", ngImport: i0, type: LoadingComponent, decorators: [{
664
- type: Component,
665
- args: [{ selector: 'rxap-loading', changeDetection: ChangeDetectionStrategy.OnPush, host: { class: 'rxap-loading' }, template: "<mat-progress-bar class=\"loading-bar\" mode=\"indeterminate\"></mat-progress-bar>\n" }]
666
- }] });
667
-
668
- class SignInWithRedirectComponent {
669
- constructor(authService) {
670
- this.authService = authService;
671
- }
672
- signIn() {
673
- this.authService.signInWithRedirect();
674
- }
675
- }
676
- SignInWithRedirectComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.3", ngImport: i0, type: SignInWithRedirectComponent, deps: [{ token: OAuthService }], target: i0.ɵɵFactoryTarget.Component });
677
- SignInWithRedirectComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.0.3", type: SignInWithRedirectComponent, selector: "rxap-sign-in-with-redirect", host: { classAttribute: "rxap-sign-in-with-redirect" }, ngImport: i0, template: "<div [@fadeAnimation]=\"'in'\" class=\"inner mat-elevation-z5\" fxLayout=\"column\" fxLayoutAlign=\"center center\" fxLayoutGap=\"32px\">\n\n <div class=\"header\" fxFlex=\"nogrow\" fxLayout=\"column\" fxLayoutAlign=\"center center\">\n\n <mat-icon class=\"avatar-icon\" color=\"primary\" fxFlex=\"nogrow\">account_circle</mat-icon>\n\n </div>\n\n <div fxFlex=\"nogrow\" fxLayout=\"row\" fxLayoutAlign=\"center center\">\n\n <div fxFlex=\"nogrow\">\n <button (click)=\"signIn()\" color=\"primary\" fxFlex=\"nogrow\" mat-raised-button>\n <span fxLayout=\"row\" fxLayoutAlign=\"start center\" fxLayoutGap=\"16px\">\n <mat-icon fxFlex=\"nogrow\">login</mat-icon>\n <span fxFlex=\"nogrow\">Sign In</span>\n </span>\n </button>\n </div>\n\n </div>\n\n</div>\n\n", styles: [".inner{padding:64px;position:relative}.inner .header .avatar-icon{width:100px;height:100px;font-size:100px}\n"], dependencies: [{ kind: "component", type: i2.MatLegacyButton, selector: "button[mat-button], button[mat-raised-button], button[mat-icon-button], button[mat-fab], button[mat-mini-fab], button[mat-stroked-button], button[mat-flat-button]", inputs: ["disabled", "disableRipple", "color"], exportAs: ["matButton"] }, { kind: "directive", type: i3.DefaultLayoutDirective, selector: " [fxLayout], [fxLayout.xs], [fxLayout.sm], [fxLayout.md], [fxLayout.lg], [fxLayout.xl], [fxLayout.lt-sm], [fxLayout.lt-md], [fxLayout.lt-lg], [fxLayout.lt-xl], [fxLayout.gt-xs], [fxLayout.gt-sm], [fxLayout.gt-md], [fxLayout.gt-lg]", inputs: ["fxLayout", "fxLayout.xs", "fxLayout.sm", "fxLayout.md", "fxLayout.lg", "fxLayout.xl", "fxLayout.lt-sm", "fxLayout.lt-md", "fxLayout.lt-lg", "fxLayout.lt-xl", "fxLayout.gt-xs", "fxLayout.gt-sm", "fxLayout.gt-md", "fxLayout.gt-lg"] }, { kind: "directive", type: i3.DefaultLayoutGapDirective, selector: " [fxLayoutGap], [fxLayoutGap.xs], [fxLayoutGap.sm], [fxLayoutGap.md], [fxLayoutGap.lg], [fxLayoutGap.xl], [fxLayoutGap.lt-sm], [fxLayoutGap.lt-md], [fxLayoutGap.lt-lg], [fxLayoutGap.lt-xl], [fxLayoutGap.gt-xs], [fxLayoutGap.gt-sm], [fxLayoutGap.gt-md], [fxLayoutGap.gt-lg]", inputs: ["fxLayoutGap", "fxLayoutGap.xs", "fxLayoutGap.sm", "fxLayoutGap.md", "fxLayoutGap.lg", "fxLayoutGap.xl", "fxLayoutGap.lt-sm", "fxLayoutGap.lt-md", "fxLayoutGap.lt-lg", "fxLayoutGap.lt-xl", "fxLayoutGap.gt-xs", "fxLayoutGap.gt-sm", "fxLayoutGap.gt-md", "fxLayoutGap.gt-lg"] }, { kind: "directive", type: i3.DefaultLayoutAlignDirective, selector: " [fxLayoutAlign], [fxLayoutAlign.xs], [fxLayoutAlign.sm], [fxLayoutAlign.md], [fxLayoutAlign.lg], [fxLayoutAlign.xl], [fxLayoutAlign.lt-sm], [fxLayoutAlign.lt-md], [fxLayoutAlign.lt-lg], [fxLayoutAlign.lt-xl], [fxLayoutAlign.gt-xs], [fxLayoutAlign.gt-sm], [fxLayoutAlign.gt-md], [fxLayoutAlign.gt-lg]", inputs: ["fxLayoutAlign", "fxLayoutAlign.xs", "fxLayoutAlign.sm", "fxLayoutAlign.md", "fxLayoutAlign.lg", "fxLayoutAlign.xl", "fxLayoutAlign.lt-sm", "fxLayoutAlign.lt-md", "fxLayoutAlign.lt-lg", "fxLayoutAlign.lt-xl", "fxLayoutAlign.gt-xs", "fxLayoutAlign.gt-sm", "fxLayoutAlign.gt-md", "fxLayoutAlign.gt-lg"] }, { kind: "directive", type: i3.DefaultFlexDirective, selector: " [fxFlex], [fxFlex.xs], [fxFlex.sm], [fxFlex.md], [fxFlex.lg], [fxFlex.xl], [fxFlex.lt-sm], [fxFlex.lt-md], [fxFlex.lt-lg], [fxFlex.lt-xl], [fxFlex.gt-xs], [fxFlex.gt-sm], [fxFlex.gt-md], [fxFlex.gt-lg]", inputs: ["fxFlex", "fxFlex.xs", "fxFlex.sm", "fxFlex.md", "fxFlex.lg", "fxFlex.xl", "fxFlex.lt-sm", "fxFlex.lt-md", "fxFlex.lt-lg", "fxFlex.lt-xl", "fxFlex.gt-xs", "fxFlex.gt-sm", "fxFlex.gt-md", "fxFlex.gt-lg"] }, { kind: "component", type: i4.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }], animations: [
678
- trigger('fadeAnimation', [
679
- // the "in" style determines the "resting" state of the element when it is visible.
680
- state('in', style({ opacity: 1 })),
681
- // fade in when created. this could also be written as transition('void => *')
682
- transition(':enter', [
683
- style({ opacity: 0 }),
684
- animate(300)
685
- ]),
686
- // fade out when destroyed. this could also be written as transition('void => *')
687
- transition(':leave', animate(300, style({ opacity: 0 })))
688
- ])
689
- ], changeDetection: i0.ChangeDetectionStrategy.OnPush });
690
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.3", ngImport: i0, type: SignInWithRedirectComponent, decorators: [{
691
- type: Component,
692
- args: [{ selector: 'rxap-sign-in-with-redirect', changeDetection: ChangeDetectionStrategy.OnPush, host: { class: 'rxap-sign-in-with-redirect' }, animations: [
693
- trigger('fadeAnimation', [
694
- // the "in" style determines the "resting" state of the element when it is visible.
695
- state('in', style({ opacity: 1 })),
696
- // fade in when created. this could also be written as transition('void => *')
697
- transition(':enter', [
698
- style({ opacity: 0 }),
699
- animate(300)
700
- ]),
701
- // fade out when destroyed. this could also be written as transition('void => *')
702
- transition(':leave', animate(300, style({ opacity: 0 })))
703
- ])
704
- ], template: "<div [@fadeAnimation]=\"'in'\" class=\"inner mat-elevation-z5\" fxLayout=\"column\" fxLayoutAlign=\"center center\" fxLayoutGap=\"32px\">\n\n <div class=\"header\" fxFlex=\"nogrow\" fxLayout=\"column\" fxLayoutAlign=\"center center\">\n\n <mat-icon class=\"avatar-icon\" color=\"primary\" fxFlex=\"nogrow\">account_circle</mat-icon>\n\n </div>\n\n <div fxFlex=\"nogrow\" fxLayout=\"row\" fxLayoutAlign=\"center center\">\n\n <div fxFlex=\"nogrow\">\n <button (click)=\"signIn()\" color=\"primary\" fxFlex=\"nogrow\" mat-raised-button>\n <span fxLayout=\"row\" fxLayoutAlign=\"start center\" fxLayoutGap=\"16px\">\n <mat-icon fxFlex=\"nogrow\">login</mat-icon>\n <span fxFlex=\"nogrow\">Sign In</span>\n </span>\n </button>\n </div>\n\n </div>\n\n</div>\n\n", styles: [".inner{padding:64px;position:relative}.inner .header .avatar-icon{width:100px;height:100px;font-size:100px}\n"] }]
705
- }], ctorParameters: function () { return [{ type: OAuthService }]; } });
706
-
707
- const RXAP_O_AUTH_ROUTES = [
708
- {
709
- path: 'oauth',
710
- component: ContainerComponent,
711
- children: [
712
- {
713
- path: 'redirect',
714
- component: SignInWithRedirectComponent
715
- },
716
- {
717
- canActivate: [OAuthExtractGuard],
718
- path: '',
719
- component: LoadingComponent
720
- },
721
- {
722
- path: '**',
723
- redirectTo: ''
724
- }
725
- ]
726
- }
727
- ];
728
-
729
- class ProfileResolve {
730
- constructor(oAuthService, router, redirectLogin) {
731
- this.oAuthService = oAuthService;
732
- this.router = router;
733
- this.redirectLogin = redirectLogin;
734
- }
735
- resolve() {
736
- return __awaiter(this, void 0, void 0, function* () {
737
- const profile = yield this.oAuthService.getProfile();
738
- if (!profile) {
739
- yield this.router.navigate(this.redirectLogin);
740
- }
741
- return profile;
742
- });
743
- }
744
- }
745
- ProfileResolve.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.3", ngImport: i0, type: ProfileResolve, deps: [{ token: OAuthService }, { token: Router }, { token: RXAP_O_AUTH_REDIRECT_SIGN_IN }], target: i0.ɵɵFactoryTarget.Injectable });
746
- ProfileResolve.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.0.3", ngImport: i0, type: ProfileResolve, providedIn: 'root' });
747
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.3", ngImport: i0, type: ProfileResolve, decorators: [{
748
- type: Injectable,
749
- args: [{ providedIn: 'root' }]
750
- }], ctorParameters: function () {
751
- return [{ type: OAuthService, decorators: [{
752
- type: Inject,
753
- args: [OAuthService]
754
- }] }, { type: i1$1.Router, decorators: [{
755
- type: Inject,
756
- args: [Router]
757
- }] }, { type: undefined, decorators: [{
758
- type: Inject,
759
- args: [RXAP_O_AUTH_REDIRECT_SIGN_IN]
760
- }] }];
761
- } });
762
-
763
- class ContainerComponentModule {
764
- }
765
- ContainerComponentModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.3", ngImport: i0, type: ContainerComponentModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
766
- ContainerComponentModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.0.3", ngImport: i0, type: ContainerComponentModule, declarations: [ContainerComponent], imports: [RouterModule], exports: [ContainerComponent] });
767
- ContainerComponentModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.0.3", ngImport: i0, type: ContainerComponentModule, imports: [RouterModule] });
768
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.3", ngImport: i0, type: ContainerComponentModule, decorators: [{
769
- type: NgModule,
770
- args: [{
771
- declarations: [ContainerComponent],
772
- imports: [
773
- RouterModule
774
- ],
775
- exports: [ContainerComponent]
776
- }]
777
- }] });
778
-
779
- class LoadingComponentModule {
780
- }
781
- LoadingComponentModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.3", ngImport: i0, type: LoadingComponentModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
782
- LoadingComponentModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.0.3", ngImport: i0, type: LoadingComponentModule, declarations: [LoadingComponent], imports: [MatLegacyProgressBarModule], exports: [LoadingComponent] });
783
- LoadingComponentModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.0.3", ngImport: i0, type: LoadingComponentModule, imports: [MatLegacyProgressBarModule] });
784
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.3", ngImport: i0, type: LoadingComponentModule, decorators: [{
785
- type: NgModule,
786
- args: [{
787
- declarations: [
788
- LoadingComponent
789
- ],
790
- imports: [
791
- MatLegacyProgressBarModule
792
- ],
793
- exports: [
794
- LoadingComponent
795
- ]
796
- }]
797
- }] });
798
-
799
- class SignInWithRedirectComponentModule {
800
- }
801
- SignInWithRedirectComponentModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.3", ngImport: i0, type: SignInWithRedirectComponentModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
802
- SignInWithRedirectComponentModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.0.3", ngImport: i0, type: SignInWithRedirectComponentModule, declarations: [SignInWithRedirectComponent], imports: [MatLegacyCardModule,
803
- MatLegacyButtonModule,
804
- FlexLayoutModule,
805
- MatIconModule,
806
- CommonModule], exports: [SignInWithRedirectComponent] });
807
- SignInWithRedirectComponentModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.0.3", ngImport: i0, type: SignInWithRedirectComponentModule, imports: [MatLegacyCardModule,
808
- MatLegacyButtonModule,
809
- FlexLayoutModule,
810
- MatIconModule,
811
- CommonModule] });
812
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.3", ngImport: i0, type: SignInWithRedirectComponentModule, decorators: [{
813
- type: NgModule,
814
- args: [{
815
- declarations: [SignInWithRedirectComponent],
816
- imports: [
817
- MatLegacyCardModule,
818
- MatLegacyButtonModule,
819
- FlexLayoutModule,
820
- MatIconModule,
821
- CommonModule
822
- ],
823
- exports: [SignInWithRedirectComponent]
824
- }]
825
- }] });
826
-
827
- class OAuthRoutingModule {
828
- }
829
- OAuthRoutingModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.3", ngImport: i0, type: OAuthRoutingModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
830
- OAuthRoutingModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.0.3", ngImport: i0, type: OAuthRoutingModule, exports: [ContainerComponentModule,
831
- LoadingComponentModule,
832
- SignInWithRedirectComponentModule] });
833
- OAuthRoutingModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.0.3", ngImport: i0, type: OAuthRoutingModule, imports: [ContainerComponentModule,
834
- LoadingComponentModule,
835
- SignInWithRedirectComponentModule] });
836
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.3", ngImport: i0, type: OAuthRoutingModule, decorators: [{
837
- type: NgModule,
838
- args: [{
839
- exports: [
840
- ContainerComponentModule,
841
- LoadingComponentModule,
842
- SignInWithRedirectComponentModule
843
- ]
844
- }]
845
- }] });
846
-
847
- /**
848
- * Generated bundle index. Do not edit.
849
- */
850
-
851
- export { ACCESS_TOKEN_LOCAL_STORAGE_KEY, AssertOAuthMethodParameters, AssertOAuthMethodWithRefreshTokenParameters, AssertOAuthMethodWithUsernamePasswordParameters, ContainerComponent, ContainerComponentModule, DefaultRedirectSignInFactory, DefaultRedirectUrl, EXPIRES_AT_LOCAL_STORAGE_KEY, GetOAuthProfileMethod, IsOAuthMethodWithRefreshTokenParameters, IsOAuthMethodWithUsernamePasswordParameters, LoadingComponent, LoadingComponentModule, OAUTH_AUTH_ENDPOINT, OAUTH_CLIENT_ID, OAUTH_SECRET, OAUTH_SSO_URL, OAuthExtractGuard, OAuthMethod, OAuthModule, OAuthRedirectGuard, OAuthRoutingModule, OAuthService, PROFILE_AUTH_ENDPOINT, ProfileResolve, REFRESH_TOKEN_LOCAL_STORAGE_KEY, REMEMBER_LOCAL_STORAGE_KEY, RXAP_O_AUTH_REDIRECT_SIGN_IN, RXAP_O_AUTH_REDIRECT_SIGN_OUT, RXAP_O_AUTH_REDIRECT_URL, RXAP_O_AUTH_ROUTES, SignInWithRedirectComponent, SignInWithRedirectComponentModule };
852
- //# sourceMappingURL=rxap-oauth.mjs.map
853
- //# sourceMappingURL=rxap-oauth.mjs.map