|
21 | 21 | using System.Threading.Tasks;
|
22 | 22 | using System.Xml;
|
23 | 23 | using Amazon.Runtime;
|
| 24 | +using Amazon.Runtime.Internal; |
| 25 | +using Amazon.Runtime.Internal.UserAgent; |
24 | 26 | using Amazon.Runtime.Internal.Util;
|
25 | 27 | using Amazon.Runtime.SharedInterfaces;
|
26 | 28 | using Amazon.SSOOIDC.Model;
|
@@ -70,6 +72,7 @@ public static GetSsoTokenResponse GetSsoToken(IAmazonSSOOIDC client, GetSsoToken
|
70 | 72 | {
|
71 | 73 | // 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.
|
72 | 74 | var useDeviceCodeFlow = request.PkceFlowOptions == null;
|
| 75 | + var featureId = useDeviceCodeFlow ? UserAgentFeatureId.SSO_LOGIN_DEVICE : UserAgentFeatureId.SSO_LOGIN_AUTH; |
73 | 76 |
|
74 | 77 | // Identity Center supports using the start URL as the issuer URL (if one was not provided).
|
75 | 78 | var issuerUrl = request.PkceFlowOptions?.IssuerUrl ?? request.StartUrl;
|
@@ -113,6 +116,7 @@ public static GetSsoTokenResponse GetSsoToken(IAmazonSSOOIDC client, GetSsoToken
|
113 | 116 | StartUrl = request.StartUrl,
|
114 | 117 | };
|
115 | 118 | InternalSDKUtils.ApplyValuesV2(startDeviceAuthorizationRequest, request.AdditionalProperties);
|
| 119 | + ((IAmazonWebServiceRequest)startDeviceAuthorizationRequest).UserAgentDetails.AddFeature(featureId); |
116 | 120 |
|
117 | 121 | var startDeviceAuthorizationResponse = client.StartDeviceAuthorization(startDeviceAuthorizationRequest);
|
118 | 122 |
|
@@ -158,6 +162,7 @@ public static GetSsoTokenResponse GetSsoToken(IAmazonSSOOIDC client, GetSsoToken
|
158 | 162 | CodeVerifier = codeVerifier,
|
159 | 163 | };
|
160 | 164 | InternalSDKUtils.ApplyValuesV2(createTokenRequest, request.AdditionalProperties);
|
| 165 | + ((IAmazonWebServiceRequest)createTokenRequest).UserAgentDetails.AddFeature(featureId); |
161 | 166 |
|
162 | 167 | createTokenResponse = client.CreateToken(createTokenRequest);
|
163 | 168 | }
|
@@ -225,6 +230,7 @@ public static async Task<GetSsoTokenResponse> GetSsoTokenAsync(IAmazonSSOOIDC cl
|
225 | 230 | {
|
226 | 231 | // 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.
|
227 | 232 | var useDeviceCodeFlow = request.PkceFlowOptions == null;
|
| 233 | + var featureId = useDeviceCodeFlow ? UserAgentFeatureId.SSO_LOGIN_DEVICE : UserAgentFeatureId.SSO_LOGIN_AUTH; |
228 | 234 |
|
229 | 235 | // Identity Center supports using the start URL as the issuer URL (if one was not provided).
|
230 | 236 | var issuerUrl = request.PkceFlowOptions?.IssuerUrl ?? request.StartUrl;
|
@@ -268,6 +274,7 @@ public static async Task<GetSsoTokenResponse> GetSsoTokenAsync(IAmazonSSOOIDC cl
|
268 | 274 | StartUrl = request.StartUrl,
|
269 | 275 | };
|
270 | 276 | InternalSDKUtils.ApplyValuesV2(startDeviceAuthorizationRequest, request.AdditionalProperties);
|
| 277 | + ((IAmazonWebServiceRequest)startDeviceAuthorizationRequest).UserAgentDetails.AddFeature(featureId); |
271 | 278 |
|
272 | 279 | var startDeviceAuthorizationResponse =
|
273 | 280 | await client.StartDeviceAuthorizationAsync(startDeviceAuthorizationRequest, cancellationToken).ConfigureAwait(false);
|
@@ -324,6 +331,7 @@ public static async Task<GetSsoTokenResponse> GetSsoTokenAsync(IAmazonSSOOIDC cl
|
324 | 331 | CodeVerifier = codeVerifier,
|
325 | 332 | };
|
326 | 333 | InternalSDKUtils.ApplyValuesV2(createTokenRequest, request.AdditionalProperties);
|
| 334 | + ((IAmazonWebServiceRequest)createTokenRequest).UserAgentDetails.AddFeature(featureId); |
327 | 335 |
|
328 | 336 | createTokenResponse = await client.CreateTokenAsync(createTokenRequest, cancellationToken).ConfigureAwait(false);
|
329 | 337 | }
|
|
0 commit comments