oip-common 0.1.8 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/assets/i18n/iframe-module.en.json +10 -0
- package/assets/i18n/iframe-module.ru.json +10 -0
- package/fesm2022/oip-common.mjs +217 -67
- package/fesm2022/oip-common.mjs.map +1 -1
- package/index.d.ts +122 -103
- package/package.json +1 -1
package/index.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import { OnInit,
|
|
2
|
+
import { OnDestroy, OnInit, DestroyRef, WritableSignal, OnChanges, SimpleChanges, Type, Provider, InjectionToken, EventEmitter, Renderer2, EnvironmentProviders, PipeTransform } from '@angular/core';
|
|
3
3
|
import { MessageService, ToastMessageOptions, MenuItem, ConfirmationService, FilterMetadata } from 'primeng/api';
|
|
4
4
|
import { ActivatedRoute, QueryParamsHandling, IsActiveMatchOptions, Params, Router, UrlTree } from '@angular/router';
|
|
5
5
|
import { InterpolationParameters, Translation, TranslationObject, TranslateService } from '@ngx-translate/core';
|
|
6
6
|
import * as rxjs from 'rxjs';
|
|
7
|
-
import {
|
|
7
|
+
import { Observable, BehaviorSubject, Subscription, Subject } from 'rxjs';
|
|
8
8
|
import { LoginResponse, AuthOptions, OidcSecurityService, LogoutAuthOptions, AbstractSecurityStorage, StsConfigHttpLoader } from 'angular-auth-oidc-client';
|
|
9
9
|
import { ContextMenu } from 'primeng/contextmenu';
|
|
10
10
|
import { PaletteDesignToken, Preset } from '@primeuix/themes/types';
|
|
@@ -228,6 +228,105 @@ interface SecurityDto {
|
|
|
228
228
|
roles: string[];
|
|
229
229
|
}
|
|
230
230
|
|
|
231
|
+
interface PutSecurityDto {
|
|
232
|
+
id: number;
|
|
233
|
+
securities: SecurityDto[];
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
declare class SecurityDataService extends BaseDataService {
|
|
237
|
+
getSecurity(controller: string, id: number): Promise<SecurityDto[]>;
|
|
238
|
+
saveSecurity(controller: string, request: PutSecurityDto): Promise<any>;
|
|
239
|
+
getRealmRoles(): Promise<string[]>;
|
|
240
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<SecurityDataService, never>;
|
|
241
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<SecurityDataService>;
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
declare abstract class SecurityService {
|
|
245
|
+
abstract auth(): void;
|
|
246
|
+
abstract logout(): void;
|
|
247
|
+
abstract isAuthenticated(): Observable<boolean>;
|
|
248
|
+
abstract getAccessToken(): Observable<string>;
|
|
249
|
+
abstract isTokenExpired(): Observable<boolean>;
|
|
250
|
+
abstract getCurrentUser(): any;
|
|
251
|
+
abstract getCurrentUser$(): Observable<any>;
|
|
252
|
+
abstract forceRefreshSession(): Observable<LoginResponse>;
|
|
253
|
+
abstract isAdmin(): boolean;
|
|
254
|
+
abstract authorize(configId?: string, authOptions?: AuthOptions): void;
|
|
255
|
+
abstract payload: BehaviorSubject<any>;
|
|
256
|
+
}
|
|
257
|
+
/**
|
|
258
|
+
* SecurityService extends OidcSecurityService to manage authentication,
|
|
259
|
+
* token handling, and user role access in an Angular application.
|
|
260
|
+
*
|
|
261
|
+
* It provides helper methods for checking authentication, managing tokens,
|
|
262
|
+
* determining user roles, and performing logout and refresh operations.
|
|
263
|
+
*/
|
|
264
|
+
declare class KeycloakSecurityService extends OidcSecurityService implements OnDestroy, SecurityService {
|
|
265
|
+
/**
|
|
266
|
+
* Handles angular OIDC events.
|
|
267
|
+
*/
|
|
268
|
+
private readonly publicEventsService;
|
|
269
|
+
/**
|
|
270
|
+
* Stores the latest login response from checkAuth().
|
|
271
|
+
*/
|
|
272
|
+
loginResponse: BehaviorSubject<LoginResponse>;
|
|
273
|
+
/**
|
|
274
|
+
* Stores the decoded access token payload.
|
|
275
|
+
*/
|
|
276
|
+
readonly payload: BehaviorSubject<any>;
|
|
277
|
+
/**
|
|
278
|
+
* Stores user-specific data from the login response.
|
|
279
|
+
*/
|
|
280
|
+
private readonly currentUser;
|
|
281
|
+
/**
|
|
282
|
+
* Emits access token updates from initial auth check, manual refresh,
|
|
283
|
+
* and library authentication events.
|
|
284
|
+
*/
|
|
285
|
+
private accessToken;
|
|
286
|
+
/**
|
|
287
|
+
* Initializes service and subscribes to authentication events.
|
|
288
|
+
* When a 'NewAuthenticationResult' event is received, the `auth` method is called.
|
|
289
|
+
*/
|
|
290
|
+
constructor();
|
|
291
|
+
getCurrentUser(): any;
|
|
292
|
+
getCurrentUser$(): Observable<any>;
|
|
293
|
+
/**
|
|
294
|
+
* Returns the ID token for the sign-in.
|
|
295
|
+
* @returns A string with the id token.
|
|
296
|
+
*/
|
|
297
|
+
getAccessToken(configId?: string): Observable<string>;
|
|
298
|
+
/**
|
|
299
|
+
* Indicates whether the current user has the 'admin' role.
|
|
300
|
+
*
|
|
301
|
+
* @returns {boolean} True if the user is an admin, false otherwise.
|
|
302
|
+
*/
|
|
303
|
+
isAdmin(): boolean;
|
|
304
|
+
/**
|
|
305
|
+
* Initiates authentication check and updates login response, user data,
|
|
306
|
+
* and decoded token payload if authenticated.
|
|
307
|
+
*/
|
|
308
|
+
auth(): void;
|
|
309
|
+
/**
|
|
310
|
+
* Performs logout and clears the local token payload.
|
|
311
|
+
*
|
|
312
|
+
* @param {string} [configId] Optional configuration ID for logout.
|
|
313
|
+
* @param {LogoutAuthOptions} [logoutAuthOptions] Optional logout options.
|
|
314
|
+
*/
|
|
315
|
+
logout(configId?: string, logoutAuthOptions?: LogoutAuthOptions): void;
|
|
316
|
+
/**
|
|
317
|
+
* Completes the BehaviorSubjects when the service is destroyed to avoid memory leaks.
|
|
318
|
+
*/
|
|
319
|
+
ngOnDestroy(): void;
|
|
320
|
+
/**
|
|
321
|
+
* Checks whether the current access token is expired based on the 'exp' claim.
|
|
322
|
+
*
|
|
323
|
+
* @returns {Observable<boolean>} Observable that emits true if the token is expired.
|
|
324
|
+
*/
|
|
325
|
+
isTokenExpired(): Observable<boolean>;
|
|
326
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<KeycloakSecurityService, never>;
|
|
327
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<KeycloakSecurityService>;
|
|
328
|
+
}
|
|
329
|
+
|
|
231
330
|
declare abstract class BaseModuleComponent<TBackendStoreSettings, TLocalStoreSettings> implements OnInit, OnDestroy {
|
|
232
331
|
private static readonly readRight;
|
|
233
332
|
private static readonly editRight;
|
|
@@ -235,9 +334,9 @@ declare abstract class BaseModuleComponent<TBackendStoreSettings, TLocalStoreSet
|
|
|
235
334
|
private isInitialized;
|
|
236
335
|
private moduleInstanceReloadPromise;
|
|
237
336
|
private rightsSubscription?;
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
337
|
+
protected readonly destroyRef: DestroyRef;
|
|
338
|
+
protected readonly securityDataService: SecurityDataService;
|
|
339
|
+
protected readonly securityService: SecurityService;
|
|
241
340
|
/**
|
|
242
341
|
* Provide access to app settings
|
|
243
342
|
*/
|
|
@@ -419,92 +518,6 @@ declare class SecurityComponent implements OnChanges, OnInit, OnDestroy {
|
|
|
419
518
|
static ɵcmp: i0.ɵɵComponentDeclaration<SecurityComponent, "security", never, { "id": { "alias": "id"; "required": false; }; "controller": { "alias": "controller"; "required": false; }; }, {}, never, never, true, never>;
|
|
420
519
|
}
|
|
421
520
|
|
|
422
|
-
declare abstract class SecurityService {
|
|
423
|
-
abstract auth(): void;
|
|
424
|
-
abstract logout(): void;
|
|
425
|
-
abstract isAuthenticated(): Observable<boolean>;
|
|
426
|
-
abstract getAccessToken(): Observable<string>;
|
|
427
|
-
abstract isTokenExpired(): Observable<boolean>;
|
|
428
|
-
abstract getCurrentUser(): any;
|
|
429
|
-
abstract getCurrentUser$(): Observable<any>;
|
|
430
|
-
abstract forceRefreshSession(): Observable<LoginResponse>;
|
|
431
|
-
abstract isAdmin(): boolean;
|
|
432
|
-
abstract authorize(configId?: string, authOptions?: AuthOptions): void;
|
|
433
|
-
abstract payload: BehaviorSubject<any>;
|
|
434
|
-
}
|
|
435
|
-
/**
|
|
436
|
-
* SecurityService extends OidcSecurityService to manage authentication,
|
|
437
|
-
* token handling, and user role access in an Angular application.
|
|
438
|
-
*
|
|
439
|
-
* It provides helper methods for checking authentication, managing tokens,
|
|
440
|
-
* determining user roles, and performing logout and refresh operations.
|
|
441
|
-
*/
|
|
442
|
-
declare class KeycloakSecurityService extends OidcSecurityService implements OnDestroy, SecurityService {
|
|
443
|
-
/**
|
|
444
|
-
* Handles angular OIDC events.
|
|
445
|
-
*/
|
|
446
|
-
private readonly publicEventsService;
|
|
447
|
-
/**
|
|
448
|
-
* Stores the latest login response from checkAuth().
|
|
449
|
-
*/
|
|
450
|
-
loginResponse: BehaviorSubject<LoginResponse>;
|
|
451
|
-
/**
|
|
452
|
-
* Stores the decoded access token payload.
|
|
453
|
-
*/
|
|
454
|
-
readonly payload: BehaviorSubject<any>;
|
|
455
|
-
/**
|
|
456
|
-
* Stores user-specific data from the login response.
|
|
457
|
-
*/
|
|
458
|
-
private readonly currentUser;
|
|
459
|
-
/**
|
|
460
|
-
* Emits access token updates from initial auth check, manual refresh,
|
|
461
|
-
* and library authentication events.
|
|
462
|
-
*/
|
|
463
|
-
private accessToken;
|
|
464
|
-
/**
|
|
465
|
-
* Initializes service and subscribes to authentication events.
|
|
466
|
-
* When a 'NewAuthenticationResult' event is received, the `auth` method is called.
|
|
467
|
-
*/
|
|
468
|
-
constructor();
|
|
469
|
-
getCurrentUser(): any;
|
|
470
|
-
getCurrentUser$(): Observable<any>;
|
|
471
|
-
/**
|
|
472
|
-
* Returns the ID token for the sign-in.
|
|
473
|
-
* @returns A string with the id token.
|
|
474
|
-
*/
|
|
475
|
-
getAccessToken(configId?: string): Observable<string>;
|
|
476
|
-
/**
|
|
477
|
-
* Indicates whether the current user has the 'admin' role.
|
|
478
|
-
*
|
|
479
|
-
* @returns {boolean} True if the user is an admin, false otherwise.
|
|
480
|
-
*/
|
|
481
|
-
isAdmin(): boolean;
|
|
482
|
-
/**
|
|
483
|
-
* Initiates authentication check and updates login response, user data,
|
|
484
|
-
* and decoded token payload if authenticated.
|
|
485
|
-
*/
|
|
486
|
-
auth(): void;
|
|
487
|
-
/**
|
|
488
|
-
* Performs logout and clears the local token payload.
|
|
489
|
-
*
|
|
490
|
-
* @param {string} [configId] Optional configuration ID for logout.
|
|
491
|
-
* @param {LogoutAuthOptions} [logoutAuthOptions] Optional logout options.
|
|
492
|
-
*/
|
|
493
|
-
logout(configId?: string, logoutAuthOptions?: LogoutAuthOptions): void;
|
|
494
|
-
/**
|
|
495
|
-
* Completes the BehaviorSubjects when the service is destroyed to avoid memory leaks.
|
|
496
|
-
*/
|
|
497
|
-
ngOnDestroy(): void;
|
|
498
|
-
/**
|
|
499
|
-
* Checks whether the current access token is expired based on the 'exp' claim.
|
|
500
|
-
*
|
|
501
|
-
* @returns {Observable<boolean>} Observable that emits true if the token is expired.
|
|
502
|
-
*/
|
|
503
|
-
isTokenExpired(): Observable<boolean>;
|
|
504
|
-
static ɵfac: i0.ɵɵFactoryDeclaration<KeycloakSecurityService, never>;
|
|
505
|
-
static ɵprov: i0.ɵɵInjectableDeclaration<KeycloakSecurityService>;
|
|
506
|
-
}
|
|
507
|
-
|
|
508
521
|
/**
|
|
509
522
|
* UserService is responsible for retrieving and handling user-related data,
|
|
510
523
|
* including the user's photo and short label for avatar display.
|
|
@@ -614,6 +627,9 @@ interface EditModuleInstanceDto {
|
|
|
614
627
|
*/
|
|
615
628
|
moduleId?: number | null;
|
|
616
629
|
}
|
|
630
|
+
interface IframeModuleSettings {
|
|
631
|
+
url?: string | null;
|
|
632
|
+
}
|
|
617
633
|
/** Represents a key-value pair where the key is an integer and the value is a string. */
|
|
618
634
|
interface IntKeyValueDto {
|
|
619
635
|
/** @format int32 */
|
|
@@ -1453,17 +1469,20 @@ declare class DiscussionComponent implements OnChanges, OnDestroy, OnInit {
|
|
|
1453
1469
|
static ɵcmp: i0.ɵɵComponentDeclaration<DiscussionComponent, "discussion", never, { "objectTypeId": { "alias": "objectTypeId"; "required": true; }; "objectId": { "alias": "objectId"; "required": true; }; }, {}, never, never, true, never>;
|
|
1454
1470
|
}
|
|
1455
1471
|
|
|
1456
|
-
|
|
1457
|
-
|
|
1458
|
-
|
|
1459
|
-
|
|
1460
|
-
|
|
1461
|
-
|
|
1462
|
-
|
|
1463
|
-
|
|
1464
|
-
|
|
1465
|
-
|
|
1466
|
-
|
|
1472
|
+
declare class IframeModuleComponent extends BaseModuleComponent<IframeModuleSettings, IframeModuleSettings> implements OnInit, OnDestroy {
|
|
1473
|
+
private iframe?;
|
|
1474
|
+
private readonly renderer;
|
|
1475
|
+
private readonly translate;
|
|
1476
|
+
protected iframeUrl: string | null;
|
|
1477
|
+
constructor();
|
|
1478
|
+
private set iframeElement(value);
|
|
1479
|
+
private setIframeUrl;
|
|
1480
|
+
private isAllowedIframeUrl;
|
|
1481
|
+
protected onModuleInstanceChange(): Promise<void>;
|
|
1482
|
+
private updateIframeSrc;
|
|
1483
|
+
onIframeError(): void;
|
|
1484
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<IframeModuleComponent, never>;
|
|
1485
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<IframeModuleComponent, "ng-component", never, {}, {}, never, never, true, never>;
|
|
1467
1486
|
}
|
|
1468
1487
|
|
|
1469
1488
|
/**
|
|
@@ -1589,5 +1608,5 @@ declare class SecurePipe implements PipeTransform {
|
|
|
1589
1608
|
*/
|
|
1590
1609
|
declare const httpLoaderAuthFactory: (httpClient: HttpClient$1) => StsConfigHttpLoader;
|
|
1591
1610
|
|
|
1592
|
-
export { APP_THEME_PRESETS, APP_THEME_PRESETS_MERGE_MODE, AppConfiguratorComponent, AppFloatingConfiguratorComponent, AppLayoutComponent, AppModulesComponent, AppTopbar, AuthGuardService, BaseDataService, BaseModuleComponent, ConfigComponent, ContentType, DEFAULT_OIP_FRONTEND_CONFIG, DbMigrationComponent, DiscussionComponent, ErrorComponent, FooterComponent, HttpClient, KeycloakSecurityService, L10nService, LOGO_COMPONENT_TOKEN, LayoutService, LogoComponent, LogoService, MenuComponent, MenuService, MsgService, NotfoundComponent, NotificationService, OIP_FRONTEND_CONFIG, ProfileComponent, SecurePipe, SecurityComponent, SecurityDataService, SecurityService, SecurityStorageService, SidebarComponent, TableFilterService, TopBarService, UnauthorizedComponent, UserService, httpLoaderAuthFactory, langIntercept, mergeWithDefaults, provideAppThemes, provideLogoComponent, replaceDefaults };
|
|
1611
|
+
export { APP_THEME_PRESETS, APP_THEME_PRESETS_MERGE_MODE, AppConfiguratorComponent, AppFloatingConfiguratorComponent, AppLayoutComponent, AppModulesComponent, AppTopbar, AuthGuardService, BaseDataService, BaseModuleComponent, ConfigComponent, ContentType, DEFAULT_OIP_FRONTEND_CONFIG, DbMigrationComponent, DiscussionComponent, ErrorComponent, FooterComponent, HttpClient, IframeModuleComponent, KeycloakSecurityService, L10nService, LOGO_COMPONENT_TOKEN, LayoutService, LogoComponent, LogoService, MenuComponent, MenuService, MsgService, NotfoundComponent, NotificationService, OIP_FRONTEND_CONFIG, ProfileComponent, SecurePipe, SecurityComponent, SecurityDataService, SecurityService, SecurityStorageService, SidebarComponent, TableFilterService, TopBarService, UnauthorizedComponent, UserService, httpLoaderAuthFactory, langIntercept, mergeWithDefaults, provideAppThemes, provideLogoComponent, replaceDefaults };
|
|
1593
1612
|
export type { AppConfig, AppThemePreset, AppThemePresetMergeMode, LanguageDto, MenuChangeEvent, NoSettingsDto, OipFrontendAppMode, OipFrontendConfig, PutSecurityDto, RequestParams, SecurityDto, TopBarDto };
|