@lafken/auth 0.11.7 → 0.11.9
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/lib/resolver/auth/auth.js +5 -2
- package/lib/resolver/auth/user-pool/external/external.d.ts +2 -2
- package/lib/resolver/auth/user-pool/external/external.js +3 -1
- package/lib/resolver/auth/user-pool/internal/internal.d.ts +2 -2
- package/lib/resolver/auth/user-pool/internal/internal.js +3 -1
- package/lib/resolver/auth/user-pool/user-pool.types.d.ts +16 -4
- package/lib/resolver/auth/user-pool-client/external/external.js +3 -1
- package/lib/resolver/auth/user-pool-client/internal/internal.js +3 -1
- package/lib/resolver/auth/user-pool-client/user-pool-client.types.d.ts +14 -3
- package/lib/resolver/auth/user-pool-client/user-pool-client.utils.d.ts +4 -4
- package/lib/resolver/resolver.types.d.ts +3 -3
- package/package.json +10 -10
|
@@ -30,14 +30,17 @@ class Auth extends constructs_1.Construct {
|
|
|
30
30
|
}
|
|
31
31
|
}
|
|
32
32
|
createUserPool() {
|
|
33
|
+
if (!this.props.userPool) {
|
|
34
|
+
return;
|
|
35
|
+
}
|
|
33
36
|
if (this.props.userPool?.isExternal) {
|
|
34
37
|
this.userPool = new external_1.ExternalUserPool(this, this.id, this.props.userPool);
|
|
35
38
|
return;
|
|
36
39
|
}
|
|
37
|
-
this.userPool = new internal_1.InternalUserPool(this, this.id, this.props.userPool
|
|
40
|
+
this.userPool = new internal_1.InternalUserPool(this, this.id, this.props.userPool);
|
|
38
41
|
}
|
|
39
42
|
createUserPoolClient() {
|
|
40
|
-
if (!this.props.userClient) {
|
|
43
|
+
if (!this.userPool || !this.props.userClient) {
|
|
41
44
|
return;
|
|
42
45
|
}
|
|
43
46
|
if (this.props.userClient?.isExternal) {
|
|
@@ -2,8 +2,8 @@ import { DataAwsCognitoUserPool } from '@cdktn/provider-aws/lib/data-aws-cognito
|
|
|
2
2
|
import type { Construct } from 'constructs';
|
|
3
3
|
import type { ExternalUserPoolProps } from '../user-pool.types';
|
|
4
4
|
declare const ExternalUserPool_base: (new (...args: any[]) => {
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
register(namespaces: import("@lafken/common").RegisterNamespaces | (string & {}), id: string): void;
|
|
6
|
+
onResolve(callback: () => void): void;
|
|
7
7
|
readonly node: import("constructs").Node;
|
|
8
8
|
with(...mixins: import("constructs").IMixin[]): import("constructs").IConstruct;
|
|
9
9
|
toString(): string;
|
|
@@ -10,7 +10,9 @@ class ExternalUserPool extends resolver_1.lafkenResource.make(data_aws_cognito_u
|
|
|
10
10
|
? props.userPoolId
|
|
11
11
|
: props.userPoolId((0, resolver_1.getExternalValues)(scope)),
|
|
12
12
|
});
|
|
13
|
-
|
|
13
|
+
if (props.ref) {
|
|
14
|
+
this.register('user-pool', props.ref);
|
|
15
|
+
}
|
|
14
16
|
}
|
|
15
17
|
}
|
|
16
18
|
exports.ExternalUserPool = ExternalUserPool;
|
|
@@ -3,8 +3,8 @@ import type { Construct } from 'constructs';
|
|
|
3
3
|
import { type CustomAttributesMetadata, type StandardAttributeMetadata } from '../../../../main';
|
|
4
4
|
import type { InternalUserPoolProps } from '../user-pool.types';
|
|
5
5
|
declare const InternalUserPool_base: (new (...args: any[]) => {
|
|
6
|
-
|
|
7
|
-
|
|
6
|
+
register(namespaces: import("@lafken/common").RegisterNamespaces | (string & {}), id: string): void;
|
|
7
|
+
onResolve(callback: () => void): void;
|
|
8
8
|
readonly node: import("constructs").Node;
|
|
9
9
|
with(...mixins: import("constructs").IMixin[]): import("constructs").IConstruct;
|
|
10
10
|
toString(): string;
|
|
@@ -39,7 +39,9 @@ class InternalUserPool extends resolver_1.lafkenResource.make(cognito_user_pool_
|
|
|
39
39
|
if (attributes?.attributeByName) {
|
|
40
40
|
this.attributeByName = attributes.attributeByName;
|
|
41
41
|
}
|
|
42
|
-
|
|
42
|
+
if (props.ref) {
|
|
43
|
+
this.register('user-pool', props.ref);
|
|
44
|
+
}
|
|
43
45
|
this.assignIdentityProviders(props.identityProviders);
|
|
44
46
|
new resolver_1.ResourceOutput(this, props.outputs);
|
|
45
47
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ClassResource, GetExternalValues, ResourceOutputType } from '@lafken/common';
|
|
1
|
+
import type { ClassResource, GetExternalValues, ResourceOutputType, UserPoolNames, UserPoolReferenceNames } from '@lafken/common';
|
|
2
2
|
export type SignInAliases = 'email' | 'phone' | 'preferred_username';
|
|
3
3
|
export type CognitoPlan = 'lite' | 'essentials' | 'plus';
|
|
4
4
|
export type UserVerificationType = 'code' | 'link';
|
|
@@ -101,8 +101,20 @@ export interface OidcIdentityProvider<T extends Function> extends CommonIdentity
|
|
|
101
101
|
jwksUri: string;
|
|
102
102
|
}
|
|
103
103
|
export type IdentityProvider<T extends ClassResource> = AmazonIdentityProvider<T> | AppleIdentityProvider<T> | FacebookIdentityProvider<T> | GoogleIdentityProvider<T> | OidcIdentityProvider<T>;
|
|
104
|
-
export interface
|
|
105
|
-
|
|
104
|
+
export interface UserPoolCommon {
|
|
105
|
+
/**
|
|
106
|
+
* Registers this User Pool as a named global reference, allowing other resources
|
|
107
|
+
* to access its attributes (e.g. ARN, ID) by reference name.
|
|
108
|
+
*
|
|
109
|
+
* @example
|
|
110
|
+
* // Register the User Pool under a reference name
|
|
111
|
+
* ref: 'myUserPool'
|
|
112
|
+
*/
|
|
113
|
+
ref?: UserPoolReferenceNames;
|
|
114
|
+
}
|
|
115
|
+
export interface InternalUserPoolProps<T extends ClassResource> extends UserPoolCommon {
|
|
116
|
+
/** Unique identifier for this User Pool within the application. */
|
|
117
|
+
name?: UserPoolNames;
|
|
106
118
|
isExternal?: never;
|
|
107
119
|
/**
|
|
108
120
|
* Defines the attributes for the Cognito User Pool.
|
|
@@ -245,7 +257,7 @@ export interface InternalUserPoolProps<T extends ClassResource> {
|
|
|
245
257
|
*/
|
|
246
258
|
outputs?: ResourceOutputType<UserPoolOutputAttributes>;
|
|
247
259
|
}
|
|
248
|
-
export interface ExternalUserPoolProps {
|
|
260
|
+
export interface ExternalUserPoolProps extends UserPoolCommon {
|
|
249
261
|
/**
|
|
250
262
|
* Marks the User Pool as an external resource.
|
|
251
263
|
*
|
|
@@ -14,7 +14,9 @@ class ExternalUserPoolClient extends constructs_1.Construct {
|
|
|
14
14
|
: props.clientId((0, resolver_1.getExternalValues)(scope)),
|
|
15
15
|
userPoolId: props.userPoolId,
|
|
16
16
|
});
|
|
17
|
-
|
|
17
|
+
if (props.ref) {
|
|
18
|
+
this.cognitoUserPoolClient.register('user-pool-client', props.ref);
|
|
19
|
+
}
|
|
18
20
|
}
|
|
19
21
|
}
|
|
20
22
|
exports.ExternalUserPoolClient = ExternalUserPoolClient;
|
|
@@ -24,7 +24,9 @@ class InternalUserPoolClient extends constructs_1.Construct {
|
|
|
24
24
|
readAttributes: this.getAttributes(props.readAttributes),
|
|
25
25
|
writeAttributes: this.getAttributes(props.writeAttributes),
|
|
26
26
|
});
|
|
27
|
-
|
|
27
|
+
if (props.ref) {
|
|
28
|
+
this.cognitoUserPoolClient.register('user-pool-client', props.ref);
|
|
29
|
+
}
|
|
28
30
|
new resolver_1.ResourceOutput(this.cognitoUserPoolClient, props.outputs);
|
|
29
31
|
}
|
|
30
32
|
getRefreshTokenRotation(period) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { GetExternalValues, ResourceOutputType } from '@lafken/common';
|
|
1
|
+
import type { GetExternalValues, ResourceOutputType, UserPoolClientReferenceNames } from '@lafken/common';
|
|
2
2
|
import type { CustomAttributesMetadata, StandardAttributeMetadata } from '../../../main';
|
|
3
3
|
export type AuthFlow = 'allow_admin_user_password_auth' | 'allow_custom_auth' | 'allow_user_password_auth' | 'allow_user_srp_auth' | 'allow_refresh_token_auth' | 'allow_user_auth';
|
|
4
4
|
export type OAuthFlow = 'code' | 'client_credentials' | 'implicit';
|
|
@@ -21,7 +21,18 @@ export interface OAuthConfig {
|
|
|
21
21
|
logoutUrls?: string[];
|
|
22
22
|
scopes?: OAuthScopes[];
|
|
23
23
|
}
|
|
24
|
-
export interface
|
|
24
|
+
export interface UserPoolClientCommon {
|
|
25
|
+
/**
|
|
26
|
+
* Registers this User Pool Client as a named global reference, allowing other resources
|
|
27
|
+
* to access its attributes (e.g. ARN, ID) by reference name.
|
|
28
|
+
*
|
|
29
|
+
* @example
|
|
30
|
+
* // Register the User Pool under a reference name
|
|
31
|
+
* ref: 'myUserPool'
|
|
32
|
+
*/
|
|
33
|
+
ref?: UserPoolClientReferenceNames;
|
|
34
|
+
}
|
|
35
|
+
export interface InternalUserClientProps<T extends Function> extends UserPoolClientCommon {
|
|
25
36
|
isExternal?: never;
|
|
26
37
|
/**
|
|
27
38
|
* Name of the Cognito User Pool Client.
|
|
@@ -151,7 +162,7 @@ export interface InternalUserClientProps<T extends Function> {
|
|
|
151
162
|
*/
|
|
152
163
|
outputs?: ResourceOutputType<UserPoolClientOutputAttributes>;
|
|
153
164
|
}
|
|
154
|
-
export interface ExternalUserClientProps {
|
|
165
|
+
export interface ExternalUserClientProps extends UserPoolClientCommon {
|
|
155
166
|
/**
|
|
156
167
|
* Marks the User Pool as an external resource.
|
|
157
168
|
*
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { CognitoUserPoolClient } from '@cdktn/provider-aws/lib/cognito-user-pool-client';
|
|
2
2
|
import { DataAwsCognitoUserPoolClient } from '@cdktn/provider-aws/lib/data-aws-cognito-user-pool-client';
|
|
3
3
|
declare const DataInternalUserPoolClient_base: (new (...args: any[]) => {
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
register(namespaces: import("@lafken/common").RegisterNamespaces | (string & {}), id: string): void;
|
|
5
|
+
onResolve(callback: () => void): void;
|
|
6
6
|
readonly node: import("constructs").Node;
|
|
7
7
|
with(...mixins: import("constructs").IMixin[]): import("constructs").IConstruct;
|
|
8
8
|
toString(): string;
|
|
@@ -10,8 +10,8 @@ declare const DataInternalUserPoolClient_base: (new (...args: any[]) => {
|
|
|
10
10
|
export declare class DataInternalUserPoolClient extends DataInternalUserPoolClient_base {
|
|
11
11
|
}
|
|
12
12
|
declare const DataExternalUserPoolClient_base: (new (...args: any[]) => {
|
|
13
|
-
|
|
14
|
-
|
|
13
|
+
register(namespaces: import("@lafken/common").RegisterNamespaces | (string & {}), id: string): void;
|
|
14
|
+
onResolve(callback: () => void): void;
|
|
15
15
|
readonly node: import("constructs").Node;
|
|
16
16
|
with(...mixins: import("constructs").IMixin[]): import("constructs").IConstruct;
|
|
17
17
|
toString(): string;
|
|
@@ -2,7 +2,7 @@ import type { CognitoUserPool } from '@cdktn/provider-aws/lib/cognito-user-pool'
|
|
|
2
2
|
import type { CognitoUserPoolClient } from '@cdktn/provider-aws/lib/cognito-user-pool-client';
|
|
3
3
|
import type { DataAwsCognitoUserPool } from '@cdktn/provider-aws/lib/data-aws-cognito-user-pool';
|
|
4
4
|
import type { DataAwsCognitoUserPoolClient } from '@cdktn/provider-aws/lib/data-aws-cognito-user-pool-client';
|
|
5
|
-
import type {
|
|
5
|
+
import type { ClassResource } from '@lafken/common';
|
|
6
6
|
import type { Construct } from 'constructs';
|
|
7
7
|
import type { UserPoolProps } from './auth/user-pool/user-pool.types';
|
|
8
8
|
import type { UserClientProps } from './auth/user-pool-client/user-pool-client.types';
|
|
@@ -13,9 +13,9 @@ export interface ExtendProps {
|
|
|
13
13
|
}
|
|
14
14
|
export interface AuthOptions<T extends ClassResource> {
|
|
15
15
|
/**
|
|
16
|
-
*
|
|
16
|
+
* name of authorizer
|
|
17
17
|
*/
|
|
18
|
-
name:
|
|
18
|
+
name: string;
|
|
19
19
|
/**
|
|
20
20
|
* Defines a custom configuration for the Cognito User Pool.
|
|
21
21
|
* This allows specifying properties such as:
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lafken/auth",
|
|
3
|
-
"version": "0.11.
|
|
3
|
+
"version": "0.11.9",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Define Cognito User Pools using TypeScript decorators - simplified authentication infrastructure with Lafken",
|
|
6
6
|
"keywords": [
|
|
@@ -50,26 +50,26 @@
|
|
|
50
50
|
],
|
|
51
51
|
"dependencies": {
|
|
52
52
|
"reflect-metadata": "^0.2.2",
|
|
53
|
-
"@lafken/resolver": "0.11.
|
|
53
|
+
"@lafken/resolver": "0.11.9"
|
|
54
54
|
},
|
|
55
55
|
"devDependencies": {
|
|
56
|
-
"@cdktn/provider-aws": "^23.
|
|
57
|
-
"@swc/core": "^1.15.
|
|
58
|
-
"@swc/helpers": "^0.5.
|
|
59
|
-
"@vitest/runner": "^4.1.
|
|
56
|
+
"@cdktn/provider-aws": "^23.9.0",
|
|
57
|
+
"@swc/core": "^1.15.30",
|
|
58
|
+
"@swc/helpers": "^0.5.21",
|
|
59
|
+
"@vitest/runner": "^4.1.5",
|
|
60
60
|
"cdktn": "^0.22.1",
|
|
61
61
|
"cdktn-vitest": "^1.0.0",
|
|
62
62
|
"constructs": "^10.6.0",
|
|
63
|
-
"typescript": "6.0.
|
|
63
|
+
"typescript": "6.0.3",
|
|
64
64
|
"unplugin-swc": "^1.5.9",
|
|
65
|
-
"vitest": "^4.1.
|
|
66
|
-
"@lafken/common": "0.11.
|
|
65
|
+
"vitest": "^4.1.5",
|
|
66
|
+
"@lafken/common": "0.11.9"
|
|
67
67
|
},
|
|
68
68
|
"peerDependencies": {
|
|
69
69
|
"@cdktn/provider-aws": ">=23.0.0",
|
|
70
70
|
"cdktn": ">=0.22.0",
|
|
71
71
|
"constructs": "^10.4.5",
|
|
72
|
-
"@lafken/common": "0.11.
|
|
72
|
+
"@lafken/common": "0.11.9"
|
|
73
73
|
},
|
|
74
74
|
"engines": {
|
|
75
75
|
"node": ">=20.19"
|