@odx/auth 17.2.1 → 18.0.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/CHANGELOG.md +82 -0
- package/fesm2022/odx-auth-plugins-service-connect.mjs +3 -3
- package/fesm2022/odx-auth-plugins-service-connect.mjs.map +1 -1
- package/fesm2022/odx-auth.mjs +42 -42
- package/fesm2022/odx-auth.mjs.map +1 -1
- package/index.d.ts +744 -15
- package/package.json +4 -8
- package/plugins/service-connect/index.d.ts +184 -8
- package/esm2022/index.mjs +0 -16
- package/esm2022/lib/auth.component.mjs +0 -50
- package/esm2022/lib/auth.config.mjs +0 -71
- package/esm2022/lib/auth.directive.mjs +0 -51
- package/esm2022/lib/auth.guard.mjs +0 -44
- package/esm2022/lib/auth.i18n.mjs +0 -13
- package/esm2022/lib/auth.interceptor.mjs +0 -23
- package/esm2022/lib/auth.logger.mjs +0 -3
- package/esm2022/lib/auth.module.mjs +0 -19
- package/esm2022/lib/auth.providers.mjs +0 -136
- package/esm2022/lib/auth.service.mjs +0 -317
- package/esm2022/lib/auth.typings.mjs +0 -2
- package/esm2022/lib/components/auth-actions/auth-actions.component.mjs +0 -40
- package/esm2022/lib/components/auth-loading-screen/auth-loading-screen.component.mjs +0 -53
- package/esm2022/lib/components/index.mjs +0 -3
- package/esm2022/lib/directives/auth-action.directive.mjs +0 -30
- package/esm2022/lib/directives/index.mjs +0 -4
- package/esm2022/lib/directives/sign-in.directive.mjs +0 -52
- package/esm2022/lib/directives/sign-out.directive.mjs +0 -50
- package/esm2022/lib/helpers/create-auth-host-url.mjs +0 -18
- package/esm2022/lib/helpers/create-inititals.mjs +0 -32
- package/esm2022/lib/helpers/handle-auth-error.mjs +0 -31
- package/esm2022/lib/helpers/handle-oauth-event.mjs +0 -13
- package/esm2022/lib/helpers/index.mjs +0 -9
- package/esm2022/lib/helpers/resolve-email.mjs +0 -34
- package/esm2022/lib/helpers/resolve-username.mjs +0 -38
- package/esm2022/lib/helpers/set-http-auth-header.mjs +0 -22
- package/esm2022/lib/helpers/user-language-loader.mjs +0 -17
- package/esm2022/lib/models/auth-environment.mjs +0 -3
- package/esm2022/lib/models/auth-plugin-manager.mjs +0 -49
- package/esm2022/lib/models/authorized-handler.mjs +0 -2
- package/esm2022/lib/models/index.mjs +0 -5
- package/esm2022/lib/models/offline-auth-error-handler.mjs +0 -7
- package/esm2022/lib/plugins/core-debug.plugin.mjs +0 -29
- package/esm2022/lib/plugins/core-identity.plugin.mjs +0 -20
- package/esm2022/lib/plugins/index.mjs +0 -4
- package/esm2022/lib/plugins/user-profile-link.plugin.mjs +0 -18
- package/esm2022/lib/unauth.guard.mjs +0 -38
- package/esm2022/odx-auth.mjs +0 -5
- package/esm2022/plugins/service-connect/index.mjs +0 -9
- package/esm2022/plugins/service-connect/lib/dtos/get-service-connect-rights-response.dto.mjs +0 -2
- package/esm2022/plugins/service-connect/lib/dtos/get-service-connect-user-response.dto.mjs +0 -2
- package/esm2022/plugins/service-connect/lib/dtos/index.mjs +0 -3
- package/esm2022/plugins/service-connect/lib/helpers/build-service-connect-url.mjs +0 -16
- package/esm2022/plugins/service-connect/lib/helpers/has-roles-or-rights-handler.mjs +0 -12
- package/esm2022/plugins/service-connect/lib/helpers/has-roles-or-rights.mjs +0 -11
- package/esm2022/plugins/service-connect/lib/helpers/index.mjs +0 -5
- package/esm2022/plugins/service-connect/lib/helpers/service-connect-plugin-factory.mjs +0 -25
- package/esm2022/plugins/service-connect/lib/service-connect-rights.directive.mjs +0 -44
- package/esm2022/plugins/service-connect/lib/service-connect-rights.guard.mjs +0 -15
- package/esm2022/plugins/service-connect/lib/service-connect-rights.plugin.mjs +0 -16
- package/esm2022/plugins/service-connect/lib/service-connect-user-language.plugin.mjs +0 -34
- package/esm2022/plugins/service-connect/lib/service-connect-user-profile.plugin.mjs +0 -28
- package/esm2022/plugins/service-connect/lib/service-connect.config.mjs +0 -17
- package/esm2022/plugins/service-connect/odx-auth-plugins-service-connect.mjs +0 -5
- package/lib/auth.component.d.ts +0 -20
- package/lib/auth.config.d.ts +0 -84
- package/lib/auth.directive.d.ts +0 -25
- package/lib/auth.guard.d.ts +0 -11
- package/lib/auth.i18n.d.ts +0 -3
- package/lib/auth.interceptor.d.ts +0 -10
- package/lib/auth.logger.d.ts +0 -3
- package/lib/auth.module.d.ts +0 -10
- package/lib/auth.providers.d.ts +0 -46
- package/lib/auth.service.d.ts +0 -206
- package/lib/auth.typings.d.ts +0 -27
- package/lib/components/auth-actions/auth-actions.component.d.ts +0 -16
- package/lib/components/auth-loading-screen/auth-loading-screen.component.d.ts +0 -24
- package/lib/components/index.d.ts +0 -2
- package/lib/directives/auth-action.directive.d.ts +0 -18
- package/lib/directives/index.d.ts +0 -3
- package/lib/directives/sign-in.directive.d.ts +0 -29
- package/lib/directives/sign-out.directive.d.ts +0 -28
- package/lib/helpers/create-auth-host-url.d.ts +0 -14
- package/lib/helpers/create-inititals.d.ts +0 -18
- package/lib/helpers/handle-auth-error.d.ts +0 -13
- package/lib/helpers/handle-oauth-event.d.ts +0 -11
- package/lib/helpers/index.d.ts +0 -8
- package/lib/helpers/resolve-email.d.ts +0 -21
- package/lib/helpers/resolve-username.d.ts +0 -22
- package/lib/helpers/set-http-auth-header.d.ts +0 -11
- package/lib/helpers/user-language-loader.d.ts +0 -11
- package/lib/models/auth-environment.d.ts +0 -6
- package/lib/models/auth-plugin-manager.d.ts +0 -21
- package/lib/models/authorized-handler.d.ts +0 -3
- package/lib/models/index.d.ts +0 -4
- package/lib/models/offline-auth-error-handler.d.ts +0 -2
- package/lib/plugins/core-debug.plugin.d.ts +0 -11
- package/lib/plugins/core-identity.plugin.d.ts +0 -18
- package/lib/plugins/index.d.ts +0 -3
- package/lib/plugins/user-profile-link.plugin.d.ts +0 -18
- package/lib/unauth.guard.d.ts +0 -11
- package/plugins/service-connect/lib/dtos/get-service-connect-rights-response.dto.d.ts +0 -3
- package/plugins/service-connect/lib/dtos/get-service-connect-user-response.dto.d.ts +0 -14
- package/plugins/service-connect/lib/dtos/index.d.ts +0 -2
- package/plugins/service-connect/lib/helpers/build-service-connect-url.d.ts +0 -10
- package/plugins/service-connect/lib/helpers/has-roles-or-rights-handler.d.ts +0 -10
- package/plugins/service-connect/lib/helpers/has-roles-or-rights.d.ts +0 -11
- package/plugins/service-connect/lib/helpers/index.d.ts +0 -4
- package/plugins/service-connect/lib/helpers/service-connect-plugin-factory.d.ts +0 -20
- package/plugins/service-connect/lib/service-connect-rights.directive.d.ts +0 -21
- package/plugins/service-connect/lib/service-connect-rights.guard.d.ts +0 -11
- package/plugins/service-connect/lib/service-connect-rights.plugin.d.ts +0 -18
- package/plugins/service-connect/lib/service-connect-user-language.plugin.d.ts +0 -24
- package/plugins/service-connect/lib/service-connect-user-profile.plugin.d.ts +0 -23
- package/plugins/service-connect/lib/service-connect.config.d.ts +0 -15
package/lib/auth.i18n.d.ts
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { HttpContextToken, HttpInterceptorFn } from '@angular/common/http';
|
|
2
|
-
export declare const requireAuthentication: HttpContextToken<boolean>;
|
|
3
|
-
/**
|
|
4
|
-
* Interceptor to handle authentication for HTTP requests.
|
|
5
|
-
*
|
|
6
|
-
* This interceptor checks if the request URL is allowed or if the request requires authentication.
|
|
7
|
-
* If the URL is not allowed and the request does not require authentication, it simply forwards the request.
|
|
8
|
-
* Otherwise, it prepares the authentication request using the AuthService.
|
|
9
|
-
*/
|
|
10
|
-
export declare const authInterceptor: HttpInterceptorFn;
|
package/lib/auth.logger.d.ts
DELETED
package/lib/auth.module.d.ts
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import * as i0 from "@angular/core";
|
|
2
|
-
import * as i1 from "./auth.component";
|
|
3
|
-
import * as i2 from "./auth.directive";
|
|
4
|
-
import * as i3 from "./directives/sign-in.directive";
|
|
5
|
-
import * as i4 from "./directives/sign-out.directive";
|
|
6
|
-
export declare class AuthModule {
|
|
7
|
-
static ɵfac: i0.ɵɵFactoryDeclaration<AuthModule, never>;
|
|
8
|
-
static ɵmod: i0.ɵɵNgModuleDeclaration<AuthModule, never, [typeof i1.AuthComponent, typeof i2.AuthDirective, typeof i3.SignInDirective, typeof i4.SignOutDirective], [typeof i1.AuthComponent, typeof i2.AuthDirective, typeof i3.SignInDirective, typeof i4.SignOutDirective]>;
|
|
9
|
-
static ɵinj: i0.ɵɵInjectorDeclaration<AuthModule>;
|
|
10
|
-
}
|
package/lib/auth.providers.d.ts
DELETED
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
import { EnvironmentProviders, InjectionToken, Provider } from '@angular/core';
|
|
2
|
-
import { ConfigDependencies, ConfigProvider } from '@odx/angular/utils';
|
|
3
|
-
import { AuthConfig, AuthErrorHandlerFn } from './auth.config';
|
|
4
|
-
import { AuthPlugin, AuthPluginErrorHandler, AuthPluginFactory } from './models';
|
|
5
|
-
export declare const ODX_AUTH_ERROR_HANDLERS: InjectionToken<AuthErrorHandlerFn[]>;
|
|
6
|
-
export declare const ODX_AUTH_PLUGINS_ERROR_HANDLER: InjectionToken<AuthPluginErrorHandler | null>;
|
|
7
|
-
export declare const ODX_AUTH_CORE_PLUGINS: InjectionToken<AuthPluginFactory[]>;
|
|
8
|
-
export declare const ODX_AUTH_PLUGINS: InjectionToken<AuthPlugin[]>;
|
|
9
|
-
/**
|
|
10
|
-
* Provides a logger for the authentication module.
|
|
11
|
-
*
|
|
12
|
-
* @returns {Provider} - The provider for the logger.
|
|
13
|
-
*/
|
|
14
|
-
export declare function provideAuthLogger(): Provider;
|
|
15
|
-
/**
|
|
16
|
-
* Initializes the authentication error handlers.
|
|
17
|
-
*/
|
|
18
|
-
export declare function initializeAuthErrorHandlers(): void;
|
|
19
|
-
/**
|
|
20
|
-
* Initializes the authentication configuration.
|
|
21
|
-
*
|
|
22
|
-
* @returns {() => Promise<void>} - A function that returns a promise resolving when the configuration is initialized.
|
|
23
|
-
*/
|
|
24
|
-
export declare function initalizeAuthConfig(): () => Promise<void>;
|
|
25
|
-
/**
|
|
26
|
-
* Provides the authentication configuration and dependencies.
|
|
27
|
-
*
|
|
28
|
-
* @param {ConfigProvider<Partial<AuthConfig>, D>} config - The configuration provider.
|
|
29
|
-
* @returns {EnvironmentProviders} The environment providers for authentication.
|
|
30
|
-
* @template D
|
|
31
|
-
*
|
|
32
|
-
* @example Provide the authentication configuration and dependencies
|
|
33
|
-
* ```ts
|
|
34
|
-
* providers: [
|
|
35
|
-
* provideAuth({
|
|
36
|
-
* useFactory: ({ environment, auth: { clientId, loadUserProfile } }: ApplicationEnvironment) => ({
|
|
37
|
-
* environment,
|
|
38
|
-
* clientId,
|
|
39
|
-
* loadUserProfile,
|
|
40
|
-
* }),
|
|
41
|
-
* deps: [APPLICATION_ENVIRONMENT],
|
|
42
|
-
* }),
|
|
43
|
-
* ],
|
|
44
|
-
* ```
|
|
45
|
-
*/
|
|
46
|
-
export declare function provideAuth<D extends ConfigDependencies>(config: ConfigProvider<Partial<AuthConfig>, D>): EnvironmentProviders;
|
package/lib/auth.service.d.ts
DELETED
|
@@ -1,206 +0,0 @@
|
|
|
1
|
-
import { HttpRequest } from '@angular/common/http';
|
|
2
|
-
import { AuthConfig, OAuthErrorEvent, TokenResponse } from 'angular-oauth2-oidc';
|
|
3
|
-
import { Observable } from 'rxjs';
|
|
4
|
-
import { AuthorizedHandler } from './models';
|
|
5
|
-
import * as i0 from "@angular/core";
|
|
6
|
-
/**
|
|
7
|
-
* The `AuthService` class provides authentication functionality for an Angular application.
|
|
8
|
-
* It handles OAuth2/OIDC authentication, token management, and user identity claims.
|
|
9
|
-
*
|
|
10
|
-
* Key responsibilities include:
|
|
11
|
-
* - Initializing authentication with a provided configuration.
|
|
12
|
-
* - Managing tokens (access, refresh, and ID tokens).
|
|
13
|
-
* - Checking and emitting authentication and authorization states.
|
|
14
|
-
* - Handling user login and logout flows.
|
|
15
|
-
* - Supporting silent refresh and offline authentication scenarios.
|
|
16
|
-
* - Integrating authentication plugins via `AuthPluginManager`.
|
|
17
|
-
*
|
|
18
|
-
* @example
|
|
19
|
-
* ```typescript
|
|
20
|
-
* // Injecting the AuthService
|
|
21
|
-
* constructor(private authService: AuthService) {}
|
|
22
|
-
*
|
|
23
|
-
* // Using the AuthService to initialize authentication
|
|
24
|
-
* async ngOnInit() {
|
|
25
|
-
* const config: AuthConfig = { clientId: 'your-client-id', discoveryUrl: 'https://example.com/.well-known/openid-configuration' };
|
|
26
|
-
* await this.authService.initialize(config);
|
|
27
|
-
* }
|
|
28
|
-
* ```
|
|
29
|
-
*/
|
|
30
|
-
export declare class AuthService {
|
|
31
|
-
private readonly authConfig;
|
|
32
|
-
private readonly authPluginManager;
|
|
33
|
-
private readonly oauthService;
|
|
34
|
-
private readonly router;
|
|
35
|
-
private readonly windowRef;
|
|
36
|
-
private readonly isInitialized$$;
|
|
37
|
-
private readonly isRedirecting$$;
|
|
38
|
-
private readonly onAccessTokenUpdate$;
|
|
39
|
-
private readonly silentRefreshHandler$;
|
|
40
|
-
private readonly onAuthStateChange$;
|
|
41
|
-
/**
|
|
42
|
-
* Emits `true` when the service has completed initialization.
|
|
43
|
-
* Emits `false` until the initialization is complete.
|
|
44
|
-
*
|
|
45
|
-
* @type {Observable<boolean>}
|
|
46
|
-
*/
|
|
47
|
-
readonly isInitialized$: Observable<true>;
|
|
48
|
-
/**
|
|
49
|
-
* Emits `true` when the user is being redirected to the login page.
|
|
50
|
-
* Emits `false` when there is no redirection in progress.
|
|
51
|
-
*
|
|
52
|
-
* @type {Observable<boolean>}
|
|
53
|
-
*/
|
|
54
|
-
readonly isRedirecting$: Observable<boolean>;
|
|
55
|
-
/**
|
|
56
|
-
* Emits `true` when the application is in a loading state (e.g., during redirection or plugin initialization).
|
|
57
|
-
* Emits `false` when there is no ongoing loading activity.
|
|
58
|
-
*
|
|
59
|
-
* @type {Observable<boolean>}
|
|
60
|
-
*/
|
|
61
|
-
readonly isLoading$: Observable<boolean>;
|
|
62
|
-
/**
|
|
63
|
-
* Emits `true` when the user is authenticated.
|
|
64
|
-
* Emits `false` when the user is not authenticated.
|
|
65
|
-
*
|
|
66
|
-
* @type {Observable<boolean>}
|
|
67
|
-
*/
|
|
68
|
-
readonly isAuthenticated$: Observable<boolean>;
|
|
69
|
-
/**
|
|
70
|
-
* Emits the identity claims of the authenticated user.
|
|
71
|
-
* If the user is not authenticated, emits `null`.
|
|
72
|
-
*
|
|
73
|
-
* @type {Observable<OdxAuth.IdentityClaims | null>}
|
|
74
|
-
*/
|
|
75
|
-
readonly identityClaims$: Observable<OdxAuth.IdentityClaims | null>;
|
|
76
|
-
/**
|
|
77
|
-
* Emits OAuth error events.
|
|
78
|
-
*
|
|
79
|
-
* @type {Observable<OAuthErrorEvent>}
|
|
80
|
-
*/
|
|
81
|
-
readonly errors$: Observable<OAuthErrorEvent>;
|
|
82
|
-
/**
|
|
83
|
-
* Emits events when an OAuth token is successfully received.
|
|
84
|
-
*
|
|
85
|
-
* @type {Observable<Event>}
|
|
86
|
-
*/
|
|
87
|
-
readonly onTokenReceived$: Observable<import("angular-oauth2-oidc").OAuthEvent>;
|
|
88
|
-
/**
|
|
89
|
-
* Emits whenever the `access_token` in local storage is updated or cleared.
|
|
90
|
-
* Provides an observable for tracking token updates.
|
|
91
|
-
*
|
|
92
|
-
* @type {Observable<StorageEvent | null>}
|
|
93
|
-
*/
|
|
94
|
-
get accessTokenUpdate$(): Observable<StorageEvent | null>;
|
|
95
|
-
constructor();
|
|
96
|
-
/**
|
|
97
|
-
* Initializes the authentication service with the provided configuration.
|
|
98
|
-
*
|
|
99
|
-
* @param {AuthConfig} config - The authentication configuration object.
|
|
100
|
-
* @returns {Promise<void>} Resolves when initialization is complete.
|
|
101
|
-
*/
|
|
102
|
-
initialize(config: AuthConfig): Promise<void>;
|
|
103
|
-
/**
|
|
104
|
-
* Runs all authentication plugins registered in the `AuthPluginManager`.
|
|
105
|
-
*/
|
|
106
|
-
runPlugins(): void;
|
|
107
|
-
/**
|
|
108
|
-
* Returns the issuer URL for the OAuth server.
|
|
109
|
-
*
|
|
110
|
-
* @returns {URL} The issuer URL.
|
|
111
|
-
*/
|
|
112
|
-
getIssuer(): URL;
|
|
113
|
-
/**
|
|
114
|
-
* Initiates the login flow for the user. Redirects to the login page.
|
|
115
|
-
*
|
|
116
|
-
* @param {string} [url] - The URL to redirect back to after login.
|
|
117
|
-
*/
|
|
118
|
-
signIn(url?: string): void;
|
|
119
|
-
/**
|
|
120
|
-
* Logs the user out and clears their tokens.
|
|
121
|
-
*
|
|
122
|
-
* @param {boolean} [noRedirect] - If `true`, no redirection occurs after logout.
|
|
123
|
-
*/
|
|
124
|
-
signOut(noRedirect?: boolean): void;
|
|
125
|
-
/**
|
|
126
|
-
* Attempts to refresh the user's tokens.
|
|
127
|
-
*
|
|
128
|
-
* @returns {Promise<TokenResponse>} Resolves with the new token response.
|
|
129
|
-
*/
|
|
130
|
-
refreshTokens(): Promise<TokenResponse>;
|
|
131
|
-
/**
|
|
132
|
-
* Retrieves the current access token, if available.
|
|
133
|
-
*
|
|
134
|
-
* @returns {string | null} The access token, or `null` if not available.
|
|
135
|
-
*/
|
|
136
|
-
getAccessToken(): string | null;
|
|
137
|
-
/**
|
|
138
|
-
* Retrieves the current refresh token, if available.
|
|
139
|
-
*
|
|
140
|
-
* @returns {string | null} The refresh token, or `null` if not available.
|
|
141
|
-
*/
|
|
142
|
-
getRefreshToken(): string | null;
|
|
143
|
-
/**
|
|
144
|
-
* Retrieves the current ID token, if available.
|
|
145
|
-
*
|
|
146
|
-
* @returns {string | null} The ID token, or `null` if not available.
|
|
147
|
-
*/
|
|
148
|
-
getIdToken(): string | null;
|
|
149
|
-
/**
|
|
150
|
-
* Retrieves the identity claims of the authenticated user.
|
|
151
|
-
*
|
|
152
|
-
* @returns {OdxAuth.IdentityClaims | null} The identity claims, or `null` if not available.
|
|
153
|
-
*/
|
|
154
|
-
getIdentityClaims(): OdxAuth.IdentityClaims | null;
|
|
155
|
-
/**
|
|
156
|
-
* Retrieves the raw identity claims of the authenticated user.
|
|
157
|
-
*
|
|
158
|
-
* @returns {OdxAuth.RawIdentityClaims | null} The raw identity claims, or `null` if not available.
|
|
159
|
-
*/
|
|
160
|
-
getRawIdentityClaims(): OdxAuth.RawIdentityClaims | null;
|
|
161
|
-
/**
|
|
162
|
-
* Checks if the user is currently authenticated.
|
|
163
|
-
*
|
|
164
|
-
* @returns {boolean} `true` if authenticated, otherwise `false`.
|
|
165
|
-
*/
|
|
166
|
-
isAuthenticated(): boolean;
|
|
167
|
-
/**
|
|
168
|
-
* Checks if the user is authorized based on the provided handler.
|
|
169
|
-
*
|
|
170
|
-
* @param {AuthorizedHandler | null} [authorizedHandler] - A handler to determine authorization.
|
|
171
|
-
* @returns {boolean} `true` if authorized, otherwise `false`.
|
|
172
|
-
*/
|
|
173
|
-
isAuthorized(authorizedHandler?: AuthorizedHandler | null): boolean;
|
|
174
|
-
/**
|
|
175
|
-
* Emits whether the user is authorized based on the provided handler.
|
|
176
|
-
*
|
|
177
|
-
* @param {AuthorizedHandler | null} [authorizedHandler] - A handler to determine authorization.
|
|
178
|
-
* @returns {Observable<boolean>} An observable emitting the authorization status.
|
|
179
|
-
*/
|
|
180
|
-
isAuthorized$(authorizedHandler?: AuthorizedHandler | null): Observable<boolean>;
|
|
181
|
-
/**
|
|
182
|
-
* Prepares an HTTP request by adding the access token to its headers.
|
|
183
|
-
*
|
|
184
|
-
* @param {HttpRequest<T> | Request} req - The HTTP request to prepare.
|
|
185
|
-
* @param {boolean} requireSignIn - Whether to require the user to sign in if no token is available.
|
|
186
|
-
* @returns {Observable<R>} An observable emitting the prepared request.
|
|
187
|
-
* @template R, T
|
|
188
|
-
*/
|
|
189
|
-
prepareAuthRequest$<R extends HttpRequest<T> | Request, T>(req: R, requireSignIn?: boolean): Observable<R>;
|
|
190
|
-
/**
|
|
191
|
-
* Waits for a valid access token to become available.
|
|
192
|
-
*
|
|
193
|
-
* @param {boolean} requireSignIn - Whether to require the user to sign in if no token is available.
|
|
194
|
-
* @returns {Observable<string | null>} An observable emitting the access token.
|
|
195
|
-
*/
|
|
196
|
-
waitForAccessToken$(requireSignIn: boolean): Observable<string | null>;
|
|
197
|
-
private routeToRequestedUrl;
|
|
198
|
-
private hasValidOfflineToken;
|
|
199
|
-
private redirectToLogin;
|
|
200
|
-
private tryLoadUserProfile;
|
|
201
|
-
private tryRefreshToken;
|
|
202
|
-
private assertAudience;
|
|
203
|
-
private updateSilentRefresh;
|
|
204
|
-
static ɵfac: i0.ɵɵFactoryDeclaration<AuthService, never>;
|
|
205
|
-
static ɵprov: i0.ɵɵInjectableDeclaration<AuthService>;
|
|
206
|
-
}
|
package/lib/auth.typings.d.ts
DELETED
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
declare global {
|
|
2
|
-
namespace OdxAuth {
|
|
3
|
-
type RawIdentityClaims = Record<string, unknown>;
|
|
4
|
-
interface AuthPluginResult {
|
|
5
|
-
institutionName?: string;
|
|
6
|
-
languageCode?: string;
|
|
7
|
-
preferredLanguage?: string;
|
|
8
|
-
}
|
|
9
|
-
interface IdentityClaims extends AuthPluginResult {
|
|
10
|
-
sub: string;
|
|
11
|
-
oktaid: string;
|
|
12
|
-
iat: number;
|
|
13
|
-
aud: string;
|
|
14
|
-
name: string;
|
|
15
|
-
firstname: string;
|
|
16
|
-
lastname: string;
|
|
17
|
-
displayname: string;
|
|
18
|
-
preferred_username: string;
|
|
19
|
-
email: string;
|
|
20
|
-
initials: string;
|
|
21
|
-
organization: string;
|
|
22
|
-
locale?: string;
|
|
23
|
-
zoneinfo?: string;
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
export {};
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import * as i0 from "@angular/core";
|
|
2
|
-
/**
|
|
3
|
-
* Displays authentication actions.
|
|
4
|
-
*/
|
|
5
|
-
export declare class AuthActionsComponent {
|
|
6
|
-
readonly element: import("@angular/core").ElementRef<HTMLElement>;
|
|
7
|
-
/**
|
|
8
|
-
* The identity claims.
|
|
9
|
-
*
|
|
10
|
-
* @type {OdxAuth.IdentityClaims | null}
|
|
11
|
-
* @default null
|
|
12
|
-
*/
|
|
13
|
-
claims: OdxAuth.IdentityClaims | null;
|
|
14
|
-
static ɵfac: i0.ɵɵFactoryDeclaration<AuthActionsComponent, never>;
|
|
15
|
-
static ɵcmp: i0.ɵɵComponentDeclaration<AuthActionsComponent, "odx-auth-actions", never, { "claims": { "alias": "claims"; "required": false; }; }, {}, never, never, true, never>;
|
|
16
|
-
}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { DynamicViewService } from '@odx/angular/cdk/dynamic-view';
|
|
2
|
-
import { AuthService } from '../../auth.service';
|
|
3
|
-
import * as i0 from "@angular/core";
|
|
4
|
-
/**
|
|
5
|
-
* Authentication loading screen.
|
|
6
|
-
*
|
|
7
|
-
* This component displays a loading screen with animations and dynamic content
|
|
8
|
-
* based on the authentication state.
|
|
9
|
-
*/
|
|
10
|
-
export declare class AuthLoadingScreenComponent {
|
|
11
|
-
private static instance;
|
|
12
|
-
protected readonly authConfig: import("../../auth.config").AuthConfig;
|
|
13
|
-
protected readonly icon$: import("rxjs").Observable<"link-external" | "user">;
|
|
14
|
-
/**
|
|
15
|
-
* Initializes the authentication loading screen.
|
|
16
|
-
*
|
|
17
|
-
* @param {AuthService} authService - The authentication service.
|
|
18
|
-
* @param {DynamicViewService} dynamicViewService - The dynamic view service used to create the loading screen.
|
|
19
|
-
* @static
|
|
20
|
-
*/
|
|
21
|
-
static initialize(authService: AuthService, dynamicViewService: DynamicViewService): void;
|
|
22
|
-
static ɵfac: i0.ɵɵFactoryDeclaration<AuthLoadingScreenComponent, never>;
|
|
23
|
-
static ɵcmp: i0.ɵɵComponentDeclaration<AuthLoadingScreenComponent, "div.odx-auth-loading-screen", never, {}, {}, never, never, true, never>;
|
|
24
|
-
}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { AfterViewInit } from '@angular/core';
|
|
2
|
-
import { AuthService } from '../auth.service';
|
|
3
|
-
import * as i0 from "@angular/core";
|
|
4
|
-
/**
|
|
5
|
-
* An abstract directive that integrates with the `LoadingSpinnerDirective` and `AuthService` to manage loading states based on authentication redirection.
|
|
6
|
-
*
|
|
7
|
-
* This directive automatically sets the `autoColor` property of the `LoadingSpinnerDirective` to `true` and subscribes to the `isRedirecting$` observable from the `AuthService`.
|
|
8
|
-
* When `isRedirecting$` emits a value, it updates the `isLoading` property of the `LoadingSpinnerDirective`.
|
|
9
|
-
*/
|
|
10
|
-
export declare abstract class AuthActionDirective implements AfterViewInit {
|
|
11
|
-
private readonly takeUntilDestroyed;
|
|
12
|
-
private readonly loadingSpinnerDirective;
|
|
13
|
-
protected readonly authService: AuthService;
|
|
14
|
-
ngAfterViewInit(): void;
|
|
15
|
-
protected abstract handleClick(): void;
|
|
16
|
-
static ɵfac: i0.ɵɵFactoryDeclaration<AuthActionDirective, never>;
|
|
17
|
-
static ɵdir: i0.ɵɵDirectiveDeclaration<AuthActionDirective, never, never, {}, {}, never, never, false, never>;
|
|
18
|
-
}
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* A directive that handles the sign-in action for a button element.
|
|
3
|
-
*
|
|
4
|
-
* This directive extends the `AuthActionDirective` and uses the `LoadingSpinnerDirective`
|
|
5
|
-
* to show a loading spinner during the sign-in process.
|
|
6
|
-
*
|
|
7
|
-
* @see {AuthActionDirective}
|
|
8
|
-
* @see {LoadingSpinnerDirective}
|
|
9
|
-
*
|
|
10
|
-
* @example
|
|
11
|
-
* ```html
|
|
12
|
-
* <button odxButton odxAuthSignIn (odxAuthSignIn)="onSignIn()">Sign In</button>
|
|
13
|
-
* ```
|
|
14
|
-
*/
|
|
15
|
-
import { EventEmitter } from '@angular/core';
|
|
16
|
-
import { AuthActionDirective } from './auth-action.directive';
|
|
17
|
-
import * as i0 from "@angular/core";
|
|
18
|
-
import * as i1 from "@odx/angular/components/loading-spinner";
|
|
19
|
-
export declare class SignInDirective extends AuthActionDirective {
|
|
20
|
-
/**
|
|
21
|
-
* Emits an event after the sign-in action is completed.
|
|
22
|
-
*
|
|
23
|
-
* @type {EventEmitter<void>}
|
|
24
|
-
*/
|
|
25
|
-
afterSignIn: EventEmitter<void>;
|
|
26
|
-
protected handleClick(): void;
|
|
27
|
-
static ɵfac: i0.ɵɵFactoryDeclaration<SignInDirective, never>;
|
|
28
|
-
static ɵdir: i0.ɵɵDirectiveDeclaration<SignInDirective, "[odxButton][odxAuthSignIn]", never, {}, { "afterSignIn": "odxAuthSignIn"; }, never, never, true, [{ directive: typeof i1.LoadingSpinnerDirective; inputs: {}; outputs: {}; }]>;
|
|
29
|
-
}
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import { EventEmitter } from '@angular/core';
|
|
2
|
-
import { AuthActionDirective } from './auth-action.directive';
|
|
3
|
-
import * as i0 from "@angular/core";
|
|
4
|
-
import * as i1 from "@odx/angular/components/loading-spinner";
|
|
5
|
-
/**
|
|
6
|
-
* A directive that handles the sign-out action for a button element.
|
|
7
|
-
*
|
|
8
|
-
* This directive extends the `AuthActionDirective` and uses the `LoadingSpinnerDirective`
|
|
9
|
-
* to show a loading spinner during the sign-out process.
|
|
10
|
-
*
|
|
11
|
-
* @see {AuthActionDirective}
|
|
12
|
-
* @see {LoadingSpinnerDirective}
|
|
13
|
-
*
|
|
14
|
-
* @example
|
|
15
|
-
* ```html
|
|
16
|
-
* <button odxButton odxAuthSignOut (odxAuthSignOut)="onSignOut()">Sign Out</button>
|
|
17
|
-
* ```
|
|
18
|
-
*/
|
|
19
|
-
export declare class SignOutDirective extends AuthActionDirective {
|
|
20
|
-
/**
|
|
21
|
-
* Emits an event after the sign-out action is completed.
|
|
22
|
-
*
|
|
23
|
-
*/
|
|
24
|
-
afterSignOut: EventEmitter<void>;
|
|
25
|
-
protected handleClick(): void;
|
|
26
|
-
static ɵfac: i0.ɵɵFactoryDeclaration<SignOutDirective, never>;
|
|
27
|
-
static ɵdir: i0.ɵɵDirectiveDeclaration<SignOutDirective, "[odxAuthSignOut]", never, {}, { "afterSignOut": "odxAuthSignOut"; }, never, never, true, [{ directive: typeof i1.LoadingSpinnerDirective; inputs: {}; outputs: {}; }]>;
|
|
28
|
-
}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { AuthEnvironment } from '../models';
|
|
2
|
-
/**
|
|
3
|
-
* Creates an authentication host URL based on the provided environment and URL segments.
|
|
4
|
-
*
|
|
5
|
-
* @param {AuthEnvironment} environment - The authentication environment (e.g., 'development', 'production').
|
|
6
|
-
* @param {string[]} segments - Additional URL segments to append to the base URL.
|
|
7
|
-
* @returns {string} The constructed authentication host URL.
|
|
8
|
-
*
|
|
9
|
-
* @example
|
|
10
|
-
* ```ts
|
|
11
|
-
* createAuthHostUrl('dev', 'api', 'v1', 'users'); // returns 'https://dev-auth.odx.com/api/v1/users'
|
|
12
|
-
* ```
|
|
13
|
-
*/
|
|
14
|
-
export declare function createAuthHostUrl(environment: AuthEnvironment, ...segments: string[]): string;
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Creates initials from a given string.
|
|
3
|
-
*
|
|
4
|
-
* This function takes a string input, removes any text within parentheses,
|
|
5
|
-
* trims any leading or trailing whitespace, and then splits the string into
|
|
6
|
-
* parts based on spaces. It then constructs initials using the first letter
|
|
7
|
-
* of the first and last parts of the string, converting them to uppercase.
|
|
8
|
-
*
|
|
9
|
-
* @param {string | null} value - The input string from which to create initials. It can be
|
|
10
|
-
* undefined or null, in which case an empty string is returned.
|
|
11
|
-
* @returns {string} - A string containing the initials derived from the input string.
|
|
12
|
-
*
|
|
13
|
-
* @example
|
|
14
|
-
* ```ts
|
|
15
|
-
* createInitials('John Smith'); // returns 'JS'
|
|
16
|
-
* ```
|
|
17
|
-
*/
|
|
18
|
-
export declare function createInitials(value?: string | null): string;
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { OAuthErrorEvent } from 'angular-oauth2-oidc';
|
|
2
|
-
import { AuthErrorHandlerFn } from '../auth.config';
|
|
3
|
-
/**
|
|
4
|
-
* Handles authentication errors by executing a series of error handler functions.
|
|
5
|
-
*
|
|
6
|
-
* @param {AuthErrorHandlerFn[]} handlers - An array of functions that handle authentication errors.
|
|
7
|
-
* Each function is expected to take an `OAuthErrorEvent` as an argument.
|
|
8
|
-
*
|
|
9
|
-
* @returns A function that takes an `OAuthErrorEvent` and processes it using the provided handlers.
|
|
10
|
-
* The function will stop processing once a handler successfully handles the error without throwing.
|
|
11
|
-
* If a handler throws an error that is not an instance of `OAuthErrorEvent`, the original error is re-thrown.
|
|
12
|
-
*/
|
|
13
|
-
export declare function handleAuthError(handlers: AuthErrorHandlerFn[]): (error: OAuthErrorEvent) => void;
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { OAuthEvent } from 'angular-oauth2-oidc';
|
|
2
|
-
import { OperatorFunction } from 'rxjs';
|
|
3
|
-
/**
|
|
4
|
-
* Handles OAuth events of a specific type by applying a provided handler function.
|
|
5
|
-
*
|
|
6
|
-
* @template {T} - The type of OAuth event.
|
|
7
|
-
* @param {T['type']} type - The type of the OAuth event to handle.
|
|
8
|
-
* @param {(event: T) => Promise<void>} handler - A function that takes an event of type T and returns a Promise that resolves to void.
|
|
9
|
-
* @returns {OperatorFunction<T, void>} - An OperatorFunction that filters events of the specified type and applies the handler function.
|
|
10
|
-
*/
|
|
11
|
-
export declare function handleOAuthEvent<T extends OAuthEvent>(type: T['type'], handler: (event: T) => Promise<void>): OperatorFunction<T, void>;
|
package/lib/helpers/index.d.ts
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
export * from './create-auth-host-url';
|
|
2
|
-
export * from './create-inititals';
|
|
3
|
-
export * from './handle-auth-error';
|
|
4
|
-
export * from './handle-oauth-event';
|
|
5
|
-
export * from './resolve-email';
|
|
6
|
-
export * from './resolve-username';
|
|
7
|
-
export * from './set-http-auth-header';
|
|
8
|
-
export * from './user-language-loader';
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Resolves the email address from the given identity claims.
|
|
3
|
-
*
|
|
4
|
-
* This function attempts to extract an email address from the provided
|
|
5
|
-
* `OdxAuth.RawIdentityClaims` object by checking the following properties
|
|
6
|
-
* in order:
|
|
7
|
-
* 1. `email` - if it is a string, it is returned.
|
|
8
|
-
* 2. `email_address` - if it is a string, it is returned.
|
|
9
|
-
* 3. `emails` - if it is an array and the first element is a string, the first element is returned.
|
|
10
|
-
*
|
|
11
|
-
* If none of these properties contain a valid string email address, an empty string is returned.
|
|
12
|
-
*
|
|
13
|
-
* @param {OdxAuth.RawIdentityClaims} claims - The identity claims object from which to resolve the email address.
|
|
14
|
-
* @returns {string} - The resolved email address as a string, or an empty string if no valid email address is found.
|
|
15
|
-
*
|
|
16
|
-
* @example
|
|
17
|
-
* ```ts
|
|
18
|
-
* resolveEmail({ email_address: 'email.address@mdn.com' }) // returns 'email.address@mdn.com';
|
|
19
|
-
* ```
|
|
20
|
-
*/
|
|
21
|
-
export declare function resolveEmail(claims: OdxAuth.RawIdentityClaims): string;
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Resolves the username from the provided identity claims.
|
|
3
|
-
*
|
|
4
|
-
* The function attempts to construct a username from the claims in the following order:
|
|
5
|
-
* 1. If both 'firstname' and 'lastname' are strings, it returns them concatenated with a space.
|
|
6
|
-
* 2. If both 'given_name' and 'family_name' are strings, it returns them concatenated with a space.
|
|
7
|
-
* 3. If 'name' is a string, it returns the 'name'.
|
|
8
|
-
* 4. If 'displayname' is a string, it returns the 'displayname'.
|
|
9
|
-
* 5. If none of the above conditions are met, it returns an empty string.
|
|
10
|
-
*
|
|
11
|
-
* @param {OdxAuth.RawIdentityClaims} claims - The raw identity claims from which to resolve the username.
|
|
12
|
-
* @returns {string} - The resolved username as a string.
|
|
13
|
-
*
|
|
14
|
-
* @example
|
|
15
|
-
* ```ts
|
|
16
|
-
* resolveUsername({ firstname: 'John', lastname: 'Doe' }) // returns 'John Doe';
|
|
17
|
-
* resolveUsername({ given_name: 'John', family_name: 'Doe' }) // returns 'John Doe';
|
|
18
|
-
* resolveUsername({ name: 'John Doe' }) // returns 'John Doe';
|
|
19
|
-
* resolveUsername({ displayname: 'John Doe' }) // returns 'John Doe';
|
|
20
|
-
* ```
|
|
21
|
-
*/
|
|
22
|
-
export declare function resolveUsername(claims: OdxAuth.RawIdentityClaims): string;
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { HttpRequest } from '@angular/common/http';
|
|
2
|
-
/**
|
|
3
|
-
* Sets the HTTP Authorization header for a given request.
|
|
4
|
-
*
|
|
5
|
-
* @template R - The type of the request, which extends HttpRequest<T> or Request.
|
|
6
|
-
* @template T - The type of the request body.
|
|
7
|
-
* @param {R} req - The HTTP request to which the Authorization header will be added.
|
|
8
|
-
* @param {string | null} [token] - The token to be used in the Authorization header. If no token is provided, the request is returned unchanged.
|
|
9
|
-
* @returns {R} - The modified HTTP request with the Authorization header set, or the original request if no token is provided.
|
|
10
|
-
*/
|
|
11
|
-
export declare function setHttpAuthHeader<R extends HttpRequest<T> | Request, T>(req: R, token?: string | null): R;
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { LanguageLoaderFn } from '@odx/angular/localization';
|
|
2
|
-
type LanguageSelector = (claims?: OdxAuth.IdentityClaims | null) => string | null | undefined;
|
|
3
|
-
/**
|
|
4
|
-
* A function that creates a language loader function for user authentication.
|
|
5
|
-
*
|
|
6
|
-
* @param {LanguageSelector} languageSelector - A function that takes optional identity claims and returns a language string, null, or undefined.
|
|
7
|
-
* Defaults to a function that returns the preferred language from the claims.
|
|
8
|
-
* @returns {LanguageLoaderFn} - A function that retrieves the user's preferred language from the identity claims.
|
|
9
|
-
*/
|
|
10
|
-
export declare function userLanguageLoader(languageSelector?: LanguageSelector): LanguageLoaderFn;
|
|
11
|
-
export {};
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { Observable } from 'rxjs';
|
|
2
|
-
import { AuthService } from '../auth.service';
|
|
3
|
-
import * as i0 from "@angular/core";
|
|
4
|
-
export type AuthPlugin = (authService: AuthService) => Observable<Partial<OdxAuth.AuthPluginResult>>;
|
|
5
|
-
export type AuthPluginFactory = () => AuthPlugin;
|
|
6
|
-
export type AuthPluginError = unknown;
|
|
7
|
-
export type AuthPluginErrorHandler = (error: AuthPluginError) => void;
|
|
8
|
-
export declare class AuthPluginManager {
|
|
9
|
-
private readonly authConfig;
|
|
10
|
-
private readonly pluginsErrorHandler;
|
|
11
|
-
private readonly plugins;
|
|
12
|
-
private readonly result$$;
|
|
13
|
-
readonly pluginsReady$: Observable<boolean>;
|
|
14
|
-
readonly pluginsLoading$: Observable<boolean>;
|
|
15
|
-
runPlugins(authService: AuthService): Observable<OdxAuth.AuthPluginResult>;
|
|
16
|
-
getResult(): OdxAuth.AuthPluginResult;
|
|
17
|
-
private handlePluginError;
|
|
18
|
-
private runPlugin;
|
|
19
|
-
static ɵfac: i0.ɵɵFactoryDeclaration<AuthPluginManager, never>;
|
|
20
|
-
static ɵprov: i0.ɵɵInjectableDeclaration<AuthPluginManager>;
|
|
21
|
-
}
|
package/lib/models/index.d.ts
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { AuthPluginFactory } from '../models';
|
|
2
|
-
/**
|
|
3
|
-
* A factory function that creates a core debug plugin for the authentication service.
|
|
4
|
-
* This plugin logs detailed information about the user's identity claims and tokens.
|
|
5
|
-
*
|
|
6
|
-
* @remarks
|
|
7
|
-
* This plugin is intended for debugging purposes only and should not be used in production environments.
|
|
8
|
-
*
|
|
9
|
-
* @returns {AuthPluginFactory} A function that takes an authentication service and sets up logging for identity claims and tokens.
|
|
10
|
-
*/
|
|
11
|
-
export declare const coreDebugPlugin: AuthPluginFactory;
|