@@ -101,43 +101,62 @@ public static class CredentialProfileTypeDetector
101
101
{
102
102
new HashSet < string > { RoleArn , SourceProfile } ,
103
103
new HashSet < string > { RoleArn , SourceProfile , AwsAccountId } ,
104
+ new HashSet < string > { RoleArn , SourceProfile , SsoSession , SsoRegion , SsoRegistrationScopes , SsoStartUrl } ,
105
+ new HashSet < string > { RoleArn , SourceProfile , AwsAccountId , SsoSession , SsoRegion , SsoRegistrationScopes , SsoStartUrl } ,
104
106
}
105
107
} ,
106
108
{
107
109
CredentialProfileType . AssumeRoleCredentialSource , new List < HashSet < string > > ( )
108
110
{
109
111
new HashSet < string > { RoleArn , CredentialSource } ,
110
- new HashSet < string > { RoleArn , CredentialSource , AwsAccountId }
112
+ new HashSet < string > { RoleArn , CredentialSource , SsoSession , SsoRegion , SsoRegistrationScopes , SsoStartUrl } ,
113
+ new HashSet < string > { RoleArn , CredentialSource , AwsAccountId } ,
114
+ new HashSet < string > { RoleArn , CredentialSource , AwsAccountId , SsoSession , SsoRegion , SsoRegistrationScopes , SsoStartUrl }
111
115
}
112
116
} ,
113
117
{
114
118
CredentialProfileType . AssumeRoleExternal , new List < HashSet < string > > ( )
115
119
{
116
120
new HashSet < string > { ExternalID , RoleArn , SourceProfile } ,
121
+ new HashSet < string > { ExternalID , RoleArn , SourceProfile , SsoSession , SsoRegion , SsoRegistrationScopes , SsoStartUrl } ,
117
122
new HashSet < string > { ExternalID , RoleArn , SourceProfile , AwsAccountId } ,
123
+ new HashSet < string > { ExternalID , RoleArn , SourceProfile , AwsAccountId , SsoSession , SsoRegion , SsoRegistrationScopes , SsoStartUrl }
124
+ }
125
+ } ,
126
+ {
127
+ CredentialProfileType . AssumeRoleExternalMFA , new List < HashSet < string > > ( )
128
+ {
129
+ new HashSet < string > { ExternalID , RoleArn , SourceProfile , MfaSerial } ,
130
+ new HashSet < string > { ExternalID , RoleArn , SourceProfile , MfaSerial , SsoSession , SsoRegion , SsoRegistrationScopes , SsoStartUrl }
118
131
}
119
132
} ,
120
- { CredentialProfileType . AssumeRoleExternalMFA , new List < HashSet < string > > ( ) { new HashSet < string > { ExternalID , RoleArn , SourceProfile , MfaSerial } } } ,
121
133
{
122
134
CredentialProfileType . AssumeRoleWithWebIdentity , new List < HashSet < string > > ( )
123
135
{
124
136
new HashSet < string > { RoleArn , WebIdentityTokenFile } ,
137
+ new HashSet < string > { RoleArn , WebIdentityTokenFile , SsoSession , SsoRegion , SsoRegistrationScopes , SsoStartUrl } ,
125
138
new HashSet < string > { RoleArn , WebIdentityTokenFile , CredentialSource } ,
139
+ new HashSet < string > { RoleArn , WebIdentityTokenFile , CredentialSource , SsoSession , SsoRegion , SsoRegistrationScopes , SsoStartUrl } ,
126
140
new HashSet < string > { RoleArn , WebIdentityTokenFile , CredentialSource , AwsAccountId } ,
141
+ new HashSet < string > { RoleArn , WebIdentityTokenFile , CredentialSource , AwsAccountId , SsoSession , SsoRegion , SsoRegistrationScopes , SsoStartUrl } ,
127
142
}
128
143
} ,
129
144
{
130
145
CredentialProfileType . AssumeRoleWithWebIdentitySessionName , new List < HashSet < string > > ( )
131
146
{
132
147
new HashSet < string > { RoleArn , WebIdentityTokenFile , RoleSessionName } ,
133
- new HashSet < string > { RoleArn , WebIdentityTokenFile , RoleSessionName , AwsAccountId } ,
148
+ new HashSet < string > { RoleArn , WebIdentityTokenFile , RoleSessionName , SsoSession , SsoRegion , SsoRegistrationScopes , SsoStartUrl } ,
149
+ new HashSet < string > { RoleArn , WebIdentityTokenFile , RoleSessionName , AwsAccountId } ,
150
+ new HashSet < string > { RoleArn , WebIdentityTokenFile , RoleSessionName , AwsAccountId , SsoSession , SsoRegion , SsoRegistrationScopes , SsoStartUrl } ,
134
151
}
135
152
} ,
136
153
{
137
154
CredentialProfileType . AssumeRoleMFA , new List < HashSet < string > > ( )
138
155
{
139
156
new HashSet < string > { MfaSerial , RoleArn , SourceProfile } ,
157
+ new HashSet < string > { MfaSerial , RoleArn , SourceProfile , SsoSession , SsoRegion , SsoRegistrationScopes , SsoStartUrl } ,
140
158
new HashSet < string > { MfaSerial , RoleArn , SourceProfile , AwsAccountId } ,
159
+ new HashSet < string > { MfaSerial , RoleArn , SourceProfile , AwsAccountId , SsoSession , SsoRegion , SsoRegistrationScopes , SsoStartUrl } ,
141
160
}
142
161
} ,
143
162
{ CredentialProfileType . Basic , new List < HashSet < string > > ( )
@@ -165,36 +184,46 @@ public static class CredentialProfileTypeDetector
165
184
CredentialProfileType . AssumeRoleSessionName , new List < HashSet < string > > ( )
166
185
{
167
186
new HashSet < string > { RoleArn , SourceProfile , RoleSessionName } ,
187
+ new HashSet < string > { RoleArn , SourceProfile , RoleSessionName , SsoSession , SsoRegion , SsoRegistrationScopes , SsoStartUrl } ,
168
188
new HashSet < string > { RoleArn , SourceProfile , RoleSessionName , AwsAccountId } ,
189
+ new HashSet < string > { RoleArn , SourceProfile , RoleSessionName , AwsAccountId , SsoSession , SsoRegion , SsoRegistrationScopes , SsoStartUrl } ,
169
190
}
170
191
} ,
171
192
{
172
193
CredentialProfileType . AssumeRoleCredentialSourceSessionName , new List < HashSet < string > > ( )
173
194
{
174
195
new HashSet < string > { RoleArn , CredentialSource , RoleSessionName } ,
196
+ new HashSet < string > { RoleArn , CredentialSource , RoleSessionName , SsoSession , SsoRegion , SsoRegistrationScopes , SsoStartUrl } ,
175
197
new HashSet < string > { RoleArn , CredentialSource , RoleSessionName , AwsAccountId } ,
198
+ new HashSet < string > { RoleArn , CredentialSource , RoleSessionName , AwsAccountId , SsoSession , SsoRegion , SsoRegistrationScopes , SsoStartUrl } ,
176
199
}
177
200
} ,
178
201
{
179
202
CredentialProfileType . AssumeRoleExternalSessionName , new List < HashSet < string > > ( )
180
203
{
181
204
new HashSet < string > { ExternalID , RoleArn , SourceProfile , RoleSessionName } ,
205
+ new HashSet < string > { ExternalID , RoleArn , SourceProfile , RoleSessionName , SsoSession , SsoRegion , SsoRegistrationScopes , SsoStartUrl } ,
182
206
new HashSet < string > { ExternalID , RoleArn , SourceProfile , RoleSessionName , AwsAccountId } ,
207
+ new HashSet < string > { ExternalID , RoleArn , SourceProfile , RoleSessionName , AwsAccountId , SsoSession , SsoRegion , SsoRegistrationScopes , SsoStartUrl } ,
183
208
}
184
209
} ,
185
210
{
186
211
CredentialProfileType . AssumeRoleExternalMFASessionName , new List < HashSet < string > > ( )
187
212
{
188
213
new HashSet < string > { ExternalID , MfaSerial , RoleArn , SourceProfile , RoleSessionName } ,
214
+ new HashSet < string > { ExternalID , MfaSerial , RoleArn , SourceProfile , RoleSessionName , SsoSession , SsoRegion , SsoRegistrationScopes , SsoStartUrl } ,
189
215
new HashSet < string > { ExternalID , MfaSerial , RoleArn , SourceProfile , RoleSessionName , AwsAccountId } ,
216
+ new HashSet < string > { ExternalID , MfaSerial , RoleArn , SourceProfile , RoleSessionName , AwsAccountId , SsoSession , SsoRegion , SsoRegistrationScopes , SsoStartUrl } ,
190
217
}
191
218
} ,
192
219
{ CredentialProfileType . SSO , new List < HashSet < string > > ( ) { new HashSet < string > { SsoAccountId , SsoRegion , SsoRegistrationScopes , SsoRoleName , SsoStartUrl , SsoSession } } } ,
193
220
{
194
221
CredentialProfileType . AssumeRoleMFASessionName , new List < HashSet < string > > ( )
195
222
{
196
223
new HashSet < string > { MfaSerial , RoleArn , SourceProfile , RoleSessionName } ,
224
+ new HashSet < string > { MfaSerial , RoleArn , SourceProfile , RoleSessionName , SsoSession , SsoRegion , SsoRegistrationScopes , SsoStartUrl } ,
197
225
new HashSet < string > { MfaSerial , RoleArn , SourceProfile , RoleSessionName , AwsAccountId } ,
226
+ new HashSet < string > { MfaSerial , RoleArn , SourceProfile , RoleSessionName , AwsAccountId , SsoSession , SsoRegion , SsoRegistrationScopes , SsoStartUrl }
198
227
}
199
228
} ,
200
229
} ;
@@ -238,11 +267,9 @@ public static string GetUserFriendlyCredentialType(CredentialProfileType? profil
238
267
239
268
HashSet < string > propertyNames = GetPropertyNames ( profileOptions ) ;
240
269
241
- // Spec: If one or more of the SSO properties is present, the profile MUST be resolved by the SSO credential provider.
242
- if ( propertyNames . Any ( propertyName => SsoProperties . Contains ( propertyName ) ) )
243
- {
270
+ //SPEC: if sso_account_id or sso_role_name exist credentials MUST be resolved by the sso credential provider.
271
+ if ( propertyNames . Contains ( SsoAccountId ) || propertyNames . Contains ( SsoRoleName ) )
244
272
return CredentialProfileType . SSO ;
245
- }
246
273
247
274
// brute force algorithm - but it's a very small set
248
275
foreach ( var pair in TypePropertyDictionary )
0 commit comments