@arsedizioni/ars-utils 20.2.2 → 20.2.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/clipper.common/index.d.ts +15 -0
- package/core/index.d.ts +2 -0
- package/fesm2022/arsedizioni-ars-utils-clipper.common.mjs +68 -25
- package/fesm2022/arsedizioni-ars-utils-clipper.common.mjs.map +1 -1
- package/fesm2022/arsedizioni-ars-utils-clipper.ui.mjs +39 -39
- package/fesm2022/arsedizioni-ars-utils-core.mjs +109 -109
- package/fesm2022/arsedizioni-ars-utils-core.mjs.map +1 -1
- package/fesm2022/arsedizioni-ars-utils-evolution.common.mjs +10 -10
- package/fesm2022/arsedizioni-ars-utils-help.mjs +13 -13
- package/fesm2022/arsedizioni-ars-utils-support.common.mjs +10 -10
- package/fesm2022/arsedizioni-ars-utils-support.ui.mjs +6 -6
- package/fesm2022/arsedizioni-ars-utils-tinymce.mjs +7 -7
- package/fesm2022/arsedizioni-ars-utils-ui.application.mjs +58 -58
- package/fesm2022/arsedizioni-ars-utils-ui.mjs +156 -44
- package/fesm2022/arsedizioni-ars-utils-ui.mjs.map +1 -1
- package/fesm2022/arsedizioni-ars-utils-ui.oauth.mjs +7 -7
- package/package.json +9 -9
- package/ui/index.d.ts +32 -3
|
@@ -17,6 +17,7 @@ declare const ClipperMessages: {
|
|
|
17
17
|
LOGIN_CHANGED: string;
|
|
18
18
|
LOGIN_COMPLETED: string;
|
|
19
19
|
LOGOUT_COMPLETED: string;
|
|
20
|
+
LOGIN_PENDING: string;
|
|
20
21
|
LOGOUT: string;
|
|
21
22
|
DOCUMENT_READ: string;
|
|
22
23
|
DOCUMENT_NAVIGATE: string;
|
|
@@ -1053,6 +1054,10 @@ declare class ClipperService implements OnDestroy {
|
|
|
1053
1054
|
* @param refresh: true to get the refresh token. Default is false.
|
|
1054
1055
|
*/
|
|
1055
1056
|
getToken(refresh?: boolean): string;
|
|
1057
|
+
/**
|
|
1058
|
+
* Get the two form factor authentication token
|
|
1059
|
+
*/
|
|
1060
|
+
getMFAToken(): string | null;
|
|
1056
1061
|
/**
|
|
1057
1062
|
* Store login info
|
|
1058
1063
|
*/
|
|
@@ -1082,6 +1087,16 @@ declare class ClipperService implements OnDestroy {
|
|
|
1082
1087
|
* @returns: the login result
|
|
1083
1088
|
*/
|
|
1084
1089
|
login(email?: string, password?: string, remember?: boolean, oauth?: LoginOAuthType, oauthAccessToken?: string | undefined): rxjs.Observable<ApiResult<ClipperLoginResult>>;
|
|
1090
|
+
/**
|
|
1091
|
+
* Complete login
|
|
1092
|
+
* @param result : the login result
|
|
1093
|
+
*/
|
|
1094
|
+
private completeLogin;
|
|
1095
|
+
/**
|
|
1096
|
+
* Confirm MFA procedure
|
|
1097
|
+
* @param code: the confirm code
|
|
1098
|
+
*/
|
|
1099
|
+
confirmIdentity(code: string): rxjs.Observable<ApiResult<ClipperLoginResult>>;
|
|
1085
1100
|
/**
|
|
1086
1101
|
* Perform logout
|
|
1087
1102
|
*/
|
package/core/index.d.ts
CHANGED
|
@@ -566,6 +566,8 @@ interface LoginResult<T> extends ApiResult<boolean> {
|
|
|
566
566
|
context: T;
|
|
567
567
|
token: string;
|
|
568
568
|
refreshToken?: string;
|
|
569
|
+
requiresMFA?: boolean;
|
|
570
|
+
MFAToken?: string;
|
|
569
571
|
}
|
|
570
572
|
|
|
571
573
|
declare class DateIntervalChangeDirective implements OnInit, OnDestroy {
|
|
@@ -16,6 +16,7 @@ const ClipperMessages = {
|
|
|
16
16
|
LOGIN_CHANGED: '§clipper-login-changed',
|
|
17
17
|
LOGIN_COMPLETED: '§clipper-login-completed',
|
|
18
18
|
LOGOUT_COMPLETED: '§clipper-logout-completed',
|
|
19
|
+
LOGIN_PENDING: '§clipper-login-pending',
|
|
19
20
|
LOGOUT: '§clipper-logout',
|
|
20
21
|
// Document
|
|
21
22
|
DOCUMENT_READ: '$clipper-document-read',
|
|
@@ -2182,6 +2183,7 @@ class ClipperService {
|
|
|
2182
2183
|
setToken(value) {
|
|
2183
2184
|
sessionStorage.setItem('clipper_jwt', value.token);
|
|
2184
2185
|
sessionStorage.setItem('clipper_jwt_refresh', value.refreshToken ?? '');
|
|
2186
|
+
localStorage.setItem('clipper_mfa', value.MFAToken ?? '');
|
|
2185
2187
|
}
|
|
2186
2188
|
/**
|
|
2187
2189
|
* Return current JWT token
|
|
@@ -2194,6 +2196,12 @@ class ClipperService {
|
|
|
2194
2196
|
}
|
|
2195
2197
|
return token ?? '';
|
|
2196
2198
|
}
|
|
2199
|
+
/**
|
|
2200
|
+
* Get the two form factor authentication token
|
|
2201
|
+
*/
|
|
2202
|
+
getMFAToken() {
|
|
2203
|
+
return localStorage.getItem("clipper_mfa");
|
|
2204
|
+
}
|
|
2197
2205
|
/**
|
|
2198
2206
|
* Store login info
|
|
2199
2207
|
*/
|
|
@@ -2271,18 +2279,18 @@ class ClipperService {
|
|
|
2271
2279
|
}, {
|
|
2272
2280
|
headers: !oauth || !oauthAccessToken
|
|
2273
2281
|
? new HttpHeaders()
|
|
2282
|
+
.set("X-MFA", this.getMFAToken() ?? '')
|
|
2274
2283
|
: new HttpHeaders()
|
|
2275
2284
|
.set("Authorization", oauthAccessToken)
|
|
2276
2285
|
})
|
|
2277
2286
|
.pipe(catchError(err => {
|
|
2278
2287
|
this.loggingIn.set(false);
|
|
2279
2288
|
localStorage.removeItem('clipper_login');
|
|
2289
|
+
localStorage.removeItem('clipper_mfa');
|
|
2280
2290
|
return throwError(() => err);
|
|
2281
2291
|
}), map((r) => {
|
|
2282
|
-
this.loggingIn.set(false);
|
|
2283
2292
|
if (r.success) {
|
|
2284
2293
|
// Store access token
|
|
2285
|
-
this.setToken(r.value);
|
|
2286
2294
|
const loginInfo = {
|
|
2287
2295
|
context: r.value.context,
|
|
2288
2296
|
channels: r.value.settings,
|
|
@@ -2295,18 +2303,52 @@ class ClipperService {
|
|
|
2295
2303
|
password: password,
|
|
2296
2304
|
remember: remember,
|
|
2297
2305
|
}), loginInfo.context.userId.toString());
|
|
2306
|
+
this.storeLogin();
|
|
2307
|
+
}
|
|
2308
|
+
if (!oauth && r.value.requiresMFA) {
|
|
2309
|
+
// Notify login is pending
|
|
2310
|
+
this.broadcastService.sendMessage(ClipperMessages.LOGIN_PENDING);
|
|
2311
|
+
}
|
|
2312
|
+
else {
|
|
2313
|
+
// Complete login
|
|
2314
|
+
this.completeLogin(r.value);
|
|
2298
2315
|
}
|
|
2299
|
-
|
|
2300
|
-
|
|
2301
|
-
|
|
2302
|
-
|
|
2303
|
-
|
|
2304
|
-
|
|
2305
|
-
|
|
2306
|
-
|
|
2307
|
-
|
|
2308
|
-
|
|
2309
|
-
|
|
2316
|
+
}
|
|
2317
|
+
return r;
|
|
2318
|
+
}));
|
|
2319
|
+
}
|
|
2320
|
+
/**
|
|
2321
|
+
* Complete login
|
|
2322
|
+
* @param result : the login result
|
|
2323
|
+
*/
|
|
2324
|
+
completeLogin(result) {
|
|
2325
|
+
// Update info
|
|
2326
|
+
this.setToken(result);
|
|
2327
|
+
this.loggedIn.set(true);
|
|
2328
|
+
this.loggingIn.set(false);
|
|
2329
|
+
// Keep alive
|
|
2330
|
+
this.setKeepAlive();
|
|
2331
|
+
// Initialize channels
|
|
2332
|
+
this.initializeChannels();
|
|
2333
|
+
// Notify
|
|
2334
|
+
this.broadcastService.sendMessage(ClipperMessages.LOGIN_COMPLETED);
|
|
2335
|
+
}
|
|
2336
|
+
/**
|
|
2337
|
+
* Confirm MFA procedure
|
|
2338
|
+
* @param code: the confirm code
|
|
2339
|
+
*/
|
|
2340
|
+
confirmIdentity(code) {
|
|
2341
|
+
return this.httpClient
|
|
2342
|
+
.post(this._serviceUri + '/login/confirm/' + code, {})
|
|
2343
|
+
.pipe(catchError((err) => {
|
|
2344
|
+
localStorage.removeItem('clipper_login');
|
|
2345
|
+
localStorage.removeItem('clipper_mfa');
|
|
2346
|
+
this.loggingIn.set(false);
|
|
2347
|
+
return throwError(() => err);
|
|
2348
|
+
}), map((r) => {
|
|
2349
|
+
if (r.success) {
|
|
2350
|
+
// Complete login
|
|
2351
|
+
this.completeLogin(r.value);
|
|
2310
2352
|
}
|
|
2311
2353
|
return r;
|
|
2312
2354
|
}));
|
|
@@ -2320,6 +2362,7 @@ class ClipperService {
|
|
|
2320
2362
|
this.clear(true);
|
|
2321
2363
|
// Remove credentials
|
|
2322
2364
|
localStorage.removeItem('clipper_login');
|
|
2365
|
+
localStorage.removeItem('clipper_mfa');
|
|
2323
2366
|
}), catchError((_e) => {
|
|
2324
2367
|
return of([]);
|
|
2325
2368
|
}));
|
|
@@ -2333,10 +2376,10 @@ class ClipperService {
|
|
|
2333
2376
|
// Logged out
|
|
2334
2377
|
this.loggedIn.set(false);
|
|
2335
2378
|
this.loggingIn.set(false);
|
|
2336
|
-
// Notify
|
|
2337
|
-
this.broadcastService.sendMessage(ClipperMessages.LOGOUT_COMPLETED);
|
|
2338
2379
|
// Reset channels
|
|
2339
2380
|
this.availableChannels.set([]);
|
|
2381
|
+
// Notify
|
|
2382
|
+
this.broadcastService.sendMessage(ClipperMessages.LOGOUT_COMPLETED);
|
|
2340
2383
|
}
|
|
2341
2384
|
/**
|
|
2342
2385
|
* Clear login data
|
|
@@ -3082,10 +3125,10 @@ class ClipperService {
|
|
|
3082
3125
|
downloadArchiveFile(id, otp) {
|
|
3083
3126
|
return this.httpClient.get(this._serviceUri + '/archive/files/download/?id=' + id + '&otp=' + (otp ?? ''), { responseType: 'blob' });
|
|
3084
3127
|
}
|
|
3085
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.2.
|
|
3086
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.2.
|
|
3128
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.2.3", ngImport: i0, type: ClipperService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
3129
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.2.3", ngImport: i0, type: ClipperService, providedIn: 'root' }); }
|
|
3087
3130
|
}
|
|
3088
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.2.
|
|
3131
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.2.3", ngImport: i0, type: ClipperService, decorators: [{
|
|
3089
3132
|
type: Injectable,
|
|
3090
3133
|
args: [{
|
|
3091
3134
|
providedIn: 'root',
|
|
@@ -3178,19 +3221,19 @@ class ClipperAuthInterceptor {
|
|
|
3178
3221
|
}
|
|
3179
3222
|
return request;
|
|
3180
3223
|
}
|
|
3181
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.2.
|
|
3182
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.2.
|
|
3224
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.2.3", ngImport: i0, type: ClipperAuthInterceptor, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
3225
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.2.3", ngImport: i0, type: ClipperAuthInterceptor }); }
|
|
3183
3226
|
}
|
|
3184
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.2.
|
|
3227
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.2.3", ngImport: i0, type: ClipperAuthInterceptor, decorators: [{
|
|
3185
3228
|
type: Injectable
|
|
3186
3229
|
}] });
|
|
3187
3230
|
|
|
3188
3231
|
class ArsClipperCommonModule {
|
|
3189
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.2.
|
|
3190
|
-
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "20.2.
|
|
3191
|
-
static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "20.2.
|
|
3232
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.2.3", ngImport: i0, type: ArsClipperCommonModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
|
|
3233
|
+
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "20.2.3", ngImport: i0, type: ArsClipperCommonModule }); }
|
|
3234
|
+
static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "20.2.3", ngImport: i0, type: ArsClipperCommonModule }); }
|
|
3192
3235
|
}
|
|
3193
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.2.
|
|
3236
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.2.3", ngImport: i0, type: ArsClipperCommonModule, decorators: [{
|
|
3194
3237
|
type: NgModule
|
|
3195
3238
|
}] });
|
|
3196
3239
|
|