Amazon.Runtime.Internal.Auth.AbstractAWSSigner.UseV4Signing C# (CSharp) Method

UseV4Signing() protected static method

Inspects the supplied evidence to return the signer appropriate for the operation
protected static UseV4Signing ( bool useSigV4Setting, IRequest request, IClientConfig config ) : bool
useSigV4Setting bool Global setting for the service
request IRequest The request.
config IClientConfig Configuration for the client
return bool
        protected static bool UseV4Signing(bool useSigV4Setting, IRequest request, IClientConfig config)
        {
            if (useSigV4Setting || request.UseSigV4 || config.SignatureVersion == "4")
                return true;

            // do a cascading series of checks to try and arrive at whether we have
            // a recognisable region; this is required to use the AWS4 signer
            RegionEndpoint r = null;
            if (!string.IsNullOrEmpty(request.AuthenticationRegion))
                r = RegionEndpoint.GetBySystemName(request.AuthenticationRegion);

            if (r == null && !string.IsNullOrEmpty(config.ServiceURL))
            {
                var parsedRegion = AWSSDKUtils.DetermineRegion(config.ServiceURL);
                if (!string.IsNullOrEmpty(parsedRegion))
                    r = RegionEndpoint.GetBySystemName(parsedRegion);
            }

            if (r == null && config.RegionEndpoint != null)
                r = config.RegionEndpoint;

            if (r != null)
            {
                var endpoint = r.GetEndpointForService(config.RegionEndpointServiceName, config.UseDualstackEndpoint);
                if (endpoint != null && (endpoint.SignatureVersionOverride == "4" || string.IsNullOrEmpty(endpoint.SignatureVersionOverride)))
                    return true;
            }

            return false;
        }