Extended Configuration
LicenseSpring offers many features to tailor the setup to meet user needs through the Configuration and ExtendedOptions classes. Throughout this tutorial, we'll provide a comprehensive overview of these classes and how they are used to manage settings.
In addition to the theoretical understanding, this tutorial also offers practical guidance. You'll find instructions on how to set up a proxy, a crucial element in various software setups. We'll also cover the important topic of SSL checks, discussing their importance and how to integrate them effectively.
This tutorial will provide readers with a solid understanding of the Configuration and ExtendedOptions classes, acquired practical skills in configuring proxies, and obtained insights into enhancing security through SSL checks.
Swift SDK does not have separated ExtendedConfiguration: all properties are defined in the Configuration itself.
Accessing Current Configuration
The current configuration can be retrieved by calling currentConfig() on a LicenseManager instance in the C++ SDK:
configuration = licenseManager->currentConfig();manager = LicenseManager(conf)
config = manager.current_config()
print(config)LicenseSpringConfiguration config = licenseManager.getConfig();It is also possible to reconfigure the current configuration, rather than having to create a new Configuration object with:
reconfigure(configuration);manager = LicenseManager(conf)
manager.reconfigure(
Configuration(
product="lkprod2",
api_key="new_key",
shared_key="new_key",
file_key="file_key",
file_iv="file_iv",
file_path="bb",
grace_period_conf=12,
is_guard_file_enabled=True,
)
)licenseManager.reinitialize(configuration);try licenseManager.reconfigure(
appName: "AA[[",
appVersion: "2.0.1",
airgapKey: "someAirgapKey",
skipResponseSignatureChecks: true)Network Information and Timeout
To activate the gathering of network information, you need to declare it during the configuration phase of the implementation, as follows:
extendedOptions.collectNetworkInfo(true);extendedOptions.CollectNetworkInfo = true;
//OR
configuration.CollectNetworkInfo = true;configuration.collectHostNameAndLocalIP = trueconfiguration.storeMachineInfo = true;Whether network collection is enabled can be checked after configuration with:
bool enabled = extendedOptions.isCollectNetworkInfoEnabled();
//OR
bool enabled = configuration->isCollectNetworkInfoEnabled();bool enabled = extendedOptions.CollectNetworkInfo;
//OR
bool enabled = configuration.CollectNetworkInfo;configuration.collectHostNameAndLocalIPboolean enabled = baseConfiguration.isStoreMachineInfo();A variety of network-related information can be accessed through both ExtendedOptions and Configuration in C++ and Configuration in .NET.
In C++, a NetworkInfo object is returned when getNetworkInfo is called. The NetworkInfo object consists of the following:
IP address
MAC address
Host name
In .NET, the IP address, MAC address, and host name are stored separately in Configuration.
In the Python SDK, network information is managed within the Python Hardware (Device) IDs class, which is designed to be customizable. If a user prefers not to send network information, they can override the relevant method in the class to return None. This information can be accessed using the following:
Override Network Information
C++ offers a method for overriding network information, setting the NetworkInfo object stored within ExtendedOptions:
Network Timeout
Similarly, the network timeout of the configuration is stored in the same locations, and can be accessed with:
Configuring the network timeout is equally straightforward, accomplished in a comparable manner:
The C++ SDK also allows to set and get the connection timeout, i.e. the value used for CURLOPT_CONNECTTIMEOUT. It defaults to 7 seconds.
Proxy Settings
Proxy settings are configuration parameters that allow you to route network traffic through an intermediary server, known as a proxy server. Proxy settings are another feature stored within ExtendedOptions and Configuration that can be accessed with:
Proxy settings can be set as follows:
In the Windows version of the C++ SDK, proxy settings can be automatically fetched through the WinHTTP API.
If the proxy is autoconfigured through a .pac file over the network, the SDK reads which proxy is used to reach api.licensespring.com or some other custom API URL.
Proxy credentials are read from Windows Credential Manager, and the caller needs to supply the exact Windows Credential target that holds the credentials:
Native Transport Layer Security
The C++ SDK offers the opportunity to enable or disable native TLS for curl.
Enable native TLS on Windows by running:
To later check for whether native TLS is being used:
Secure Sockets Layer Certificate Verification
Similar to native TLS, the C++ SDK allows developers to decide whether SSL certificate verification is to be enabled or disabled.
To disable SSL certificate verification:
There is also a checker for whether SSL certificate verification is enabled:
Last updated
Was this helpful?