common-header-lib 0.20.10 → 0.20.12
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/README.md +119 -2
- package/fesm2022/common-header-lib.mjs +332 -28
- package/fesm2022/common-header-lib.mjs.map +1 -1
- package/index.d.ts +62 -1
- package/package.json +1 -1
package/index.d.ts
CHANGED
|
@@ -578,4 +578,65 @@ declare class ToastMsgService {
|
|
|
578
578
|
|
|
579
579
|
declare const httpErrorInterceptor: HttpInterceptorFn;
|
|
580
580
|
|
|
581
|
-
|
|
581
|
+
declare class SessionEndService {
|
|
582
|
+
private readonly http;
|
|
583
|
+
private ending;
|
|
584
|
+
/** The cookiesUpdation payload: delete ('d') all cookies ('-100'). Unchanged from before. */
|
|
585
|
+
private readonly deleteAllCookiesPayload;
|
|
586
|
+
/**
|
|
587
|
+
* The session has expired: delete the server-side cookies, clear the browser storage and send
|
|
588
|
+
* the user where their sign-in method allows (see readSessionEndAction).
|
|
589
|
+
*
|
|
590
|
+
* Called by the host application - its HTTP interceptor (302 / 401 / 419, missing token) and
|
|
591
|
+
* its 403 error page. Safe to call more than once; only the first call does anything.
|
|
592
|
+
*/
|
|
593
|
+
endSession(): void;
|
|
594
|
+
/**
|
|
595
|
+
* Sends the user where a cookiesUpdation / logout `result` says:
|
|
596
|
+
* the login page for loginMethod 1, the logout screen with `?mode=windowsAuth` /
|
|
597
|
+
* `?mode=defaultIdp` for 2 / 3. Without a valid loginMethod (always the case for the logout
|
|
598
|
+
* API's result) `identity`, then `ssoDefaultLogin` decide, else the login page - see
|
|
599
|
+
* readSessionEndAction.
|
|
600
|
+
*
|
|
601
|
+
* Used by endSession() and by the header's Logout button.
|
|
602
|
+
*/
|
|
603
|
+
redirect(result: any): void;
|
|
604
|
+
/**
|
|
605
|
+
* Leaves the page. A full page load (not router navigation) on purpose: the login and logout
|
|
606
|
+
* screens are served at the origin root, not inside the host application, so a router path
|
|
607
|
+
* like '/logout' would land on the host's page-not-found.
|
|
608
|
+
* Public only so tests can replace it - a real navigation would unload the test runner.
|
|
609
|
+
*/
|
|
610
|
+
navigate(url: string): void;
|
|
611
|
+
private origin;
|
|
612
|
+
private clearStorage;
|
|
613
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<SessionEndService, never>;
|
|
614
|
+
static ɵprov: _angular_core.ɵɵInjectableDeclaration<SessionEndService>;
|
|
615
|
+
}
|
|
616
|
+
|
|
617
|
+
/** Where the user has to go once their session has ended. */
|
|
618
|
+
type SessionEndAction = 'login' | 'windowsAuth' | 'defaultIdp';
|
|
619
|
+
/**
|
|
620
|
+
* Reads where to send the user from a cookiesUpdation / logout `result`.
|
|
621
|
+
*
|
|
622
|
+
* Rules (all four matter):
|
|
623
|
+
* 1. `loginMethod` is read first - it is the more precise signal.
|
|
624
|
+
* 2. An unrecognised `loginMethod` (e.g. a 4th method this build does not know) falls through to
|
|
625
|
+
* the legacy booleans, NOT to the login page - the booleans are still a better answer.
|
|
626
|
+
* 3. The login page is the floor - what a tenant with no special sign-in method always had.
|
|
627
|
+
* 4. `0` is not a value and a numeric string is (see toEnumValue).
|
|
628
|
+
*/
|
|
629
|
+
declare function readSessionEndAction(result: any): SessionEndAction;
|
|
630
|
+
/**
|
|
631
|
+
* The login page of the host. `origin` is the page's own origin (never a URL from an API
|
|
632
|
+
* response - that would be an open redirect).
|
|
633
|
+
*/
|
|
634
|
+
declare function loginPageUrl(origin: string): string;
|
|
635
|
+
/**
|
|
636
|
+
* The logout screen for a mode that must not go to the login page. Built from the page's own
|
|
637
|
+
* origin and the route constant - never from a URL in the API response (open redirect).
|
|
638
|
+
*/
|
|
639
|
+
declare function logoutScreenUrl(origin: string, mode: Exclude<SessionEndAction, 'login'>): string;
|
|
640
|
+
|
|
641
|
+
export { COOKIECONSTANT, CommonHeaderLibComponent, CommonHeaderLibModule, ConfirmDialogComponent, CustomDateFormatPipe, DateDiffPipe, GlobalConstants, SessionEndService, SliceToTwoPipe, StorageService, ToastMsgService, ViewpasswordPopupComponent, httpErrorInterceptor, loginPageUrl, logoutScreenUrl, readSessionEndAction };
|
|
642
|
+
export type { SessionEndAction };
|