CSharp Auth and auth lib changes v1.0

This commit is contained in:
Meena Peri 2023-10-02 12:28:46 -05:00
parent 39dd71cdb6
commit 1133bd580f
3 changed files with 18 additions and 8 deletions

View File

@ -61,7 +61,7 @@ AWSAuthenticationCredentials awsAuthenticationCredentials = new AWSAuthenticatio
restRequest = new AWSSigV4Signer(awsAuthenticationCredentials)
.Sign(restRequest, restClient.BaseUrl.Host);
```
Note the IRestRequest reference is treated as **mutable** when signed.
Note the IRestRequest reference is treated as **mutable** when signed. **AWSSigV4 Authentication is now optional**
## RateLimitConfiguration
@ -77,6 +77,8 @@ RateLimitConfiguration rateLimitConfig = new RateLimitConfigurationOnRequests
};
```
## Version
Selling Partner API Authentication/Authorization Library version 1.0
## Resources
This package features Mustache templates designed for use with [swagger codegen](https://swagger.io/tools/swagger-codegen/).

View File

@ -49,7 +49,11 @@ namespace {{packageName}}.Client
private void InterceptRequest(IRestRequest request)
{
lwaAuthorizationSigner.Sign(request);
awsSigV4Signer.Sign(request, RestClient.BaseUrl.Host);
if(awsSigV4Signer != null && RestClient.BaseUrl.Host.Contains("business-api.amazon.com"))
{
awsSigV4Signer.Sign(request, RestClient.BaseUrl.Host);
}
}
/// <summary>
@ -74,7 +78,10 @@ namespace {{packageName}}.Client
{{/netStandard}}
lwaAuthorizationSigner = new LWAAuthorizationSigner(Configuration.AuthorizationCredentials);
awsSigV4Signer = new AWSSigV4Signer(Configuration.AuthenticationCredentials);
if(Configuration.AuthenticationCredentials != null)
{
awsSigV4Signer = new AWSSigV4Signer(Configuration.AuthenticationCredentials);
}
rateLimitConfig = Configuration.RateLimitConfig;
if(rateLimitConfig != null)
{

View File

@ -464,18 +464,19 @@ namespace {{packageName}}.{{apiPackage}}
throw new NullReferenceException("LWAAuthoriztionCredentials not set");
}
if (awsAuthenticationCredentials == null)
{
throw new NullReferenceException("AWSAuthenticationCredentials not set");
}
{{packageName}}.Client.Configuration configuration = new {{packageName}}.Client.Configuration()
{
AuthorizationCredentials = lwaAuthorizationCredentials,
AuthenticationCredentials = awsAuthenticationCredentials,
RateLimitConfig = rateLimitConfiguration
};
if(awsAuthenticationCredentials != null)
{
configuration.AuthenticationCredentials = awsAuthenticationCredentials;
}
// default HTTP connection timeout (in milliseconds)
configuration.Timeout = 100000;