Skip to content

Commit c450eed

Browse files
Merge pull request #250 from awslabs/v3
v3.0.0
2 parents 768255a + 066a17b commit c450eed

File tree

176 files changed

+28855
-8241
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

176 files changed

+28855
-8241
lines changed

README.md

Lines changed: 25 additions & 139 deletions
Large diffs are not rendered by default.

README_SAR.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ The Serverless Developer Portal is an application that you use for developer eng
66
#### To deploy
77
1. Enter a name for ArtifactsS3BucketName: this will create an Amazon S3 bucket with that name for storing the catalog metadata.
88
1. Enter a name for DevPortalSiteS3BucketName: this will create an Amazon S3 bucket with that name for the web application code.
9+
1. Enter a unique prefix for CognitoDomainNameOrPrefix; this will be used in the sign in page's URL.
910
1. You should leave all the other settings as-is unless you need to change them. For example, you can optionally enter a custom domain name in the CustomDomainName field.
1011
1. Acknowledge that the app uses custom roles by checking the box "I acknowledge that this app creates custom IAM roles."
1112
1. Choose Deploy.
@@ -16,14 +17,14 @@ The Serverless Developer Portal is an application that you use for developer eng
1617
1. Open the Outputs section. The URL for the developer portal is specified in the WebSiteURL property.
1718

1819
#### Updating to a new version
19-
The Developer Portal follows the semantic versioning scheme (major.minor.patch). Changes to the minor or patch version are backwards compatible so you should feel safe to get the latest version.
20+
The Developer Portal follows the semantic versioning scheme (major.minor.patch). Changes to the minor or patch version are backwards compatible so you should feel safe to get the latest version. For changes to major versions, please see [this page on updating](https://github.com/awslabs/aws-api-gateway-developer-portal/wiki/Upgrading/_edit).
2021

2122
To update:
22-
1. When deploying follow the same steps as previous and use the same values for the parameters. The only difference is passing in a new value for "-StaticAssetRebuildToken". You can use any string for this as long as it is different than previously used (default value is "defaultRebuildToken").
23+
1. When deploying follow the same steps as previous and use the same values for the parameters. The only difference is passing in a new value for the stack parameter StaticAssetRebuildToken. You can use any string for this as long as it is different than the previously used string.
2324

2425
#### Next steps
2526
1. Publish an API on it for your customer to look at. Learn how to do that [here](https://docs.aws.amazon.com/apigateway/latest/developerguide/apigateway-developer-portal.html#apigateway-developer-portal-publish).
26-
1. Customize, own, and brand the portal. Learn how to do that [here](https://github.com/awslabs/aws-api-gateway-developer-portal#customization).
27+
1. Customize, own, and brand the portal. Learn how to do that [here](https://github.com/awslabs/aws-api-gateway-developer-portal/wiki/Customization).
2728
1. Setup a custom domain on it your customers recognize your brand and the associated APIs. Learn how to do that [here](https://github.com/awslabs/aws-api-gateway-developer-portal#before-going-to-production).
2829

2930
To learn more about the API Gateway Serverless Developer Portal, read the [documentation](https://docs.aws.amazon.com/apigateway/latest/developerguide/apigateway-developer-portal.html) or visit the [GitHub repository](https://github.com/awslabs/aws-api-gateway-developer-portal). For more information about Amazon API Gateway, visit the API Gateway [product page](https://aws.amazon.com/api-gateway/).

cloudformation/template.yaml

Lines changed: 60 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -87,8 +87,7 @@ Parameters:
8787

8888
CognitoDomainNameOrPrefix:
8989
Type: String
90-
Description: The Domain Name (or Prefix) at which your Cognito Hosted UI is located. Omitting this value opts out of the Cognito Hosted UI.
91-
Default: ''
90+
Description: The Domain Name (or Prefix) at which your Cognito Hosted UI is located. This should be regionally unique.
9291

9392
# CognitoDomainAcmCertArn:
9493
# Type: String
@@ -107,12 +106,12 @@ Parameters:
107106

108107
UseRoute53Nameservers:
109108
Type: String
110-
Description: Only applicable if creating a custom domain name for your dev portal. If true, skips creating a Route53 HostedZone and RecordSet. You'll need to provide your own nameserver hosting in place of Route53.
109+
Description: Only applicable if creating a custom domain name for your dev portal. Defaults to false, and you'll need to provide your own nameserver hosting. If set to true, a Route53 HostedZone and RecordSet are created for you.
111110
Default: 'false'
112111

113112
DevelopmentMode:
114113
Type: String
115-
Description: Enabling this weakens security features (OAI, SSL, site S3 bucket with public read ACLs, Cognito callback verification, etc.) for easier development. Do not enable this in production! Additionally, do not update a stack that was previously in development mode to be a production stack; instead, make a new stack that has never been in development mode.
114+
Description: Enabling this weakens security features (OAI, SSL, site S3 bucket with public read ACLs, Cognito callback verification, CORS, etc.) for easier development. Do not enable this in production! Additionally, do not update a stack that was previously in development mode to be a production stack; instead, make a new stack that has never been in development mode.
116115
Default: 'false'
117116

118117
Conditions:
@@ -183,7 +182,11 @@ Resources:
183182
responseParameters:
184183
method.response.header.Access-Control-Allow-Methods: "'DELETE,GET,HEAD,OPTIONS,PATCH,POST,PUT'"
185184
method.response.header.Access-Control-Allow-Headers: "'Content-Type,Authorization,X-Amz-Date,X-Api-Key,X-Amz-Security-Token'"
186-
method.response.header.Access-Control-Allow-Origin: "'*'"
185+
method.response.header.Access-Control-Allow-Origin: !If [ 'DevelopmentMode', "'*'", !If [
186+
'UseCustomDomainName',
187+
!Join ['', [ "'https://", !GetAtt CustomDomainCloudfrontDistribution.DomainName, "'" ]],
188+
!Join ['', [ "'https://", !GetAtt DefaultCloudfrontDistribution.DomainName, "'" ]]
189+
]]
187190
passthroughBehavior: when_no_match
188191
requestTemplates:
189192
application/json: "{\"statusCode\": 200}"
@@ -226,7 +229,11 @@ Resources:
226229
responseParameters:
227230
method.response.header.Access-Control-Allow-Methods: "'DELETE,GET,HEAD,OPTIONS,PATCH,POST,PUT'"
228231
method.response.header.Access-Control-Allow-Headers: "'Content-Type,Authorization,X-Amz-Date,X-Api-Key,X-Amz-Security-Token'"
229-
method.response.header.Access-Control-Allow-Origin: "'*'"
232+
method.response.header.Access-Control-Allow-Origin: !If [ 'DevelopmentMode', "'*'", !If [
233+
'UseCustomDomainName',
234+
!Join ['', [ "'https://", !GetAtt CustomDomainCloudfrontDistribution.DomainName, "'" ]],
235+
!Join ['', [ "'https://", !GetAtt DefaultCloudfrontDistribution.DomainName, "'" ]]
236+
]]
230237
passthroughBehavior: when_no_match
231238
requestTemplates:
232239
application/json: "{\"statusCode\": 200}"
@@ -269,7 +276,11 @@ Resources:
269276
responseParameters:
270277
method.response.header.Access-Control-Allow-Methods: "'DELETE,GET,HEAD,OPTIONS,PATCH,POST,PUT'"
271278
method.response.header.Access-Control-Allow-Headers: "'Content-Type,Authorization,X-Amz-Date,X-Api-Key,X-Amz-Security-Token'"
272-
method.response.header.Access-Control-Allow-Origin: "'*'"
279+
method.response.header.Access-Control-Allow-Origin: !If [ 'DevelopmentMode', "'*'", !If [
280+
'UseCustomDomainName',
281+
!Join ['', [ "'https://", !GetAtt CustomDomainCloudfrontDistribution.DomainName, "'" ]],
282+
!Join ['', [ "'https://", !GetAtt DefaultCloudfrontDistribution.DomainName, "'" ]]
283+
]]
273284
passthroughBehavior: when_no_match
274285
requestTemplates:
275286
application/json: "{\"statusCode\": 200}"
@@ -312,7 +323,11 @@ Resources:
312323
responseParameters:
313324
method.response.header.Access-Control-Allow-Methods: "'DELETE,GET,HEAD,OPTIONS,PATCH,POST,PUT'"
314325
method.response.header.Access-Control-Allow-Headers: "'Content-Type,Authorization,X-Amz-Date,X-Api-Key,X-Amz-Security-Token'"
315-
method.response.header.Access-Control-Allow-Origin: "'*'"
326+
method.response.header.Access-Control-Allow-Origin: !If [ 'DevelopmentMode', "'*'", !If [
327+
'UseCustomDomainName',
328+
!Join ['', [ "'https://", !GetAtt CustomDomainCloudfrontDistribution.DomainName, "'" ]],
329+
!Join ['', [ "'https://", !GetAtt DefaultCloudfrontDistribution.DomainName, "'" ]]
330+
]]
316331
passthroughBehavior: when_no_match
317332
requestTemplates:
318333
application/json: "{\"statusCode\": 200}"
@@ -381,7 +396,11 @@ Resources:
381396
responseParameters:
382397
method.response.header.Access-Control-Allow-Methods: "'DELETE,GET,HEAD,OPTIONS,PATCH,POST,PUT'"
383398
method.response.header.Access-Control-Allow-Headers: "'Content-Type,Authorization,X-Amz-Date,X-Api-Key,X-Amz-Security-Token'"
384-
method.response.header.Access-Control-Allow-Origin: "'*'"
399+
method.response.header.Access-Control-Allow-Origin: !If [ 'DevelopmentMode', "'*'", !If [
400+
'UseCustomDomainName',
401+
!Join ['', [ "'https://", !GetAtt CustomDomainCloudfrontDistribution.DomainName, "'" ]],
402+
!Join ['', [ "'https://", !GetAtt DefaultCloudfrontDistribution.DomainName, "'" ]]
403+
]]
385404
passthroughBehavior: when_no_match
386405
requestTemplates:
387406
application/json: "{\"statusCode\": 200}"
@@ -437,7 +456,11 @@ Resources:
437456
responseParameters:
438457
method.response.header.Access-Control-Allow-Methods: "'DELETE,GET,HEAD,OPTIONS,PATCH,POST,PUT'"
439458
method.response.header.Access-Control-Allow-Headers: "'Content-Type,Authorization,X-Amz-Date,X-Api-Key,X-Amz-Security-Token'"
440-
method.response.header.Access-Control-Allow-Origin: "'*'"
459+
method.response.header.Access-Control-Allow-Origin: !If [ 'DevelopmentMode', "'*'", !If [
460+
'UseCustomDomainName',
461+
!Join ['', [ "'https://", !GetAtt CustomDomainCloudfrontDistribution.DomainName, "'" ]],
462+
!Join ['', [ "'https://", !GetAtt DefaultCloudfrontDistribution.DomainName, "'" ]]
463+
]]
441464
passthroughBehavior: when_no_match
442465
requestTemplates:
443466
application/json: "{\"statusCode\": 200}"
@@ -485,7 +508,11 @@ Resources:
485508
responseParameters:
486509
method.response.header.Access-Control-Allow-Methods: "'DELETE,GET,HEAD,OPTIONS,PATCH,POST,PUT'"
487510
method.response.header.Access-Control-Allow-Headers: "'Content-Type,Authorization,X-Amz-Date,X-Api-Key,X-Amz-Security-Token'"
488-
method.response.header.Access-Control-Allow-Origin: "'*'"
511+
method.response.header.Access-Control-Allow-Origin: !If [ 'DevelopmentMode', "'*'", !If [
512+
'UseCustomDomainName',
513+
!Join ['', [ "'https://", !GetAtt CustomDomainCloudfrontDistribution.DomainName, "'" ]],
514+
!Join ['', [ "'https://", !GetAtt DefaultCloudfrontDistribution.DomainName, "'" ]]
515+
]]
489516
passthroughBehavior: when_no_match
490517
requestTemplates:
491518
application/json: "{\"statusCode\": 200}"
@@ -640,12 +667,23 @@ Resources:
640667
- Effect: Allow
641668
Action:
642669
- s3:GetObject
670+
- s3:DeleteObject
643671
- s3:PutObject
644672
Resource: !Join
645673
- ''
646674
- - 'arn:aws:s3:::'
647675
- !Ref ArtifactsS3BucketName
648676
- '/*'
677+
- Effect: Allow
678+
Action:
679+
- apigateway:GET
680+
Resource: !Join
681+
- ''
682+
- - 'arn:aws:apigateway:'
683+
- !Ref 'AWS::Region'
684+
- '::/restapis/'
685+
- !Ref ApiGatewayApi
686+
- '/*/exports/*'
649687
- Effect: Allow
650688
Action:
651689
- aws-marketplace:ResolveCustomer
@@ -1009,9 +1047,13 @@ Resources:
10091047

10101048
CognitoUserPoolClient:
10111049
Type: AWS::Cognito::UserPoolClient
1050+
# It's really unintuitive, but changing any of the properties here will cause stack updates to deploy non-functionally.
1051+
# The CognitoUserPoolClientSettings custom resource runs after this resource and adds a bunch of fields.
1052+
# However, when this is updated and changes, the CUPCS custom resource doesn't re-run, and so a bunch of vital
1053+
# settings won't be set, e.g., CallbackURL.
10121054
Properties:
10131055
UserPoolId: !Ref CognitoUserPool
1014-
ClientName: 'CognitoUserPoolClient'
1056+
ClientName: CognitoIdentityPool
10151057
GenerateSecret: false
10161058
RefreshTokenValidity: 30
10171059

@@ -1068,16 +1110,16 @@ Resources:
10681110
CallbackURL: !If [ DevelopmentMode,
10691111
[
10701112
'http://localhost:3000/login',
1071-
!Join [ '', [ 'http://', !GetAtt DevPortalSiteS3Bucket.RegionalDomainName ]]
1113+
!Join [ '', [ 'https://', !GetAtt DevPortalSiteS3Bucket.RegionalDomainName ]]
10721114
],
10731115
[
10741116
!Join [ '', [ 'https://', !If [ UseCustomDomainName, !Ref CustomDomainName, !GetAtt DefaultCloudfrontDistribution.DomainName ], '/login' ]]
10751117
]
10761118
]
10771119
LogoutURL: !If [ DevelopmentMode,
10781120
[
1079-
'http://localhost:3000/login',
1080-
!Join [ '', [ 'http://', !GetAtt DevPortalSiteS3Bucket.RegionalDomainName]]
1121+
'http://localhost:3000',
1122+
!Join [ '', [ 'https://', !GetAtt DevPortalSiteS3Bucket.RegionalDomainName]]
10811123
],
10821124
[
10831125
!Join [ '', [ 'https://', !If [ UseCustomDomainName, !Ref CustomDomainName, !GetAtt DefaultCloudfrontDistribution.DomainName ]]]
@@ -1327,7 +1369,7 @@ Resources:
13271369
- !Join [ '', [ 'www.', !Ref CustomDomainName ] ]
13281370
CustomErrorResponses:
13291371
- ErrorCode: 403
1330-
ResponseCode: 200
1372+
ResponseCode: 403
13311373
ResponsePagePath: '/index.html'
13321374
DefaultCacheBehavior:
13331375
ForwardedValues:
@@ -1356,7 +1398,7 @@ Resources:
13561398
DistributionConfig:
13571399
CustomErrorResponses:
13581400
- ErrorCode: 403
1359-
ResponseCode: 200
1401+
ResponseCode: 403
13601402
ResponsePagePath: '/index.html'
13611403
DefaultCacheBehavior:
13621404
ForwardedValues:
@@ -1410,7 +1452,7 @@ Resources:
14101452
Outputs:
14111453
WebsiteURL:
14121454
Value: !If [ 'DevelopmentMode',
1413-
!Join [ '', [ !GetAtt DevPortalSiteS3Bucket.RegionalDomainName, '/index.html' ]],
1455+
!Join [ '', [ 'https://', !GetAtt DevPortalSiteS3Bucket.RegionalDomainName, '/index.html' ]],
14141456
!If [
14151457
'UseCustomDomainName',
14161458
!Join [ '', [ 'https://', !GetAtt CustomDomainCloudfrontDistribution.DomainName ]],

dev-portal/.env

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1-
NODE_PATH=src/
1+
NODE_PATH=src/
2+
SKIP_PREFLIGHT_CHECK=true
-445 Bytes
Binary file not shown.
-1.11 KB
Binary file not shown.

dev-portal/node_modules/swagger-ui/dist/index.html

Lines changed: 0 additions & 60 deletions
This file was deleted.

dev-portal/node_modules/swagger-ui/dist/swagger-ui-bundle.js

Lines changed: 0 additions & 93 deletions
This file was deleted.

dev-portal/node_modules/swagger-ui/dist/swagger-ui-bundle.js.map

Lines changed: 0 additions & 1 deletion
This file was deleted.

dev-portal/node_modules/swagger-ui/dist/swagger-ui-standalone-preset.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)