@igo2/auth 1.14.2 → 1.14.3

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 (53) hide show
  1. package/esm2020/igo2-auth.mjs +4 -4
  2. package/esm2020/lib/auth-form/auth-facebook.component.mjs +60 -60
  3. package/esm2020/lib/auth-form/auth-form.component.mjs +276 -276
  4. package/esm2020/lib/auth-form/auth-google.component.mjs +98 -98
  5. package/esm2020/lib/auth-form/auth-intern.component.mjs +118 -118
  6. package/esm2020/lib/auth-form/auth-microsoft.component.mjs +93 -93
  7. package/esm2020/lib/auth-form/auth-microsoftb2c.component.mjs +92 -92
  8. package/esm2020/lib/auth-form/index.mjs +4 -4
  9. package/esm2020/lib/auth-routing.module.mjs +23 -23
  10. package/esm2020/lib/auth.module.mjs +90 -90
  11. package/esm2020/lib/shared/admin.guard.mjs +32 -32
  12. package/esm2020/lib/shared/auth-microsoft.provider.mjs +83 -83
  13. package/esm2020/lib/shared/auth-msalBroadcastServiceb2c.service.mjs +37 -37
  14. package/esm2020/lib/shared/auth-msalServiceb2c.service..mjs +79 -79
  15. package/esm2020/lib/shared/auth.guard.mjs +31 -31
  16. package/esm2020/lib/shared/auth.interceptor.mjs +154 -154
  17. package/esm2020/lib/shared/auth.interface.mjs +1 -1
  18. package/esm2020/lib/shared/auth.service.mjs +159 -159
  19. package/esm2020/lib/shared/logged.guard.mjs +31 -31
  20. package/esm2020/lib/shared/profils.guard.mjs +36 -36
  21. package/esm2020/lib/shared/protected.directive.mjs +18 -18
  22. package/esm2020/lib/shared/storage.interface.mjs +1 -1
  23. package/esm2020/lib/shared/storage.service.mjs +90 -90
  24. package/esm2020/lib/shared/token.service.mjs +46 -46
  25. package/esm2020/public_api.mjs +18 -18
  26. package/fesm2015/igo2-auth.mjs +1579 -1579
  27. package/fesm2020/igo2-auth.mjs +1477 -1477
  28. package/index.d.ts +5 -5
  29. package/lib/auth-form/auth-facebook.component.d.ts +18 -18
  30. package/lib/auth-form/auth-form.component.d.ts +42 -42
  31. package/lib/auth-form/auth-google.component.d.ts +24 -24
  32. package/lib/auth-form/auth-intern.component.d.ts +21 -21
  33. package/lib/auth-form/auth-microsoft.component.d.ts +23 -23
  34. package/lib/auth-form/auth-microsoftb2c.component.d.ts +23 -23
  35. package/lib/auth-form/index.d.ts +4 -4
  36. package/lib/auth-routing.module.d.ts +7 -7
  37. package/lib/auth.module.d.ts +23 -23
  38. package/lib/shared/admin.guard.d.ts +13 -13
  39. package/lib/shared/auth-microsoft.provider.d.ts +30 -30
  40. package/lib/shared/auth-msalBroadcastServiceb2c.service.d.ts +15 -15
  41. package/lib/shared/auth-msalServiceb2c.service..d.ts +33 -33
  42. package/lib/shared/auth.guard.d.ts +13 -13
  43. package/lib/shared/auth.interceptor.d.ts +24 -24
  44. package/lib/shared/auth.interface.d.ts +99 -99
  45. package/lib/shared/auth.service.d.ts +44 -44
  46. package/lib/shared/logged.guard.d.ts +13 -13
  47. package/lib/shared/profils.guard.d.ts +13 -13
  48. package/lib/shared/protected.directive.d.ts +8 -8
  49. package/lib/shared/storage.interface.d.ts +4 -4
  50. package/lib/shared/storage.service.d.ts +18 -18
  51. package/lib/shared/token.service.d.ts +15 -15
  52. package/package.json +3 -3
  53. package/public_api.d.ts +15 -15
@@ -29,1525 +29,1525 @@ import * as i4 from '@angular/material/icon';
29
29
  import { MatIconModule } from '@angular/material/icon';
30
30
  import { Md5 } from 'ts-md5';
31
31
 
32
- class TokenService {
33
- constructor(injector) {
34
- this.injector = injector;
35
- }
36
- set(token) {
37
- localStorage.setItem(this.tokenKey, token);
38
- }
39
- remove() {
40
- localStorage.removeItem(this.tokenKey);
41
- }
42
- get() {
43
- return localStorage.getItem(this.tokenKey);
44
- }
45
- decode() {
46
- const token = this.get();
47
- if (!token) {
48
- return;
49
- }
50
- return jwtDecode(token);
51
- }
52
- isExpired() {
53
- const jwt = this.decode();
54
- const currentTime = new Date().getTime() / 1000;
55
- if (jwt && currentTime < jwt.exp) {
56
- return false;
57
- }
58
- return true;
59
- }
60
- get tokenKey() {
61
- const config = this.injector.get(ConfigService);
62
- this.options = config.getConfig('auth') || {};
63
- return this.options.tokenKey;
64
- }
65
- }
66
- TokenService.ɵfac = function TokenService_Factory(t) { return new (t || TokenService)(i0.ɵɵinject(i0.Injector)); };
67
- TokenService.ɵprov = /*@__PURE__*/ i0.ɵɵdefineInjectable({ token: TokenService, factory: TokenService.ɵfac, providedIn: 'root' });
68
- (function () { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(TokenService, [{
69
- type: Injectable,
70
- args: [{
71
- providedIn: 'root'
72
- }]
32
+ class TokenService {
33
+ constructor(injector) {
34
+ this.injector = injector;
35
+ }
36
+ set(token) {
37
+ localStorage.setItem(this.tokenKey, token);
38
+ }
39
+ remove() {
40
+ localStorage.removeItem(this.tokenKey);
41
+ }
42
+ get() {
43
+ return localStorage.getItem(this.tokenKey);
44
+ }
45
+ decode() {
46
+ const token = this.get();
47
+ if (!token) {
48
+ return;
49
+ }
50
+ return jwtDecode(token);
51
+ }
52
+ isExpired() {
53
+ const jwt = this.decode();
54
+ const currentTime = new Date().getTime() / 1000;
55
+ if (jwt && currentTime < jwt.exp) {
56
+ return false;
57
+ }
58
+ return true;
59
+ }
60
+ get tokenKey() {
61
+ const config = this.injector.get(ConfigService);
62
+ this.options = config.getConfig('auth') || {};
63
+ return this.options.tokenKey;
64
+ }
65
+ }
66
+ TokenService.ɵfac = function TokenService_Factory(t) { return new (t || TokenService)(i0.ɵɵinject(i0.Injector)); };
67
+ TokenService.ɵprov = /*@__PURE__*/ i0.ɵɵdefineInjectable({ token: TokenService, factory: TokenService.ɵfac, providedIn: 'root' });
68
+ (function () { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(TokenService, [{
69
+ type: Injectable,
70
+ args: [{
71
+ providedIn: 'root'
72
+ }]
73
73
  }], function () { return [{ type: i0.Injector }]; }, null); })();
74
74
 
75
- class AuthService {
76
- constructor(http, tokenService, config, languageService, messageService, router) {
77
- this.http = http;
78
- this.tokenService = tokenService;
79
- this.config = config;
80
- this.languageService = languageService;
81
- this.messageService = messageService;
82
- this.router = router;
83
- this.authenticate$ = new BehaviorSubject(undefined);
84
- this.logged$ = new BehaviorSubject(undefined);
85
- this.languageForce = false;
86
- this.anonymous = false;
87
- this.authenticate$.next(this.authenticated);
88
- this.authenticate$.subscribe((authenticated) => {
89
- this.logged$.next(authenticated);
90
- globalCacheBusterNotifier.next();
91
- });
92
- }
93
- get hasAuthService() {
94
- return this.config.getConfig('auth.url') !== undefined;
95
- }
96
- login(username, password) {
97
- const myHeader = new HttpHeaders({ 'Content-Type': 'application/json' });
98
- const body = {
99
- username,
100
- password: this.encodePassword(password)
101
- };
102
- return this.loginCall(body, myHeader);
103
- }
104
- loginWithToken(token, type, infosUser) {
105
- const myHeader = new HttpHeaders({ 'Content-Type': 'application/json' });
106
- const body = {
107
- token,
108
- typeConnection: type,
109
- infosUser
110
- };
111
- return this.loginCall(body, myHeader);
112
- }
113
- loginAnonymous() {
114
- this.anonymous = true;
115
- this.logged$.next(true);
116
- return of(true);
117
- }
118
- refresh() {
119
- const url = this.config.getConfig('auth.url');
120
- return this.http.post(`${url}/refresh`, {}).pipe(tap((data) => {
121
- this.tokenService.set(data.token);
122
- }), catchError((err) => {
123
- err.error.caught = true;
124
- throw err;
125
- }));
126
- }
127
- logout() {
128
- this.anonymous = false;
129
- this.tokenService.remove();
130
- this.authenticate$.next(false);
131
- return of(true);
132
- }
133
- isAuthenticated() {
134
- return !this.tokenService.isExpired();
135
- }
136
- getToken() {
137
- return this.tokenService.get();
138
- }
139
- decodeToken() {
140
- if (this.isAuthenticated()) {
141
- return this.tokenService.decode();
142
- }
143
- return false;
144
- }
145
- goToRedirectUrl() {
146
- if (!this.router) {
147
- return;
148
- }
149
- const redirectUrl = this.redirectUrl || this.router.url;
150
- const options = this.config.getConfig('auth') || {};
151
- if (redirectUrl === options.loginRoute) {
152
- const homeRoute = options.homeRoute || '/';
153
- this.router.navigateByUrl(homeRoute);
154
- }
155
- else if (redirectUrl) {
156
- this.router.navigateByUrl(redirectUrl);
157
- }
158
- }
159
- getUserInfo() {
160
- const url = this.config.getConfig('auth.url') + '/info';
161
- return this.http.get(url);
162
- }
163
- getProfils() {
164
- const url = this.config.getConfig('auth.url');
165
- return this.http.get(`${url}/profils`);
166
- }
167
- updateUser(user) {
168
- const url = this.config.getConfig('auth.url');
169
- return this.http.patch(url, user);
170
- }
171
- encodePassword(password) {
172
- return Base64.encode(password);
173
- }
174
- // authenticated or anonymous
175
- get logged() {
176
- return this.authenticated || this.isAnonymous;
177
- }
178
- get isAnonymous() {
179
- return this.anonymous;
180
- }
181
- get authenticated() {
182
- return this.isAuthenticated();
183
- }
184
- get isAdmin() {
185
- const token = this.decodeToken();
186
- if (token && token.user && token.user.isAdmin) {
187
- return true;
188
- }
189
- return false;
190
- }
191
- loginCall(body, headers) {
192
- const url = this.config.getConfig('auth.url');
193
- return this.http.post(`${url}/login`, body, { headers }).pipe(tap((data) => {
194
- this.tokenService.set(data.token);
195
- const tokenDecoded = this.decodeToken();
196
- if (tokenDecoded && tokenDecoded.user) {
197
- if (tokenDecoded.user.locale && !this.languageForce) {
198
- this.languageService.setLanguage(tokenDecoded.user.locale);
199
- }
200
- if (tokenDecoded.user.isExpired) {
201
- this.languageService.translate
202
- .get('igo.auth.error.Password expired')
203
- .subscribe((expiredAlert) => this.messageService.alert(expiredAlert));
204
- }
205
- }
206
- this.authenticate$.next(true);
207
- }), catchError((err) => {
208
- err.error.caught = true;
209
- throw err;
210
- }));
211
- }
212
- }
213
- AuthService.ɵfac = function AuthService_Factory(t) { return new (t || AuthService)(i0.ɵɵinject(i1.HttpClient), i0.ɵɵinject(TokenService), i0.ɵɵinject(i2.ConfigService), i0.ɵɵinject(i2.LanguageService), i0.ɵɵinject(i2.MessageService), i0.ɵɵinject(i3.Router, 8)); };
214
- AuthService.ɵprov = /*@__PURE__*/ i0.ɵɵdefineInjectable({ token: AuthService, factory: AuthService.ɵfac, providedIn: 'root' });
215
- (function () { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(AuthService, [{
216
- type: Injectable,
217
- args: [{
218
- providedIn: 'root'
219
- }]
220
- }], function () { return [{ type: i1.HttpClient }, { type: TokenService }, { type: i2.ConfigService }, { type: i2.LanguageService }, { type: i2.MessageService }, { type: i3.Router, decorators: [{
221
- type: Optional
75
+ class AuthService {
76
+ constructor(http, tokenService, config, languageService, messageService, router) {
77
+ this.http = http;
78
+ this.tokenService = tokenService;
79
+ this.config = config;
80
+ this.languageService = languageService;
81
+ this.messageService = messageService;
82
+ this.router = router;
83
+ this.authenticate$ = new BehaviorSubject(undefined);
84
+ this.logged$ = new BehaviorSubject(undefined);
85
+ this.languageForce = false;
86
+ this.anonymous = false;
87
+ this.authenticate$.next(this.authenticated);
88
+ this.authenticate$.subscribe((authenticated) => {
89
+ this.logged$.next(authenticated);
90
+ globalCacheBusterNotifier.next();
91
+ });
92
+ }
93
+ get hasAuthService() {
94
+ return this.config.getConfig('auth.url') !== undefined;
95
+ }
96
+ login(username, password) {
97
+ const myHeader = new HttpHeaders({ 'Content-Type': 'application/json' });
98
+ const body = {
99
+ username,
100
+ password: this.encodePassword(password)
101
+ };
102
+ return this.loginCall(body, myHeader);
103
+ }
104
+ loginWithToken(token, type, infosUser) {
105
+ const myHeader = new HttpHeaders({ 'Content-Type': 'application/json' });
106
+ const body = {
107
+ token,
108
+ typeConnection: type,
109
+ infosUser
110
+ };
111
+ return this.loginCall(body, myHeader);
112
+ }
113
+ loginAnonymous() {
114
+ this.anonymous = true;
115
+ this.logged$.next(true);
116
+ return of(true);
117
+ }
118
+ refresh() {
119
+ const url = this.config.getConfig('auth.url');
120
+ return this.http.post(`${url}/refresh`, {}).pipe(tap((data) => {
121
+ this.tokenService.set(data.token);
122
+ }), catchError((err) => {
123
+ err.error.caught = true;
124
+ throw err;
125
+ }));
126
+ }
127
+ logout() {
128
+ this.anonymous = false;
129
+ this.tokenService.remove();
130
+ this.authenticate$.next(false);
131
+ return of(true);
132
+ }
133
+ isAuthenticated() {
134
+ return !this.tokenService.isExpired();
135
+ }
136
+ getToken() {
137
+ return this.tokenService.get();
138
+ }
139
+ decodeToken() {
140
+ if (this.isAuthenticated()) {
141
+ return this.tokenService.decode();
142
+ }
143
+ return false;
144
+ }
145
+ goToRedirectUrl() {
146
+ if (!this.router) {
147
+ return;
148
+ }
149
+ const redirectUrl = this.redirectUrl || this.router.url;
150
+ const options = this.config.getConfig('auth') || {};
151
+ if (redirectUrl === options.loginRoute) {
152
+ const homeRoute = options.homeRoute || '/';
153
+ this.router.navigateByUrl(homeRoute);
154
+ }
155
+ else if (redirectUrl) {
156
+ this.router.navigateByUrl(redirectUrl);
157
+ }
158
+ }
159
+ getUserInfo() {
160
+ const url = this.config.getConfig('auth.url') + '/info';
161
+ return this.http.get(url);
162
+ }
163
+ getProfils() {
164
+ const url = this.config.getConfig('auth.url');
165
+ return this.http.get(`${url}/profils`);
166
+ }
167
+ updateUser(user) {
168
+ const url = this.config.getConfig('auth.url');
169
+ return this.http.patch(url, user);
170
+ }
171
+ encodePassword(password) {
172
+ return Base64.encode(password);
173
+ }
174
+ // authenticated or anonymous
175
+ get logged() {
176
+ return this.authenticated || this.isAnonymous;
177
+ }
178
+ get isAnonymous() {
179
+ return this.anonymous;
180
+ }
181
+ get authenticated() {
182
+ return this.isAuthenticated();
183
+ }
184
+ get isAdmin() {
185
+ const token = this.decodeToken();
186
+ if (token && token.user && token.user.isAdmin) {
187
+ return true;
188
+ }
189
+ return false;
190
+ }
191
+ loginCall(body, headers) {
192
+ const url = this.config.getConfig('auth.url');
193
+ return this.http.post(`${url}/login`, body, { headers }).pipe(tap((data) => {
194
+ this.tokenService.set(data.token);
195
+ const tokenDecoded = this.decodeToken();
196
+ if (tokenDecoded && tokenDecoded.user) {
197
+ if (tokenDecoded.user.locale && !this.languageForce) {
198
+ this.languageService.setLanguage(tokenDecoded.user.locale);
199
+ }
200
+ if (tokenDecoded.user.isExpired) {
201
+ this.languageService.translate
202
+ .get('igo.auth.error.Password expired')
203
+ .subscribe((expiredAlert) => this.messageService.alert(expiredAlert));
204
+ }
205
+ }
206
+ this.authenticate$.next(true);
207
+ }), catchError((err) => {
208
+ err.error.caught = true;
209
+ throw err;
210
+ }));
211
+ }
212
+ }
213
+ AuthService.ɵfac = function AuthService_Factory(t) { return new (t || AuthService)(i0.ɵɵinject(i1.HttpClient), i0.ɵɵinject(TokenService), i0.ɵɵinject(i2.ConfigService), i0.ɵɵinject(i2.LanguageService), i0.ɵɵinject(i2.MessageService), i0.ɵɵinject(i3.Router, 8)); };
214
+ AuthService.ɵprov = /*@__PURE__*/ i0.ɵɵdefineInjectable({ token: AuthService, factory: AuthService.ɵfac, providedIn: 'root' });
215
+ (function () { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(AuthService, [{
216
+ type: Injectable,
217
+ args: [{
218
+ providedIn: 'root'
219
+ }]
220
+ }], function () { return [{ type: i1.HttpClient }, { type: TokenService }, { type: i2.ConfigService }, { type: i2.LanguageService }, { type: i2.MessageService }, { type: i3.Router, decorators: [{
221
+ type: Optional
222
222
  }] }]; }, null); })();
223
223
 
224
- class AuthGoogleComponent {
225
- constructor(authService, config, languageService, appRef) {
226
- this.authService = authService;
227
- this.config = config;
228
- this.languageService = languageService;
229
- this.appRef = appRef;
230
- this.login = new EventEmitter();
231
- this.options = this.config.getConfig('auth.google') || {};
232
- if (this.options.apiKey && this.options.clientId) {
233
- this.loadSDKGoogle();
234
- this.loadPlatform();
235
- }
236
- else {
237
- console.warn('Google authentification needs "apiKey" and "clientId" options');
238
- }
239
- }
240
- handleSignInClick() {
241
- window.gapi.auth2.getAuthInstance().signIn();
242
- }
243
- handleSignOutClick() {
244
- window.gapi.auth2.getAuthInstance().signOut();
245
- }
246
- handleClientLoad() {
247
- window.gapi.load('client:auth2', () => this.initClient());
248
- }
249
- initClient() {
250
- window.gapi.client
251
- .init({
252
- apiKey: this.options.apiKey,
253
- clientId: this.options.clientId,
254
- discoveryDocs: [
255
- 'https://people.googleapis.com/$discovery/rest?version=v1'
256
- ],
257
- scope: 'profile'
258
- })
259
- .then(() => {
260
- this.handleSignOutClick();
261
- this.updateTextButton();
262
- window.gapi.auth2.getAuthInstance().isSignedIn.listen(rep => {
263
- this.updateSigninStatus(rep);
264
- });
265
- });
266
- }
267
- updateSigninStatus(isSignedIn) {
268
- this.updateTextButton();
269
- if (isSignedIn) {
270
- this.loginGoogle(window.gapi.client.getToken().access_token);
271
- }
272
- }
273
- updateTextButton() {
274
- const btn = document.querySelector('span[id^="not_signed_"]');
275
- if (btn && this.languageService.getLanguage() !== 'en') {
276
- if (btn.innerHTML === 'Sign in with Google') {
277
- btn.innerHTML = this.languageService.translate.instant('igo.auth.google.login');
278
- }
279
- else if (btn.innerHTML === 'Signed in with Google') {
280
- btn.innerHTML = this.languageService.translate.instant('igo.auth.google.logged');
281
- }
282
- }
283
- }
284
- loginGoogle(token) {
285
- this.authService.loginWithToken(token, 'google').subscribe(() => {
286
- this.appRef.tick();
287
- this.login.emit(true);
288
- });
289
- }
290
- loadSDKGoogle() {
291
- const fjs = document.getElementsByTagName('script')[0];
292
- const js = document.createElement('script');
293
- js.id = 'google-jssdk';
294
- js.src = 'https://apis.google.com/js/api.js';
295
- js.onload = () => {
296
- this.handleClientLoad();
297
- };
298
- fjs.parentNode.insertBefore(js, fjs);
299
- }
300
- loadPlatform() {
301
- const fjs = document.getElementsByTagName('script')[0];
302
- const js = document.createElement('script');
303
- js.id = 'google-platform';
304
- js.src = 'https://apis.google.com/js/platform.js';
305
- fjs.parentNode.insertBefore(js, fjs);
306
- }
307
- }
308
- AuthGoogleComponent.ɵfac = function AuthGoogleComponent_Factory(t) { return new (t || AuthGoogleComponent)(i0.ɵɵdirectiveInject(AuthService), i0.ɵɵdirectiveInject(i2.ConfigService), i0.ɵɵdirectiveInject(i2.LanguageService), i0.ɵɵdirectiveInject(i0.ApplicationRef)); };
309
- AuthGoogleComponent.ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: AuthGoogleComponent, selectors: [["igo-auth-google"]], outputs: { login: "login" }, decls: 1, vars: 0, consts: [["data-height", "40", "data-width", "265", "data-longtitle", "true", 1, "g-signin2", "google-login-button"]], template: function AuthGoogleComponent_Template(rf, ctx) { if (rf & 1) {
310
- i0.ɵɵelement(0, "div", 0);
311
- } }, styles: ["[_nghost-%COMP%]{padding:10px 10px 10px 0;display:inline-block}.google-login-button[_ngcontent-%COMP%] .abcRioButton{color:#000000de}"], changeDetection: 0 });
312
- (function () { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(AuthGoogleComponent, [{
313
- type: Component,
314
- args: [{ selector: 'igo-auth-google', changeDetection: ChangeDetectionStrategy.OnPush, template: "<div class=\"g-signin2 google-login-button\" data-height=\"40\" data-width=\"265\" data-longtitle=\"true\">\n", styles: [":host{padding:10px 10px 10px 0;display:inline-block}.google-login-button ::ng-deep .abcRioButton{color:#000000de}\n"] }]
315
- }], function () { return [{ type: AuthService }, { type: i2.ConfigService }, { type: i2.LanguageService }, { type: i0.ApplicationRef }]; }, { login: [{
316
- type: Output
224
+ class AuthGoogleComponent {
225
+ constructor(authService, config, languageService, appRef) {
226
+ this.authService = authService;
227
+ this.config = config;
228
+ this.languageService = languageService;
229
+ this.appRef = appRef;
230
+ this.login = new EventEmitter();
231
+ this.options = this.config.getConfig('auth.google') || {};
232
+ if (this.options.apiKey && this.options.clientId) {
233
+ this.loadSDKGoogle();
234
+ this.loadPlatform();
235
+ }
236
+ else {
237
+ console.warn('Google authentification needs "apiKey" and "clientId" options');
238
+ }
239
+ }
240
+ handleSignInClick() {
241
+ window.gapi.auth2.getAuthInstance().signIn();
242
+ }
243
+ handleSignOutClick() {
244
+ window.gapi.auth2.getAuthInstance().signOut();
245
+ }
246
+ handleClientLoad() {
247
+ window.gapi.load('client:auth2', () => this.initClient());
248
+ }
249
+ initClient() {
250
+ window.gapi.client
251
+ .init({
252
+ apiKey: this.options.apiKey,
253
+ clientId: this.options.clientId,
254
+ discoveryDocs: [
255
+ 'https://people.googleapis.com/$discovery/rest?version=v1'
256
+ ],
257
+ scope: 'profile'
258
+ })
259
+ .then(() => {
260
+ this.handleSignOutClick();
261
+ this.updateTextButton();
262
+ window.gapi.auth2.getAuthInstance().isSignedIn.listen(rep => {
263
+ this.updateSigninStatus(rep);
264
+ });
265
+ });
266
+ }
267
+ updateSigninStatus(isSignedIn) {
268
+ this.updateTextButton();
269
+ if (isSignedIn) {
270
+ this.loginGoogle(window.gapi.client.getToken().access_token);
271
+ }
272
+ }
273
+ updateTextButton() {
274
+ const btn = document.querySelector('span[id^="not_signed_"]');
275
+ if (btn && this.languageService.getLanguage() !== 'en') {
276
+ if (btn.innerHTML === 'Sign in with Google') {
277
+ btn.innerHTML = this.languageService.translate.instant('igo.auth.google.login');
278
+ }
279
+ else if (btn.innerHTML === 'Signed in with Google') {
280
+ btn.innerHTML = this.languageService.translate.instant('igo.auth.google.logged');
281
+ }
282
+ }
283
+ }
284
+ loginGoogle(token) {
285
+ this.authService.loginWithToken(token, 'google').subscribe(() => {
286
+ this.appRef.tick();
287
+ this.login.emit(true);
288
+ });
289
+ }
290
+ loadSDKGoogle() {
291
+ const fjs = document.getElementsByTagName('script')[0];
292
+ const js = document.createElement('script');
293
+ js.id = 'google-jssdk';
294
+ js.src = 'https://apis.google.com/js/api.js';
295
+ js.onload = () => {
296
+ this.handleClientLoad();
297
+ };
298
+ fjs.parentNode.insertBefore(js, fjs);
299
+ }
300
+ loadPlatform() {
301
+ const fjs = document.getElementsByTagName('script')[0];
302
+ const js = document.createElement('script');
303
+ js.id = 'google-platform';
304
+ js.src = 'https://apis.google.com/js/platform.js';
305
+ fjs.parentNode.insertBefore(js, fjs);
306
+ }
307
+ }
308
+ AuthGoogleComponent.ɵfac = function AuthGoogleComponent_Factory(t) { return new (t || AuthGoogleComponent)(i0.ɵɵdirectiveInject(AuthService), i0.ɵɵdirectiveInject(i2.ConfigService), i0.ɵɵdirectiveInject(i2.LanguageService), i0.ɵɵdirectiveInject(i0.ApplicationRef)); };
309
+ AuthGoogleComponent.ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: AuthGoogleComponent, selectors: [["igo-auth-google"]], outputs: { login: "login" }, decls: 1, vars: 0, consts: [["data-height", "40", "data-width", "265", "data-longtitle", "true", 1, "g-signin2", "google-login-button"]], template: function AuthGoogleComponent_Template(rf, ctx) { if (rf & 1) {
310
+ i0.ɵɵelement(0, "div", 0);
311
+ } }, styles: ["[_nghost-%COMP%]{padding:10px 10px 10px 0;display:inline-block}.google-login-button[_ngcontent-%COMP%] .abcRioButton{color:#000000de}"], changeDetection: 0 });
312
+ (function () { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(AuthGoogleComponent, [{
313
+ type: Component,
314
+ args: [{ selector: 'igo-auth-google', changeDetection: ChangeDetectionStrategy.OnPush, template: "<div class=\"g-signin2 google-login-button\" data-height=\"40\" data-width=\"265\" data-longtitle=\"true\">\n", styles: [":host{padding:10px 10px 10px 0;display:inline-block}.google-login-button ::ng-deep .abcRioButton{color:#000000de}\n"] }]
315
+ }], function () { return [{ type: AuthService }, { type: i2.ConfigService }, { type: i2.LanguageService }, { type: i0.ApplicationRef }]; }, { login: [{
316
+ type: Output
317
317
  }] }); })();
318
318
 
319
- function AuthInternComponent_button_12_Template(rf, ctx) { if (rf & 1) {
320
- const _r3 = i0.ɵɵgetCurrentView();
321
- i0.ɵɵelementStart(0, "button", 7);
322
- i0.ɵɵlistener("click", function AuthInternComponent_button_12_Template_button_click_0_listener() { i0.ɵɵrestoreView(_r3); const ctx_r2 = i0.ɵɵnextContext(); return i0.ɵɵresetView(ctx_r2.loginAnonymous()); });
323
- i0.ɵɵtext(1);
324
- i0.ɵɵpipe(2, "translate");
325
- i0.ɵɵelementEnd();
326
- } if (rf & 2) {
327
- const ctx_r0 = i0.ɵɵnextContext();
328
- i0.ɵɵproperty("disabled", ctx_r0.loading);
329
- i0.ɵɵadvance(1);
330
- i0.ɵɵtextInterpolate1(" ", i0.ɵɵpipeBind1(2, 2, "igo.auth.accessAnonymous"), " ");
331
- } }
332
- function AuthInternComponent_div_13_Template(rf, ctx) { if (rf & 1) {
333
- i0.ɵɵelementStart(0, "div");
334
- i0.ɵɵelement(1, "br");
335
- i0.ɵɵelementStart(2, "font", 8);
336
- i0.ɵɵtext(3);
337
- i0.ɵɵelementEnd()();
338
- } if (rf & 2) {
339
- const ctx_r1 = i0.ɵɵnextContext();
340
- i0.ɵɵadvance(3);
341
- i0.ɵɵtextInterpolate(ctx_r1.error);
342
- } }
343
- class AuthInternComponent {
344
- constructor(auth, languageService, fb) {
345
- this.auth = auth;
346
- this.languageService = languageService;
347
- this._allowAnonymous = true;
348
- this.error = '';
349
- this.loading = false;
350
- this.login = new EventEmitter();
351
- this.form = fb.group({
352
- username: ['', Validators.required],
353
- password: ['', Validators.required]
354
- });
355
- }
356
- get allowAnonymous() {
357
- return this._allowAnonymous;
358
- }
359
- set allowAnonymous(value) {
360
- this._allowAnonymous = value;
361
- }
362
- loginUser(values) {
363
- this.loading = true;
364
- this.auth.login(values.username, values.password).subscribe(() => {
365
- this.login.emit(true);
366
- this.loading = false;
367
- }, (error) => {
368
- try {
369
- this.languageService.translate
370
- .get('igo.auth.error.' + error.error.message)
371
- .subscribe(errorMsg => (this.error = errorMsg));
372
- }
373
- catch (e) {
374
- this.error = error.error.message;
375
- }
376
- this.loading = false;
377
- });
378
- return false;
379
- }
380
- loginAnonymous() {
381
- this.auth.loginAnonymous().subscribe(() => {
382
- this.login.emit(true);
383
- });
384
- }
385
- }
386
- AuthInternComponent.ɵfac = function AuthInternComponent_Factory(t) { return new (t || AuthInternComponent)(i0.ɵɵdirectiveInject(AuthService), i0.ɵɵdirectiveInject(i2.LanguageService), i0.ɵɵdirectiveInject(i3$1.UntypedFormBuilder)); };
387
- AuthInternComponent.ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: AuthInternComponent, selectors: [["igo-auth-intern"]], inputs: { allowAnonymous: "allowAnonymous" }, outputs: { login: "login" }, decls: 14, vars: 12, consts: [["role", "form", 3, "formGroup", "ngSubmit"], [1, "full-width"], ["matInput", "", "required", "", "formControlName", "username", 3, "placeholder"], ["matInput", "", "required", "", "type", "password", "formControlName", "password", 3, "placeholder"], ["mat-raised-button", "", "type", "submit"], ["mat-raised-button", "", "class", "anonymous", "type", "button", 3, "disabled", "click", 4, "ngIf"], [4, "ngIf"], ["mat-raised-button", "", "type", "button", 1, "anonymous", 3, "disabled", "click"], ["size", "3", "color", "red"]], template: function AuthInternComponent_Template(rf, ctx) { if (rf & 1) {
388
- i0.ɵɵelementStart(0, "form", 0);
389
- i0.ɵɵlistener("ngSubmit", function AuthInternComponent_Template_form_ngSubmit_0_listener() { return ctx.loginUser(ctx.form.value); });
390
- i0.ɵɵelementStart(1, "div")(2, "mat-form-field", 1);
391
- i0.ɵɵelement(3, "input", 2);
392
- i0.ɵɵpipe(4, "translate");
393
- i0.ɵɵelementEnd()();
394
- i0.ɵɵelementStart(5, "div")(6, "mat-form-field", 1);
395
- i0.ɵɵelement(7, "input", 3);
396
- i0.ɵɵpipe(8, "translate");
397
- i0.ɵɵelementEnd()();
398
- i0.ɵɵelementStart(9, "button", 4);
399
- i0.ɵɵtext(10);
400
- i0.ɵɵpipe(11, "translate");
401
- i0.ɵɵelementEnd();
402
- i0.ɵɵtemplate(12, AuthInternComponent_button_12_Template, 3, 4, "button", 5);
403
- i0.ɵɵtemplate(13, AuthInternComponent_div_13_Template, 4, 1, "div", 6);
404
- i0.ɵɵelementEnd();
405
- } if (rf & 2) {
406
- i0.ɵɵproperty("formGroup", ctx.form);
407
- i0.ɵɵadvance(3);
408
- i0.ɵɵpropertyInterpolate("placeholder", i0.ɵɵpipeBind1(4, 6, "igo.auth.user"));
409
- i0.ɵɵadvance(4);
410
- i0.ɵɵpropertyInterpolate("placeholder", i0.ɵɵpipeBind1(8, 8, "igo.auth.password"));
411
- i0.ɵɵadvance(3);
412
- i0.ɵɵtextInterpolate(i0.ɵɵpipeBind1(11, 10, "igo.auth.login"));
413
- i0.ɵɵadvance(2);
414
- i0.ɵɵproperty("ngIf", ctx.allowAnonymous);
415
- i0.ɵɵadvance(1);
416
- i0.ɵɵproperty("ngIf", ctx.error);
417
- } }, dependencies: [i1$1.NgIf, i3$1.ɵNgNoValidate, i3$1.DefaultValueAccessor, i3$1.NgControlStatus, i3$1.NgControlStatusGroup, i3$1.RequiredValidator, i3$1.FormGroupDirective, i3$1.FormControlName, i5.MatFormField, i6.MatInput, i5$1.MatButton, i6$1.TranslatePipe], styles: [".full-width[_ngcontent-%COMP%]{width:100%}.anonymous[_ngcontent-%COMP%]{margin-left:10px}"] });
418
- (function () { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(AuthInternComponent, [{
419
- type: Component,
420
- args: [{ selector: 'igo-auth-intern', changeDetection: ChangeDetectionStrategy.Default, template: "<form [formGroup]=\"form\" role=\"form\" (ngSubmit)=\"loginUser(form.value)\">\n <div>\n <mat-form-field class=\"full-width\">\n <input matInput required placeholder=\"{{'igo.auth.user' | translate}}\" formControlName=\"username\">\n </mat-form-field>\n </div>\n\n <div>\n <mat-form-field class=\"full-width\">\n <input matInput required type=\"password\" placeholder=\"{{'igo.auth.password' | translate}}\" formControlName=\"password\">\n </mat-form-field>\n </div>\n\n <button mat-raised-button type=\"submit\">{{'igo.auth.login' | translate}}</button>\n <button *ngIf=\"allowAnonymous\" mat-raised-button class=\"anonymous\" type=\"button\" [disabled]=\"loading\" (click)=\"loginAnonymous()\">\n {{'igo.auth.accessAnonymous' | translate }}\n </button>\n <div *ngIf=\"error\">\n <br/>\n <font size=\"3\" color=\"red\">{{error}}</font>\n </div>\n</form>\n\n<!--\nThis part was removed from the below line to fix Angular issue 30616 : [disabled]=\"!form.valid || loading\n <button mat-raised-button type=\"submit\" [disabled]=\"!form.valid || loading\">{{'igo.auth.login' | translate}}</button>*/\n-->\n", styles: [".full-width{width:100%}.anonymous{margin-left:10px}\n"] }]
421
- }], function () { return [{ type: AuthService }, { type: i2.LanguageService }, { type: i3$1.UntypedFormBuilder }]; }, { allowAnonymous: [{
422
- type: Input
423
- }], login: [{
424
- type: Output
319
+ function AuthInternComponent_button_12_Template(rf, ctx) { if (rf & 1) {
320
+ const _r3 = i0.ɵɵgetCurrentView();
321
+ i0.ɵɵelementStart(0, "button", 7);
322
+ i0.ɵɵlistener("click", function AuthInternComponent_button_12_Template_button_click_0_listener() { i0.ɵɵrestoreView(_r3); const ctx_r2 = i0.ɵɵnextContext(); return i0.ɵɵresetView(ctx_r2.loginAnonymous()); });
323
+ i0.ɵɵtext(1);
324
+ i0.ɵɵpipe(2, "translate");
325
+ i0.ɵɵelementEnd();
326
+ } if (rf & 2) {
327
+ const ctx_r0 = i0.ɵɵnextContext();
328
+ i0.ɵɵproperty("disabled", ctx_r0.loading);
329
+ i0.ɵɵadvance(1);
330
+ i0.ɵɵtextInterpolate1(" ", i0.ɵɵpipeBind1(2, 2, "igo.auth.accessAnonymous"), " ");
331
+ } }
332
+ function AuthInternComponent_div_13_Template(rf, ctx) { if (rf & 1) {
333
+ i0.ɵɵelementStart(0, "div");
334
+ i0.ɵɵelement(1, "br");
335
+ i0.ɵɵelementStart(2, "font", 8);
336
+ i0.ɵɵtext(3);
337
+ i0.ɵɵelementEnd()();
338
+ } if (rf & 2) {
339
+ const ctx_r1 = i0.ɵɵnextContext();
340
+ i0.ɵɵadvance(3);
341
+ i0.ɵɵtextInterpolate(ctx_r1.error);
342
+ } }
343
+ class AuthInternComponent {
344
+ constructor(auth, languageService, fb) {
345
+ this.auth = auth;
346
+ this.languageService = languageService;
347
+ this._allowAnonymous = true;
348
+ this.error = '';
349
+ this.loading = false;
350
+ this.login = new EventEmitter();
351
+ this.form = fb.group({
352
+ username: ['', Validators.required],
353
+ password: ['', Validators.required]
354
+ });
355
+ }
356
+ get allowAnonymous() {
357
+ return this._allowAnonymous;
358
+ }
359
+ set allowAnonymous(value) {
360
+ this._allowAnonymous = value;
361
+ }
362
+ loginUser(values) {
363
+ this.loading = true;
364
+ this.auth.login(values.username, values.password).subscribe(() => {
365
+ this.login.emit(true);
366
+ this.loading = false;
367
+ }, (error) => {
368
+ try {
369
+ this.languageService.translate
370
+ .get('igo.auth.error.' + error.error.message)
371
+ .subscribe(errorMsg => (this.error = errorMsg));
372
+ }
373
+ catch (e) {
374
+ this.error = error.error.message;
375
+ }
376
+ this.loading = false;
377
+ });
378
+ return false;
379
+ }
380
+ loginAnonymous() {
381
+ this.auth.loginAnonymous().subscribe(() => {
382
+ this.login.emit(true);
383
+ });
384
+ }
385
+ }
386
+ AuthInternComponent.ɵfac = function AuthInternComponent_Factory(t) { return new (t || AuthInternComponent)(i0.ɵɵdirectiveInject(AuthService), i0.ɵɵdirectiveInject(i2.LanguageService), i0.ɵɵdirectiveInject(i3$1.UntypedFormBuilder)); };
387
+ AuthInternComponent.ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: AuthInternComponent, selectors: [["igo-auth-intern"]], inputs: { allowAnonymous: "allowAnonymous" }, outputs: { login: "login" }, decls: 14, vars: 12, consts: [["role", "form", 3, "formGroup", "ngSubmit"], [1, "full-width"], ["matInput", "", "required", "", "formControlName", "username", 3, "placeholder"], ["matInput", "", "required", "", "type", "password", "formControlName", "password", 3, "placeholder"], ["mat-raised-button", "", "type", "submit"], ["mat-raised-button", "", "class", "anonymous", "type", "button", 3, "disabled", "click", 4, "ngIf"], [4, "ngIf"], ["mat-raised-button", "", "type", "button", 1, "anonymous", 3, "disabled", "click"], ["size", "3", "color", "red"]], template: function AuthInternComponent_Template(rf, ctx) { if (rf & 1) {
388
+ i0.ɵɵelementStart(0, "form", 0);
389
+ i0.ɵɵlistener("ngSubmit", function AuthInternComponent_Template_form_ngSubmit_0_listener() { return ctx.loginUser(ctx.form.value); });
390
+ i0.ɵɵelementStart(1, "div")(2, "mat-form-field", 1);
391
+ i0.ɵɵelement(3, "input", 2);
392
+ i0.ɵɵpipe(4, "translate");
393
+ i0.ɵɵelementEnd()();
394
+ i0.ɵɵelementStart(5, "div")(6, "mat-form-field", 1);
395
+ i0.ɵɵelement(7, "input", 3);
396
+ i0.ɵɵpipe(8, "translate");
397
+ i0.ɵɵelementEnd()();
398
+ i0.ɵɵelementStart(9, "button", 4);
399
+ i0.ɵɵtext(10);
400
+ i0.ɵɵpipe(11, "translate");
401
+ i0.ɵɵelementEnd();
402
+ i0.ɵɵtemplate(12, AuthInternComponent_button_12_Template, 3, 4, "button", 5);
403
+ i0.ɵɵtemplate(13, AuthInternComponent_div_13_Template, 4, 1, "div", 6);
404
+ i0.ɵɵelementEnd();
405
+ } if (rf & 2) {
406
+ i0.ɵɵproperty("formGroup", ctx.form);
407
+ i0.ɵɵadvance(3);
408
+ i0.ɵɵpropertyInterpolate("placeholder", i0.ɵɵpipeBind1(4, 6, "igo.auth.user"));
409
+ i0.ɵɵadvance(4);
410
+ i0.ɵɵpropertyInterpolate("placeholder", i0.ɵɵpipeBind1(8, 8, "igo.auth.password"));
411
+ i0.ɵɵadvance(3);
412
+ i0.ɵɵtextInterpolate(i0.ɵɵpipeBind1(11, 10, "igo.auth.login"));
413
+ i0.ɵɵadvance(2);
414
+ i0.ɵɵproperty("ngIf", ctx.allowAnonymous);
415
+ i0.ɵɵadvance(1);
416
+ i0.ɵɵproperty("ngIf", ctx.error);
417
+ } }, dependencies: [i1$1.NgIf, i3$1.ɵNgNoValidate, i3$1.DefaultValueAccessor, i3$1.NgControlStatus, i3$1.NgControlStatusGroup, i3$1.RequiredValidator, i3$1.FormGroupDirective, i3$1.FormControlName, i5.MatFormField, i6.MatInput, i5$1.MatButton, i6$1.TranslatePipe], styles: [".full-width[_ngcontent-%COMP%]{width:100%}.anonymous[_ngcontent-%COMP%]{margin-left:10px}"] });
418
+ (function () { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(AuthInternComponent, [{
419
+ type: Component,
420
+ args: [{ selector: 'igo-auth-intern', changeDetection: ChangeDetectionStrategy.Default, template: "<form [formGroup]=\"form\" role=\"form\" (ngSubmit)=\"loginUser(form.value)\">\n <div>\n <mat-form-field class=\"full-width\">\n <input matInput required placeholder=\"{{'igo.auth.user' | translate}}\" formControlName=\"username\">\n </mat-form-field>\n </div>\n\n <div>\n <mat-form-field class=\"full-width\">\n <input matInput required type=\"password\" placeholder=\"{{'igo.auth.password' | translate}}\" formControlName=\"password\">\n </mat-form-field>\n </div>\n\n <button mat-raised-button type=\"submit\">{{'igo.auth.login' | translate}}</button>\n <button *ngIf=\"allowAnonymous\" mat-raised-button class=\"anonymous\" type=\"button\" [disabled]=\"loading\" (click)=\"loginAnonymous()\">\n {{'igo.auth.accessAnonymous' | translate }}\n </button>\n <div *ngIf=\"error\">\n <br/>\n <font size=\"3\" color=\"red\">{{error}}</font>\n </div>\n</form>\n\n<!--\nThis part was removed from the below line to fix Angular issue 30616 : [disabled]=\"!form.valid || loading\n <button mat-raised-button type=\"submit\" [disabled]=\"!form.valid || loading\">{{'igo.auth.login' | translate}}</button>*/\n-->\n", styles: [".full-width{width:100%}.anonymous{margin-left:10px}\n"] }]
421
+ }], function () { return [{ type: AuthService }, { type: i2.LanguageService }, { type: i3$1.UntypedFormBuilder }]; }, { allowAnonymous: [{
422
+ type: Input
423
+ }], login: [{
424
+ type: Output
425
425
  }] }); })();
426
426
 
427
- class AuthFacebookComponent {
428
- constructor(authService, config, appRef) {
429
- this.authService = authService;
430
- this.config = config;
431
- this.appRef = appRef;
432
- this.login = new EventEmitter();
433
- this.options = this.config.getConfig('auth.facebook') || {};
434
- if (this.options.appId) {
435
- this.loadSDKFacebook();
436
- }
437
- else {
438
- console.warn('Facebook authentification needs "appId" option');
439
- }
440
- }
441
- subscribeEvents() {
442
- window.FB.Event.subscribe('auth.statusChange', rep => {
443
- this.statusChangeCallback(rep);
444
- });
445
- }
446
- statusChangeCallback(response) {
447
- if (response.status === 'connected') {
448
- const accessToken = response.authResponse.accessToken;
449
- this.loginFacebook(accessToken);
450
- }
451
- }
452
- loginFacebook(token) {
453
- this.authService.loginWithToken(token, 'facebook').subscribe(() => {
454
- this.appRef.tick();
455
- this.login.emit(true);
456
- });
457
- }
458
- loadSDKFacebook() {
459
- if (document.getElementById('facebook-jssdk')) {
460
- return;
461
- }
462
- const urlSDK = 'https://connect.facebook.net/fr_CA/sdk.js#xfbml=1&version=v2.9';
463
- const fjs = document.getElementsByTagName('script')[0];
464
- const js = document.createElement('script');
465
- js.id = 'facebook-jssdk';
466
- js.src = `${urlSDK}&appId=${this.options.appId}`;
467
- js.onload = () => {
468
- this.subscribeEvents();
469
- };
470
- fjs.parentNode.insertBefore(js, fjs);
471
- }
472
- }
473
- AuthFacebookComponent.ɵfac = function AuthFacebookComponent_Factory(t) { return new (t || AuthFacebookComponent)(i0.ɵɵdirectiveInject(AuthService), i0.ɵɵdirectiveInject(i2.ConfigService), i0.ɵɵdirectiveInject(i0.ApplicationRef)); };
474
- AuthFacebookComponent.ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: AuthFacebookComponent, selectors: [["igo-auth-facebook"]], outputs: { login: "login" }, decls: 1, vars: 0, consts: [["scope", "public_profile,email", "data-max-rows", "1", "data-size", "large", "data-button-type", "login_with", "data-show-faces", "false", "data-auto-logout-link", "false", "data-use-continue-as", "false", 1, "fb-login-button"]], template: function AuthFacebookComponent_Template(rf, ctx) { if (rf & 1) {
475
- i0.ɵɵelement(0, "div", 0);
476
- } }, styles: ["[_nghost-%COMP%]{padding:10px 10px 10px 0;display:inline-block;position:relative;top:-3px}"], changeDetection: 0 });
477
- (function () { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(AuthFacebookComponent, [{
478
- type: Component,
479
- args: [{ selector: 'igo-auth-facebook', changeDetection: ChangeDetectionStrategy.OnPush, template: "<div scope=\"public_profile,email\"\n class=\"fb-login-button\" data-max-rows=\"1\" data-size=\"large\"\n data-button-type=\"login_with\" data-show-faces=\"false\"\n data-auto-logout-link=\"false\" data-use-continue-as=\"false\">\n</div>\n", styles: [":host{padding:10px 10px 10px 0;display:inline-block;position:relative;top:-3px}\n"] }]
480
- }], function () { return [{ type: AuthService }, { type: i2.ConfigService }, { type: i0.ApplicationRef }]; }, { login: [{
481
- type: Output
427
+ class AuthFacebookComponent {
428
+ constructor(authService, config, appRef) {
429
+ this.authService = authService;
430
+ this.config = config;
431
+ this.appRef = appRef;
432
+ this.login = new EventEmitter();
433
+ this.options = this.config.getConfig('auth.facebook') || {};
434
+ if (this.options.appId) {
435
+ this.loadSDKFacebook();
436
+ }
437
+ else {
438
+ console.warn('Facebook authentification needs "appId" option');
439
+ }
440
+ }
441
+ subscribeEvents() {
442
+ window.FB.Event.subscribe('auth.statusChange', rep => {
443
+ this.statusChangeCallback(rep);
444
+ });
445
+ }
446
+ statusChangeCallback(response) {
447
+ if (response.status === 'connected') {
448
+ const accessToken = response.authResponse.accessToken;
449
+ this.loginFacebook(accessToken);
450
+ }
451
+ }
452
+ loginFacebook(token) {
453
+ this.authService.loginWithToken(token, 'facebook').subscribe(() => {
454
+ this.appRef.tick();
455
+ this.login.emit(true);
456
+ });
457
+ }
458
+ loadSDKFacebook() {
459
+ if (document.getElementById('facebook-jssdk')) {
460
+ return;
461
+ }
462
+ const urlSDK = 'https://connect.facebook.net/fr_CA/sdk.js#xfbml=1&version=v2.9';
463
+ const fjs = document.getElementsByTagName('script')[0];
464
+ const js = document.createElement('script');
465
+ js.id = 'facebook-jssdk';
466
+ js.src = `${urlSDK}&appId=${this.options.appId}`;
467
+ js.onload = () => {
468
+ this.subscribeEvents();
469
+ };
470
+ fjs.parentNode.insertBefore(js, fjs);
471
+ }
472
+ }
473
+ AuthFacebookComponent.ɵfac = function AuthFacebookComponent_Factory(t) { return new (t || AuthFacebookComponent)(i0.ɵɵdirectiveInject(AuthService), i0.ɵɵdirectiveInject(i2.ConfigService), i0.ɵɵdirectiveInject(i0.ApplicationRef)); };
474
+ AuthFacebookComponent.ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: AuthFacebookComponent, selectors: [["igo-auth-facebook"]], outputs: { login: "login" }, decls: 1, vars: 0, consts: [["scope", "public_profile,email", "data-max-rows", "1", "data-size", "large", "data-button-type", "login_with", "data-show-faces", "false", "data-auto-logout-link", "false", "data-use-continue-as", "false", 1, "fb-login-button"]], template: function AuthFacebookComponent_Template(rf, ctx) { if (rf & 1) {
475
+ i0.ɵɵelement(0, "div", 0);
476
+ } }, styles: ["[_nghost-%COMP%]{padding:10px 10px 10px 0;display:inline-block;position:relative;top:-3px}"], changeDetection: 0 });
477
+ (function () { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(AuthFacebookComponent, [{
478
+ type: Component,
479
+ args: [{ selector: 'igo-auth-facebook', changeDetection: ChangeDetectionStrategy.OnPush, template: "<div scope=\"public_profile,email\"\n class=\"fb-login-button\" data-max-rows=\"1\" data-size=\"large\"\n data-button-type=\"login_with\" data-show-faces=\"false\"\n data-auto-logout-link=\"false\" data-use-continue-as=\"false\">\n</div>\n", styles: [":host{padding:10px 10px 10px 0;display:inline-block;position:relative;top:-3px}\n"] }]
480
+ }], function () { return [{ type: AuthService }, { type: i2.ConfigService }, { type: i0.ApplicationRef }]; }, { login: [{
481
+ type: Output
482
482
  }] }); })();
483
483
 
484
- class AuthMicrosoftComponent {
485
- constructor(authService, config, appRef, msalService, msalGuardConfig) {
486
- this.authService = authService;
487
- this.config = config;
488
- this.appRef = appRef;
489
- this.msalService = msalService;
490
- this.msalGuardConfig = msalGuardConfig;
491
- this._destroying$ = new Subject();
492
- this.login = new EventEmitter();
493
- this.options = this.config.getConfig('auth.microsoft') || {};
494
- this.msalService.instance = new PublicClientApplication({
495
- auth: this.options,
496
- cache: {
497
- cacheLocation: 'sessionStorage'
498
- }
499
- });
500
- this.broadcastService = new MsalBroadcastService(this.msalService.instance, this.msalService);
501
- if (this.options.clientId) {
502
- this.broadcastService.inProgress$
503
- .pipe(filter((status) => status === InteractionStatus.None), takeUntil(this._destroying$))
504
- .subscribe(() => {
505
- this.checkAccount();
506
- });
507
- }
508
- else {
509
- console.warn('Microsoft authentification needs "clientId" option');
510
- }
511
- }
512
- loginMicrosoft() {
513
- this.msalService.loginPopup({ ...this.getConf().authRequest })
514
- .subscribe((response) => {
515
- this.msalService.instance.setActiveAccount(response.account);
516
- this.checkAccount();
517
- });
518
- }
519
- checkAccount() {
520
- this.msalService.instance
521
- .acquireTokenSilent(this.getConf().authRequest)
522
- .then((response) => {
523
- const tokenAccess = response.accessToken;
524
- const tokenId = response.idToken;
525
- this.authService.loginWithToken(tokenAccess, 'microsoft', { tokenId }).subscribe(() => {
526
- this.appRef.tick();
527
- this.login.emit(true);
528
- });
529
- })
530
- .catch(async (error) => {
531
- if (error instanceof InteractionRequiredAuthError) {
532
- // fallback to interaction when silent call fails
533
- return this.msalService.acquireTokenPopup(this.getConf().authRequest);
534
- }
535
- console.log(error);
536
- }).catch(error => {
537
- console.log('Silent token fails');
538
- });
539
- }
540
- getConf() {
541
- return this.msalGuardConfig.filter(conf => conf.type === 'add')[0];
542
- }
543
- }
544
- AuthMicrosoftComponent.ɵfac = function AuthMicrosoftComponent_Factory(t) { return new (t || AuthMicrosoftComponent)(i0.ɵɵdirectiveInject(AuthService), i0.ɵɵdirectiveInject(i2.ConfigService), i0.ɵɵdirectiveInject(i0.ApplicationRef), i0.ɵɵdirectiveInject(i3$2.MsalService), i0.ɵɵdirectiveInject(MSAL_GUARD_CONFIG)); };
545
- AuthMicrosoftComponent.ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: AuthMicrosoftComponent, selectors: [["igo-auth-microsoft"]], outputs: { login: "login" }, decls: 4, vars: 3, consts: [["mat-raised-button", "", 1, "microsoft-login-button", 3, "click"], ["svgIcon", "microsoft"]], template: function AuthMicrosoftComponent_Template(rf, ctx) { if (rf & 1) {
546
- i0.ɵɵelementStart(0, "button", 0);
547
- i0.ɵɵlistener("click", function AuthMicrosoftComponent_Template_button_click_0_listener() { return ctx.loginMicrosoft(); });
548
- i0.ɵɵelement(1, "mat-icon", 1);
549
- i0.ɵɵtext(2);
550
- i0.ɵɵpipe(3, "translate");
551
- i0.ɵɵelementEnd();
552
- } if (rf & 2) {
553
- i0.ɵɵadvance(2);
554
- i0.ɵɵtextInterpolate1(" ", i0.ɵɵpipeBind1(3, 1, "igo.auth.microsoft.login"), "\n");
555
- } }, dependencies: [i4.MatIcon, i5$1.MatButton, i6$1.TranslatePipe], styles: ["[_nghost-%COMP%]{padding:10px 10px 10px 0;display:inline-block;position:relative;top:-15px}[_nghost-%COMP%] > button[_ngcontent-%COMP%]{font-size:15px;height:40px;width:265px}mat-icon[_ngcontent-%COMP%]{margin-right:10px}"], changeDetection: 0 });
556
- (function () { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(AuthMicrosoftComponent, [{
557
- type: Component,
558
- args: [{ selector: 'igo-auth-microsoft', changeDetection: ChangeDetectionStrategy.OnPush, template: "<button class=\"microsoft-login-button\" mat-raised-button (click)=\"loginMicrosoft()\">\n <mat-icon svgIcon=\"microsoft\"></mat-icon>\n {{'igo.auth.microsoft.login' | translate}}\n</button>\n", styles: [":host{padding:10px 10px 10px 0;display:inline-block;position:relative;top:-15px}:host>button{font-size:15px;height:40px;width:265px}mat-icon{margin-right:10px}\n"] }]
559
- }], function () { return [{ type: AuthService }, { type: i2.ConfigService }, { type: i0.ApplicationRef }, { type: i3$2.MsalService }, { type: undefined, decorators: [{
560
- type: Inject,
561
- args: [MSAL_GUARD_CONFIG]
562
- }] }]; }, { login: [{
563
- type: Output
484
+ class AuthMicrosoftComponent {
485
+ constructor(authService, config, appRef, msalService, msalGuardConfig) {
486
+ this.authService = authService;
487
+ this.config = config;
488
+ this.appRef = appRef;
489
+ this.msalService = msalService;
490
+ this.msalGuardConfig = msalGuardConfig;
491
+ this._destroying$ = new Subject();
492
+ this.login = new EventEmitter();
493
+ this.options = this.config.getConfig('auth.microsoft') || {};
494
+ this.msalService.instance = new PublicClientApplication({
495
+ auth: this.options,
496
+ cache: {
497
+ cacheLocation: 'sessionStorage'
498
+ }
499
+ });
500
+ this.broadcastService = new MsalBroadcastService(this.msalService.instance, this.msalService);
501
+ if (this.options.clientId) {
502
+ this.broadcastService.inProgress$
503
+ .pipe(filter((status) => status === InteractionStatus.None), takeUntil(this._destroying$))
504
+ .subscribe(() => {
505
+ this.checkAccount();
506
+ });
507
+ }
508
+ else {
509
+ console.warn('Microsoft authentification needs "clientId" option');
510
+ }
511
+ }
512
+ loginMicrosoft() {
513
+ this.msalService.loginPopup({ ...this.getConf().authRequest })
514
+ .subscribe((response) => {
515
+ this.msalService.instance.setActiveAccount(response.account);
516
+ this.checkAccount();
517
+ });
518
+ }
519
+ checkAccount() {
520
+ this.msalService.instance
521
+ .acquireTokenSilent(this.getConf().authRequest)
522
+ .then((response) => {
523
+ const tokenAccess = response.accessToken;
524
+ const tokenId = response.idToken;
525
+ this.authService.loginWithToken(tokenAccess, 'microsoft', { tokenId }).subscribe(() => {
526
+ this.appRef.tick();
527
+ this.login.emit(true);
528
+ });
529
+ })
530
+ .catch(async (error) => {
531
+ if (error instanceof InteractionRequiredAuthError) {
532
+ // fallback to interaction when silent call fails
533
+ return this.msalService.acquireTokenPopup(this.getConf().authRequest);
534
+ }
535
+ console.log(error);
536
+ }).catch(error => {
537
+ console.log('Silent token fails');
538
+ });
539
+ }
540
+ getConf() {
541
+ return this.msalGuardConfig.filter(conf => conf.type === 'add')[0];
542
+ }
543
+ }
544
+ AuthMicrosoftComponent.ɵfac = function AuthMicrosoftComponent_Factory(t) { return new (t || AuthMicrosoftComponent)(i0.ɵɵdirectiveInject(AuthService), i0.ɵɵdirectiveInject(i2.ConfigService), i0.ɵɵdirectiveInject(i0.ApplicationRef), i0.ɵɵdirectiveInject(i3$2.MsalService), i0.ɵɵdirectiveInject(MSAL_GUARD_CONFIG)); };
545
+ AuthMicrosoftComponent.ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: AuthMicrosoftComponent, selectors: [["igo-auth-microsoft"]], outputs: { login: "login" }, decls: 4, vars: 3, consts: [["mat-raised-button", "", 1, "microsoft-login-button", 3, "click"], ["svgIcon", "microsoft"]], template: function AuthMicrosoftComponent_Template(rf, ctx) { if (rf & 1) {
546
+ i0.ɵɵelementStart(0, "button", 0);
547
+ i0.ɵɵlistener("click", function AuthMicrosoftComponent_Template_button_click_0_listener() { return ctx.loginMicrosoft(); });
548
+ i0.ɵɵelement(1, "mat-icon", 1);
549
+ i0.ɵɵtext(2);
550
+ i0.ɵɵpipe(3, "translate");
551
+ i0.ɵɵelementEnd();
552
+ } if (rf & 2) {
553
+ i0.ɵɵadvance(2);
554
+ i0.ɵɵtextInterpolate1(" ", i0.ɵɵpipeBind1(3, 1, "igo.auth.microsoft.login"), "\n");
555
+ } }, dependencies: [i4.MatIcon, i5$1.MatButton, i6$1.TranslatePipe], styles: ["[_nghost-%COMP%]{padding:10px 10px 10px 0;display:inline-block;position:relative;top:-15px}[_nghost-%COMP%] > button[_ngcontent-%COMP%]{font-size:15px;height:40px;width:265px}mat-icon[_ngcontent-%COMP%]{margin-right:10px}"], changeDetection: 0 });
556
+ (function () { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(AuthMicrosoftComponent, [{
557
+ type: Component,
558
+ args: [{ selector: 'igo-auth-microsoft', changeDetection: ChangeDetectionStrategy.OnPush, template: "<button class=\"microsoft-login-button\" mat-raised-button (click)=\"loginMicrosoft()\">\n <mat-icon svgIcon=\"microsoft\"></mat-icon>\n {{'igo.auth.microsoft.login' | translate}}\n</button>\n", styles: [":host{padding:10px 10px 10px 0;display:inline-block;position:relative;top:-15px}:host>button{font-size:15px;height:40px;width:265px}mat-icon{margin-right:10px}\n"] }]
559
+ }], function () { return [{ type: AuthService }, { type: i2.ConfigService }, { type: i0.ApplicationRef }, { type: i3$2.MsalService }, { type: undefined, decorators: [{
560
+ type: Inject,
561
+ args: [MSAL_GUARD_CONFIG]
562
+ }] }]; }, { login: [{
563
+ type: Output
564
564
  }] }); })();
565
565
 
566
- /*
567
- * Copyright (c) Microsoft Corporation. All rights reserved.
568
- * Licensed under the MIT License.
569
- */
570
- class MsalServiceb2c {
571
- constructor(instance, location) {
572
- this.instance = instance;
573
- this.location = location;
574
- this.name = '@azure/msal-angular';
575
- this.version = '2.0.0-beta.2';
576
- const hash = this.location.path(true).split('#').pop();
577
- if (hash) {
578
- this.redirectHash = `#${hash}`;
579
- }
580
- this.instance.initializeWrapperLibrary(WrapperSKU.Angular, this.version);
581
- }
582
- initialize() {
583
- return from(this.instance.initialize());
584
- }
585
- acquireTokenPopup(request) {
586
- return from(this.instance.acquireTokenPopup(request));
587
- }
588
- acquireTokenRedirect(request) {
589
- return from(this.instance.acquireTokenRedirect(request));
590
- }
591
- acquireTokenSilent(silentRequest) {
592
- return from(this.instance.acquireTokenSilent(silentRequest));
593
- }
594
- handleRedirectObservable(hash) {
595
- return from(this.instance.handleRedirectPromise(hash || this.redirectHash));
596
- }
597
- loginPopup(request) {
598
- return from(this.instance.loginPopup(request));
599
- }
600
- loginRedirect(request) {
601
- return from(this.instance.loginRedirect(request));
602
- }
603
- logout(logoutRequest) {
604
- return from(this.instance.logout(logoutRequest));
605
- }
606
- logoutRedirect(logoutRequest) {
607
- return from(this.instance.logoutRedirect(logoutRequest));
608
- }
609
- logoutPopup(logoutRequest) {
610
- return from(this.instance.logoutPopup(logoutRequest));
611
- }
612
- ssoSilent(request) {
613
- return from(this.instance.ssoSilent(request));
614
- }
615
- /**
616
- * Gets logger for msal-angular.
617
- * If no logger set, returns logger instance created with same options as msal-browser
618
- */
619
- getLogger() {
620
- if (!this.logger) {
621
- this.logger = this.instance.getLogger().clone(this.name, this.version);
622
- }
623
- return this.logger;
624
- }
625
- // Create a logger instance for msal-angular with the same options as msal-browser
626
- setLogger(logger) {
627
- this.logger = logger.clone(this.name, this.version);
628
- this.instance.setLogger(logger);
629
- }
630
- }
631
- MsalServiceb2c.ɵfac = function MsalServiceb2c_Factory(t) { return new (t || MsalServiceb2c)(i0.ɵɵinject(MSAL_INSTANCE), i0.ɵɵinject(i1$1.Location)); };
632
- MsalServiceb2c.ɵprov = /*@__PURE__*/ i0.ɵɵdefineInjectable({ token: MsalServiceb2c, factory: MsalServiceb2c.ɵfac });
633
- (function () { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(MsalServiceb2c, [{
634
- type: Injectable
635
- }], function () { return [{ type: undefined, decorators: [{
636
- type: Inject,
637
- args: [MSAL_INSTANCE]
566
+ /*
567
+ * Copyright (c) Microsoft Corporation. All rights reserved.
568
+ * Licensed under the MIT License.
569
+ */
570
+ class MsalServiceb2c {
571
+ constructor(instance, location) {
572
+ this.instance = instance;
573
+ this.location = location;
574
+ this.name = '@azure/msal-angular';
575
+ this.version = '2.0.0-beta.2';
576
+ const hash = this.location.path(true).split('#').pop();
577
+ if (hash) {
578
+ this.redirectHash = `#${hash}`;
579
+ }
580
+ this.instance.initializeWrapperLibrary(WrapperSKU.Angular, this.version);
581
+ }
582
+ initialize() {
583
+ return from(this.instance.initialize());
584
+ }
585
+ acquireTokenPopup(request) {
586
+ return from(this.instance.acquireTokenPopup(request));
587
+ }
588
+ acquireTokenRedirect(request) {
589
+ return from(this.instance.acquireTokenRedirect(request));
590
+ }
591
+ acquireTokenSilent(silentRequest) {
592
+ return from(this.instance.acquireTokenSilent(silentRequest));
593
+ }
594
+ handleRedirectObservable(hash) {
595
+ return from(this.instance.handleRedirectPromise(hash || this.redirectHash));
596
+ }
597
+ loginPopup(request) {
598
+ return from(this.instance.loginPopup(request));
599
+ }
600
+ loginRedirect(request) {
601
+ return from(this.instance.loginRedirect(request));
602
+ }
603
+ logout(logoutRequest) {
604
+ return from(this.instance.logout(logoutRequest));
605
+ }
606
+ logoutRedirect(logoutRequest) {
607
+ return from(this.instance.logoutRedirect(logoutRequest));
608
+ }
609
+ logoutPopup(logoutRequest) {
610
+ return from(this.instance.logoutPopup(logoutRequest));
611
+ }
612
+ ssoSilent(request) {
613
+ return from(this.instance.ssoSilent(request));
614
+ }
615
+ /**
616
+ * Gets logger for msal-angular.
617
+ * If no logger set, returns logger instance created with same options as msal-browser
618
+ */
619
+ getLogger() {
620
+ if (!this.logger) {
621
+ this.logger = this.instance.getLogger().clone(this.name, this.version);
622
+ }
623
+ return this.logger;
624
+ }
625
+ // Create a logger instance for msal-angular with the same options as msal-browser
626
+ setLogger(logger) {
627
+ this.logger = logger.clone(this.name, this.version);
628
+ this.instance.setLogger(logger);
629
+ }
630
+ }
631
+ MsalServiceb2c.ɵfac = function MsalServiceb2c_Factory(t) { return new (t || MsalServiceb2c)(i0.ɵɵinject(MSAL_INSTANCE), i0.ɵɵinject(i1$1.Location)); };
632
+ MsalServiceb2c.ɵprov = /*@__PURE__*/ i0.ɵɵdefineInjectable({ token: MsalServiceb2c, factory: MsalServiceb2c.ɵfac });
633
+ (function () { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(MsalServiceb2c, [{
634
+ type: Injectable
635
+ }], function () { return [{ type: undefined, decorators: [{
636
+ type: Inject,
637
+ args: [MSAL_INSTANCE]
638
638
  }] }, { type: i1$1.Location }]; }, null); })();
639
639
 
640
- /*
641
- * Copyright (c) Microsoft Corporation. All rights reserved.
642
- * Licensed under the MIT License.
643
- */
644
- class MsalBroadcastServiceb2c {
645
- constructor(msalInstance, authService) {
646
- this.msalInstance = msalInstance;
647
- this.authService = authService;
648
- this._msalSubject = new Subject();
649
- this.msalSubject$ = this._msalSubject.asObservable();
650
- // InProgress as BehaviorSubject so most recent inProgress state will be available upon subscription
651
- this._inProgress = new BehaviorSubject(InteractionStatus.Startup);
652
- this.inProgress$ = this._inProgress.asObservable();
653
- this.msalInstance.addEventCallback((message) => {
654
- this._msalSubject.next(message);
655
- const status = EventMessageUtils.getInteractionStatusFromEvent(message);
656
- if (status !== null) {
657
- this.authService.getLogger().verbose(`BroadcastService - ${message.eventType} results in setting inProgress to ${status}`);
658
- this._inProgress.next(status);
659
- }
660
- });
661
- }
662
- }
663
- MsalBroadcastServiceb2c.ɵfac = function MsalBroadcastServiceb2c_Factory(t) { return new (t || MsalBroadcastServiceb2c)(i0.ɵɵinject(MSAL_INSTANCE), i0.ɵɵinject(MsalServiceb2c)); };
664
- MsalBroadcastServiceb2c.ɵprov = /*@__PURE__*/ i0.ɵɵdefineInjectable({ token: MsalBroadcastServiceb2c, factory: MsalBroadcastServiceb2c.ɵfac });
665
- (function () { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(MsalBroadcastServiceb2c, [{
666
- type: Injectable
667
- }], function () { return [{ type: undefined, decorators: [{
668
- type: Inject,
669
- args: [MSAL_INSTANCE]
640
+ /*
641
+ * Copyright (c) Microsoft Corporation. All rights reserved.
642
+ * Licensed under the MIT License.
643
+ */
644
+ class MsalBroadcastServiceb2c {
645
+ constructor(msalInstance, authService) {
646
+ this.msalInstance = msalInstance;
647
+ this.authService = authService;
648
+ this._msalSubject = new Subject();
649
+ this.msalSubject$ = this._msalSubject.asObservable();
650
+ // InProgress as BehaviorSubject so most recent inProgress state will be available upon subscription
651
+ this._inProgress = new BehaviorSubject(InteractionStatus.Startup);
652
+ this.inProgress$ = this._inProgress.asObservable();
653
+ this.msalInstance.addEventCallback((message) => {
654
+ this._msalSubject.next(message);
655
+ const status = EventMessageUtils.getInteractionStatusFromEvent(message);
656
+ if (status !== null) {
657
+ this.authService.getLogger().verbose(`BroadcastService - ${message.eventType} results in setting inProgress to ${status}`);
658
+ this._inProgress.next(status);
659
+ }
660
+ });
661
+ }
662
+ }
663
+ MsalBroadcastServiceb2c.ɵfac = function MsalBroadcastServiceb2c_Factory(t) { return new (t || MsalBroadcastServiceb2c)(i0.ɵɵinject(MSAL_INSTANCE), i0.ɵɵinject(MsalServiceb2c)); };
664
+ MsalBroadcastServiceb2c.ɵprov = /*@__PURE__*/ i0.ɵɵdefineInjectable({ token: MsalBroadcastServiceb2c, factory: MsalBroadcastServiceb2c.ɵfac });
665
+ (function () { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(MsalBroadcastServiceb2c, [{
666
+ type: Injectable
667
+ }], function () { return [{ type: undefined, decorators: [{
668
+ type: Inject,
669
+ args: [MSAL_INSTANCE]
670
670
  }] }, { type: MsalServiceb2c }]; }, null); })();
671
671
 
672
- class AuthMicrosoftb2cComponent {
673
- constructor(authService, config, appRef, msalService, msalGuardConfig) {
674
- this.authService = authService;
675
- this.config = config;
676
- this.appRef = appRef;
677
- this.msalService = msalService;
678
- this.msalGuardConfig = msalGuardConfig;
679
- this._destroying$ = new Subject();
680
- this.login = new EventEmitter();
681
- this.options = this.config.getConfig('auth.microsoftb2c') || {};
682
- this.msalService.instance = new PublicClientApplication({
683
- auth: this.options.browserAuthOptions,
684
- cache: {
685
- cacheLocation: 'sessionStorage'
686
- }
687
- });
688
- this.broadcastService = new MsalBroadcastServiceb2c(this.msalService.instance, this.msalService);
689
- if (this.options.browserAuthOptions.clientId) {
690
- this.broadcastService.inProgress$
691
- .pipe(filter((status) => status === InteractionStatus.None), takeUntil(this._destroying$))
692
- .subscribe(() => {
693
- this.checkAccount();
694
- });
695
- }
696
- else {
697
- console.warn('Microsoft authentification needs "clientId" option');
698
- }
699
- }
700
- loginMicrosoftb2c() {
701
- this.msalService.loginPopup({ ...this.getConf().authRequest })
702
- .subscribe((response) => {
703
- this.msalService.instance.setActiveAccount(response.account);
704
- this.checkAccount();
705
- });
706
- }
707
- checkAccount() {
708
- this.msalService.instance
709
- .acquireTokenSilent(this.getConf().authRequest)
710
- .then((response) => {
711
- const token = response.idToken;
712
- this.authService.loginWithToken(token, 'microsoftb2c').subscribe(() => {
713
- this.appRef.tick();
714
- this.login.emit(true);
715
- });
716
- })
717
- .catch(async (error) => {
718
- if (error instanceof InteractionRequiredAuthError) {
719
- // fallback to interaction when silent call fails
720
- return this.msalService.acquireTokenPopup(this.getConf().authRequest);
721
- }
722
- }).catch(error => {
723
- console.log('Silent token fails');
724
- });
725
- }
726
- getConf() {
727
- return this.msalGuardConfig.filter(conf => conf.type === 'b2c')[0];
728
- }
729
- }
730
- AuthMicrosoftb2cComponent.ɵfac = function AuthMicrosoftb2cComponent_Factory(t) { return new (t || AuthMicrosoftb2cComponent)(i0.ɵɵdirectiveInject(AuthService), i0.ɵɵdirectiveInject(i2.ConfigService), i0.ɵɵdirectiveInject(i0.ApplicationRef), i0.ɵɵdirectiveInject(MsalServiceb2c), i0.ɵɵdirectiveInject(MSAL_GUARD_CONFIG)); };
731
- AuthMicrosoftb2cComponent.ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: AuthMicrosoftb2cComponent, selectors: [["igo-auth-microsoftb2c"]], outputs: { login: "login" }, decls: 4, vars: 3, consts: [["mat-raised-button", "", 1, "microsoft-login-button", 3, "click"], ["svgIcon", "microsoft"]], template: function AuthMicrosoftb2cComponent_Template(rf, ctx) { if (rf & 1) {
732
- i0.ɵɵelementStart(0, "button", 0);
733
- i0.ɵɵlistener("click", function AuthMicrosoftb2cComponent_Template_button_click_0_listener() { return ctx.loginMicrosoftb2c(); });
734
- i0.ɵɵelement(1, "mat-icon", 1);
735
- i0.ɵɵtext(2);
736
- i0.ɵɵpipe(3, "translate");
737
- i0.ɵɵelementEnd();
738
- } if (rf & 2) {
739
- i0.ɵɵadvance(2);
740
- i0.ɵɵtextInterpolate1(" ", i0.ɵɵpipeBind1(3, 1, "igo.auth.microsoftb2c.login"), "\n");
741
- } }, dependencies: [i4.MatIcon, i5$1.MatButton, i6$1.TranslatePipe], styles: ["[_nghost-%COMP%]{padding:10px 10px 10px 0;display:inline-block;position:relative;top:-15px}[_nghost-%COMP%] > button[_ngcontent-%COMP%]{font-size:15px;height:40px;width:265px}mat-icon[_ngcontent-%COMP%]{margin-right:10px}"], changeDetection: 0 });
742
- (function () { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(AuthMicrosoftb2cComponent, [{
743
- type: Component,
744
- args: [{ selector: 'igo-auth-microsoftb2c', changeDetection: ChangeDetectionStrategy.OnPush, template: "<button class=\"microsoft-login-button\" mat-raised-button (click)=\"loginMicrosoftb2c()\">\n <mat-icon svgIcon=\"microsoft\"></mat-icon>\n {{'igo.auth.microsoftb2c.login' | translate}}\n</button>\n", styles: [":host{padding:10px 10px 10px 0;display:inline-block;position:relative;top:-15px}:host>button{font-size:15px;height:40px;width:265px}mat-icon{margin-right:10px}\n"] }]
745
- }], function () { return [{ type: AuthService }, { type: i2.ConfigService }, { type: i0.ApplicationRef }, { type: MsalServiceb2c }, { type: undefined, decorators: [{
746
- type: Inject,
747
- args: [MSAL_GUARD_CONFIG]
748
- }] }]; }, { login: [{
749
- type: Output
672
+ class AuthMicrosoftb2cComponent {
673
+ constructor(authService, config, appRef, msalService, msalGuardConfig) {
674
+ this.authService = authService;
675
+ this.config = config;
676
+ this.appRef = appRef;
677
+ this.msalService = msalService;
678
+ this.msalGuardConfig = msalGuardConfig;
679
+ this._destroying$ = new Subject();
680
+ this.login = new EventEmitter();
681
+ this.options = this.config.getConfig('auth.microsoftb2c') || {};
682
+ this.msalService.instance = new PublicClientApplication({
683
+ auth: this.options.browserAuthOptions,
684
+ cache: {
685
+ cacheLocation: 'sessionStorage'
686
+ }
687
+ });
688
+ this.broadcastService = new MsalBroadcastServiceb2c(this.msalService.instance, this.msalService);
689
+ if (this.options.browserAuthOptions.clientId) {
690
+ this.broadcastService.inProgress$
691
+ .pipe(filter((status) => status === InteractionStatus.None), takeUntil(this._destroying$))
692
+ .subscribe(() => {
693
+ this.checkAccount();
694
+ });
695
+ }
696
+ else {
697
+ console.warn('Microsoft authentification needs "clientId" option');
698
+ }
699
+ }
700
+ loginMicrosoftb2c() {
701
+ this.msalService.loginPopup({ ...this.getConf().authRequest })
702
+ .subscribe((response) => {
703
+ this.msalService.instance.setActiveAccount(response.account);
704
+ this.checkAccount();
705
+ });
706
+ }
707
+ checkAccount() {
708
+ this.msalService.instance
709
+ .acquireTokenSilent(this.getConf().authRequest)
710
+ .then((response) => {
711
+ const token = response.idToken;
712
+ this.authService.loginWithToken(token, 'microsoftb2c').subscribe(() => {
713
+ this.appRef.tick();
714
+ this.login.emit(true);
715
+ });
716
+ })
717
+ .catch(async (error) => {
718
+ if (error instanceof InteractionRequiredAuthError) {
719
+ // fallback to interaction when silent call fails
720
+ return this.msalService.acquireTokenPopup(this.getConf().authRequest);
721
+ }
722
+ }).catch(error => {
723
+ console.log('Silent token fails');
724
+ });
725
+ }
726
+ getConf() {
727
+ return this.msalGuardConfig.filter(conf => conf.type === 'b2c')[0];
728
+ }
729
+ }
730
+ AuthMicrosoftb2cComponent.ɵfac = function AuthMicrosoftb2cComponent_Factory(t) { return new (t || AuthMicrosoftb2cComponent)(i0.ɵɵdirectiveInject(AuthService), i0.ɵɵdirectiveInject(i2.ConfigService), i0.ɵɵdirectiveInject(i0.ApplicationRef), i0.ɵɵdirectiveInject(MsalServiceb2c), i0.ɵɵdirectiveInject(MSAL_GUARD_CONFIG)); };
731
+ AuthMicrosoftb2cComponent.ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: AuthMicrosoftb2cComponent, selectors: [["igo-auth-microsoftb2c"]], outputs: { login: "login" }, decls: 4, vars: 3, consts: [["mat-raised-button", "", 1, "microsoft-login-button", 3, "click"], ["svgIcon", "microsoft"]], template: function AuthMicrosoftb2cComponent_Template(rf, ctx) { if (rf & 1) {
732
+ i0.ɵɵelementStart(0, "button", 0);
733
+ i0.ɵɵlistener("click", function AuthMicrosoftb2cComponent_Template_button_click_0_listener() { return ctx.loginMicrosoftb2c(); });
734
+ i0.ɵɵelement(1, "mat-icon", 1);
735
+ i0.ɵɵtext(2);
736
+ i0.ɵɵpipe(3, "translate");
737
+ i0.ɵɵelementEnd();
738
+ } if (rf & 2) {
739
+ i0.ɵɵadvance(2);
740
+ i0.ɵɵtextInterpolate1(" ", i0.ɵɵpipeBind1(3, 1, "igo.auth.microsoftb2c.login"), "\n");
741
+ } }, dependencies: [i4.MatIcon, i5$1.MatButton, i6$1.TranslatePipe], styles: ["[_nghost-%COMP%]{padding:10px 10px 10px 0;display:inline-block;position:relative;top:-15px}[_nghost-%COMP%] > button[_ngcontent-%COMP%]{font-size:15px;height:40px;width:265px}mat-icon[_ngcontent-%COMP%]{margin-right:10px}"], changeDetection: 0 });
742
+ (function () { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(AuthMicrosoftb2cComponent, [{
743
+ type: Component,
744
+ args: [{ selector: 'igo-auth-microsoftb2c', changeDetection: ChangeDetectionStrategy.OnPush, template: "<button class=\"microsoft-login-button\" mat-raised-button (click)=\"loginMicrosoftb2c()\">\n <mat-icon svgIcon=\"microsoft\"></mat-icon>\n {{'igo.auth.microsoftb2c.login' | translate}}\n</button>\n", styles: [":host{padding:10px 10px 10px 0;display:inline-block;position:relative;top:-15px}:host>button{font-size:15px;height:40px;width:265px}mat-icon{margin-right:10px}\n"] }]
745
+ }], function () { return [{ type: AuthService }, { type: i2.ConfigService }, { type: i0.ApplicationRef }, { type: MsalServiceb2c }, { type: undefined, decorators: [{
746
+ type: Inject,
747
+ args: [MSAL_GUARD_CONFIG]
748
+ }] }]; }, { login: [{
749
+ type: Output
750
750
  }] }); })();
751
751
 
752
- function AuthFormComponent_div_0_div_1_Template(rf, ctx) { if (rf & 1) {
753
- i0.ɵɵelement(0, "div", 3);
754
- } }
755
- function AuthFormComponent_div_0_div_2_igo_auth_google_4_Template(rf, ctx) { if (rf & 1) {
756
- const _r11 = i0.ɵɵgetCurrentView();
757
- i0.ɵɵelementStart(0, "igo-auth-google", 7);
758
- i0.ɵɵlistener("login", function AuthFormComponent_div_0_div_2_igo_auth_google_4_Template_igo_auth_google_login_0_listener() { i0.ɵɵrestoreView(_r11); const ctx_r10 = i0.ɵɵnextContext(3); return i0.ɵɵresetView(ctx_r10.onLogin()); });
759
- i0.ɵɵelementEnd();
760
- } }
761
- function AuthFormComponent_div_0_div_2_igo_auth_microsoft_5_Template(rf, ctx) { if (rf & 1) {
762
- const _r13 = i0.ɵɵgetCurrentView();
763
- i0.ɵɵelementStart(0, "igo-auth-microsoft", 7);
764
- i0.ɵɵlistener("login", function AuthFormComponent_div_0_div_2_igo_auth_microsoft_5_Template_igo_auth_microsoft_login_0_listener() { i0.ɵɵrestoreView(_r13); const ctx_r12 = i0.ɵɵnextContext(3); return i0.ɵɵresetView(ctx_r12.onLogin()); });
765
- i0.ɵɵelementEnd();
766
- } }
767
- function AuthFormComponent_div_0_div_2_igo_auth_microsoftb2c_6_Template(rf, ctx) { if (rf & 1) {
768
- const _r15 = i0.ɵɵgetCurrentView();
769
- i0.ɵɵelementStart(0, "igo-auth-microsoftb2c", 7);
770
- i0.ɵɵlistener("login", function AuthFormComponent_div_0_div_2_igo_auth_microsoftb2c_6_Template_igo_auth_microsoftb2c_login_0_listener() { i0.ɵɵrestoreView(_r15); const ctx_r14 = i0.ɵɵnextContext(3); return i0.ɵɵresetView(ctx_r14.onLogin()); });
771
- i0.ɵɵelementEnd();
772
- } }
773
- function AuthFormComponent_div_0_div_2_igo_auth_facebook_7_Template(rf, ctx) { if (rf & 1) {
774
- const _r17 = i0.ɵɵgetCurrentView();
775
- i0.ɵɵelementStart(0, "igo-auth-facebook", 7);
776
- i0.ɵɵlistener("login", function AuthFormComponent_div_0_div_2_igo_auth_facebook_7_Template_igo_auth_facebook_login_0_listener() { i0.ɵɵrestoreView(_r17); const ctx_r16 = i0.ɵɵnextContext(3); return i0.ɵɵresetView(ctx_r16.onLogin()); });
777
- i0.ɵɵelementEnd();
778
- } }
779
- function AuthFormComponent_div_0_div_2_igo_auth_intern_8_Template(rf, ctx) { if (rf & 1) {
780
- const _r19 = i0.ɵɵgetCurrentView();
781
- i0.ɵɵelementStart(0, "igo-auth-intern", 8);
782
- i0.ɵɵlistener("login", function AuthFormComponent_div_0_div_2_igo_auth_intern_8_Template_igo_auth_intern_login_0_listener() { i0.ɵɵrestoreView(_r19); const ctx_r18 = i0.ɵɵnextContext(3); return i0.ɵɵresetView(ctx_r18.onLogin()); });
783
- i0.ɵɵelementEnd();
784
- } if (rf & 2) {
785
- const ctx_r9 = i0.ɵɵnextContext(3);
786
- i0.ɵɵproperty("allowAnonymous", ctx_r9.options.allowAnonymous);
787
- } }
788
- function AuthFormComponent_div_0_div_2_Template(rf, ctx) { if (rf & 1) {
789
- i0.ɵɵelementStart(0, "div", 4)(1, "h1");
790
- i0.ɵɵtext(2);
791
- i0.ɵɵpipe(3, "translate");
792
- i0.ɵɵelementEnd();
793
- i0.ɵɵtemplate(4, AuthFormComponent_div_0_div_2_igo_auth_google_4_Template, 1, 0, "igo-auth-google", 5);
794
- i0.ɵɵtemplate(5, AuthFormComponent_div_0_div_2_igo_auth_microsoft_5_Template, 1, 0, "igo-auth-microsoft", 5);
795
- i0.ɵɵtemplate(6, AuthFormComponent_div_0_div_2_igo_auth_microsoftb2c_6_Template, 1, 0, "igo-auth-microsoftb2c", 5);
796
- i0.ɵɵtemplate(7, AuthFormComponent_div_0_div_2_igo_auth_facebook_7_Template, 1, 0, "igo-auth-facebook", 5);
797
- i0.ɵɵtemplate(8, AuthFormComponent_div_0_div_2_igo_auth_intern_8_Template, 1, 1, "igo-auth-intern", 6);
798
- i0.ɵɵelementEnd();
799
- } if (rf & 2) {
800
- const ctx_r2 = i0.ɵɵnextContext(2);
801
- i0.ɵɵadvance(2);
802
- i0.ɵɵtextInterpolate(i0.ɵɵpipeBind1(3, 6, "igo.auth.connection"));
803
- i0.ɵɵadvance(2);
804
- i0.ɵɵproperty("ngIf", ctx_r2.options.google && ctx_r2.options.google.enabled !== false);
805
- i0.ɵɵadvance(1);
806
- i0.ɵɵproperty("ngIf", ctx_r2.options.microsoft && ctx_r2.options.microsoft.enabled !== false);
807
- i0.ɵɵadvance(1);
808
- i0.ɵɵproperty("ngIf", ctx_r2.options.microsoftb2c && ctx_r2.options.microsoftb2c.enabled !== false);
809
- i0.ɵɵadvance(1);
810
- i0.ɵɵproperty("ngIf", ctx_r2.options.facebook && ctx_r2.options.facebook.enabled !== false);
811
- i0.ɵɵadvance(1);
812
- i0.ɵɵproperty("ngIf", !ctx_r2.options.intern || ctx_r2.options.intern.enabled !== false);
813
- } }
814
- function AuthFormComponent_div_0_div_3_Template(rf, ctx) { if (rf & 1) {
815
- const _r21 = i0.ɵɵgetCurrentView();
816
- i0.ɵɵelementStart(0, "div", 4)(1, "p");
817
- i0.ɵɵtext(2);
818
- i0.ɵɵpipe(3, "translate");
819
- i0.ɵɵelementEnd();
820
- i0.ɵɵelementStart(4, "button", 9);
821
- i0.ɵɵlistener("click", function AuthFormComponent_div_0_div_3_Template_button_click_4_listener() { i0.ɵɵrestoreView(_r21); const ctx_r20 = i0.ɵɵnextContext(2); return i0.ɵɵresetView(ctx_r20.logout()); });
822
- i0.ɵɵtext(5);
823
- i0.ɵɵpipe(6, "translate");
824
- i0.ɵɵelementEnd()();
825
- } if (rf & 2) {
826
- const ctx_r3 = i0.ɵɵnextContext(2);
827
- i0.ɵɵadvance(2);
828
- i0.ɵɵtextInterpolate(i0.ɵɵpipeBind2(3, 2, "igo.auth.welcome", ctx_r3.user));
829
- i0.ɵɵadvance(3);
830
- i0.ɵɵtextInterpolate(i0.ɵɵpipeBind1(6, 5, "igo.auth.signOut"));
831
- } }
832
- function AuthFormComponent_div_0_div_4_button_4_Template(rf, ctx) { if (rf & 1) {
833
- const _r24 = i0.ɵɵgetCurrentView();
834
- i0.ɵɵelementStart(0, "button", 9);
835
- i0.ɵɵlistener("click", function AuthFormComponent_div_0_div_4_button_4_Template_button_click_0_listener() { i0.ɵɵrestoreView(_r24); const ctx_r23 = i0.ɵɵnextContext(3); return i0.ɵɵresetView(ctx_r23.home()); });
836
- i0.ɵɵtext(1);
837
- i0.ɵɵpipe(2, "translate");
838
- i0.ɵɵelementEnd();
839
- } if (rf & 2) {
840
- i0.ɵɵadvance(1);
841
- i0.ɵɵtextInterpolate(i0.ɵɵpipeBind1(2, 1, "igo.auth.home"));
842
- } }
843
- function AuthFormComponent_div_0_div_4_Template(rf, ctx) { if (rf & 1) {
844
- i0.ɵɵelementStart(0, "div", 4)(1, "p");
845
- i0.ɵɵtext(2);
846
- i0.ɵɵpipe(3, "translate");
847
- i0.ɵɵelementEnd();
848
- i0.ɵɵtemplate(4, AuthFormComponent_div_0_div_4_button_4_Template, 3, 3, "button", 10);
849
- i0.ɵɵelementEnd();
850
- } if (rf & 2) {
851
- const ctx_r4 = i0.ɵɵnextContext(2);
852
- i0.ɵɵadvance(2);
853
- i0.ɵɵtextInterpolate(i0.ɵɵpipeBind1(3, 2, "igo.auth.deconnection"));
854
- i0.ɵɵadvance(2);
855
- i0.ɵɵproperty("ngIf", ctx_r4.options.homeRoute);
856
- } }
857
- function AuthFormComponent_div_0_Template(rf, ctx) { if (rf & 1) {
858
- i0.ɵɵelementStart(0, "div");
859
- i0.ɵɵtemplate(1, AuthFormComponent_div_0_div_1_Template, 1, 0, "div", 1);
860
- i0.ɵɵtemplate(2, AuthFormComponent_div_0_div_2_Template, 9, 8, "div", 2);
861
- i0.ɵɵtemplate(3, AuthFormComponent_div_0_div_3_Template, 7, 7, "div", 2);
862
- i0.ɵɵtemplate(4, AuthFormComponent_div_0_div_4_Template, 5, 4, "div", 2);
863
- i0.ɵɵelementEnd();
864
- } if (rf & 2) {
865
- const ctx_r0 = i0.ɵɵnextContext();
866
- i0.ɵɵadvance(1);
867
- i0.ɵɵproperty("ngIf", !ctx_r0.auth.logged && ctx_r0.backgroundDisable);
868
- i0.ɵɵadvance(1);
869
- i0.ɵɵproperty("ngIf", !ctx_r0.auth.logged && ctx_r0.showLoginDiv);
870
- i0.ɵɵadvance(1);
871
- i0.ɵɵproperty("ngIf", ctx_r0.auth.logged && ctx_r0.showAlreadyConnectedDiv);
872
- i0.ɵɵadvance(1);
873
- i0.ɵɵproperty("ngIf", ctx_r0.showLogoutDiv);
874
- } }
875
- class AuthFormComponent {
876
- constructor(auth, config, router) {
877
- this.auth = auth;
878
- this.config = config;
879
- this.router = router;
880
- this._backgroundDisable = true;
881
- this._hasAlreadyConnectedDiv = true;
882
- this._hasLogoutDiv = true;
883
- this._showAlreadyConnectedDiv = false;
884
- this._showLogoutDiv = false;
885
- this.login = new EventEmitter();
886
- this.visible = true;
887
- this.options = this.config.getConfig('auth') || {};
888
- this.visible = Object.getOwnPropertyNames(this.options).length !== 0;
889
- }
890
- get backgroundDisable() {
891
- if (this.isLogoutRoute || this.isLogoutRoute) {
892
- return false;
893
- }
894
- return this._backgroundDisable;
895
- }
896
- set backgroundDisable(value) {
897
- this._backgroundDisable = value.toString() === 'true';
898
- }
899
- get hasAlreadyConnectedDiv() {
900
- return this._hasAlreadyConnectedDiv;
901
- }
902
- set hasAlreadyConnectedDiv(value) {
903
- this._hasAlreadyConnectedDiv = value.toString() === 'true';
904
- }
905
- get hasLogoutDiv() {
906
- return this._hasLogoutDiv;
907
- }
908
- set hasLogoutDiv(value) {
909
- this._hasLogoutDiv = value.toString() === 'true';
910
- }
911
- get showAlreadyConnectedDiv() {
912
- if (this.isLogoutRoute) {
913
- return this.hasAlreadyConnectedDiv;
914
- }
915
- return this._showAlreadyConnectedDiv;
916
- }
917
- set showAlreadyConnectedDiv(value) {
918
- this._showAlreadyConnectedDiv = value.toString() === 'true';
919
- }
920
- get showLogoutDiv() {
921
- if (this.isLogoutRoute) {
922
- return this.hasLogoutDiv;
923
- }
924
- return this._showLogoutDiv;
925
- }
926
- set showLogoutDiv(value) {
927
- this._showLogoutDiv = value.toString() === 'true';
928
- }
929
- get showLoginDiv() {
930
- if (!this.isLogoutRoute) {
931
- return true;
932
- }
933
- }
934
- ngOnInit() {
935
- this.analyzeRoute();
936
- this.getName();
937
- }
938
- onLogin() {
939
- this.auth.goToRedirectUrl();
940
- this.getName();
941
- this.login.emit(true);
942
- }
943
- logout() {
944
- this.auth.logout().subscribe(() => {
945
- this.user = undefined;
946
- if (this.router) {
947
- if (this.options.logoutRoute) {
948
- this.router.navigate([this.options.logoutRoute]);
949
- }
950
- else if (this.options.homeRoute) {
951
- this.router.navigate([this.options.homeRoute]);
952
- }
953
- }
954
- });
955
- }
956
- home() {
957
- if (this.router && this.options.homeRoute) {
958
- this.router.navigate([this.options.homeRoute]);
959
- }
960
- }
961
- getName() {
962
- const tokenDecoded = this.auth.decodeToken();
963
- if (tokenDecoded) {
964
- this.user = {
965
- name: tokenDecoded.user.firstName || tokenDecoded.user.sourceId
966
- };
967
- }
968
- }
969
- analyzeRoute() {
970
- if (!this.router) {
971
- return;
972
- }
973
- this.router.events
974
- .pipe(filter((event) => event instanceof NavigationStart))
975
- .subscribe((changeEvent) => {
976
- if (changeEvent.url) {
977
- const currentRoute = changeEvent.url;
978
- const logoutRoute = this.options.logoutRoute;
979
- const loginRoute = this.options.loginRoute;
980
- this.isLogoutRoute = currentRoute === logoutRoute;
981
- this.isLoginRoute = currentRoute === loginRoute;
982
- if (this.isLogoutRoute) {
983
- this.auth.logout();
984
- }
985
- }
986
- });
987
- }
988
- }
989
- AuthFormComponent.ɵfac = function AuthFormComponent_Factory(t) { return new (t || AuthFormComponent)(i0.ɵɵdirectiveInject(AuthService), i0.ɵɵdirectiveInject(i2.ConfigService), i0.ɵɵdirectiveInject(i3.Router, 8)); };
990
- AuthFormComponent.ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: AuthFormComponent, selectors: [["igo-auth-form"]], inputs: { backgroundDisable: "backgroundDisable", hasAlreadyConnectedDiv: "hasAlreadyConnectedDiv", hasLogoutDiv: "hasLogoutDiv", showAlreadyConnectedDiv: "showAlreadyConnectedDiv", showLogoutDiv: "showLogoutDiv" }, outputs: { login: "login" }, decls: 1, vars: 1, consts: [[4, "ngIf"], ["class", "backgroundDisable", 4, "ngIf"], ["class", "login center-block", 4, "ngIf"], [1, "backgroundDisable"], [1, "login", "center-block"], [3, "login", 4, "ngIf"], [3, "allowAnonymous", "login", 4, "ngIf"], [3, "login"], [3, "allowAnonymous", "login"], ["mat-raised-button", "", "type", "button", 3, "click"], ["mat-raised-button", "", "type", "button", 3, "click", 4, "ngIf"]], template: function AuthFormComponent_Template(rf, ctx) { if (rf & 1) {
991
- i0.ɵɵtemplate(0, AuthFormComponent_div_0_Template, 5, 4, "div", 0);
992
- } if (rf & 2) {
993
- i0.ɵɵproperty("ngIf", ctx.visible);
994
- } }, dependencies: [i1$1.NgIf, i5$1.MatButton, AuthGoogleComponent, AuthInternComponent, AuthFacebookComponent, AuthMicrosoftComponent, AuthMicrosoftb2cComponent, i6$1.TranslatePipe], styles: ["[_nghost-%COMP%]{z-index:999}div.login[_ngcontent-%COMP%]{z-index:200;width:90%;min-width:360px;max-width:600px;padding:25px 50px;border:1px solid;background-color:#fff;border-color:#888}.center-block[_ngcontent-%COMP%]{position:fixed;top:20%;left:50%;transform:translate(-50%)}.backgroundDisable[_ngcontent-%COMP%]{position:fixed;top:0;left:0;background:#000;opacity:.8;z-index:100;height:100%;width:100%}"] });
995
- (function () { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(AuthFormComponent, [{
996
- type: Component,
997
- args: [{ selector: 'igo-auth-form', changeDetection: ChangeDetectionStrategy.Default, template: "<div *ngIf=\"visible\">\n <div *ngIf=\"!auth.logged && backgroundDisable\" class=\"backgroundDisable\"></div>\n\n <div *ngIf=\"!auth.logged && showLoginDiv\" class=\"login center-block\">\n <h1>{{'igo.auth.connection' | translate}}</h1>\n\n <igo-auth-google\n *ngIf=\"options.google && options.google.enabled !== false\"\n (login)=\"onLogin()\">\n </igo-auth-google>\n <igo-auth-microsoft\n *ngIf=\"options.microsoft && options.microsoft.enabled !== false\"\n (login)=\"onLogin()\">\n </igo-auth-microsoft>\n <igo-auth-microsoftb2c\n *ngIf=\"options.microsoftb2c && options.microsoftb2c.enabled !== false\"\n (login)=\"onLogin()\">\n </igo-auth-microsoftb2c>\n <igo-auth-facebook\n *ngIf=\"options.facebook && options.facebook.enabled !== false\"\n (login)=\"onLogin()\">\n </igo-auth-facebook>\n <igo-auth-intern\n *ngIf=\"!options.intern || options.intern.enabled !== false\"\n [allowAnonymous]=\"options.allowAnonymous\"\n (login)=\"onLogin()\">\n </igo-auth-intern>\n </div>\n\n <div *ngIf=\"auth.logged && showAlreadyConnectedDiv\" class=\"login center-block\">\n <p>{{'igo.auth.welcome' |\u00A0translate: user}}</p>\n <button mat-raised-button type=\"button\" (click)=\"logout()\">{{'igo.auth.signOut' |\u00A0translate}}</button>\n </div>\n\n <div *ngIf=\"showLogoutDiv\" class=\"login center-block\">\n <p>{{'igo.auth.deconnection' |\u00A0translate}}</p>\n <button *ngIf=\"options.homeRoute\" mat-raised-button type=\"button\" (click)=\"home()\">{{'igo.auth.home' |\u00A0translate}}</button>\n </div>\n\n</div>\n", styles: [":host{z-index:999}div.login{z-index:200;width:90%;min-width:360px;max-width:600px;padding:25px 50px;border:1px solid;background-color:#fff;border-color:#888}.center-block{position:fixed;top:20%;left:50%;transform:translate(-50%)}.backgroundDisable{position:fixed;top:0;left:0;background:#000;opacity:.8;z-index:100;height:100%;width:100%}\n"] }]
998
- }], function () { return [{ type: AuthService }, { type: i2.ConfigService }, { type: i3.Router, decorators: [{
999
- type: Optional
1000
- }] }]; }, { backgroundDisable: [{
1001
- type: Input
1002
- }], hasAlreadyConnectedDiv: [{
1003
- type: Input
1004
- }], hasLogoutDiv: [{
1005
- type: Input
1006
- }], showAlreadyConnectedDiv: [{
1007
- type: Input
1008
- }], showLogoutDiv: [{
1009
- type: Input
1010
- }], login: [{
1011
- type: Output
752
+ function AuthFormComponent_div_0_div_1_Template(rf, ctx) { if (rf & 1) {
753
+ i0.ɵɵelement(0, "div", 3);
754
+ } }
755
+ function AuthFormComponent_div_0_div_2_igo_auth_google_4_Template(rf, ctx) { if (rf & 1) {
756
+ const _r11 = i0.ɵɵgetCurrentView();
757
+ i0.ɵɵelementStart(0, "igo-auth-google", 7);
758
+ i0.ɵɵlistener("login", function AuthFormComponent_div_0_div_2_igo_auth_google_4_Template_igo_auth_google_login_0_listener() { i0.ɵɵrestoreView(_r11); const ctx_r10 = i0.ɵɵnextContext(3); return i0.ɵɵresetView(ctx_r10.onLogin()); });
759
+ i0.ɵɵelementEnd();
760
+ } }
761
+ function AuthFormComponent_div_0_div_2_igo_auth_microsoft_5_Template(rf, ctx) { if (rf & 1) {
762
+ const _r13 = i0.ɵɵgetCurrentView();
763
+ i0.ɵɵelementStart(0, "igo-auth-microsoft", 7);
764
+ i0.ɵɵlistener("login", function AuthFormComponent_div_0_div_2_igo_auth_microsoft_5_Template_igo_auth_microsoft_login_0_listener() { i0.ɵɵrestoreView(_r13); const ctx_r12 = i0.ɵɵnextContext(3); return i0.ɵɵresetView(ctx_r12.onLogin()); });
765
+ i0.ɵɵelementEnd();
766
+ } }
767
+ function AuthFormComponent_div_0_div_2_igo_auth_microsoftb2c_6_Template(rf, ctx) { if (rf & 1) {
768
+ const _r15 = i0.ɵɵgetCurrentView();
769
+ i0.ɵɵelementStart(0, "igo-auth-microsoftb2c", 7);
770
+ i0.ɵɵlistener("login", function AuthFormComponent_div_0_div_2_igo_auth_microsoftb2c_6_Template_igo_auth_microsoftb2c_login_0_listener() { i0.ɵɵrestoreView(_r15); const ctx_r14 = i0.ɵɵnextContext(3); return i0.ɵɵresetView(ctx_r14.onLogin()); });
771
+ i0.ɵɵelementEnd();
772
+ } }
773
+ function AuthFormComponent_div_0_div_2_igo_auth_facebook_7_Template(rf, ctx) { if (rf & 1) {
774
+ const _r17 = i0.ɵɵgetCurrentView();
775
+ i0.ɵɵelementStart(0, "igo-auth-facebook", 7);
776
+ i0.ɵɵlistener("login", function AuthFormComponent_div_0_div_2_igo_auth_facebook_7_Template_igo_auth_facebook_login_0_listener() { i0.ɵɵrestoreView(_r17); const ctx_r16 = i0.ɵɵnextContext(3); return i0.ɵɵresetView(ctx_r16.onLogin()); });
777
+ i0.ɵɵelementEnd();
778
+ } }
779
+ function AuthFormComponent_div_0_div_2_igo_auth_intern_8_Template(rf, ctx) { if (rf & 1) {
780
+ const _r19 = i0.ɵɵgetCurrentView();
781
+ i0.ɵɵelementStart(0, "igo-auth-intern", 8);
782
+ i0.ɵɵlistener("login", function AuthFormComponent_div_0_div_2_igo_auth_intern_8_Template_igo_auth_intern_login_0_listener() { i0.ɵɵrestoreView(_r19); const ctx_r18 = i0.ɵɵnextContext(3); return i0.ɵɵresetView(ctx_r18.onLogin()); });
783
+ i0.ɵɵelementEnd();
784
+ } if (rf & 2) {
785
+ const ctx_r9 = i0.ɵɵnextContext(3);
786
+ i0.ɵɵproperty("allowAnonymous", ctx_r9.options.allowAnonymous);
787
+ } }
788
+ function AuthFormComponent_div_0_div_2_Template(rf, ctx) { if (rf & 1) {
789
+ i0.ɵɵelementStart(0, "div", 4)(1, "h1");
790
+ i0.ɵɵtext(2);
791
+ i0.ɵɵpipe(3, "translate");
792
+ i0.ɵɵelementEnd();
793
+ i0.ɵɵtemplate(4, AuthFormComponent_div_0_div_2_igo_auth_google_4_Template, 1, 0, "igo-auth-google", 5);
794
+ i0.ɵɵtemplate(5, AuthFormComponent_div_0_div_2_igo_auth_microsoft_5_Template, 1, 0, "igo-auth-microsoft", 5);
795
+ i0.ɵɵtemplate(6, AuthFormComponent_div_0_div_2_igo_auth_microsoftb2c_6_Template, 1, 0, "igo-auth-microsoftb2c", 5);
796
+ i0.ɵɵtemplate(7, AuthFormComponent_div_0_div_2_igo_auth_facebook_7_Template, 1, 0, "igo-auth-facebook", 5);
797
+ i0.ɵɵtemplate(8, AuthFormComponent_div_0_div_2_igo_auth_intern_8_Template, 1, 1, "igo-auth-intern", 6);
798
+ i0.ɵɵelementEnd();
799
+ } if (rf & 2) {
800
+ const ctx_r2 = i0.ɵɵnextContext(2);
801
+ i0.ɵɵadvance(2);
802
+ i0.ɵɵtextInterpolate(i0.ɵɵpipeBind1(3, 6, "igo.auth.connection"));
803
+ i0.ɵɵadvance(2);
804
+ i0.ɵɵproperty("ngIf", ctx_r2.options.google && ctx_r2.options.google.enabled !== false);
805
+ i0.ɵɵadvance(1);
806
+ i0.ɵɵproperty("ngIf", ctx_r2.options.microsoft && ctx_r2.options.microsoft.enabled !== false);
807
+ i0.ɵɵadvance(1);
808
+ i0.ɵɵproperty("ngIf", ctx_r2.options.microsoftb2c && ctx_r2.options.microsoftb2c.enabled !== false);
809
+ i0.ɵɵadvance(1);
810
+ i0.ɵɵproperty("ngIf", ctx_r2.options.facebook && ctx_r2.options.facebook.enabled !== false);
811
+ i0.ɵɵadvance(1);
812
+ i0.ɵɵproperty("ngIf", !ctx_r2.options.intern || ctx_r2.options.intern.enabled !== false);
813
+ } }
814
+ function AuthFormComponent_div_0_div_3_Template(rf, ctx) { if (rf & 1) {
815
+ const _r21 = i0.ɵɵgetCurrentView();
816
+ i0.ɵɵelementStart(0, "div", 4)(1, "p");
817
+ i0.ɵɵtext(2);
818
+ i0.ɵɵpipe(3, "translate");
819
+ i0.ɵɵelementEnd();
820
+ i0.ɵɵelementStart(4, "button", 9);
821
+ i0.ɵɵlistener("click", function AuthFormComponent_div_0_div_3_Template_button_click_4_listener() { i0.ɵɵrestoreView(_r21); const ctx_r20 = i0.ɵɵnextContext(2); return i0.ɵɵresetView(ctx_r20.logout()); });
822
+ i0.ɵɵtext(5);
823
+ i0.ɵɵpipe(6, "translate");
824
+ i0.ɵɵelementEnd()();
825
+ } if (rf & 2) {
826
+ const ctx_r3 = i0.ɵɵnextContext(2);
827
+ i0.ɵɵadvance(2);
828
+ i0.ɵɵtextInterpolate(i0.ɵɵpipeBind2(3, 2, "igo.auth.welcome", ctx_r3.user));
829
+ i0.ɵɵadvance(3);
830
+ i0.ɵɵtextInterpolate(i0.ɵɵpipeBind1(6, 5, "igo.auth.signOut"));
831
+ } }
832
+ function AuthFormComponent_div_0_div_4_button_4_Template(rf, ctx) { if (rf & 1) {
833
+ const _r24 = i0.ɵɵgetCurrentView();
834
+ i0.ɵɵelementStart(0, "button", 9);
835
+ i0.ɵɵlistener("click", function AuthFormComponent_div_0_div_4_button_4_Template_button_click_0_listener() { i0.ɵɵrestoreView(_r24); const ctx_r23 = i0.ɵɵnextContext(3); return i0.ɵɵresetView(ctx_r23.home()); });
836
+ i0.ɵɵtext(1);
837
+ i0.ɵɵpipe(2, "translate");
838
+ i0.ɵɵelementEnd();
839
+ } if (rf & 2) {
840
+ i0.ɵɵadvance(1);
841
+ i0.ɵɵtextInterpolate(i0.ɵɵpipeBind1(2, 1, "igo.auth.home"));
842
+ } }
843
+ function AuthFormComponent_div_0_div_4_Template(rf, ctx) { if (rf & 1) {
844
+ i0.ɵɵelementStart(0, "div", 4)(1, "p");
845
+ i0.ɵɵtext(2);
846
+ i0.ɵɵpipe(3, "translate");
847
+ i0.ɵɵelementEnd();
848
+ i0.ɵɵtemplate(4, AuthFormComponent_div_0_div_4_button_4_Template, 3, 3, "button", 10);
849
+ i0.ɵɵelementEnd();
850
+ } if (rf & 2) {
851
+ const ctx_r4 = i0.ɵɵnextContext(2);
852
+ i0.ɵɵadvance(2);
853
+ i0.ɵɵtextInterpolate(i0.ɵɵpipeBind1(3, 2, "igo.auth.deconnection"));
854
+ i0.ɵɵadvance(2);
855
+ i0.ɵɵproperty("ngIf", ctx_r4.options.homeRoute);
856
+ } }
857
+ function AuthFormComponent_div_0_Template(rf, ctx) { if (rf & 1) {
858
+ i0.ɵɵelementStart(0, "div");
859
+ i0.ɵɵtemplate(1, AuthFormComponent_div_0_div_1_Template, 1, 0, "div", 1);
860
+ i0.ɵɵtemplate(2, AuthFormComponent_div_0_div_2_Template, 9, 8, "div", 2);
861
+ i0.ɵɵtemplate(3, AuthFormComponent_div_0_div_3_Template, 7, 7, "div", 2);
862
+ i0.ɵɵtemplate(4, AuthFormComponent_div_0_div_4_Template, 5, 4, "div", 2);
863
+ i0.ɵɵelementEnd();
864
+ } if (rf & 2) {
865
+ const ctx_r0 = i0.ɵɵnextContext();
866
+ i0.ɵɵadvance(1);
867
+ i0.ɵɵproperty("ngIf", !ctx_r0.auth.logged && ctx_r0.backgroundDisable);
868
+ i0.ɵɵadvance(1);
869
+ i0.ɵɵproperty("ngIf", !ctx_r0.auth.logged && ctx_r0.showLoginDiv);
870
+ i0.ɵɵadvance(1);
871
+ i0.ɵɵproperty("ngIf", ctx_r0.auth.logged && ctx_r0.showAlreadyConnectedDiv);
872
+ i0.ɵɵadvance(1);
873
+ i0.ɵɵproperty("ngIf", ctx_r0.showLogoutDiv);
874
+ } }
875
+ class AuthFormComponent {
876
+ constructor(auth, config, router) {
877
+ this.auth = auth;
878
+ this.config = config;
879
+ this.router = router;
880
+ this._backgroundDisable = true;
881
+ this._hasAlreadyConnectedDiv = true;
882
+ this._hasLogoutDiv = true;
883
+ this._showAlreadyConnectedDiv = false;
884
+ this._showLogoutDiv = false;
885
+ this.login = new EventEmitter();
886
+ this.visible = true;
887
+ this.options = this.config.getConfig('auth') || {};
888
+ this.visible = Object.getOwnPropertyNames(this.options).length !== 0;
889
+ }
890
+ get backgroundDisable() {
891
+ if (this.isLogoutRoute || this.isLogoutRoute) {
892
+ return false;
893
+ }
894
+ return this._backgroundDisable;
895
+ }
896
+ set backgroundDisable(value) {
897
+ this._backgroundDisable = value.toString() === 'true';
898
+ }
899
+ get hasAlreadyConnectedDiv() {
900
+ return this._hasAlreadyConnectedDiv;
901
+ }
902
+ set hasAlreadyConnectedDiv(value) {
903
+ this._hasAlreadyConnectedDiv = value.toString() === 'true';
904
+ }
905
+ get hasLogoutDiv() {
906
+ return this._hasLogoutDiv;
907
+ }
908
+ set hasLogoutDiv(value) {
909
+ this._hasLogoutDiv = value.toString() === 'true';
910
+ }
911
+ get showAlreadyConnectedDiv() {
912
+ if (this.isLogoutRoute) {
913
+ return this.hasAlreadyConnectedDiv;
914
+ }
915
+ return this._showAlreadyConnectedDiv;
916
+ }
917
+ set showAlreadyConnectedDiv(value) {
918
+ this._showAlreadyConnectedDiv = value.toString() === 'true';
919
+ }
920
+ get showLogoutDiv() {
921
+ if (this.isLogoutRoute) {
922
+ return this.hasLogoutDiv;
923
+ }
924
+ return this._showLogoutDiv;
925
+ }
926
+ set showLogoutDiv(value) {
927
+ this._showLogoutDiv = value.toString() === 'true';
928
+ }
929
+ get showLoginDiv() {
930
+ if (!this.isLogoutRoute) {
931
+ return true;
932
+ }
933
+ }
934
+ ngOnInit() {
935
+ this.analyzeRoute();
936
+ this.getName();
937
+ }
938
+ onLogin() {
939
+ this.auth.goToRedirectUrl();
940
+ this.getName();
941
+ this.login.emit(true);
942
+ }
943
+ logout() {
944
+ this.auth.logout().subscribe(() => {
945
+ this.user = undefined;
946
+ if (this.router) {
947
+ if (this.options.logoutRoute) {
948
+ this.router.navigate([this.options.logoutRoute]);
949
+ }
950
+ else if (this.options.homeRoute) {
951
+ this.router.navigate([this.options.homeRoute]);
952
+ }
953
+ }
954
+ });
955
+ }
956
+ home() {
957
+ if (this.router && this.options.homeRoute) {
958
+ this.router.navigate([this.options.homeRoute]);
959
+ }
960
+ }
961
+ getName() {
962
+ const tokenDecoded = this.auth.decodeToken();
963
+ if (tokenDecoded) {
964
+ this.user = {
965
+ name: tokenDecoded.user.firstName || tokenDecoded.user.sourceId
966
+ };
967
+ }
968
+ }
969
+ analyzeRoute() {
970
+ if (!this.router) {
971
+ return;
972
+ }
973
+ this.router.events
974
+ .pipe(filter((event) => event instanceof NavigationStart))
975
+ .subscribe((changeEvent) => {
976
+ if (changeEvent.url) {
977
+ const currentRoute = changeEvent.url;
978
+ const logoutRoute = this.options.logoutRoute;
979
+ const loginRoute = this.options.loginRoute;
980
+ this.isLogoutRoute = currentRoute === logoutRoute;
981
+ this.isLoginRoute = currentRoute === loginRoute;
982
+ if (this.isLogoutRoute) {
983
+ this.auth.logout();
984
+ }
985
+ }
986
+ });
987
+ }
988
+ }
989
+ AuthFormComponent.ɵfac = function AuthFormComponent_Factory(t) { return new (t || AuthFormComponent)(i0.ɵɵdirectiveInject(AuthService), i0.ɵɵdirectiveInject(i2.ConfigService), i0.ɵɵdirectiveInject(i3.Router, 8)); };
990
+ AuthFormComponent.ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: AuthFormComponent, selectors: [["igo-auth-form"]], inputs: { backgroundDisable: "backgroundDisable", hasAlreadyConnectedDiv: "hasAlreadyConnectedDiv", hasLogoutDiv: "hasLogoutDiv", showAlreadyConnectedDiv: "showAlreadyConnectedDiv", showLogoutDiv: "showLogoutDiv" }, outputs: { login: "login" }, decls: 1, vars: 1, consts: [[4, "ngIf"], ["class", "backgroundDisable", 4, "ngIf"], ["class", "login center-block", 4, "ngIf"], [1, "backgroundDisable"], [1, "login", "center-block"], [3, "login", 4, "ngIf"], [3, "allowAnonymous", "login", 4, "ngIf"], [3, "login"], [3, "allowAnonymous", "login"], ["mat-raised-button", "", "type", "button", 3, "click"], ["mat-raised-button", "", "type", "button", 3, "click", 4, "ngIf"]], template: function AuthFormComponent_Template(rf, ctx) { if (rf & 1) {
991
+ i0.ɵɵtemplate(0, AuthFormComponent_div_0_Template, 5, 4, "div", 0);
992
+ } if (rf & 2) {
993
+ i0.ɵɵproperty("ngIf", ctx.visible);
994
+ } }, dependencies: [i1$1.NgIf, i5$1.MatButton, AuthGoogleComponent, AuthInternComponent, AuthFacebookComponent, AuthMicrosoftComponent, AuthMicrosoftb2cComponent, i6$1.TranslatePipe], styles: ["[_nghost-%COMP%]{z-index:999}div.login[_ngcontent-%COMP%]{z-index:200;width:90%;min-width:360px;max-width:600px;padding:25px 50px;border:1px solid;background-color:#fff;border-color:#888}.center-block[_ngcontent-%COMP%]{position:fixed;top:20%;left:50%;transform:translate(-50%)}.backgroundDisable[_ngcontent-%COMP%]{position:fixed;top:0;left:0;background:#000;opacity:.8;z-index:100;height:100%;width:100%}"] });
995
+ (function () { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(AuthFormComponent, [{
996
+ type: Component,
997
+ args: [{ selector: 'igo-auth-form', changeDetection: ChangeDetectionStrategy.Default, template: "<div *ngIf=\"visible\">\n <div *ngIf=\"!auth.logged && backgroundDisable\" class=\"backgroundDisable\"></div>\n\n <div *ngIf=\"!auth.logged && showLoginDiv\" class=\"login center-block\">\n <h1>{{'igo.auth.connection' | translate}}</h1>\n\n <igo-auth-google\n *ngIf=\"options.google && options.google.enabled !== false\"\n (login)=\"onLogin()\">\n </igo-auth-google>\n <igo-auth-microsoft\n *ngIf=\"options.microsoft && options.microsoft.enabled !== false\"\n (login)=\"onLogin()\">\n </igo-auth-microsoft>\n <igo-auth-microsoftb2c\n *ngIf=\"options.microsoftb2c && options.microsoftb2c.enabled !== false\"\n (login)=\"onLogin()\">\n </igo-auth-microsoftb2c>\n <igo-auth-facebook\n *ngIf=\"options.facebook && options.facebook.enabled !== false\"\n (login)=\"onLogin()\">\n </igo-auth-facebook>\n <igo-auth-intern\n *ngIf=\"!options.intern || options.intern.enabled !== false\"\n [allowAnonymous]=\"options.allowAnonymous\"\n (login)=\"onLogin()\">\n </igo-auth-intern>\n </div>\n\n <div *ngIf=\"auth.logged && showAlreadyConnectedDiv\" class=\"login center-block\">\n <p>{{'igo.auth.welcome' |\u00A0translate: user}}</p>\n <button mat-raised-button type=\"button\" (click)=\"logout()\">{{'igo.auth.signOut' |\u00A0translate}}</button>\n </div>\n\n <div *ngIf=\"showLogoutDiv\" class=\"login center-block\">\n <p>{{'igo.auth.deconnection' |\u00A0translate}}</p>\n <button *ngIf=\"options.homeRoute\" mat-raised-button type=\"button\" (click)=\"home()\">{{'igo.auth.home' |\u00A0translate}}</button>\n </div>\n\n</div>\n", styles: [":host{z-index:999}div.login{z-index:200;width:90%;min-width:360px;max-width:600px;padding:25px 50px;border:1px solid;background-color:#fff;border-color:#888}.center-block{position:fixed;top:20%;left:50%;transform:translate(-50%)}.backgroundDisable{position:fixed;top:0;left:0;background:#000;opacity:.8;z-index:100;height:100%;width:100%}\n"] }]
998
+ }], function () { return [{ type: AuthService }, { type: i2.ConfigService }, { type: i3.Router, decorators: [{
999
+ type: Optional
1000
+ }] }]; }, { backgroundDisable: [{
1001
+ type: Input
1002
+ }], hasAlreadyConnectedDiv: [{
1003
+ type: Input
1004
+ }], hasLogoutDiv: [{
1005
+ type: Input
1006
+ }], showAlreadyConnectedDiv: [{
1007
+ type: Input
1008
+ }], showLogoutDiv: [{
1009
+ type: Input
1010
+ }], login: [{
1011
+ type: Output
1012
1012
  }] }); })();
1013
1013
 
1014
- class LoggedGuard {
1015
- constructor(authService, config, router) {
1016
- this.authService = authService;
1017
- this.config = config;
1018
- this.router = router;
1019
- }
1020
- canActivate(route, state) {
1021
- if (this.authService.logged) {
1022
- return true;
1023
- }
1024
- this.authService.redirectUrl = state.url;
1025
- const authConfig = this.config.getConfig('auth');
1026
- if (authConfig && authConfig.loginRoute) {
1027
- this.router.navigateByUrl(authConfig.loginRoute);
1028
- }
1029
- return false;
1030
- }
1031
- }
1032
- LoggedGuard.ɵfac = function LoggedGuard_Factory(t) { return new (t || LoggedGuard)(i0.ɵɵinject(AuthService), i0.ɵɵinject(i2.ConfigService), i0.ɵɵinject(i3.Router)); };
1033
- LoggedGuard.ɵprov = /*@__PURE__*/ i0.ɵɵdefineInjectable({ token: LoggedGuard, factory: LoggedGuard.ɵfac, providedIn: 'root' });
1034
- (function () { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(LoggedGuard, [{
1035
- type: Injectable,
1036
- args: [{
1037
- providedIn: 'root'
1038
- }]
1014
+ class LoggedGuard {
1015
+ constructor(authService, config, router) {
1016
+ this.authService = authService;
1017
+ this.config = config;
1018
+ this.router = router;
1019
+ }
1020
+ canActivate(route, state) {
1021
+ if (this.authService.logged) {
1022
+ return true;
1023
+ }
1024
+ this.authService.redirectUrl = state.url;
1025
+ const authConfig = this.config.getConfig('auth');
1026
+ if (authConfig && authConfig.loginRoute) {
1027
+ this.router.navigateByUrl(authConfig.loginRoute);
1028
+ }
1029
+ return false;
1030
+ }
1031
+ }
1032
+ LoggedGuard.ɵfac = function LoggedGuard_Factory(t) { return new (t || LoggedGuard)(i0.ɵɵinject(AuthService), i0.ɵɵinject(i2.ConfigService), i0.ɵɵinject(i3.Router)); };
1033
+ LoggedGuard.ɵprov = /*@__PURE__*/ i0.ɵɵdefineInjectable({ token: LoggedGuard, factory: LoggedGuard.ɵfac, providedIn: 'root' });
1034
+ (function () { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(LoggedGuard, [{
1035
+ type: Injectable,
1036
+ args: [{
1037
+ providedIn: 'root'
1038
+ }]
1039
1039
  }], function () { return [{ type: AuthService }, { type: i2.ConfigService }, { type: i3.Router }]; }, null); })();
1040
1040
 
1041
- class AuthGuard {
1042
- constructor(authService, config, router) {
1043
- this.authService = authService;
1044
- this.config = config;
1045
- this.router = router;
1046
- }
1047
- canActivate(route, state) {
1048
- if (this.authService.authenticated) {
1049
- return true;
1050
- }
1051
- this.authService.redirectUrl = state.url;
1052
- const authConfig = this.config.getConfig('auth');
1053
- if (authConfig && authConfig.loginRoute) {
1054
- this.router.navigateByUrl(authConfig.loginRoute);
1055
- }
1056
- return false;
1057
- }
1058
- }
1059
- AuthGuard.ɵfac = function AuthGuard_Factory(t) { return new (t || AuthGuard)(i0.ɵɵinject(AuthService), i0.ɵɵinject(i2.ConfigService), i0.ɵɵinject(i3.Router)); };
1060
- AuthGuard.ɵprov = /*@__PURE__*/ i0.ɵɵdefineInjectable({ token: AuthGuard, factory: AuthGuard.ɵfac, providedIn: 'root' });
1061
- (function () { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(AuthGuard, [{
1062
- type: Injectable,
1063
- args: [{
1064
- providedIn: 'root'
1065
- }]
1041
+ class AuthGuard {
1042
+ constructor(authService, config, router) {
1043
+ this.authService = authService;
1044
+ this.config = config;
1045
+ this.router = router;
1046
+ }
1047
+ canActivate(route, state) {
1048
+ if (this.authService.authenticated) {
1049
+ return true;
1050
+ }
1051
+ this.authService.redirectUrl = state.url;
1052
+ const authConfig = this.config.getConfig('auth');
1053
+ if (authConfig && authConfig.loginRoute) {
1054
+ this.router.navigateByUrl(authConfig.loginRoute);
1055
+ }
1056
+ return false;
1057
+ }
1058
+ }
1059
+ AuthGuard.ɵfac = function AuthGuard_Factory(t) { return new (t || AuthGuard)(i0.ɵɵinject(AuthService), i0.ɵɵinject(i2.ConfigService), i0.ɵɵinject(i3.Router)); };
1060
+ AuthGuard.ɵprov = /*@__PURE__*/ i0.ɵɵdefineInjectable({ token: AuthGuard, factory: AuthGuard.ɵfac, providedIn: 'root' });
1061
+ (function () { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(AuthGuard, [{
1062
+ type: Injectable,
1063
+ args: [{
1064
+ providedIn: 'root'
1065
+ }]
1066
1066
  }], function () { return [{ type: AuthService }, { type: i2.ConfigService }, { type: i3.Router }]; }, null); })();
1067
1067
 
1068
- class AdminGuard {
1069
- constructor(authService, config, router) {
1070
- this.authService = authService;
1071
- this.config = config;
1072
- this.router = router;
1073
- }
1074
- canActivate(route, state) {
1075
- const token = this.authService.decodeToken();
1076
- if (token && token.user && token.user.isAdmin) {
1077
- return true;
1078
- }
1079
- this.authService.redirectUrl = state.url;
1080
- const authConfig = this.config.getConfig('auth');
1081
- if (authConfig && authConfig.loginRoute) {
1082
- this.router.navigateByUrl(authConfig.loginRoute);
1083
- }
1084
- return false;
1085
- }
1086
- }
1087
- AdminGuard.ɵfac = function AdminGuard_Factory(t) { return new (t || AdminGuard)(i0.ɵɵinject(AuthService), i0.ɵɵinject(i2.ConfigService), i0.ɵɵinject(i3.Router)); };
1088
- AdminGuard.ɵprov = /*@__PURE__*/ i0.ɵɵdefineInjectable({ token: AdminGuard, factory: AdminGuard.ɵfac, providedIn: 'root' });
1089
- (function () { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(AdminGuard, [{
1090
- type: Injectable,
1091
- args: [{
1092
- providedIn: 'root'
1093
- }]
1068
+ class AdminGuard {
1069
+ constructor(authService, config, router) {
1070
+ this.authService = authService;
1071
+ this.config = config;
1072
+ this.router = router;
1073
+ }
1074
+ canActivate(route, state) {
1075
+ const token = this.authService.decodeToken();
1076
+ if (token && token.user && token.user.isAdmin) {
1077
+ return true;
1078
+ }
1079
+ this.authService.redirectUrl = state.url;
1080
+ const authConfig = this.config.getConfig('auth');
1081
+ if (authConfig && authConfig.loginRoute) {
1082
+ this.router.navigateByUrl(authConfig.loginRoute);
1083
+ }
1084
+ return false;
1085
+ }
1086
+ }
1087
+ AdminGuard.ɵfac = function AdminGuard_Factory(t) { return new (t || AdminGuard)(i0.ɵɵinject(AuthService), i0.ɵɵinject(i2.ConfigService), i0.ɵɵinject(i3.Router)); };
1088
+ AdminGuard.ɵprov = /*@__PURE__*/ i0.ɵɵdefineInjectable({ token: AdminGuard, factory: AdminGuard.ɵfac, providedIn: 'root' });
1089
+ (function () { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(AdminGuard, [{
1090
+ type: Injectable,
1091
+ args: [{
1092
+ providedIn: 'root'
1093
+ }]
1094
1094
  }], function () { return [{ type: AuthService }, { type: i2.ConfigService }, { type: i3.Router }]; }, null); })();
1095
1095
 
1096
- class ProfilsGuard {
1097
- constructor(authService, config, router) {
1098
- this.authService = authService;
1099
- this.config = config;
1100
- this.router = router;
1101
- }
1102
- canActivate(_route, state) {
1103
- return this.authService.getProfils().pipe(map((profils) => {
1104
- const authConfig = this.config.getConfig('auth');
1105
- if (profils &&
1106
- profils.profils &&
1107
- profils.profils.some(v => authConfig.profilsGuard.indexOf(v) !== -1)) {
1108
- return true;
1109
- }
1110
- this.authService.redirectUrl = state.url;
1111
- if (authConfig && authConfig.loginRoute) {
1112
- this.router.navigateByUrl(authConfig.loginRoute);
1113
- }
1114
- return false;
1115
- }));
1116
- }
1117
- }
1118
- ProfilsGuard.ɵfac = function ProfilsGuard_Factory(t) { return new (t || ProfilsGuard)(i0.ɵɵinject(AuthService), i0.ɵɵinject(i2.ConfigService), i0.ɵɵinject(i3.Router)); };
1119
- ProfilsGuard.ɵprov = /*@__PURE__*/ i0.ɵɵdefineInjectable({ token: ProfilsGuard, factory: ProfilsGuard.ɵfac, providedIn: 'root' });
1120
- (function () { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(ProfilsGuard, [{
1121
- type: Injectable,
1122
- args: [{
1123
- providedIn: 'root'
1124
- }]
1096
+ class ProfilsGuard {
1097
+ constructor(authService, config, router) {
1098
+ this.authService = authService;
1099
+ this.config = config;
1100
+ this.router = router;
1101
+ }
1102
+ canActivate(_route, state) {
1103
+ return this.authService.getProfils().pipe(map((profils) => {
1104
+ const authConfig = this.config.getConfig('auth');
1105
+ if (profils &&
1106
+ profils.profils &&
1107
+ profils.profils.some(v => authConfig.profilsGuard.indexOf(v) !== -1)) {
1108
+ return true;
1109
+ }
1110
+ this.authService.redirectUrl = state.url;
1111
+ if (authConfig && authConfig.loginRoute) {
1112
+ this.router.navigateByUrl(authConfig.loginRoute);
1113
+ }
1114
+ return false;
1115
+ }));
1116
+ }
1117
+ }
1118
+ ProfilsGuard.ɵfac = function ProfilsGuard_Factory(t) { return new (t || ProfilsGuard)(i0.ɵɵinject(AuthService), i0.ɵɵinject(i2.ConfigService), i0.ɵɵinject(i3.Router)); };
1119
+ ProfilsGuard.ɵprov = /*@__PURE__*/ i0.ɵɵdefineInjectable({ token: ProfilsGuard, factory: ProfilsGuard.ɵfac, providedIn: 'root' });
1120
+ (function () { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(ProfilsGuard, [{
1121
+ type: Injectable,
1122
+ args: [{
1123
+ providedIn: 'root'
1124
+ }]
1125
1125
  }], function () { return [{ type: AuthService }, { type: i2.ConfigService }, { type: i3.Router }]; }, null); })();
1126
1126
 
1127
- class AuthInterceptor {
1128
- constructor(config, tokenService, http) {
1129
- this.config = config;
1130
- this.tokenService = tokenService;
1131
- this.http = http;
1132
- this.refreshInProgress = false;
1133
- }
1134
- get trustHosts() {
1135
- const trustHosts = this.config.getConfig('auth.trustHosts') || [];
1136
- trustHosts.push(window.location.hostname);
1137
- return trustHosts;
1138
- }
1139
- get hostsWithCredentials() {
1140
- return this.config.getConfig('auth.hostsWithCredentials') || [];
1141
- }
1142
- get hostsWithAuthByKey() {
1143
- return this.config.getConfig('auth.hostsByKey') || [];
1144
- }
1145
- intercept(originalReq, next) {
1146
- const withCredentials = this.handleHostsWithCredentials(originalReq.url);
1147
- let req = originalReq.clone();
1148
- const hostWithKey = this.handleHostsAuthByKey(originalReq.url);
1149
- if (hostWithKey) {
1150
- req = req.clone({
1151
- params: req.params.set(hostWithKey.key, hostWithKey.value)
1152
- });
1153
- }
1154
- if (withCredentials) {
1155
- req = originalReq.clone({
1156
- withCredentials
1157
- });
1158
- return next.handle(req);
1159
- }
1160
- this.refreshToken();
1161
- const token = this.tokenService.get();
1162
- const element = document.createElement('a');
1163
- element.href = req.url;
1164
- if (element.host === '') {
1165
- element.href = element.href; // FIX IE11, DO NOT REMOVE
1166
- }
1167
- if (!token || this.trustHosts.indexOf(element.hostname) === -1) {
1168
- return next.handle(req);
1169
- }
1170
- const authHeader = `Bearer ${token}`;
1171
- let authReq = req.clone({
1172
- headers: req.headers.set('Authorization', authHeader)
1173
- });
1174
- const tokenDecoded = this.tokenService.decode();
1175
- if (authReq.params.get('_i') === 'true' &&
1176
- tokenDecoded &&
1177
- tokenDecoded.user &&
1178
- tokenDecoded.user.sourceId) {
1179
- const hashUser = Md5.hashStr(tokenDecoded.user.sourceId);
1180
- authReq = authReq.clone({
1181
- params: authReq.params.set('_i', hashUser)
1182
- });
1183
- }
1184
- else if (authReq.params.get('_i') === 'true') {
1185
- authReq = authReq.clone({
1186
- params: authReq.params.delete('_i')
1187
- });
1188
- }
1189
- return next.handle(authReq);
1190
- }
1191
- interceptXhr(xhr, url) {
1192
- const withCredentials = this.handleHostsWithCredentials(url);
1193
- if (withCredentials) {
1194
- xhr.withCredentials = withCredentials;
1195
- return true;
1196
- }
1197
- this.refreshToken();
1198
- const element = document.createElement('a');
1199
- element.href = url;
1200
- const token = this.tokenService.get();
1201
- if (!token || this.trustHosts.indexOf(element.hostname) === -1) {
1202
- return false;
1203
- }
1204
- xhr.setRequestHeader('Authorization', 'Bearer ' + token);
1205
- return true;
1206
- }
1207
- alterUrlWithKeyAuth(url) {
1208
- const hostWithKey = this.handleHostsAuthByKey(url);
1209
- let interceptedUrl = url;
1210
- if (hostWithKey) {
1211
- const urlDecomposed = interceptedUrl.split(/[?&]/);
1212
- let urlWithKeyAdded = urlDecomposed.shift();
1213
- const paramsToKeep = urlDecomposed.filter(p => p.length !== 0);
1214
- paramsToKeep.push(`${hostWithKey.key}=${hostWithKey.value}`);
1215
- if (paramsToKeep.length) {
1216
- urlWithKeyAdded += '?' + paramsToKeep.join('&');
1217
- }
1218
- return urlWithKeyAdded;
1219
- }
1220
- return;
1221
- }
1222
- handleHostsWithCredentials(reqUrl) {
1223
- let withCredentials = false;
1224
- for (const hostWithCredentials of this.hostsWithCredentials) {
1225
- const domainRegex = new RegExp(hostWithCredentials.domainRegFilters);
1226
- if (domainRegex.test(reqUrl)) {
1227
- withCredentials = hostWithCredentials.withCredentials !== undefined ? hostWithCredentials.withCredentials : undefined;
1228
- break;
1229
- }
1230
- }
1231
- return withCredentials;
1232
- }
1233
- handleHostsAuthByKey(reqUrl) {
1234
- let hostWithKey;
1235
- for (const hostWithAuthByKey of this.hostsWithAuthByKey) {
1236
- const domainRegex = new RegExp(hostWithAuthByKey.domainRegFilters);
1237
- if (domainRegex.test(reqUrl)) {
1238
- var replace = `${hostWithAuthByKey.keyProperty}=${hostWithAuthByKey.keyValue}`;
1239
- var keyAdded = new RegExp(replace, "gm");
1240
- if (!keyAdded.test(reqUrl)) {
1241
- hostWithKey = { key: hostWithAuthByKey.keyProperty, value: hostWithAuthByKey.keyValue };
1242
- break;
1243
- }
1244
- }
1245
- }
1246
- return hostWithKey;
1247
- }
1248
- refreshToken() {
1249
- const jwt = this.tokenService.decode();
1250
- const currentTime = new Date().getTime() / 1000;
1251
- if (!this.refreshInProgress &&
1252
- jwt &&
1253
- currentTime < jwt.exp &&
1254
- currentTime > jwt.exp - 1800) {
1255
- this.refreshInProgress = true;
1256
- const url = this.config.getConfig('auth.url');
1257
- return this.http.post(`${url}/refresh`, {}).subscribe((data) => {
1258
- this.tokenService.set(data.token);
1259
- this.refreshInProgress = false;
1260
- }, err => {
1261
- err.error.caught = true;
1262
- return err;
1263
- });
1264
- }
1265
- }
1266
- }
1267
- AuthInterceptor.ɵfac = function AuthInterceptor_Factory(t) { return new (t || AuthInterceptor)(i0.ɵɵinject(i2.ConfigService), i0.ɵɵinject(TokenService), i0.ɵɵinject(i1.HttpClient)); };
1268
- AuthInterceptor.ɵprov = /*@__PURE__*/ i0.ɵɵdefineInjectable({ token: AuthInterceptor, factory: AuthInterceptor.ɵfac, providedIn: 'root' });
1269
- (function () { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(AuthInterceptor, [{
1270
- type: Injectable,
1271
- args: [{
1272
- providedIn: 'root'
1273
- }]
1127
+ class AuthInterceptor {
1128
+ constructor(config, tokenService, http) {
1129
+ this.config = config;
1130
+ this.tokenService = tokenService;
1131
+ this.http = http;
1132
+ this.refreshInProgress = false;
1133
+ }
1134
+ get trustHosts() {
1135
+ const trustHosts = this.config.getConfig('auth.trustHosts') || [];
1136
+ trustHosts.push(window.location.hostname);
1137
+ return trustHosts;
1138
+ }
1139
+ get hostsWithCredentials() {
1140
+ return this.config.getConfig('auth.hostsWithCredentials') || [];
1141
+ }
1142
+ get hostsWithAuthByKey() {
1143
+ return this.config.getConfig('auth.hostsByKey') || [];
1144
+ }
1145
+ intercept(originalReq, next) {
1146
+ const withCredentials = this.handleHostsWithCredentials(originalReq.url);
1147
+ let req = originalReq.clone();
1148
+ const hostWithKey = this.handleHostsAuthByKey(originalReq.url);
1149
+ if (hostWithKey) {
1150
+ req = req.clone({
1151
+ params: req.params.set(hostWithKey.key, hostWithKey.value)
1152
+ });
1153
+ }
1154
+ if (withCredentials) {
1155
+ req = originalReq.clone({
1156
+ withCredentials
1157
+ });
1158
+ return next.handle(req);
1159
+ }
1160
+ this.refreshToken();
1161
+ const token = this.tokenService.get();
1162
+ const element = document.createElement('a');
1163
+ element.href = req.url;
1164
+ if (element.host === '') {
1165
+ element.href = element.href; // FIX IE11, DO NOT REMOVE
1166
+ }
1167
+ if (!token || this.trustHosts.indexOf(element.hostname) === -1) {
1168
+ return next.handle(req);
1169
+ }
1170
+ const authHeader = `Bearer ${token}`;
1171
+ let authReq = req.clone({
1172
+ headers: req.headers.set('Authorization', authHeader)
1173
+ });
1174
+ const tokenDecoded = this.tokenService.decode();
1175
+ if (authReq.params.get('_i') === 'true' &&
1176
+ tokenDecoded &&
1177
+ tokenDecoded.user &&
1178
+ tokenDecoded.user.sourceId) {
1179
+ const hashUser = Md5.hashStr(tokenDecoded.user.sourceId);
1180
+ authReq = authReq.clone({
1181
+ params: authReq.params.set('_i', hashUser)
1182
+ });
1183
+ }
1184
+ else if (authReq.params.get('_i') === 'true') {
1185
+ authReq = authReq.clone({
1186
+ params: authReq.params.delete('_i')
1187
+ });
1188
+ }
1189
+ return next.handle(authReq);
1190
+ }
1191
+ interceptXhr(xhr, url) {
1192
+ const withCredentials = this.handleHostsWithCredentials(url);
1193
+ if (withCredentials) {
1194
+ xhr.withCredentials = withCredentials;
1195
+ return true;
1196
+ }
1197
+ this.refreshToken();
1198
+ const element = document.createElement('a');
1199
+ element.href = url;
1200
+ const token = this.tokenService.get();
1201
+ if (!token || this.trustHosts.indexOf(element.hostname) === -1) {
1202
+ return false;
1203
+ }
1204
+ xhr.setRequestHeader('Authorization', 'Bearer ' + token);
1205
+ return true;
1206
+ }
1207
+ alterUrlWithKeyAuth(url) {
1208
+ const hostWithKey = this.handleHostsAuthByKey(url);
1209
+ let interceptedUrl = url;
1210
+ if (hostWithKey) {
1211
+ const urlDecomposed = interceptedUrl.split(/[?&]/);
1212
+ let urlWithKeyAdded = urlDecomposed.shift();
1213
+ const paramsToKeep = urlDecomposed.filter(p => p.length !== 0);
1214
+ paramsToKeep.push(`${hostWithKey.key}=${hostWithKey.value}`);
1215
+ if (paramsToKeep.length) {
1216
+ urlWithKeyAdded += '?' + paramsToKeep.join('&');
1217
+ }
1218
+ return urlWithKeyAdded;
1219
+ }
1220
+ return;
1221
+ }
1222
+ handleHostsWithCredentials(reqUrl) {
1223
+ let withCredentials = false;
1224
+ for (const hostWithCredentials of this.hostsWithCredentials) {
1225
+ const domainRegex = new RegExp(hostWithCredentials.domainRegFilters);
1226
+ if (domainRegex.test(reqUrl)) {
1227
+ withCredentials = hostWithCredentials.withCredentials !== undefined ? hostWithCredentials.withCredentials : undefined;
1228
+ break;
1229
+ }
1230
+ }
1231
+ return withCredentials;
1232
+ }
1233
+ handleHostsAuthByKey(reqUrl) {
1234
+ let hostWithKey;
1235
+ for (const hostWithAuthByKey of this.hostsWithAuthByKey) {
1236
+ const domainRegex = new RegExp(hostWithAuthByKey.domainRegFilters);
1237
+ if (domainRegex.test(reqUrl)) {
1238
+ var replace = `${hostWithAuthByKey.keyProperty}=${hostWithAuthByKey.keyValue}`;
1239
+ var keyAdded = new RegExp(replace, "gm");
1240
+ if (!keyAdded.test(reqUrl)) {
1241
+ hostWithKey = { key: hostWithAuthByKey.keyProperty, value: hostWithAuthByKey.keyValue };
1242
+ break;
1243
+ }
1244
+ }
1245
+ }
1246
+ return hostWithKey;
1247
+ }
1248
+ refreshToken() {
1249
+ const jwt = this.tokenService.decode();
1250
+ const currentTime = new Date().getTime() / 1000;
1251
+ if (!this.refreshInProgress &&
1252
+ jwt &&
1253
+ currentTime < jwt.exp &&
1254
+ currentTime > jwt.exp - 1800) {
1255
+ this.refreshInProgress = true;
1256
+ const url = this.config.getConfig('auth.url');
1257
+ return this.http.post(`${url}/refresh`, {}).subscribe((data) => {
1258
+ this.tokenService.set(data.token);
1259
+ this.refreshInProgress = false;
1260
+ }, err => {
1261
+ err.error.caught = true;
1262
+ return err;
1263
+ });
1264
+ }
1265
+ }
1266
+ }
1267
+ AuthInterceptor.ɵfac = function AuthInterceptor_Factory(t) { return new (t || AuthInterceptor)(i0.ɵɵinject(i2.ConfigService), i0.ɵɵinject(TokenService), i0.ɵɵinject(i1.HttpClient)); };
1268
+ AuthInterceptor.ɵprov = /*@__PURE__*/ i0.ɵɵdefineInjectable({ token: AuthInterceptor, factory: AuthInterceptor.ɵfac, providedIn: 'root' });
1269
+ (function () { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(AuthInterceptor, [{
1270
+ type: Injectable,
1271
+ args: [{
1272
+ providedIn: 'root'
1273
+ }]
1274
1274
  }], function () { return [{ type: i2.ConfigService }, { type: TokenService }, { type: i1.HttpClient }]; }, null); })();
1275
1275
 
1276
- function MSALConfigFactory(config) {
1277
- const msConf = config.getConfig('auth.microsoft') || {};
1278
- msConf.redirectUri = msConf.redirectUri || window.location.href;
1279
- msConf.authority = msConf.authority || 'https://login.microsoftonline.com/organizations';
1280
- const myMsalObj = new PublicClientApplication({
1281
- auth: msConf,
1282
- cache: {
1283
- cacheLocation: 'sessionStorage'
1284
- }
1285
- });
1286
- return myMsalObj;
1287
- }
1288
- function MSALConfigFactoryb2c(config) {
1289
- const msConf = config.getConfig('auth.microsoftb2c.browserAuthOptions') || {};
1290
- msConf.redirectUri = msConf.redirectUri || window.location.href;
1291
- msConf.authority = msConf.authority || 'https://login.microsoftonline.com/organizations';
1292
- const myMsalObj = new PublicClientApplication({
1293
- auth: msConf,
1294
- cache: {
1295
- cacheLocation: 'sessionStorage'
1296
- }
1297
- });
1298
- return myMsalObj;
1299
- }
1300
- function MSALAngularConfigFactory(config) {
1301
- const msConf = config.getConfig('auth.microsoft') || {};
1302
- return {
1303
- interactionType: InteractionType.Popup,
1304
- authRequest: {
1305
- scopes: ['user.read'],
1306
- loginHint: 'todo',
1307
- },
1308
- type: 'add'
1309
- };
1310
- }
1311
- function MSALAngularConfigFactoryb2c(config) {
1312
- const msConf = config.getConfig('auth.microsoftb2c.browserAuthOptions') || {};
1313
- return {
1314
- interactionType: InteractionType.Popup,
1315
- authRequest: {
1316
- scopes: [msConf.clientId]
1317
- },
1318
- type: 'b2c'
1319
- };
1320
- }
1321
- function provideAuthMicrosoft(type) {
1322
- if (type === 'b2c') {
1323
- return [
1324
- {
1325
- provide: MSAL_INSTANCE,
1326
- useFactory: MSALConfigFactoryb2c,
1327
- deps: [ConfigService]
1328
- },
1329
- {
1330
- provide: MSAL_GUARD_CONFIG,
1331
- useFactory: MSALAngularConfigFactoryb2c,
1332
- deps: [ConfigService],
1333
- multi: true
1334
- },
1335
- MsalServiceb2c
1336
- ];
1337
- }
1338
- else {
1339
- return [
1340
- {
1341
- provide: MSAL_INSTANCE,
1342
- useFactory: MSALConfigFactory,
1343
- deps: [ConfigService]
1344
- },
1345
- {
1346
- provide: MSAL_GUARD_CONFIG,
1347
- useFactory: MSALAngularConfigFactory,
1348
- deps: [ConfigService],
1349
- multi: true
1350
- },
1351
- MsalService
1352
- ];
1353
- }
1276
+ function MSALConfigFactory(config) {
1277
+ const msConf = config.getConfig('auth.microsoft') || {};
1278
+ msConf.redirectUri = msConf.redirectUri || window.location.href;
1279
+ msConf.authority = msConf.authority || 'https://login.microsoftonline.com/organizations';
1280
+ const myMsalObj = new PublicClientApplication({
1281
+ auth: msConf,
1282
+ cache: {
1283
+ cacheLocation: 'sessionStorage'
1284
+ }
1285
+ });
1286
+ return myMsalObj;
1287
+ }
1288
+ function MSALConfigFactoryb2c(config) {
1289
+ const msConf = config.getConfig('auth.microsoftb2c.browserAuthOptions') || {};
1290
+ msConf.redirectUri = msConf.redirectUri || window.location.href;
1291
+ msConf.authority = msConf.authority || 'https://login.microsoftonline.com/organizations';
1292
+ const myMsalObj = new PublicClientApplication({
1293
+ auth: msConf,
1294
+ cache: {
1295
+ cacheLocation: 'sessionStorage'
1296
+ }
1297
+ });
1298
+ return myMsalObj;
1299
+ }
1300
+ function MSALAngularConfigFactory(config) {
1301
+ const msConf = config.getConfig('auth.microsoft') || {};
1302
+ return {
1303
+ interactionType: InteractionType.Popup,
1304
+ authRequest: {
1305
+ scopes: ['user.read'],
1306
+ loginHint: 'todo',
1307
+ },
1308
+ type: 'add'
1309
+ };
1310
+ }
1311
+ function MSALAngularConfigFactoryb2c(config) {
1312
+ const msConf = config.getConfig('auth.microsoftb2c.browserAuthOptions') || {};
1313
+ return {
1314
+ interactionType: InteractionType.Popup,
1315
+ authRequest: {
1316
+ scopes: [msConf.clientId]
1317
+ },
1318
+ type: 'b2c'
1319
+ };
1320
+ }
1321
+ function provideAuthMicrosoft(type) {
1322
+ if (type === 'b2c') {
1323
+ return [
1324
+ {
1325
+ provide: MSAL_INSTANCE,
1326
+ useFactory: MSALConfigFactoryb2c,
1327
+ deps: [ConfigService]
1328
+ },
1329
+ {
1330
+ provide: MSAL_GUARD_CONFIG,
1331
+ useFactory: MSALAngularConfigFactoryb2c,
1332
+ deps: [ConfigService],
1333
+ multi: true
1334
+ },
1335
+ MsalServiceb2c
1336
+ ];
1337
+ }
1338
+ else {
1339
+ return [
1340
+ {
1341
+ provide: MSAL_INSTANCE,
1342
+ useFactory: MSALConfigFactory,
1343
+ deps: [ConfigService]
1344
+ },
1345
+ {
1346
+ provide: MSAL_GUARD_CONFIG,
1347
+ useFactory: MSALAngularConfigFactory,
1348
+ deps: [ConfigService],
1349
+ multi: true
1350
+ },
1351
+ MsalService
1352
+ ];
1353
+ }
1354
1354
  }
1355
1355
 
1356
- class ProtectedDirective {
1357
- constructor(authentication, el) {
1358
- if (!authentication.isAuthenticated()) {
1359
- el.nativeElement.parentNode.removeChild(el.nativeElement);
1360
- }
1361
- }
1362
- }
1363
- ProtectedDirective.ɵfac = function ProtectedDirective_Factory(t) { return new (t || ProtectedDirective)(i0.ɵɵdirectiveInject(AuthService), i0.ɵɵdirectiveInject(i0.ElementRef)); };
1364
- ProtectedDirective.ɵdir = /*@__PURE__*/ i0.ɵɵdefineDirective({ type: ProtectedDirective, selectors: [["", "igoProtected", ""]] });
1365
- (function () { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(ProtectedDirective, [{
1366
- type: Directive,
1367
- args: [{
1368
- selector: '[igoProtected]'
1369
- }]
1356
+ class ProtectedDirective {
1357
+ constructor(authentication, el) {
1358
+ if (!authentication.isAuthenticated()) {
1359
+ el.nativeElement.parentNode.removeChild(el.nativeElement);
1360
+ }
1361
+ }
1362
+ }
1363
+ ProtectedDirective.ɵfac = function ProtectedDirective_Factory(t) { return new (t || ProtectedDirective)(i0.ɵɵdirectiveInject(AuthService), i0.ɵɵdirectiveInject(i0.ElementRef)); };
1364
+ ProtectedDirective.ɵdir = /*@__PURE__*/ i0.ɵɵdefineDirective({ type: ProtectedDirective, selectors: [["", "igoProtected", ""]] });
1365
+ (function () { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(ProtectedDirective, [{
1366
+ type: Directive,
1367
+ args: [{
1368
+ selector: '[igoProtected]'
1369
+ }]
1370
1370
  }], function () { return [{ type: AuthService }, { type: i0.ElementRef }]; }, null); })();
1371
1371
 
1372
- class AuthStorageService extends StorageService {
1373
- constructor(config, http, authService, tokenService) {
1374
- super(config);
1375
- this.http = http;
1376
- this.authService = authService;
1377
- this.tokenService = tokenService;
1378
- this.authService.authenticate$.subscribe(isAuthenticated => {
1379
- if (isAuthenticated && this.options.url) {
1380
- this.http
1381
- .get(this.options.url)
1382
- .subscribe((userIgo) => {
1383
- if (userIgo && userIgo.preference) {
1384
- for (const key of Object.keys(userIgo.preference)) {
1385
- const value = userIgo.preference[key];
1386
- super.set(key, value);
1387
- }
1388
- }
1389
- });
1390
- }
1391
- });
1392
- }
1393
- set(key, value, scope = StorageScope.LOCAL) {
1394
- if (scope === StorageScope.LOCAL &&
1395
- this.authService.authenticated &&
1396
- this.options.url) {
1397
- const preference = {};
1398
- preference[key] = value;
1399
- this.http.patch(this.options.url, { preference }).subscribe();
1400
- }
1401
- super.set(key, value, scope);
1402
- }
1403
- remove(key, scope = StorageScope.LOCAL) {
1404
- if (scope === StorageScope.LOCAL &&
1405
- this.authService.authenticated &&
1406
- this.options.url) {
1407
- const preference = {};
1408
- preference[key] = undefined;
1409
- this.http.patch(this.options.url, { preference }).subscribe();
1410
- }
1411
- super.remove(key, scope);
1412
- }
1413
- clear(scope = StorageScope.LOCAL) {
1414
- if (scope === StorageScope.LOCAL &&
1415
- this.authService.authenticated &&
1416
- this.options.url) {
1417
- this.http.patch(this.options.url, { preference: {} }, {
1418
- params: {
1419
- mergePreference: 'false'
1420
- }
1421
- }).subscribe();
1422
- }
1423
- let token;
1424
- if (scope === StorageScope.LOCAL) {
1425
- token = this.tokenService.get();
1426
- }
1427
- super.clear(scope);
1428
- if (token) {
1429
- this.tokenService.set(token);
1430
- }
1431
- if (scope === StorageScope.LOCAL &&
1432
- this.authService.authenticated &&
1433
- this.options.url) {
1434
- this.http
1435
- .get(this.options.url)
1436
- .subscribe((userIgo) => {
1437
- if (userIgo && userIgo.preference) {
1438
- for (const key of Object.keys(userIgo.preference)) {
1439
- const value = userIgo.preference[key];
1440
- super.set(key, value);
1441
- }
1442
- }
1443
- });
1444
- }
1445
- }
1446
- }
1447
- AuthStorageService.ɵfac = function AuthStorageService_Factory(t) { return new (t || AuthStorageService)(i0.ɵɵinject(i2.ConfigService), i0.ɵɵinject(i1.HttpClient), i0.ɵɵinject(AuthService), i0.ɵɵinject(TokenService)); };
1448
- AuthStorageService.ɵprov = /*@__PURE__*/ i0.ɵɵdefineInjectable({ token: AuthStorageService, factory: AuthStorageService.ɵfac, providedIn: 'root' });
1449
- (function () { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(AuthStorageService, [{
1450
- type: Injectable,
1451
- args: [{
1452
- providedIn: 'root'
1453
- }]
1372
+ class AuthStorageService extends StorageService {
1373
+ constructor(config, http, authService, tokenService) {
1374
+ super(config);
1375
+ this.http = http;
1376
+ this.authService = authService;
1377
+ this.tokenService = tokenService;
1378
+ this.authService.authenticate$.subscribe(isAuthenticated => {
1379
+ if (isAuthenticated && this.options.url) {
1380
+ this.http
1381
+ .get(this.options.url)
1382
+ .subscribe((userIgo) => {
1383
+ if (userIgo && userIgo.preference) {
1384
+ for (const key of Object.keys(userIgo.preference)) {
1385
+ const value = userIgo.preference[key];
1386
+ super.set(key, value);
1387
+ }
1388
+ }
1389
+ });
1390
+ }
1391
+ });
1392
+ }
1393
+ set(key, value, scope = StorageScope.LOCAL) {
1394
+ if (scope === StorageScope.LOCAL &&
1395
+ this.authService.authenticated &&
1396
+ this.options.url) {
1397
+ const preference = {};
1398
+ preference[key] = value;
1399
+ this.http.patch(this.options.url, { preference }).subscribe();
1400
+ }
1401
+ super.set(key, value, scope);
1402
+ }
1403
+ remove(key, scope = StorageScope.LOCAL) {
1404
+ if (scope === StorageScope.LOCAL &&
1405
+ this.authService.authenticated &&
1406
+ this.options.url) {
1407
+ const preference = {};
1408
+ preference[key] = undefined;
1409
+ this.http.patch(this.options.url, { preference }).subscribe();
1410
+ }
1411
+ super.remove(key, scope);
1412
+ }
1413
+ clear(scope = StorageScope.LOCAL) {
1414
+ if (scope === StorageScope.LOCAL &&
1415
+ this.authService.authenticated &&
1416
+ this.options.url) {
1417
+ this.http.patch(this.options.url, { preference: {} }, {
1418
+ params: {
1419
+ mergePreference: 'false'
1420
+ }
1421
+ }).subscribe();
1422
+ }
1423
+ let token;
1424
+ if (scope === StorageScope.LOCAL) {
1425
+ token = this.tokenService.get();
1426
+ }
1427
+ super.clear(scope);
1428
+ if (token) {
1429
+ this.tokenService.set(token);
1430
+ }
1431
+ if (scope === StorageScope.LOCAL &&
1432
+ this.authService.authenticated &&
1433
+ this.options.url) {
1434
+ this.http
1435
+ .get(this.options.url)
1436
+ .subscribe((userIgo) => {
1437
+ if (userIgo && userIgo.preference) {
1438
+ for (const key of Object.keys(userIgo.preference)) {
1439
+ const value = userIgo.preference[key];
1440
+ super.set(key, value);
1441
+ }
1442
+ }
1443
+ });
1444
+ }
1445
+ }
1446
+ }
1447
+ AuthStorageService.ɵfac = function AuthStorageService_Factory(t) { return new (t || AuthStorageService)(i0.ɵɵinject(i2.ConfigService), i0.ɵɵinject(i1.HttpClient), i0.ɵɵinject(AuthService), i0.ɵɵinject(TokenService)); };
1448
+ AuthStorageService.ɵprov = /*@__PURE__*/ i0.ɵɵdefineInjectable({ token: AuthStorageService, factory: AuthStorageService.ɵfac, providedIn: 'root' });
1449
+ (function () { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(AuthStorageService, [{
1450
+ type: Injectable,
1451
+ args: [{
1452
+ providedIn: 'root'
1453
+ }]
1454
1454
  }], function () { return [{ type: i2.ConfigService }, { type: i1.HttpClient }, { type: AuthService }, { type: TokenService }]; }, null); })();
1455
1455
 
1456
- const routes = [
1457
- { path: 'login', component: AuthFormComponent },
1458
- { path: 'logout', component: AuthFormComponent }
1459
- ];
1460
- class AuthRoutingModule {
1461
- }
1462
- AuthRoutingModule.ɵfac = function AuthRoutingModule_Factory(t) { return new (t || AuthRoutingModule)(); };
1463
- AuthRoutingModule.ɵmod = /*@__PURE__*/ i0.ɵɵdefineNgModule({ type: AuthRoutingModule });
1464
- AuthRoutingModule.ɵinj = /*@__PURE__*/ i0.ɵɵdefineInjector({ imports: [RouterModule.forChild(routes), RouterModule] });
1465
- (function () { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(AuthRoutingModule, [{
1466
- type: NgModule,
1467
- args: [{
1468
- imports: [RouterModule.forChild(routes)],
1469
- exports: [RouterModule],
1470
- providers: []
1471
- }]
1472
- }], null, null); })();
1456
+ const routes = [
1457
+ { path: 'login', component: AuthFormComponent },
1458
+ { path: 'logout', component: AuthFormComponent }
1459
+ ];
1460
+ class AuthRoutingModule {
1461
+ }
1462
+ AuthRoutingModule.ɵfac = function AuthRoutingModule_Factory(t) { return new (t || AuthRoutingModule)(); };
1463
+ AuthRoutingModule.ɵmod = /*@__PURE__*/ i0.ɵɵdefineNgModule({ type: AuthRoutingModule });
1464
+ AuthRoutingModule.ɵinj = /*@__PURE__*/ i0.ɵɵdefineInjector({ imports: [RouterModule.forChild(routes), RouterModule] });
1465
+ (function () { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(AuthRoutingModule, [{
1466
+ type: NgModule,
1467
+ args: [{
1468
+ imports: [RouterModule.forChild(routes)],
1469
+ exports: [RouterModule],
1470
+ providers: []
1471
+ }]
1472
+ }], null, null); })();
1473
1473
  (function () { (typeof ngJitMode === "undefined" || ngJitMode) && i0.ɵɵsetNgModuleScope(AuthRoutingModule, { imports: [i3.RouterModule], exports: [RouterModule] }); })();
1474
1474
 
1475
- class IgoAuthModule {
1476
- static forRoot() {
1477
- return {
1478
- ngModule: IgoAuthModule,
1479
- providers: [
1480
- {
1481
- provide: HTTP_INTERCEPTORS,
1482
- useClass: AuthInterceptor,
1483
- multi: true
1484
- },
1485
- {
1486
- provide: StorageService,
1487
- useClass: AuthStorageService
1488
- },
1489
- ...provideAuthMicrosoft('add'),
1490
- ...provideAuthMicrosoft('b2c')
1491
- ]
1492
- };
1493
- }
1494
- }
1495
- IgoAuthModule.ɵfac = function IgoAuthModule_Factory(t) { return new (t || IgoAuthModule)(); };
1496
- IgoAuthModule.ɵmod = /*@__PURE__*/ i0.ɵɵdefineNgModule({ type: IgoAuthModule });
1497
- IgoAuthModule.ɵinj = /*@__PURE__*/ i0.ɵɵdefineInjector({ imports: [CommonModule,
1498
- ReactiveFormsModule,
1499
- MatFormFieldModule,
1500
- MatInputModule,
1501
- MatIconModule,
1502
- MatButtonModule,
1503
- IgoLanguageModule,
1504
- MsalModule] });
1505
- (function () { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(IgoAuthModule, [{
1506
- type: NgModule,
1507
- args: [{
1508
- imports: [
1509
- CommonModule,
1510
- ReactiveFormsModule,
1511
- MatFormFieldModule,
1512
- MatInputModule,
1513
- MatIconModule,
1514
- MatButtonModule,
1515
- IgoLanguageModule,
1516
- MsalModule
1517
- ],
1518
- declarations: [
1519
- AuthFormComponent,
1520
- AuthGoogleComponent,
1521
- AuthInternComponent,
1522
- AuthFacebookComponent,
1523
- AuthMicrosoftComponent,
1524
- AuthMicrosoftb2cComponent,
1525
- ProtectedDirective
1526
- ],
1527
- exports: [AuthFormComponent, ProtectedDirective]
1528
- }]
1529
- }], null, null); })();
1530
- (function () { (typeof ngJitMode === "undefined" || ngJitMode) && i0.ɵɵsetNgModuleScope(IgoAuthModule, { declarations: [AuthFormComponent,
1531
- AuthGoogleComponent,
1532
- AuthInternComponent,
1533
- AuthFacebookComponent,
1534
- AuthMicrosoftComponent,
1535
- AuthMicrosoftb2cComponent,
1536
- ProtectedDirective], imports: [CommonModule,
1537
- ReactiveFormsModule,
1538
- MatFormFieldModule,
1539
- MatInputModule,
1540
- MatIconModule,
1541
- MatButtonModule,
1542
- IgoLanguageModule,
1475
+ class IgoAuthModule {
1476
+ static forRoot() {
1477
+ return {
1478
+ ngModule: IgoAuthModule,
1479
+ providers: [
1480
+ {
1481
+ provide: HTTP_INTERCEPTORS,
1482
+ useClass: AuthInterceptor,
1483
+ multi: true
1484
+ },
1485
+ {
1486
+ provide: StorageService,
1487
+ useClass: AuthStorageService
1488
+ },
1489
+ ...provideAuthMicrosoft('add'),
1490
+ ...provideAuthMicrosoft('b2c')
1491
+ ]
1492
+ };
1493
+ }
1494
+ }
1495
+ IgoAuthModule.ɵfac = function IgoAuthModule_Factory(t) { return new (t || IgoAuthModule)(); };
1496
+ IgoAuthModule.ɵmod = /*@__PURE__*/ i0.ɵɵdefineNgModule({ type: IgoAuthModule });
1497
+ IgoAuthModule.ɵinj = /*@__PURE__*/ i0.ɵɵdefineInjector({ imports: [CommonModule,
1498
+ ReactiveFormsModule,
1499
+ MatFormFieldModule,
1500
+ MatInputModule,
1501
+ MatIconModule,
1502
+ MatButtonModule,
1503
+ IgoLanguageModule,
1504
+ MsalModule] });
1505
+ (function () { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(IgoAuthModule, [{
1506
+ type: NgModule,
1507
+ args: [{
1508
+ imports: [
1509
+ CommonModule,
1510
+ ReactiveFormsModule,
1511
+ MatFormFieldModule,
1512
+ MatInputModule,
1513
+ MatIconModule,
1514
+ MatButtonModule,
1515
+ IgoLanguageModule,
1516
+ MsalModule
1517
+ ],
1518
+ declarations: [
1519
+ AuthFormComponent,
1520
+ AuthGoogleComponent,
1521
+ AuthInternComponent,
1522
+ AuthFacebookComponent,
1523
+ AuthMicrosoftComponent,
1524
+ AuthMicrosoftb2cComponent,
1525
+ ProtectedDirective
1526
+ ],
1527
+ exports: [AuthFormComponent, ProtectedDirective]
1528
+ }]
1529
+ }], null, null); })();
1530
+ (function () { (typeof ngJitMode === "undefined" || ngJitMode) && i0.ɵɵsetNgModuleScope(IgoAuthModule, { declarations: [AuthFormComponent,
1531
+ AuthGoogleComponent,
1532
+ AuthInternComponent,
1533
+ AuthFacebookComponent,
1534
+ AuthMicrosoftComponent,
1535
+ AuthMicrosoftb2cComponent,
1536
+ ProtectedDirective], imports: [CommonModule,
1537
+ ReactiveFormsModule,
1538
+ MatFormFieldModule,
1539
+ MatInputModule,
1540
+ MatIconModule,
1541
+ MatButtonModule,
1542
+ IgoLanguageModule,
1543
1543
  MsalModule], exports: [AuthFormComponent, ProtectedDirective] }); })();
1544
1544
 
1545
- /*
1546
- * Public API Surface of auth
1545
+ /*
1546
+ * Public API Surface of auth
1547
1547
  */
1548
1548
 
1549
- /**
1550
- * Generated bundle index. Do not edit.
1549
+ /**
1550
+ * Generated bundle index. Do not edit.
1551
1551
  */
1552
1552
 
1553
1553
  export { AdminGuard, AuthFormComponent, AuthGuard, AuthInterceptor, AuthRoutingModule, AuthService, AuthStorageService, IgoAuthModule, LoggedGuard, MSALAngularConfigFactory, MSALAngularConfigFactoryb2c, MSALConfigFactory, MSALConfigFactoryb2c, ProfilsGuard, ProtectedDirective, TokenService, provideAuthMicrosoft };