Skip to content

Commit ed4b4ad

Browse files
committed
Add userpool client product
1 parent f6cd48d commit ed4b4ad

File tree

3 files changed

+64
-1
lines changed

3 files changed

+64
-1
lines changed

.github/workflows/main.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,9 @@ jobs:
3535
- name: Validate template (products stackset)
3636
run: sam validate --lint --template ./products/stackset.yaml
3737

38+
- name: Validate template (client product)
39+
run: sam validate --lint --template ./products/client/product.yaml
40+
3841
- name: Validate template (server product)
3942
run: sam validate --lint --template ./products/server/product.yaml
4043

products/client/product.yaml

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
AWSTemplateFormatVersion: '2010-09-09'
2+
Description: Create a Cognito User Pool Client
3+
4+
Parameters:
5+
CognitoUserPoolId:
6+
Type: AWS::SSM::Parameter::Value<String>
7+
Description: The ID of the user pool to which the resource server belongs
8+
Default: /org/authnz/UserPoolId
9+
ClientName:
10+
Type: String
11+
Description: The name of the client
12+
13+
Resources:
14+
CognitoUserPoolClient:
15+
Type: AWS::Cognito::UserPoolClient
16+
Properties:
17+
ClientName: !Ref ClientName
18+
UserPoolId: !Ref CognitoUserPoolId
19+
PreventUserExistenceErrors: ENABLED
20+
EnableTokenRevocation: true
21+
GenerateSecret: true
22+
TokenValidityUnits:
23+
IdToken: minutes
24+
AccessToken: minutes
25+
RefreshToken: days
26+
AccessTokenValidity: 10
27+
IdTokenValidity: 10
28+
RefreshTokenValidity: 1
29+
AllowedOAuthFlowsUserPoolClient: true
30+
AllowedOAuthFlows:
31+
- client_credentials
32+
AllowedOAuthScopes:
33+
- openid
34+
ReadAttributes:
35+
- name
36+
WriteAttributes:
37+
- name
38+
ExplicitAuthFlows:
39+
- ALLOW_USER_SRP_AUTH
40+
- ALLOW_REFRESH_TOKEN_AUTH
41+
SupportedIdentityProviders:
42+
- COGNITO

products/stackset.yaml

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,4 +50,22 @@ Resources:
5050
Type: AWS::ServiceCatalog::PortfolioProductAssociation
5151
Properties:
5252
PortfolioId: !Ref ApiAuthnzPortfolio
53-
ProductId: !Ref CognitoResourceServerProduct
53+
ProductId: !Ref CognitoResourceServerProduct
54+
55+
CognitoUserPoolClientProduct:
56+
Type: AWS::ServiceCatalog::CloudFormationProduct
57+
Properties:
58+
Name: Cognito User Pool Client
59+
Description: Create a Cognito User Pool Client
60+
Owner: ServerlessOps
61+
ProvisioningArtifactParameters:
62+
- Name: latest
63+
Description: latest release
64+
Info:
65+
LoadTemplateFromURL: !Sub 'https://${CfnTemplateBucket}.s3.amazonaws.com/serverlessops-api-authnz/${GitHubSha}/client/product.yaml'
66+
67+
CognitoUserPoolClientProductAssociation:
68+
Type: AWS::ServiceCatalog::PortfolioProductAssociation
69+
Properties:
70+
PortfolioId: !Ref ApiAuthnzPortfolio
71+
ProductId: !Ref CognitoUserPoolClientProduct

0 commit comments

Comments
 (0)