Skip to content

Commit c4f47c7

Browse files
Add SSO_LOGIN feature IDs for SSO login flow requests
1 parent 07513d1 commit c4f47c7

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

sdk/src/Services/SSOOIDC/Custom/Internal/_bcl+netstandard/CoreAmazonSSOOIDC.cs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@
2121
using System.Threading.Tasks;
2222
using System.Xml;
2323
using Amazon.Runtime;
24+
using Amazon.Runtime.Internal;
25+
using Amazon.Runtime.Internal.UserAgent;
2426
using Amazon.Runtime.Internal.Util;
2527
using Amazon.Runtime.SharedInterfaces;
2628
using Amazon.SSOOIDC.Model;
@@ -70,6 +72,7 @@ public static GetSsoTokenResponse GetSsoToken(IAmazonSSOOIDC client, GetSsoToken
7072
{
7173
// PkceFlowOptions is a newer property that must be specified when using the PKCE flow. If it's null, we'll default to the device code flow.
7274
var useDeviceCodeFlow = request.PkceFlowOptions == null;
75+
var featureId = useDeviceCodeFlow ? UserAgentFeatureId.SSO_LOGIN_DEVICE : UserAgentFeatureId.SSO_LOGIN_AUTH;
7376

7477
// Identity Center supports using the start URL as the issuer URL (if one was not provided).
7578
var issuerUrl = request.PkceFlowOptions?.IssuerUrl ?? request.StartUrl;
@@ -113,6 +116,7 @@ public static GetSsoTokenResponse GetSsoToken(IAmazonSSOOIDC client, GetSsoToken
113116
StartUrl = request.StartUrl,
114117
};
115118
InternalSDKUtils.ApplyValuesV2(startDeviceAuthorizationRequest, request.AdditionalProperties);
119+
((IAmazonWebServiceRequest)startDeviceAuthorizationRequest).UserAgentDetails.AddFeature(featureId);
116120

117121
var startDeviceAuthorizationResponse = client.StartDeviceAuthorization(startDeviceAuthorizationRequest);
118122

@@ -158,6 +162,7 @@ public static GetSsoTokenResponse GetSsoToken(IAmazonSSOOIDC client, GetSsoToken
158162
CodeVerifier = codeVerifier,
159163
};
160164
InternalSDKUtils.ApplyValuesV2(createTokenRequest, request.AdditionalProperties);
165+
((IAmazonWebServiceRequest)createTokenRequest).UserAgentDetails.AddFeature(featureId);
161166

162167
createTokenResponse = client.CreateToken(createTokenRequest);
163168
}
@@ -225,6 +230,7 @@ public static async Task<GetSsoTokenResponse> GetSsoTokenAsync(IAmazonSSOOIDC cl
225230
{
226231
// PkceFlowOptions is a newer property that must be specified when using the PKCE flow. If it's null, we'll default to the device code flow.
227232
var useDeviceCodeFlow = request.PkceFlowOptions == null;
233+
var featureId = useDeviceCodeFlow ? UserAgentFeatureId.SSO_LOGIN_DEVICE : UserAgentFeatureId.SSO_LOGIN_AUTH;
228234

229235
// Identity Center supports using the start URL as the issuer URL (if one was not provided).
230236
var issuerUrl = request.PkceFlowOptions?.IssuerUrl ?? request.StartUrl;
@@ -268,6 +274,7 @@ public static async Task<GetSsoTokenResponse> GetSsoTokenAsync(IAmazonSSOOIDC cl
268274
StartUrl = request.StartUrl,
269275
};
270276
InternalSDKUtils.ApplyValuesV2(startDeviceAuthorizationRequest, request.AdditionalProperties);
277+
((IAmazonWebServiceRequest)startDeviceAuthorizationRequest).UserAgentDetails.AddFeature(featureId);
271278

272279
var startDeviceAuthorizationResponse =
273280
await client.StartDeviceAuthorizationAsync(startDeviceAuthorizationRequest, cancellationToken).ConfigureAwait(false);
@@ -324,6 +331,7 @@ public static async Task<GetSsoTokenResponse> GetSsoTokenAsync(IAmazonSSOOIDC cl
324331
CodeVerifier = codeVerifier,
325332
};
326333
InternalSDKUtils.ApplyValuesV2(createTokenRequest, request.AdditionalProperties);
334+
((IAmazonWebServiceRequest)createTokenRequest).UserAgentDetails.AddFeature(featureId);
327335

328336
createTokenResponse = await client.CreateTokenAsync(createTokenRequest, cancellationToken).ConfigureAwait(false);
329337
}

0 commit comments

Comments
 (0)