@openhi/constructs 0.0.128 → 0.0.129
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/index.d.mts +13 -0
- package/lib/index.d.ts +13 -0
- package/lib/index.js +22 -2
- package/lib/index.js.map +1 -1
- package/lib/index.mjs +22 -2
- package/lib/index.mjs.map +1 -1
- package/lib/rest-api-lambda.handler.js +2 -2
- package/lib/rest-api-lambda.handler.js.map +1 -1
- package/lib/rest-api-lambda.handler.mjs +2 -2
- package/lib/rest-api-lambda.handler.mjs.map +1 -1
- package/package.json +1 -1
package/lib/index.mjs
CHANGED
|
@@ -2509,6 +2509,26 @@ var _OpenHiAuthService = class _OpenHiAuthService extends OpenHiService {
|
|
|
2509
2509
|
});
|
|
2510
2510
|
return UserPoolDomain2.fromDomainName(scope, "user-pool-domain", domainName);
|
|
2511
2511
|
}
|
|
2512
|
+
/**
|
|
2513
|
+
* Returns the full Cognito Hosted UI base URL (e.g.
|
|
2514
|
+
* `https://auth-abc.auth.us-east-2.amazoncognito.com`) by looking up
|
|
2515
|
+
* the Auth stack's User Pool Domain from SSM and composing it with the
|
|
2516
|
+
* calling stack's region.
|
|
2517
|
+
*
|
|
2518
|
+
* Equivalent to `UserPoolDomain.baseUrl()` on the concrete construct,
|
|
2519
|
+
* but works across stacks where the looked-up `IUserPoolDomain` is an
|
|
2520
|
+
* `Import` and does not carry the `baseUrl()` method. Assumes the
|
|
2521
|
+
* domain was created as a Cognito-managed prefix domain (the only
|
|
2522
|
+
* variant `OpenHiAuthService.createUserPoolDomain` produces).
|
|
2523
|
+
*/
|
|
2524
|
+
static userPoolDomainBaseUrlFromConstruct(scope) {
|
|
2525
|
+
const domainName = DiscoverableStringParameter.valueForLookupName(scope, {
|
|
2526
|
+
ssmParamName: CognitoUserPoolDomain.SSM_PARAM_NAME,
|
|
2527
|
+
serviceType: _OpenHiAuthService.SERVICE_TYPE
|
|
2528
|
+
});
|
|
2529
|
+
const region = Stack7.of(scope).region;
|
|
2530
|
+
return `https://${domainName}.auth.${region}.amazoncognito.com`;
|
|
2531
|
+
}
|
|
2512
2532
|
/**
|
|
2513
2533
|
* Returns an IKey (KMS) by looking up the Auth stack's User Pool KMS Key ARN from SSM.
|
|
2514
2534
|
*/
|
|
@@ -3118,11 +3138,11 @@ var _OpenHiRestApiService = class _OpenHiRestApiService extends OpenHiService {
|
|
|
3118
3138
|
const cognitoScope = new Construct21(this, "runtime-config");
|
|
3119
3139
|
const userPool = OpenHiAuthService.userPoolFromConstruct(cognitoScope);
|
|
3120
3140
|
const userPoolClient = OpenHiAuthService.userPoolClientFromConstruct(cognitoScope);
|
|
3121
|
-
const
|
|
3141
|
+
const cognitoDomainUrl = OpenHiAuthService.userPoolDomainBaseUrlFromConstruct(cognitoScope);
|
|
3122
3142
|
return {
|
|
3123
3143
|
OPENHI_RUNTIME_CONFIG_COGNITO_USER_POOL_ID: userPool.userPoolId,
|
|
3124
3144
|
OPENHI_RUNTIME_CONFIG_COGNITO_USER_POOL_CLIENT_ID: userPoolClient.userPoolClientId,
|
|
3125
|
-
|
|
3145
|
+
OPENHI_RUNTIME_CONFIG_COGNITO_DOMAIN_URL: cognitoDomainUrl,
|
|
3126
3146
|
OPENHI_RUNTIME_CONFIG_COGNITO_REDIRECT_URI: this.props.runtimeConfig.cognitoRedirectUri,
|
|
3127
3147
|
OPENHI_RUNTIME_CONFIG_API_BASE_URL: this.props.runtimeConfig.apiBaseUrl
|
|
3128
3148
|
};
|