-
Notifications
You must be signed in to change notification settings - Fork 4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
(cognito): UserPoolDomain baseUrl
is incorrect in us-gov-west-1
#20182
Comments
@kylelaker I think that I'm fine with the solution of adding a fips flag to We do already have an issue tracking this so I'm going to close this issue in favor of #12500 |
|
Thanks! Opened #20200 to resolve this. |
… url for gov cloud regions (#20200) This ensures that users in GovCloud can retrieve a URL that works in their region and allows users in us-{east,west}-{1,2} to also use the FIPs endpoints. Partially discussed in #20182. Resolves #12500 ---- ### All Submissions: * [X] Have you followed the guidelines in our [Contributing guide?](https://github.com/aws/aws-cdk/blob/master/CONTRIBUTING.md) ### Adding new Unconventional Dependencies: * [ ] This PR adds new unconventional dependencies following the process described [here](https://github.com/aws/aws-cdk/blob/master/CONTRIBUTING.md/#adding-new-unconventional-dependencies) ### New Features * [ ] Have you added the new feature to an [integration test](https://github.com/aws/aws-cdk/blob/master/INTEGRATION_TESTS.md)? * [ ] Did you use `yarn integ` to deploy the infrastructure and generate the snapshot (i.e. `yarn integ` without `--dry-run`)? *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
… url for gov cloud regions (aws#20200) This ensures that users in GovCloud can retrieve a URL that works in their region and allows users in us-{east,west}-{1,2} to also use the FIPs endpoints. Partially discussed in aws#20182. Resolves aws#12500 ---- ### All Submissions: * [X] Have you followed the guidelines in our [Contributing guide?](https://github.com/aws/aws-cdk/blob/master/CONTRIBUTING.md) ### Adding new Unconventional Dependencies: * [ ] This PR adds new unconventional dependencies following the process described [here](https://github.com/aws/aws-cdk/blob/master/CONTRIBUTING.md/#adding-new-unconventional-dependencies) ### New Features * [ ] Have you added the new feature to an [integration test](https://github.com/aws/aws-cdk/blob/master/INTEGRATION_TESTS.md)? * [ ] Did you use `yarn integ` to deploy the infrastructure and generate the snapshot (i.e. `yarn integ` without `--dry-run`)? *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
Describe the bug
In the
us-gov-west-1
region, the Cognito Hosted UI always uses the fips endpoint (<domain-prefix>.auth-fips.<region>.amazoncognito.com
). TheUserPoolDomain.baseUrl
function assumes the endpoint is always<prefix>.auth.<region>.amazoncognito.com
. This results in a value that does not work inus-gov-west-1
.Expected Behavior
I expected calling
baseUrl
to return a URL that works in my current region.Current Behavior
Calling
baseUrl()
returns a URL that does not work inus-gov-west-1
.Reproduction Steps
Change the
UNIQUE_PREFIX
constant to actually contain a unique value and deploy this stack tous-gov-west-1
and try to navigate to the URL contained in theDomainBroken.Domain
output. The name does not resolve.Because I understand that not everyone has access to GovCloud, I have deployed a sample stack setting
UNIQUE_PREFIX
togovrepro
. The CDK returnshttps://govrepro.auth.us-gov-west-1.amazoncognito.com
; however, that does not resolve.https://govrepro.auth-fips.us-gov-west-1.amazoncognito.com
does.Possible Solution
Adding a parameter to
baseUrl
This could be fixed by adding an optional
fips?: boolean
parameter tobaseUrl
(that defaults to false). The nice side effect here is that you'd be able to get FIPS URLs for Hosted UIs in US East/West and other regions that support it; the downside is that users may passtrue
in regions that do not support FIPS endpoints.Code for adding FIPS parameter
Using a
CfnCondition
Because this only impacts a single region (for now), it's possible
baseUrl
could return a CloudFormation condition but that scales poorly and adds a condition in the stack.Code for using a CloudFormation condition
Using
region-info
This also feels like a good use case for a
region-info
in some ways, though,us-gov-west-1
is really the only "special" region I am aware of. The service is not yet available in other US government regions nor are User Pools available yet inaws-cn
.Adding Documentation
It would also be possible to just add documentation saying that the function doesn't work in GovCloud and to provide a workaround.
Documentation patch
Additional Information/Context
The Amazon Cognito service in AWS GovCloud (US) does not support custom domains, so the only available option is a prefixed Cognito domain.
FIPS endpoints are available but not required in
us-east-1
,us-east-2
,us-west-1
, andus-west-2
.CDK CLI Version
2.22.0
Framework Version
No response
Node.js Version
16.14.1
OS
Fedora
Language
Typescript
Language Version
No response
Other information
I am happy to help implement a fix for this issue.
The text was updated successfully, but these errors were encountered: