@@ -12,9 +12,9 @@ Parameters:
1212 ServerName :
1313 Type : String
1414 Description : The name of the server
15- AllowedAuthScopes :
16- Type : CommaDelimitedList
17- Description : The allowed OAuth scopes
15+ ScopeEntity :
16+ Type : String
17+ Description : The name of the scope
1818 AccessTokenValidity :
1919 Type : Number
2020 Description : The time in minutes that the access token is valid
@@ -27,6 +27,36 @@ Parameters:
2727 Type : Number
2828 Description : The time in days that the refresh token is valid
2929 Default : 1
30+ ReadScope :
31+ Type : String
32+ Description : The name of the read scope
33+ AllowedValues :
34+ - ' true'
35+ - ' false'
36+ WriteScope :
37+ Type : String
38+ Description : The name of the write scope
39+ AllowedValues :
40+ - ' true'
41+ - ' false'
42+ AdminScope :
43+ Type : String
44+ Description : The name of the admin scope
45+ AllowedValues :
46+ - ' true'
47+ - ' false'
48+ HealthScope :
49+ Type : String
50+ Description : The name of the health scope
51+ AllowedValues :
52+ - ' true'
53+ - ' false'
54+
55+ Conditions :
56+ HasReadScope : !Equals [!Ref ReadScope, 'true']
57+ HasWriteScope : !Equals [!Ref WriteScope, 'true']
58+ HasAdminScope : !Equals [!Ref AdminScope, 'true']
59+ HasHealthScope : !Equals [!Ref HealthScope, 'true']
3060
3161Resources :
3262 CognitoUserPoolClient :
@@ -47,7 +77,23 @@ Resources:
4777 AllowedOAuthFlowsUserPoolClient : true
4878 AllowedOAuthFlows :
4979 - client_credentials
50- AllowedOAuthScopes : !Ref AllowedAuthScopes
80+ AllowedOAuthScopes :
81+ - Fn::If :
82+ - HasReadScope
83+ - !Sub ' https://${ServerName}/${ScopeEntity}.read'
84+ - Ref : AWS::NoValue
85+ - Fn::If :
86+ - HasWriteScope
87+ - !Sub ' https://${ServerName}/${ScopeEntity}.write'
88+ - Ref : AWS::NoValue
89+ - Fn::If :
90+ - HasAdminScope
91+ - !Sub ' https://${ServerName}/${ScopeEntity}.admin'
92+ - Ref : AWS::NoValue
93+ - Fn::If :
94+ - HasHealthScope
95+ - !Sub ' https://${ServerName}/health.read'
96+ - Ref : AWS::NoValue
5197 ReadAttributes :
5298 - name
5399 WriteAttributes :
0 commit comments