@memberjunction/ng-auth-services 5.23.0 → 5.25.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.
@@ -0,0 +1,127 @@
1
+ import { MJAuthBase } from '../mjexplorer-auth-base.service';
2
+ import { StandardUserInfo, StandardAuthToken, StandardAuthError, TokenRefreshResult } from '../auth-types';
3
+ import * as i0 from "@angular/core";
4
+ /**
5
+ * Configuration interface for the Cognito provider.
6
+ * Populated from environment config via the `angularProviderFactory`.
7
+ */
8
+ interface CognitoConfig {
9
+ userPoolId: string;
10
+ userPoolClientId: string;
11
+ region?: string;
12
+ /** Cognito Hosted UI domain, e.g. 'myapp.auth.us-east-1.amazoncognito.com' */
13
+ domain: string;
14
+ /** OAuth redirect URI. Defaults to window.location.origin */
15
+ redirectUri?: string;
16
+ /** OAuth scopes. Defaults to ['openid', 'profile', 'email'] */
17
+ scopes?: string[];
18
+ /** When true, skips redirect callback processing (for MCP OAuth callback path) */
19
+ skipRedirectCallback?: boolean;
20
+ }
21
+ /**
22
+ * AWS Cognito authentication provider implementation - v3.0.0
23
+ *
24
+ * Implements the abstract methods from MJAuthBase to hide Cognito-specific details.
25
+ * Uses AWS Amplify v6 (tree-shakeable subpath imports) for authentication.
26
+ *
27
+ * Key abstraction: Cognito stores tokens in Amplify's internal storage, accessed
28
+ * via `fetchAuthSession().tokens?.idToken?.toString()`. Consumers never need to
29
+ * know this detail.
30
+ *
31
+ * ## Cognito Hosted UI Flow
32
+ * This provider uses the Cognito Hosted UI for login via `signInWithRedirect()`.
33
+ * The flow is: redirect to Hosted UI -> user authenticates -> redirect back with
34
+ * authorization code -> Amplify exchanges code for tokens (PKCE).
35
+ */
36
+ export declare class MJCognitoProvider extends MJAuthBase {
37
+ private cognitoConfig;
38
+ static readonly PROVIDER_TYPE = "cognito";
39
+ readonly type = "cognito";
40
+ private _initialized;
41
+ private _hubListenerCancel;
42
+ /**
43
+ * Factory function to provide Angular dependencies required by the Cognito provider.
44
+ * Returns a config injection token following the Okta provider pattern.
45
+ */
46
+ static angularProviderFactory: (environment: Record<string, unknown>) => {
47
+ provide: string;
48
+ useValue: CognitoConfig;
49
+ }[];
50
+ constructor(cognitoConfig: CognitoConfig);
51
+ initialize(): Promise<void>;
52
+ protected loginInternal(_options?: Record<string, unknown>): Promise<void>;
53
+ protected logoutInternal(): Promise<void>;
54
+ handleCallback(): Promise<void>;
55
+ /**
56
+ * Extract ID token from Cognito via Amplify's fetchAuthSession.
57
+ *
58
+ * Cognito stores the JWT in session.tokens.idToken. The .toString()
59
+ * call extracts the raw JWT string. Consumers never need to know this detail.
60
+ */
61
+ protected extractIdTokenInternal(): Promise<string | null>;
62
+ /**
63
+ * Extract complete token info from Cognito session.
64
+ * Maps Amplify's token structure to StandardAuthToken.
65
+ */
66
+ protected extractTokenInfoInternal(): Promise<StandardAuthToken | null>;
67
+ /**
68
+ * Extract user info from Cognito user attributes.
69
+ * Maps Cognito's attribute structure to StandardUserInfo.
70
+ */
71
+ protected extractUserInfoInternal(): Promise<StandardUserInfo | null>;
72
+ /**
73
+ * Refresh token using Amplify's fetchAuthSession with forceRefresh.
74
+ *
75
+ * Amplify v6 handles the entire refresh token exchange internally:
76
+ * fetchAuthSession({ forceRefresh: true }) uses the stored refresh token
77
+ * to obtain new ID and access tokens from Cognito.
78
+ */
79
+ protected refreshTokenInternal(): Promise<TokenRefreshResult>;
80
+ /**
81
+ * Classify Cognito/Amplify-specific errors into semantic types.
82
+ *
83
+ * Maps Amplify v6 error names and messages to AuthErrorType enum.
84
+ */
85
+ protected classifyErrorInternal(error: unknown): StandardAuthError;
86
+ /**
87
+ * Get profile picture URL from Cognito user attributes.
88
+ *
89
+ * Cognito can store a `picture` attribute if configured in the user pool.
90
+ * Returns null if the attribute is not set.
91
+ */
92
+ protected getProfilePictureUrlInternal(): Promise<string | null>;
93
+ /**
94
+ * Handle session expiry by redirecting to Cognito Hosted UI.
95
+ *
96
+ * Cognito uses refresh tokens (responseType: 'code'), so silent refresh
97
+ * usually works. If it fails, we redirect to the Hosted UI for
98
+ * re-authentication. This will navigate the browser and may never return.
99
+ */
100
+ protected handleSessionExpiryInternal(): Promise<void>;
101
+ private ensureInitialized;
102
+ /**
103
+ * Refresh user info from Cognito and update the reactive state.
104
+ */
105
+ private refreshUserInfo;
106
+ /**
107
+ * Map Cognito user attributes to StandardUserInfo.
108
+ *
109
+ * Cognito attributes use snake_case keys (email, given_name, family_name, etc.)
110
+ * and all values are strings (including booleans like email_verified = 'true').
111
+ */
112
+ private mapCognitoAttributesToStandard;
113
+ /**
114
+ * Extract OAuth scopes from an access token's payload.
115
+ */
116
+ private extractScopes;
117
+ /**
118
+ * Cancel the Hub event listener if active.
119
+ */
120
+ private cancelHubListener;
121
+ getRequiredConfig(): string[];
122
+ validateConfig(config: Record<string, unknown>): boolean;
123
+ static ɵfac: i0.ɵɵFactoryDeclaration<MJCognitoProvider, never>;
124
+ static ɵprov: i0.ɵɵInjectableDeclaration<MJCognitoProvider>;
125
+ }
126
+ export {};
127
+ //# sourceMappingURL=mjexplorer-cognito-provider.service.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mjexplorer-cognito-provider.service.d.ts","sourceRoot":"","sources":["../../../src/lib/providers/mjexplorer-cognito-provider.service.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,UAAU,EAAE,MAAM,iCAAiC,CAAC;AAW7D,OAAO,EACL,gBAAgB,EAChB,iBAAiB,EACjB,iBAAiB,EAEjB,kBAAkB,EACnB,MAAM,eAAe,CAAC;;AAEvB;;;GAGG;AACH,UAAU,aAAa;IACrB,UAAU,EAAE,MAAM,CAAC;IACnB,gBAAgB,EAAE,MAAM,CAAC;IACzB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,8EAA8E;IAC9E,MAAM,EAAE,MAAM,CAAC;IACf,6DAA6D;IAC7D,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,+DAA+D;IAC/D,MAAM,CAAC,EAAE,MAAM,E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;;OAKG;IACH,OAAO,CAAC,8BAA8B;IAsBtC;;OAEG;IACH,OAAO,CAAC,aAAa;IAQrB;;OAEG;IACH,OAAO,CAAC,iBAAiB;IAWhB,iBAAiB,IAAI,MAAM,EAAE;IAI7B,cAAc,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,OAAO;yCApctD,iBAAiB;6CAAjB,iBAAiB;CAuc7B"}
@@ -0,0 +1,463 @@
1
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
2
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
4
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
6
+ };
7
+ var MJCognitoProvider_1;
8
+ import { Injectable, Inject } from '@angular/core';
9
+ import { RegisterClass } from '@memberjunction/global';
10
+ import { MJAuthBase } from '../mjexplorer-auth-base.service';
11
+ import { Amplify } from 'aws-amplify';
12
+ import { signInWithRedirect, signOut, fetchAuthSession, getCurrentUser, fetchUserAttributes } from 'aws-amplify/auth';
13
+ import { Hub } from 'aws-amplify/utils';
14
+ import { AuthErrorType } from '../auth-types';
15
+ import * as i0 from "@angular/core";
16
+ /**
17
+ * AWS Cognito authentication provider implementation - v3.0.0
18
+ *
19
+ * Implements the abstract methods from MJAuthBase to hide Cognito-specific details.
20
+ * Uses AWS Amplify v6 (tree-shakeable subpath imports) for authentication.
21
+ *
22
+ * Key abstraction: Cognito stores tokens in Amplify's internal storage, accessed
23
+ * via `fetchAuthSession().tokens?.idToken?.toString()`. Consumers never need to
24
+ * know this detail.
25
+ *
26
+ * ## Cognito Hosted UI Flow
27
+ * This provider uses the Cognito Hosted UI for login via `signInWithRedirect()`.
28
+ * The flow is: redirect to Hosted UI -> user authenticates -> redirect back with
29
+ * authorization code -> Amplify exchanges code for tokens (PKCE).
30
+ */
31
+ let MJCognitoProvider = class MJCognitoProvider extends MJAuthBase {
32
+ static { MJCognitoProvider_1 = this; }
33
+ cognitoConfig;
34
+ static PROVIDER_TYPE = 'cognito';
35
+ type = MJCognitoProvider_1.PROVIDER_TYPE;
36
+ _initialized = false;
37
+ _hubListenerCancel = null;
38
+ /**
39
+ * Factory function to provide Angular dependencies required by the Cognito provider.
40
+ * Returns a config injection token following the Okta provider pattern.
41
+ */
42
+ static angularProviderFactory = (environment) => {
43
+ const isMCPOAuthCallback = window.location.pathname.startsWith('/oauth/callback');
44
+ return [
45
+ {
46
+ provide: 'cognitoConfig',
47
+ useValue: {
48
+ userPoolId: environment['COGNITO_USER_POOL_ID'],
49
+ userPoolClientId: environment['COGNITO_CLIENT_ID'] || environment['COGNITO_CLIENTID'],
50
+ region: environment['COGNITO_REGION'] || environment['AWS_REGION'],
51
+ domain: environment['COGNITO_DOMAIN'],
52
+ redirectUri: environment['COGNITO_REDIRECT_URI'] || window.location.origin,
53
+ scopes: environment['COGNITO_SCOPES'] || ['openid', 'profile', 'email', 'aws.cognito.signin.user.admin'],
54
+ skipRedirectCallback: isMCPOAuthCallback,
55
+ }
56
+ }
57
+ ];
58
+ };
59
+ constructor(cognitoConfig) {
60
+ const config = {
61
+ name: MJCognitoProvider_1.PROVIDER_TYPE,
62
+ type: MJCognitoProvider_1.PROVIDER_TYPE
63
+ };
64
+ super(config);
65
+ this.cognitoConfig = cognitoConfig;
66
+ // Configure Amplify with the existing Cognito User Pool
67
+ const redirectUri = this.cognitoConfig.redirectUri || window.location.origin;
68
+ Amplify.configure({
69
+ Auth: {
70
+ Cognito: {
71
+ userPoolId: this.cognitoConfig.userPoolId,
72
+ userPoolClientId: this.cognitoConfig.userPoolClientId,
73
+ loginWith: {
74
+ oauth: {
75
+ domain: this.cognitoConfig.domain,
76
+ scopes: this.cognitoConfig.scopes || ['openid', 'profile', 'email', 'aws.cognito.signin.user.admin'],
77
+ redirectSignIn: [redirectUri],
78
+ redirectSignOut: [redirectUri],
79
+ responseType: 'code', // Authorization code + PKCE for refresh tokens
80
+ }
81
+ }
82
+ }
83
+ }
84
+ });
85
+ }
86
+ // ============================================================================
87
+ // LIFECYCLE METHODS
88
+ // ============================================================================
89
+ async initialize() {
90
+ if (this._initialized) {
91
+ return;
92
+ }
93
+ // CRITICAL: Skip Amplify's redirect handling on the MCP OAuth callback path.
94
+ // The /oauth/callback path is used by MCP OAuth, not Cognito. If we don't skip,
95
+ // Amplify will consume the authorization code and prevent the MCP OAuth flow.
96
+ if (this.cognitoConfig.skipRedirectCallback) {
97
+ this._initialized = true;
98
+ return;
99
+ }
100
+ // Set up Hub listener for reactive auth events
101
+ this._hubListenerCancel = Hub.listen('auth', async ({ payload }) => {
102
+ switch (payload.event) {
103
+ case 'signedIn':
104
+ this.updateAuthState(true);
105
+ await this.refreshUserInfo();
106
+ break;
107
+ case 'signedOut':
108
+ this.updateAuthState(false);
109
+ this.updateUserInfo(null);
110
+ break;
111
+ case 'tokenRefresh':
112
+ console.log('[Cognito] Token refreshed successfully');
113
+ break;
114
+ case 'tokenRefresh_failure':
115
+ console.warn('[Cognito] Token refresh failed');
116
+ break;
117
+ case 'signInWithRedirect':
118
+ console.log('[Cognito] OAuth redirect sign-in completed');
119
+ break;
120
+ case 'signInWithRedirect_failure':
121
+ console.error('[Cognito] OAuth redirect sign-in failed');
122
+ break;
123
+ }
124
+ });
125
+ // Check for existing session (page refresh or returning from redirect)
126
+ try {
127
+ const user = await getCurrentUser();
128
+ if (user) {
129
+ this.updateAuthState(true);
130
+ await this.refreshUserInfo();
131
+ }
132
+ }
133
+ catch {
134
+ // Not authenticated — this is expected on fresh visits
135
+ this.updateAuthState(false);
136
+ }
137
+ this._initialized = true;
138
+ }
139
+ async loginInternal(_options) {
140
+ await this.ensureInitialized();
141
+ // Redirect to Cognito Hosted UI. This navigates the browser and never returns.
142
+ await signInWithRedirect();
143
+ }
144
+ async logoutInternal() {
145
+ this.updateAuthState(false);
146
+ this.updateUserInfo(null);
147
+ // Cancel Hub listener before sign-out to avoid race conditions
148
+ this.cancelHubListener();
149
+ await signOut();
150
+ // signOut() clears local tokens. With Hosted UI, it also redirects to the
151
+ // Cognito logout endpoint to clear the Hosted UI session cookie.
152
+ }
153
+ async handleCallback() {
154
+ // Amplify v6 handles OAuth code exchange automatically when it detects
155
+ // ?code= and ?state= in the URL during initialization. The Hub listener
156
+ // catches 'signInWithRedirect' events. This method exists for interface
157
+ // compatibility.
158
+ try {
159
+ const user = await getCurrentUser();
160
+ if (user) {
161
+ this.updateAuthState(true);
162
+ await this.refreshUserInfo();
163
+ }
164
+ }
165
+ catch {
166
+ // Not authenticated after callback
167
+ }
168
+ }
169
+ // ============================================================================
170
+ // ABSTRACT METHOD IMPLEMENTATIONS (v3.0.0)
171
+ // ============================================================================
172
+ /**
173
+ * Extract ID token from Cognito via Amplify's fetchAuthSession.
174
+ *
175
+ * Cognito stores the JWT in session.tokens.idToken. The .toString()
176
+ * call extracts the raw JWT string. Consumers never need to know this detail.
177
+ */
178
+ async extractIdTokenInternal() {
179
+ try {
180
+ const session = await fetchAuthSession();
181
+ return session.tokens?.idToken?.toString() || null;
182
+ }
183
+ catch (error) {
184
+ console.error('[Cognito] Error extracting ID token:', error);
185
+ return null;
186
+ }
187
+ }
188
+ /**
189
+ * Extract complete token info from Cognito session.
190
+ * Maps Amplify's token structure to StandardAuthToken.
191
+ */
192
+ async extractTokenInfoInternal() {
193
+ try {
194
+ const session = await fetchAuthSession();
195
+ const idToken = session.tokens?.idToken;
196
+ if (!idToken) {
197
+ return null;
198
+ }
199
+ const payload = idToken.payload;
200
+ const accessToken = session.tokens?.accessToken;
201
+ return {
202
+ idToken: idToken.toString(),
203
+ accessToken: accessToken?.toString(),
204
+ expiresAt: payload?.exp ? payload.exp * 1000 : 0, // Convert to ms
205
+ scopes: this.extractScopes(accessToken)
206
+ };
207
+ }
208
+ catch (error) {
209
+ console.error('[Cognito] Error extracting token info:', error);
210
+ return null;
211
+ }
212
+ }
213
+ /**
214
+ * Extract user info from Cognito user attributes.
215
+ * Maps Cognito's attribute structure to StandardUserInfo.
216
+ */
217
+ async extractUserInfoInternal() {
218
+ try {
219
+ const user = await getCurrentUser();
220
+ const attributes = await fetchUserAttributes();
221
+ return this.mapCognitoAttributesToStandard(user, attributes);
222
+ }
223
+ catch (error) {
224
+ console.error('[Cognito] Error extracting user info:', error);
225
+ return null;
226
+ }
227
+ }
228
+ /**
229
+ * Refresh token using Amplify's fetchAuthSession with forceRefresh.
230
+ *
231
+ * Amplify v6 handles the entire refresh token exchange internally:
232
+ * fetchAuthSession({ forceRefresh: true }) uses the stored refresh token
233
+ * to obtain new ID and access tokens from Cognito.
234
+ */
235
+ async refreshTokenInternal() {
236
+ try {
237
+ console.log('[Cognito] Attempting to refresh token...');
238
+ const session = await fetchAuthSession({ forceRefresh: true });
239
+ const idToken = session.tokens?.idToken;
240
+ if (!idToken) {
241
+ return {
242
+ success: false,
243
+ error: {
244
+ type: AuthErrorType.NO_ACTIVE_SESSION,
245
+ message: 'Token refresh succeeded but no ID token returned',
246
+ userMessage: 'Session refresh failed. Please log in again.'
247
+ }
248
+ };
249
+ }
250
+ const payload = idToken.payload;
251
+ const accessToken = session.tokens?.accessToken;
252
+ console.log('[Cognito] Token refresh successful', {
253
+ expiresAt: payload?.exp ? new Date(payload.exp * 1000).toISOString() : 'N/A'
254
+ });
255
+ return {
256
+ success: true,
257
+ token: {
258
+ idToken: idToken.toString(),
259
+ accessToken: accessToken?.toString(),
260
+ expiresAt: payload?.exp ? payload.exp * 1000 : 0,
261
+ scopes: this.extractScopes(accessToken)
262
+ }
263
+ };
264
+ }
265
+ catch (error) {
266
+ console.error('[Cognito] Token refresh failed:', error);
267
+ return {
268
+ success: false,
269
+ error: this.classifyErrorInternal(error)
270
+ };
271
+ }
272
+ }
273
+ /**
274
+ * Classify Cognito/Amplify-specific errors into semantic types.
275
+ *
276
+ * Maps Amplify v6 error names and messages to AuthErrorType enum.
277
+ */
278
+ classifyErrorInternal(error) {
279
+ const errorObj = error;
280
+ const message = errorObj?.['message'] || 'Unknown error';
281
+ const name = errorObj?.['name'] || '';
282
+ // Not authenticated / no session
283
+ if (name === 'UserUnAuthenticatedException' ||
284
+ message.includes('not authenticated') ||
285
+ message.includes('No current user') ||
286
+ name === 'UserNotFoundException') {
287
+ return {
288
+ type: AuthErrorType.NO_ACTIVE_SESSION,
289
+ message,
290
+ originalError: error,
291
+ userMessage: 'You need to log in to continue.'
292
+ };
293
+ }
294
+ // Token expired / invalid refresh token
295
+ if (name === 'NotAuthorizedException' ||
296
+ message.includes('not authorized') ||
297
+ message.includes('Invalid Refresh Token') ||
298
+ message.includes('expired') ||
299
+ message.includes('invalid_grant')) {
300
+ return {
301
+ type: AuthErrorType.TOKEN_EXPIRED,
302
+ message,
303
+ originalError: error,
304
+ userMessage: 'Your session has expired. Please log in again.'
305
+ };
306
+ }
307
+ // User cancelled login
308
+ if (message.includes('cancelled') || message.includes('canceled') ||
309
+ message.includes('user denied')) {
310
+ return {
311
+ type: AuthErrorType.USER_CANCELLED,
312
+ message,
313
+ originalError: error,
314
+ userMessage: 'Login was cancelled.'
315
+ };
316
+ }
317
+ // Network errors
318
+ if (message.includes('network') || message.includes('fetch') ||
319
+ message.includes('Network') || message.includes('Load failed')) {
320
+ return {
321
+ type: AuthErrorType.NETWORK_ERROR,
322
+ message,
323
+ originalError: error,
324
+ userMessage: 'Network error. Please check your connection and try again.'
325
+ };
326
+ }
327
+ // OAuth configuration errors
328
+ if (name === 'OAuthNotConfigureException' ||
329
+ name === 'AuthTokenConfigException' ||
330
+ message.includes('OAuth') || message.includes('configuration')) {
331
+ return {
332
+ type: AuthErrorType.CONFIGURATION_ERROR,
333
+ message,
334
+ originalError: error,
335
+ userMessage: 'Authentication configuration error. Please contact support.'
336
+ };
337
+ }
338
+ // Default to unknown
339
+ return {
340
+ type: AuthErrorType.UNKNOWN_ERROR,
341
+ message,
342
+ originalError: error,
343
+ userMessage: 'An unexpected error occurred. Please try again.'
344
+ };
345
+ }
346
+ /**
347
+ * Get profile picture URL from Cognito user attributes.
348
+ *
349
+ * Cognito can store a `picture` attribute if configured in the user pool.
350
+ * Returns null if the attribute is not set.
351
+ */
352
+ async getProfilePictureUrlInternal() {
353
+ try {
354
+ const attributes = await fetchUserAttributes();
355
+ return attributes.picture || null;
356
+ }
357
+ catch (error) {
358
+ console.error('[Cognito] Error getting profile picture:', error);
359
+ return null;
360
+ }
361
+ }
362
+ /**
363
+ * Handle session expiry by redirecting to Cognito Hosted UI.
364
+ *
365
+ * Cognito uses refresh tokens (responseType: 'code'), so silent refresh
366
+ * usually works. If it fails, we redirect to the Hosted UI for
367
+ * re-authentication. This will navigate the browser and may never return.
368
+ */
369
+ async handleSessionExpiryInternal() {
370
+ console.log('[Cognito] Session expired, redirecting to Hosted UI for re-authentication');
371
+ await signInWithRedirect();
372
+ // This redirects the page and never returns
373
+ }
374
+ // ============================================================================
375
+ // HELPER METHODS
376
+ // ============================================================================
377
+ async ensureInitialized() {
378
+ if (!this._initialized) {
379
+ await this.initialize();
380
+ }
381
+ }
382
+ /**
383
+ * Refresh user info from Cognito and update the reactive state.
384
+ */
385
+ async refreshUserInfo() {
386
+ try {
387
+ const userInfo = await this.extractUserInfoInternal();
388
+ if (userInfo) {
389
+ this.updateUserInfo(userInfo);
390
+ }
391
+ }
392
+ catch (error) {
393
+ console.warn('[Cognito] Failed to refresh user info:', error);
394
+ }
395
+ }
396
+ /**
397
+ * Map Cognito user attributes to StandardUserInfo.
398
+ *
399
+ * Cognito attributes use snake_case keys (email, given_name, family_name, etc.)
400
+ * and all values are strings (including booleans like email_verified = 'true').
401
+ */
402
+ mapCognitoAttributesToStandard(user, attributes) {
403
+ const givenName = attributes['given_name'];
404
+ const familyName = attributes['family_name'];
405
+ const fullName = attributes['name'] ||
406
+ (givenName && familyName ? `${givenName} ${familyName}` : givenName || familyName || '');
407
+ return {
408
+ id: user.userId || user.username,
409
+ email: attributes['email'] || '',
410
+ name: fullName,
411
+ givenName,
412
+ familyName,
413
+ preferredUsername: attributes['preferred_username'] || user.username,
414
+ pictureUrl: attributes['picture'],
415
+ emailVerified: attributes['email_verified'] === 'true',
416
+ locale: attributes['locale'],
417
+ };
418
+ }
419
+ /**
420
+ * Extract OAuth scopes from an access token's payload.
421
+ */
422
+ extractScopes(accessToken) {
423
+ const scope = accessToken?.payload?.['scope'];
424
+ if (typeof scope === 'string') {
425
+ return scope.split(' ');
426
+ }
427
+ return undefined;
428
+ }
429
+ /**
430
+ * Cancel the Hub event listener if active.
431
+ */
432
+ cancelHubListener() {
433
+ if (this._hubListenerCancel) {
434
+ this._hubListenerCancel();
435
+ this._hubListenerCancel = null;
436
+ }
437
+ }
438
+ // ============================================================================
439
+ // CONFIGURATION
440
+ // ============================================================================
441
+ getRequiredConfig() {
442
+ return ['userPoolId', 'userPoolClientId', 'domain'];
443
+ }
444
+ validateConfig(config) {
445
+ return !!(config['userPoolId'] && config['userPoolClientId'] && config['domain']);
446
+ }
447
+ static ɵfac = function MJCognitoProvider_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || MJCognitoProvider)(i0.ɵɵinject('cognitoConfig')); };
448
+ static ɵprov = /*@__PURE__*/ i0.ɵɵdefineInjectable({ token: MJCognitoProvider, factory: MJCognitoProvider.ɵfac, providedIn: 'root' });
449
+ };
450
+ MJCognitoProvider = MJCognitoProvider_1 = __decorate([
451
+ RegisterClass(MJAuthBase, 'cognito')
452
+ ], MJCognitoProvider);
453
+ export { MJCognitoProvider };
454
+ (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(MJCognitoProvider, [{
455
+ type: Injectable,
456
+ args: [{
457
+ providedIn: 'root'
458
+ }]
459
+ }], () => [{ type: undefined, decorators: [{
460
+ type: Inject,
461
+ args: ['cognitoConfig']
462
+ }] }], null); })();
463
+ //# sourceMappingURL=mjexplorer-cognito-provider.service.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mjexplorer-cognito-provider.service.js","sourceRoot":"","sources":["../../../src/lib/providers/mjexplorer-cognito-provider.service.ts"],"names":[],"mappings":";;;;;;;AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AACnD,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AACvD,OAAO,EAAE,UAAU,EAAE,MAAM,iCAAiC,CAAC;AAE7D,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AACtC,OAAO,EACL,kBAAkB,EAClB,OAAO,EACP,gBAAgB,EAChB,cAAc,EACd,mBAAmB,EACpB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AACxC,OAAO,EAIL,aAAa,EAEd,MAAM,eAAe,CAAC;;AAoBvB;;;;;;;;;;;;;;GAcG;AAKI,IAAM,iBAAiB,GAAvB,MAAM,iBAAkB,SAAQ,UAAU;;IA6BF;IA5B7C,MAAM,CAAU,aAAa,GAAG,SAAS,CAAC;IACjC,IAAI,GAAG,mBAAiB,CAAC,aAAa,CAAC;IACxC,YAAY,GAAG,KAAK,CAAC;IACrB,kBAAkB,GAAwB,IAAI,CAAC;IAEvD;;;OAGG;IACH,MAAM,CAAC,sBAAsB,GAAG,CAAC,WAAoC,EAAE,EAAE;QACvE,MAAM,kBAAkB,GAAG,MAAM,CAAC,QAAQ,CAAC,QAAQ,CAAC,UAAU,CAAC,iBAAiB,CAAC,CAAC;QAElF,OAAO;YACL;gBACE,OAAO,EAAE,eAAe;gBACxB,QAAQ,EAAE;oBACR,UAAU,EAAE,WAAW,CAAC,sBAAsB,CAAC;oBAC/C,gBAAgB,EAAE,WAAW,CAAC,mBAAmB,CAAC,IAAI,WAAW,CAAC,kBAAkB,CAAC;oBACrF,MAAM,EAAE,WAAW,CAAC,gBAAgB,CAAC,IAAI,WAAW,CAAC,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able, Inject } from '@angular/core';\nimport { RegisterClass } from '@memberjunction/global';\nimport { MJAuthBase } from '../mjexplorer-auth-base.service';\nimport { AngularAuthProviderConfig } from '../IAuthProvider';\nimport { Amplify } from 'aws-amplify';\nimport {\n signInWithRedirect,\n signOut,\n fetchAuthSession,\n getCurrentUser,\n fetchUserAttributes\n} from 'aws-amplify/auth';\nimport { Hub } from 'aws-amplify/utils';\nimport {\n StandardUserInfo,\n StandardAuthToken,\n StandardAuthError,\n AuthErrorType,\n TokenRefreshResult\n} from '../auth-types';\n\n/**\n * Configuration interface for the Cognito provider.\n * Populated from environment config via the `angularProviderFactory`.\n */\ninterface CognitoConfig {\n userPoolId: string;\n userPoolClientId: string;\n region?: string;\n /** Cognito Hosted UI domain, e.g. 'myapp.auth.us-east-1.amazoncognito.com' */\n domain: string;\n /** OAuth redirect URI. Defaults to window.location.origin */\n redirectUri?: string;\n /** OAuth scopes. Defaults to ['openid', 'profile', 'email'] */\n scopes?: string[];\n /** When true, skips redirect callback processing (for MCP OAuth callback path) */\n skipRedirectCallback?: boolean;\n}\n\n/**\n * AWS Cognito authentication provider implementation - v3.0.0\n *\n * Implements the abstract methods from MJAuthBase to hide Cognito-specific details.\n * Uses AWS Amplify v6 (tree-shakeable subpath imports) for authentication.\n *\n * Key abstraction: Cognito stores tokens in Amplify's internal storage, accessed\n * via `fetchAuthSession().tokens?.idToken?.toString()`. Consumers never need to\n * know this detail.\n *\n * ## Cognito Hosted UI Flow\n * This provider uses the Cognito Hosted UI for login via `signInWithRedirect()`.\n * The flow is: redirect to Hosted UI -> user authenticates -> redirect back with\n * authorization code -> Amplify exchanges code for tokens (PKCE).\n */\n@Injectable({\n providedIn: 'root'\n})\n@RegisterClass(MJAuthBase, 'cognito')\nexport class MJCognitoProvider extends MJAuthBase {\n static readonly PROVIDER_TYPE = 'cognito';\n readonly type = MJCognitoProvider.PROVIDER_TYPE;\n private _initialized = false;\n private _hubListenerCancel: (() => void) | null = null;\n\n /**\n * Factory function to provide Angular dependencies required by the Cognito provider.\n * Returns a config injection token following the Okta provider pattern.\n */\n static angularProviderFactory = (environment: Record<string, unknown>) => {\n const isMCPOAuthCallback = window.location.pathname.startsWith('/oauth/callback');\n\n return [\n {\n provide: 'cognitoConfig',\n useValue: {\n userPoolId: environment['COGNITO_USER_POOL_ID'],\n userPoolClientId: environment['COGNITO_CLIENT_ID'] || environment['COGNITO_CLIENTID'],\n region: environment['COGNITO_REGION'] || environment['AWS_REGION'],\n domain: environment['COGNITO_DOMAIN'],\n redirectUri: environment['COGNITO_REDIRECT_URI'] || window.location.origin,\n scopes: environment['COGNITO_SCOPES'] || ['openid', 'profile', 'email', 'aws.cognito.signin.user.admin'],\n skipRedirectCallback: isMCPOAuthCallback,\n } as CognitoConfig\n }\n ];\n };\n\n constructor(@Inject('cognitoConfig') private cognitoConfig: CognitoConfig) {\n const config: AngularAuthProviderConfig = {\n name: MJCognitoProvider.PROVIDER_TYPE,\n type: MJCognitoProvider.PROVIDER_TYPE\n };\n super(config);\n\n // Configure Amplify with the existing Cognito User Pool\n const redirectUri = this.cognitoConfig.redirectUri || window.location.origin;\n Amplify.configure({\n Auth: {\n Cognito: {\n userPoolId: this.cognitoConfig.userPoolId,\n userPoolClientId: this.cognitoConfig.userPoolClientId,\n loginWith: {\n oauth: {\n domain: this.cognitoConfig.domain,\n scopes: this.cognitoConfig.scopes || ['openid', 'profile', 'email', 'aws.cognito.signin.user.admin'],\n redirectSignIn: [redirectUri],\n redirectSignOut: [redirectUri],\n responseType: 'code', // Authorization code + PKCE for refresh tokens\n }\n }\n }\n }\n });\n }\n\n // ============================================================================\n // LIFECYCLE METHODS\n // ============================================================================\n\n async initialize(): Promise<void> {\n if (this._initialized) {\n return;\n }\n\n // CRITICAL: Skip Amplify's redirect handling on the MCP OAuth callback path.\n // The /oauth/callback path is used by MCP OAuth, not Cognito. If we don't skip,\n // Amplify will consume the authorization code and prevent the MCP OAuth flow.\n if (this.cognitoConfig.skipRedirectCallback) {\n this._initialized = true;\n return;\n }\n\n // Set up Hub listener for reactive auth events\n this._hubListenerCancel = Hub.listen('auth', async ({ payload }) => {\n switch (payload.event) {\n case 'signedIn':\n this.updateAuthState(true);\n await this.refreshUserInfo();\n break;\n case 'signedOut':\n this.updateAuthState(false);\n this.updateUserInfo(null);\n break;\n case 'tokenRefresh':\n console.log('[Cognito] Token refreshed successfully');\n break;\n case 'tokenRefresh_failure':\n console.warn('[Cognito] Token refresh failed');\n break;\n case 'signInWithRedirect':\n console.log('[Cognito] OAuth redirect sign-in completed');\n break;\n case 'signInWithRedirect_failure':\n console.error('[Cognito] OAuth redirect sign-in failed');\n break;\n }\n });\n\n // Check for existing session (page refresh or returning from redirect)\n try {\n const user = await getCurrentUser();\n if (user) {\n this.updateAuthState(true);\n await this.refreshUserInfo();\n }\n } catch {\n // Not authenticated — this is expected on fresh visits\n this.updateAuthState(false);\n }\n\n this._initialized = true;\n }\n\n protected async loginInternal(_options?: Record<string, unknown>): Promise<void> {\n await this.ensureInitialized();\n // Redirect to Cognito Hosted UI. This navigates the browser and never returns.\n await signInWithRedirect();\n }\n\n protected async logoutInternal(): Promise<void> {\n this.updateAuthState(false);\n this.updateUserInfo(null);\n\n // Cancel Hub listener before sign-out to avoid race conditions\n this.cancelHubListener();\n\n await signOut();\n // signOut() clears local tokens. With Hosted UI, it also redirects to the\n // Cognito logout endpoint to clear the Hosted UI session cookie.\n }\n\n async handleCallback(): Promise<void> {\n // Amplify v6 handles OAuth code exchange automatically when it detects\n // ?code= and ?state= in the URL during initialization. The Hub listener\n // catches 'signInWithRedirect' events. This method exists for interface\n // compatibility.\n try {\n const user = await getCurrentUser();\n if (user) {\n this.updateAuthState(true);\n await this.refreshUserInfo();\n }\n } catch {\n // Not authenticated after callback\n }\n }\n\n // ============================================================================\n // ABSTRACT METHOD IMPLEMENTATIONS (v3.0.0)\n // ============================================================================\n\n /**\n * Extract ID token from Cognito via Amplify's fetchAuthSession.\n *\n * Cognito stores the JWT in session.tokens.idToken. The .toString()\n * call extracts the raw JWT string. Consumers never need to know this detail.\n */\n protected async extractIdTokenInternal(): Promise<string | null> {\n try {\n const session = await fetchAuthSession();\n return session.tokens?.idToken?.toString() || null;\n } catch (error) {\n console.error('[Cognito] Error extracting ID token:', error);\n return null;\n }\n }\n\n /**\n * Extract complete token info from Cognito session.\n * Maps Amplify's token structure to StandardAuthToken.\n */\n protected async extractTokenInfoInternal(): Promise<StandardAuthToken | null> {\n try {\n const session = await fetchAuthSession();\n const idToken = session.tokens?.idToken;\n if (!idToken) {\n return null;\n }\n\n const payload = idToken.payload;\n const accessToken = session.tokens?.accessToken;\n\n return {\n idToken: idToken.toString(),\n accessToken: accessToken?.toString(),\n expiresAt: payload?.exp ? (payload.exp as number) * 1000 : 0, // Convert to ms\n scopes: this.extractScopes(accessToken)\n };\n } catch (error) {\n console.error('[Cognito] Error extracting token info:', error);\n return null;\n }\n }\n\n /**\n * Extract user info from Cognito user attributes.\n * Maps Cognito's attribute structure to StandardUserInfo.\n */\n protected async extractUserInfoInternal(): Promise<StandardUserInfo | null> {\n try {\n const user = await getCurrentUser();\n const attributes = await fetchUserAttributes();\n\n return this.mapCognitoAttributesToStandard(user, attributes);\n } catch (error) {\n console.error('[Cognito] Error extracting user info:', error);\n return null;\n }\n }\n\n /**\n * Refresh token using Amplify's fetchAuthSession with forceRefresh.\n *\n * Amplify v6 handles the entire refresh token exchange internally:\n * fetchAuthSession({ forceRefresh: true }) uses the stored refresh token\n * to obtain new ID and access tokens from Cognito.\n */\n protected async refreshTokenInternal(): Promise<TokenRefreshResult> {\n try {\n console.log('[Cognito] Attempting to refresh token...');\n\n const session = await fetchAuthSession({ forceRefresh: true });\n const idToken = session.tokens?.idToken;\n\n if (!idToken) {\n return {\n success: false,\n error: {\n type: AuthErrorType.NO_ACTIVE_SESSION,\n message: 'Token refresh succeeded but no ID token returned',\n userMessage: 'Session refresh failed. Please log in again.'\n }\n };\n }\n\n const payload = idToken.payload;\n const accessToken = session.tokens?.accessToken;\n\n console.log('[Cognito] Token refresh successful', {\n expiresAt: payload?.exp ? new Date((payload.exp as number) * 1000).toISOString() : 'N/A'\n });\n\n return {\n success: true,\n token: {\n idToken: idToken.toString(),\n accessToken: accessToken?.toString(),\n expiresAt: payload?.exp ? (payload.exp as number) * 1000 : 0,\n scopes: this.extractScopes(accessToken)\n }\n };\n } catch (error) {\n console.error('[Cognito] Token refresh failed:', error);\n return {\n success: false,\n error: this.classifyErrorInternal(error)\n };\n }\n }\n\n /**\n * Classify Cognito/Amplify-specific errors into semantic types.\n *\n * Maps Amplify v6 error names and messages to AuthErrorType enum.\n */\n protected classifyErrorInternal(error: unknown): StandardAuthError {\n const errorObj = error as Record<string, unknown>;\n const message = (errorObj?.['message'] as string) || 'Unknown error';\n const name = (errorObj?.['name'] as string) || '';\n\n // Not authenticated / no session\n if (name === 'UserUnAuthenticatedException' ||\n message.includes('not authenticated') ||\n message.includes('No current user') ||\n name === 'UserNotFoundException') {\n return {\n type: AuthErrorType.NO_ACTIVE_SESSION,\n message,\n originalError: error,\n userMessage: 'You need to log in to continue.'\n };\n }\n\n // Token expired / invalid refresh token\n if (name === 'NotAuthorizedException' ||\n message.includes('not authorized') ||\n message.includes('Invalid Refresh Token') ||\n message.includes('expired') ||\n message.includes('invalid_grant')) {\n return {\n type: AuthErrorType.TOKEN_EXPIRED,\n message,\n originalError: error,\n userMessage: 'Your session has expired. Please log in again.'\n };\n }\n\n // User cancelled login\n if (message.includes('cancelled') || message.includes('canceled') ||\n message.includes('user denied')) {\n return {\n type: AuthErrorType.USER_CANCELLED,\n message,\n originalError: error,\n userMessage: 'Login was cancelled.'\n };\n }\n\n // Network errors\n if (message.includes('network') || message.includes('fetch') ||\n message.includes('Network') || message.includes('Load failed')) {\n return {\n type: AuthErrorType.NETWORK_ERROR,\n message,\n originalError: error,\n userMessage: 'Network error. Please check your connection and try again.'\n };\n }\n\n // OAuth configuration errors\n if (name === 'OAuthNotConfigureException' ||\n name === 'AuthTokenConfigException' ||\n message.includes('OAuth') || message.includes('configuration')) {\n return {\n type: AuthErrorType.CONFIGURATION_ERROR,\n message,\n originalError: error,\n userMessage: 'Authentication configuration error. Please contact support.'\n };\n }\n\n // Default to unknown\n return {\n type: AuthErrorType.UNKNOWN_ERROR,\n message,\n originalError: error,\n userMessage: 'An unexpected error occurred. Please try again.'\n };\n }\n\n /**\n * Get profile picture URL from Cognito user attributes.\n *\n * Cognito can store a `picture` attribute if configured in the user pool.\n * Returns null if the attribute is not set.\n */\n protected async getProfilePictureUrlInternal(): Promise<string | null> {\n try {\n const attributes = await fetchUserAttributes();\n return attributes.picture || null;\n } catch (error) {\n console.error('[Cognito] Error getting profile picture:', error);\n return null;\n }\n }\n\n /**\n * Handle session expiry by redirecting to Cognito Hosted UI.\n *\n * Cognito uses refresh tokens (responseType: 'code'), so silent refresh\n * usually works. If it fails, we redirect to the Hosted UI for\n * re-authentication. This will navigate the browser and may never return.\n */\n protected async handleSessionExpiryInternal(): Promise<void> {\n console.log('[Cognito] Session expired, redirecting to Hosted UI for re-authentication');\n await signInWithRedirect();\n // This redirects the page and never returns\n }\n\n // ============================================================================\n // HELPER METHODS\n // ============================================================================\n\n private async ensureInitialized(): Promise<void> {\n if (!this._initialized) {\n await this.initialize();\n }\n }\n\n /**\n * Refresh user info from Cognito and update the reactive state.\n */\n private async refreshUserInfo(): Promise<void> {\n try {\n const userInfo = await this.extractUserInfoInternal();\n if (userInfo) {\n this.updateUserInfo(userInfo);\n }\n } catch (error) {\n console.warn('[Cognito] Failed to refresh user info:', error);\n }\n }\n\n /**\n * Map Cognito user attributes to StandardUserInfo.\n *\n * Cognito attributes use snake_case keys (email, given_name, family_name, etc.)\n * and all values are strings (including booleans like email_verified = 'true').\n */\n private mapCognitoAttributesToStandard(\n user: { userId: string; username: string; signInDetails?: { loginId?: string } },\n attributes: Partial<Record<string, string>>\n ): StandardUserInfo {\n const givenName = attributes['given_name'];\n const familyName = attributes['family_name'];\n const fullName = attributes['name'] ||\n (givenName && familyName ? `${givenName} ${familyName}` : givenName || familyName || '');\n\n return {\n id: user.userId || user.username,\n email: attributes['email'] || '',\n name: fullName,\n givenName,\n familyName,\n preferredUsername: attributes['preferred_username'] || user.username,\n pictureUrl: attributes['picture'],\n emailVerified: attributes['email_verified'] === 'true',\n locale: attributes['locale'],\n };\n }\n\n /**\n * Extract OAuth scopes from an access token's payload.\n */\n private extractScopes(accessToken: { payload?: Record<string, unknown> } | undefined): string[] | undefined {\n const scope = accessToken?.payload?.['scope'];\n if (typeof scope === 'string') {\n return scope.split(' ');\n }\n return undefined;\n }\n\n /**\n * Cancel the Hub event listener if active.\n */\n private cancelHubListener(): void {\n if (this._hubListenerCancel) {\n this._hubListenerCancel();\n this._hubListenerCancel = null;\n }\n }\n\n // ============================================================================\n // CONFIGURATION\n // ============================================================================\n\n override getRequiredConfig(): string[] {\n return ['userPoolId', 'userPoolClientId', 'domain'];\n }\n\n override validateConfig(config: Record<string, unknown>): boolean {\n return !!(config['userPoolId'] && config['userPoolClientId'] && config['domain']);\n }\n}\n"]}
@@ -7,4 +7,5 @@ export * from './lib/AngularAuthProviderFactory';
7
7
  export * from './lib/providers/mjexplorer-msal-provider.service';
8
8
  export * from './lib/providers/mjexplorer-auth0-provider.service';
9
9
  export * from './lib/providers/mjexplorer-okta-provider.service';
10
+ export * from './lib/providers/mjexplorer-cognito-provider.service';
10
11
  //# sourceMappingURL=public-api.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"public-api.d.ts","sourceRoot":"","sources":["../src/public-api.ts"],"names":[],"mappings":"AAKA,cAAc,oCAAoC,CAAC;AACnD,cAAc,4BAA4B,CAAC;AAC3C,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAG7D,cAAc,kBAAkB,CAAC;AAGjC,cAAc,qBAAqB,CAAC;AACpC,cAAc,kCAAkC,CAAC;AAGjD,cAAc,kDAAkD,CAAC;AACjE,cAAc,mDAAmD,CAAC;AAClE,cAAc,kDAAkD,CAAC"}
1
+ {"version":3,"file":"public-api.d.ts","sourceRoot":"","sources":["../src/public-api.ts"],"names":[],"mappings":"AAKA,cAAc,oCAAoC,CAAC;AACnD,cAAc,4BAA4B,CAAC;AAC3C,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAG7D,cAAc,kBAAkB,CAAC;AAGjC,cAAc,qBAAqB,CAAC;AACpC,cAAc,kCAAkC,CAAC;AAGjD,cAAc,kDAAkD,CAAC;AACjE,cAAc,mDAAmD,CAAC;AAClE,cAAc,kDAAkD,CAAC;AACjE,cAAc,qDAAqD,CAAC"}
@@ -14,4 +14,5 @@ export * from './lib/AngularAuthProviderFactory';
14
14
  export * from './lib/providers/mjexplorer-msal-provider.service';
15
15
  export * from './lib/providers/mjexplorer-auth0-provider.service';
16
16
  export * from './lib/providers/mjexplorer-okta-provider.service';
17
+ export * from './lib/providers/mjexplorer-cognito-provider.service';
17
18
  //# sourceMappingURL=public-api.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"public-api.js","sourceRoot":"","sources":["../src/public-api.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,eAAe;AACf,cAAc,oCAAoC,CAAC;AACnD,cAAc,4BAA4B,CAAC;AAC3C,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAE7D,2CAA2C;AAC3C,cAAc,kBAAkB,CAAC;AAEjC,oBAAoB;AACpB,cAAc,qBAAqB,CAAC;AACpC,cAAc,kCAAkC,CAAC;AAEjD,2BAA2B;AAC3B,cAAc,kDAAkD,CAAC;AACjE,cAAc,mDAAmD,CAAC;AAClE,cAAc,kDAAkD,CAAC","sourcesContent":["/*\n * Public API Surface\n */\n\n// Core exports\nexport * from './lib/mjexplorer-auth-base.service';\nexport * from './lib/auth-services.module';\nexport { RedirectComponent } from './lib/redirect.component';\n\n// Type exports - v3.0.0 standardized types\nexport * from './lib/auth-types';\n\n// Interface exports\nexport * from './lib/IAuthProvider';\nexport * from './lib/AngularAuthProviderFactory';\n\n// Provider implementations\nexport * from './lib/providers/mjexplorer-msal-provider.service';\nexport * from './lib/providers/mjexplorer-auth0-provider.service';\nexport * from './lib/providers/mjexplorer-okta-provider.service';"]}
1
+ {"version":3,"file":"public-api.js","sourceRoot":"","sources":["../src/public-api.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,eAAe;AACf,cAAc,oCAAoC,CAAC;AACnD,cAAc,4BAA4B,CAAC;AAC3C,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAE7D,2CAA2C;AAC3C,cAAc,kBAAkB,CAAC;AAEjC,oBAAoB;AACpB,cAAc,qBAAqB,CAAC;AACpC,cAAc,kCAAkC,CAAC;AAEjD,2BAA2B;AAC3B,cAAc,kDAAkD,CAAC;AACjE,cAAc,mDAAmD,CAAC;AAClE,cAAc,kDAAkD,CAAC;AACjE,cAAc,qDAAqD,CAAC","sourcesContent":["/*\n * Public API Surface\n */\n\n// Core exports\nexport * from './lib/mjexplorer-auth-base.service';\nexport * from './lib/auth-services.module';\nexport { RedirectComponent } from './lib/redirect.component';\n\n// Type exports - v3.0.0 standardized types\nexport * from './lib/auth-types';\n\n// Interface exports\nexport * from './lib/IAuthProvider';\nexport * from './lib/AngularAuthProviderFactory';\n\n// Provider implementations\nexport * from './lib/providers/mjexplorer-msal-provider.service';\nexport * from './lib/providers/mjexplorer-auth0-provider.service';\nexport * from './lib/providers/mjexplorer-okta-provider.service';\nexport * from './lib/providers/mjexplorer-cognito-provider.service';"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@memberjunction/ng-auth-services",
3
- "version": "5.23.0",
3
+ "version": "5.25.0",
4
4
  "description": "MemberJunction Explorer: Authentication Services",
5
5
  "main": "./dist/public-api.js",
6
6
  "typings": "./dist/public-api.d.ts",
@@ -27,11 +27,12 @@
27
27
  "@azure/msal-angular": "^5.0.3",
28
28
  "@azure/msal-browser": "^5.1.0",
29
29
  "@azure/msal-common": "^16.0.3",
30
- "@okta/okta-auth-js": "^7.14.1"
30
+ "@okta/okta-auth-js": "^7.14.1",
31
+ "aws-amplify": "^6.0.0"
31
32
  },
32
33
  "dependencies": {
33
- "@memberjunction/core": "5.23.0",
34
- "@memberjunction/global": "5.23.0",
34
+ "@memberjunction/core": "5.25.0",
35
+ "@memberjunction/global": "5.25.0",
35
36
  "rxjs": "^7.8.2",
36
37
  "tslib": "^2.8.1"
37
38
  },