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