Proxy Configuration

The following guide covers how to make API calls to OneSpan Sign through a proxy server.

A proxy server is a server that acts as an intermediary for requests from clients seeking resources from other servers. With OneSpan Sign, you can make API calls via a proxy server.

The Code

The complete example code can be found in the Developer Community Code Share, here.

To make API calls to OneSpan Sign through a proxy server, you will need to build a ProxyConfiguration object. You will need to pass the proxy server’s address and port number to the withHttpHost() and withHttpPort() methods respectively.

ProxyConfiguration httpProxyConfiguration = ProxyConfigurationBuilder.newProxyConfiguration()
                .withHttpHost("serverAddress") //e.g. localhost
                .withHttpPort(portNumber) //e.g. 8001
                .build();

If you’ve setup your proxy server with additional authentication, such as a username and password, you will need to add it to your ProxyConfiguration object.

ProxyConfiguration httpProxyConfiguration = ProxyConfigurationBuilder.newProxyConfiguration()
                .withHttpHost("serverAddress")
                .withHttpPort(portNumber)
                .withCredentials("httpUser", "httpPwd")
                .build();

The final step is to create your EslClient object. It is important to note that trusting all certificates should not be enabled for security reasons.

boolean allowAllSSLCertificates = false;		
EslClient client = new EslClient(API_KEY, API_URL, allowAllSSLCertificates, httpProxyConfiguration);

Get the Code

A proxy server is a server that acts as an intermediary for requests from clients seeking resources from other servers. With OneSpan Sign, you can make API calls via a proxy server.

The Code

The complete example code can be found in the Developer Community Code Share, here.

To make API calls to OneSpan Sign through a proxy server, you will need to build a ProxyConfiguration object. You will need to pass the proxy server’s address and port number to the WithHttpHost() and WithHttpPort() methods respectively.

ProxyConfiguration httpProxyConfiguration = ProxyConfigurationBuilder.newProxyConfiguration()
                .WithHttpHost("serverAddress") //e.g. localhost
                .WithHttpPort(portNumber) //e.g. 8001
                .Build();

If you’ve setup your proxy server with additional authentication, such as a username and password, you will need to add it to your ProxyConfiguration object.

ProxyConfiguration httpProxyConfiguration = ProxyConfigurationBuilder.newProxyConfiguration()
                .WithHttpHost("serverAddress")
                .WithHttpPort(portNumber)
                .WithCredentials("httpUser", "httpPwd")
                .Build();

The final step is to create your EslClient object. It is important to note that trusting all certificates should not be enabled for security reasons.

Boolean allowAllSSLCertificates = false;		
EslClient client = new EslClient(API_KEY, API_URL, allowAllSSLCertificates, httpProxyConfiguration);

Get the Code

A proxy server is a server that acts as an intermediary for requests from clients seeking resources from other servers. With OneSpan Sign, you can make API calls via a proxy server.

The Code

The complete example code can be found in the Developer Community Code Share, here.

To make API calls to OneSpan Sign through a proxy server, the first step is to build a WebProxy object. The UseDefaultCredentials property should be set to true when requests made by your WebProxy object should, if requested by the server, be authenticated using the credentials of the currently logged on user. Otherwise, set this property to false.

string proxyUri = string.Format("{0}:{1}", "serverAddress", portNumber); //e.g. 13.1.25.80:8200 

WebProxy proxy = new WebProxy(proxyUri, false)
{
        UseDefaultCredentials = false
};

Next, you will need to create your HttpClient that you will used to send requests to OneSpan Sign. In this example, you wil need to create one with a specific handler. The Proxy property sets the proxy information used by the handler and the PreAuthenticate property indicates the handler will send an Authorization header with the request.

HttpClient client = null;
HttpClientHandler httpClientHandler = new HttpClientHandler()
 {
        Proxy = proxy,
        PreAuthenticate = true,
        UseDefaultCredentials = false,
};

If you’ve setup your proxy server with additional authentication, such as a username and password, you will need to add it to your handler.

string httpUserName = "httpUser", httpPassword = "httpPwd";

httpClientHandler.Credentials = new NetworkCredential(httpUserName, httpPassword);

The last step is to initialize a new instance of the HttpClient class with the specific handler.

client = new HttpClient(httpClientHandler);

Get the Code