oip-common 0.0.13 → 0.0.14
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/fesm2022/oip-common.mjs +3 -12
- package/fesm2022/oip-common.mjs.map +1 -1
- package/index.d.ts +68 -2
- package/package.json +1 -1
package/index.d.ts
CHANGED
|
@@ -5,7 +5,7 @@ import { ActivatedRoute, QueryParamsHandling, IsActiveMatchOptions, Params, Rout
|
|
|
5
5
|
import { TranslateService } from '@ngx-translate/core';
|
|
6
6
|
import * as rxjs from 'rxjs';
|
|
7
7
|
import { Subject, Observable, Subscription } from 'rxjs';
|
|
8
|
-
import { LoginResponse, AuthOptions, AbstractSecurityStorage, StsConfigHttpLoader } from 'angular-auth-oidc-client';
|
|
8
|
+
import { LoginResponse, AuthOptions, OidcSecurityService, LogoutAuthOptions, AbstractSecurityStorage, StsConfigHttpLoader } from 'angular-auth-oidc-client';
|
|
9
9
|
import { ContextMenu } from 'primeng/contextmenu';
|
|
10
10
|
import { PrimeNG } from 'primeng/config';
|
|
11
11
|
import { HttpInterceptorFn, HttpClient as HttpClient$1 } from '@angular/common/http';
|
|
@@ -326,6 +326,72 @@ declare abstract class SecurityService {
|
|
|
326
326
|
abstract isAdmin(): boolean;
|
|
327
327
|
abstract authorize(configId?: string, authOptions?: AuthOptions): void;
|
|
328
328
|
}
|
|
329
|
+
/**
|
|
330
|
+
* SecurityService extends OidcSecurityService to manage authentication,
|
|
331
|
+
* token handling, and user role access in an Angular application.
|
|
332
|
+
*
|
|
333
|
+
* It provides helper methods for checking authentication, managing tokens,
|
|
334
|
+
* determining user roles, and performing logout and refresh operations.
|
|
335
|
+
*/
|
|
336
|
+
declare class KeycloakSecurityService extends OidcSecurityService implements OnDestroy, SecurityService {
|
|
337
|
+
/**
|
|
338
|
+
* Handles angular OIDC events.
|
|
339
|
+
*/
|
|
340
|
+
private readonly publicEventsService;
|
|
341
|
+
/**
|
|
342
|
+
* Stores the latest login response from checkAuth().
|
|
343
|
+
*/
|
|
344
|
+
private loginResponse;
|
|
345
|
+
/**
|
|
346
|
+
* Stores the decoded access token payload.
|
|
347
|
+
*/
|
|
348
|
+
private payload;
|
|
349
|
+
/**
|
|
350
|
+
* Stores user-specific data from the login response.
|
|
351
|
+
*/
|
|
352
|
+
userData: any;
|
|
353
|
+
/**
|
|
354
|
+
* Initializes service and subscribes to authentication events.
|
|
355
|
+
* When a 'NewAuthenticationResult' event is received, the `auth` method is called.
|
|
356
|
+
*/
|
|
357
|
+
constructor();
|
|
358
|
+
getCurrentUser(): any;
|
|
359
|
+
/**
|
|
360
|
+
* Returns the ID token for the sign-in.
|
|
361
|
+
* @returns A string with the id token.
|
|
362
|
+
*/
|
|
363
|
+
getAccessToken(): Observable<string>;
|
|
364
|
+
/**
|
|
365
|
+
* Indicates whether the current user has the 'admin' role.
|
|
366
|
+
*
|
|
367
|
+
* @returns {boolean} True if the user is an admin, false otherwise.
|
|
368
|
+
*/
|
|
369
|
+
isAdmin(): boolean;
|
|
370
|
+
/**
|
|
371
|
+
* Initiates authentication check and updates login response, user data,
|
|
372
|
+
* and decoded token payload if authenticated.
|
|
373
|
+
*/
|
|
374
|
+
auth(): void;
|
|
375
|
+
/**
|
|
376
|
+
* Performs logout and clears the local token payload.
|
|
377
|
+
*
|
|
378
|
+
* @param {string} [configId] Optional configuration ID for logout.
|
|
379
|
+
* @param {LogoutAuthOptions} [logoutAuthOptions] Optional logout options.
|
|
380
|
+
*/
|
|
381
|
+
logout(configId?: string, logoutAuthOptions?: LogoutAuthOptions): void;
|
|
382
|
+
/**
|
|
383
|
+
* Completes the BehaviorSubjects when the service is destroyed to avoid memory leaks.
|
|
384
|
+
*/
|
|
385
|
+
ngOnDestroy(): void;
|
|
386
|
+
/**
|
|
387
|
+
* Checks whether the current access token is expired based on the 'exp' claim.
|
|
388
|
+
*
|
|
389
|
+
* @returns {Observable<boolean>} Observable that emits true if the token is expired.
|
|
390
|
+
*/
|
|
391
|
+
isTokenExpired(): Observable<boolean>;
|
|
392
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<KeycloakSecurityService, never>;
|
|
393
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<KeycloakSecurityService>;
|
|
394
|
+
}
|
|
329
395
|
|
|
330
396
|
/**
|
|
331
397
|
* UserService is responsible for retrieving and handling user-related data,
|
|
@@ -1068,5 +1134,5 @@ declare class SecurePipe implements PipeTransform {
|
|
|
1068
1134
|
*/
|
|
1069
1135
|
declare const httpLoaderAuthFactory: (httpClient: HttpClient$1) => StsConfigHttpLoader;
|
|
1070
1136
|
|
|
1071
|
-
export { AppConfiguratorComponent, AppFloatingConfiguratorComponent, AppLayoutComponent, AppModulesComponent, AppTopbar, AuthGuardService, BaseDataService, BaseModuleComponent, ConfigComponent, DbMigrationComponent, ErrorComponent, FooterComponent, LayoutService, LogoComponent, MenuComponent, MenuService, MsgService, NotfoundComponent, ProfileComponent, SecurePipe, SecurityComponent, SecurityDataService, SecurityService, SecurityStorageService, SidebarComponent, TopBarService, UnauthorizedComponent, UserService, httpLoaderAuthFactory, langIntercept };
|
|
1137
|
+
export { AppConfiguratorComponent, AppFloatingConfiguratorComponent, AppLayoutComponent, AppModulesComponent, AppTopbar, AuthGuardService, BaseDataService, BaseModuleComponent, ConfigComponent, DbMigrationComponent, ErrorComponent, FooterComponent, KeycloakSecurityService, LayoutService, LogoComponent, MenuComponent, MenuService, MsgService, NotfoundComponent, ProfileComponent, SecurePipe, SecurityComponent, SecurityDataService, SecurityService, SecurityStorageService, SidebarComponent, TopBarService, UnauthorizedComponent, UserService, httpLoaderAuthFactory, langIntercept };
|
|
1072
1138
|
export type { AppConfig, MenuChangeEvent, NoSettingsDto, PutSecurityDto, SecurityDto, TopBarDto };
|