Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add configuration setting to set RestClient url and Host header independently of RunEnvironment setting #26

Open
wopietrz opened this issue Mar 10, 2022 · 2 comments

Comments

@wopietrz
Copy link

wopietrz commented Mar 10, 2022

I'm trying to call Cybersource Rest Api via Azure Api Management to meet security and complaince requirements. Unfortunately I run into some issues:

  1. I' m not able to set RestClient Url to Api Management endpoint independently of RunEnviroment setting.
  2. I'm not able to modify the Host header independently of RunEnviroment setting to establish ssl connection.
  3. When I set the value of RunEnvironemnt to Azure Api Management endpoint then it is possilbe to connect to APIM but, Cybersource refuses a request becasue of inccorrect value of Signature header

There is a possibility to initialize RestClient with a custom url, however in ApiClient.CallAuthtenticationHeaders the RestClient property is recreated:

ApiClient.cs:

    public void CallAuthenticationHeaders(string requestType, string requestTarget, string requestJsonData = null)
    {
       ...
        
        Configuration.DefaultHeader = authenticationHeaders;
        RestClient = new RestClient("https://" + merchantConfig.HostName);
        
        if (Configuration.Proxy != null)
        {
            RestClient.Proxy = Configuration.Proxy;
        }
    }

In above code merchantConfig.HostName points to RunEnvironement setting.

@wopietrz
Copy link
Author

wopietrz commented Jul 8, 2022

Pull Request with changes proposal:
#45

@sebastian-sawicki
Copy link

This issue is related with issue #39 which also points to CallAuthenticationHeaders where new instance of RestClient is recreated.

I raise also separate #46 "Update RestSharp to v107 and follow recommended usage".

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants