LicenseSpring C++ SDK
Easily add Software Licensing to your application
Configuration.h
Go to the documentation of this file.
1#ifndef LS_CONFIGURATION_H
2#define LS_CONFIGURATION_H
3
4#ifdef _MSC_VER
5#pragma once
6#pragma warning(push)
7#pragma warning(disable : 4251)
8#endif
9
10#include <memory>
11#include "ExtendedOptions.h"
12
13namespace LicenseSpring
14{
19{
20public:
21 using ptr_t = std::shared_ptr<Configuration>;
22
24 Configuration() = default;
25
38 static ptr_t Create(const std::string &apiKey, const std::string &sharedKey,
39 const std::string &productCode, const std::string &appName, const std::string &appVersion,
40 const ExtendedOptions &extendedOptions = ExtendedOptions());
41
53 static ptr_t CreateOAuth(const std::string &clientId, const std::string &clientSecret,
54 const std::string &productCode, const std::string &appName, const std::string &appVersion,
55 const ExtendedOptions &extendedOptions = ExtendedOptions());
56
59 bool isOAuth() const;
60
63 const std::string &getApiKey() const;
64
67 const std::string &getSharedKey() const;
68
71 const std::string &getClientId() const;
72
75 const std::string &getClientSecret() const;
76
79 const std::string &getProductCode() const;
80
83 const std::string &getAppName() const;
84
87 const std::string &getAppVersion() const;
88
92 const std::string &getCustomerAccount() const;
93
98 void setCustomerAccount(const std::string &accountCode);
99
102 const std::string &getAirGapPublicKey() const;
103
106 void setAirGapPublicKey(const std::string &key);
107
113 const std::wstring &getLicenseFilePath() const;
114
124 const std::string &getHardwareID();
125
129 void setHardwareID(const std::string &deviceId);
130
134
138
141 bool isLoggingEnabled() const;
142
145 bool isGuardFileEnabled() const;
146
150 bool isSSLCheckEnabled() const;
151
155 bool isNativeTLSEnabled() const;
156
161
166
169 uint32_t getGracePeriod() const;
170
174 long getNetworkTimeout() const;
175
178 void setNetworkTimeout(long timeoutValue);
179
183 long getConnectTimeout() const;
184
187 void setConnectTimeout(long timeoutValue);
188
192
196
199 const std::string &getSdkVersion() const;
200
203 const std::string &getOsVersion() const;
204
207 const std::string &getHostName() const; // note: string is UTF-8 encoded
208
211 const std::string &getIP() const;
212
215 const std::string &getMAC() const;
216
220
224
231 bool isVM() const;
232
238 const std::string &getDetectedVMName() const;
239
244
247 const std::string &getAlternateServiceUrl() const;
248
251 const std::string &getAlternateKey() const;
252
256 const std::string &getUserInfo() const;
257
260 void setUserInfo(const std::string &customInfo);
261
264 const std::string &getHardwareKeyTargetSerial() const;
265
268 const std::string &getHardwareKeyPin() const;
269
270private:
271 bool m_isOAuth;
272 std::string m_apiKey;
273 std::string m_sharedKey;
274 std::string m_clientId;
275 std::string m_clientSecret;
276 std::string m_productCode;
277 std::string m_customerAccount;
278 std::string m_appName;
279 std::string m_appVersion;
280 std::string m_userInfo;
281 std::string m_airGapPublicKey;
282 ExtendedOptions m_extOptions;
283};
284} // namespace LicenseSpring
285
286#ifdef _MSC_VER
287#pragma warning(pop)
288#endif
289
290#endif // LS_CONFIGURATION_H
#define LS_API
Definition: APIDef.h:23
DeviceIDAlgorithm
Type of Device ID algorithm used by the SDK.
Definition: PODTypes.h:119
Class for configuring application.
Definition: Configuration.h:19
std::shared_ptr< Configuration > ptr_t
Definition: Configuration.h:21
const std::string & getAirGapPublicKey() const
Getter for air gap public key.
bool isVM() const
Checker for whether the user is on a virtual machine.
bool isOAuth() const
Checker if authn is done with OAuth.
const std::string & getApiKey() const
Getter for API key (UUID).
const std::string & getIP() const
Getter for IP Address.
void setDeviceIdAlgorithm(DeviceIDAlgorithm algorithm)
Setter for DeviceIDAlgorithm.
const std::string & getAppName() const
Getter for application name.
bool isCollectNetworkInfoEnabled() const
Checker for if collection of network information is enabled in ExtendedOptions.
const NetworkInfo & getNetworkInfo() const
Getter for Network Information.
long getNetworkTimeout() const
Getter for network timeout.
uint32_t getGracePeriod() const
Getter for grace period.
long getConnectTimeout() const
Getter for connect timeout, used for CURLOPT_CONNECTTIMEOUT option.
CryptoProvider::ptr_t getCryptoProvider()
Getter for crypto provider.
bool isHardwareKeyEnabled() const
Checker for whether requests should be sent with a hardware key signature.
const std::string & getClientId() const
Getter for OAuth client ID.
void setConnectTimeout(long timeoutValue)
Setter for connect timeout, used for CURLOPT_CONNECTTIMEOUT option.
const ProxySettings & getProxySettings() const
Getter for ProxySettings object.
const std::wstring & getLicenseFilePath() const
This method is obsolete! Return license file path that was set through ExtendedOptions or empty strin...
const std::string & getHardwareID()
Getter for device id.
bool isLoggingEnabled() const
Checker for if logging is enabled in ExtendedOptions.
const std::string & getSdkVersion() const
Getter for LicenseSpring SDK version.
Configuration()=default
Constructor for internal needs, use Create instead.
const std::string & getMAC() const
Getter for MAC Address.
void setUserInfo(const std::string &customInfo)
Set custom information to be passed to the backend with all API requests.
bool isGuardFileEnabled() const
Checker for whether guard file usage is enabled in ExtendedOptions.
const std::string & getOsVersion() const
Getter for Operating System version.
bool isLicenseCorruptionCheckEnabled() const
Checker for whether encrypted license data corruption checking is enabled or not.
void setHardwareID(const std::string &deviceId)
Setter for device id.
const std::string & getUserInfo() const
Returns custom information to be passed along with all API requests.
void setCustomerAccount(const std::string &accountCode)
Set customer group (account) code that is required for SSO.
const std::string & getHardwareKeyTargetSerial() const
Getter for the target YubiKey serial number configured via ExtendedOptions.
const std::string & getSharedKey() const
Getter for shared key.
bool isNativeTLSEnabled() const
Checker for whether native TLS for curl enabled or not.
const std::string & getHostName() const
Getter for Host Name.
bool isSSLCheckEnabled() const
Checker for whether SSL certificate verification is enabled.
const std::string & getDetectedVMName() const
Getter for hypervisor name, calls isVM first if not yet called.
const std::string & getAlternateKey() const
Getter for alternate public key.
static ptr_t CreateOAuth(const std::string &clientId, const std::string &clientSecret, const std::string &productCode, const std::string &appName, const std::string &appVersion, const ExtendedOptions &extendedOptions=ExtendedOptions())
Creates shared pointer for configuration object, used for OAuth authentication.
bool isVMDetectionEnabled() const
Checker for whether Virtual Machine Detection is enabled.
const std::string & getAlternateServiceUrl() const
Getter for alternate service URL.
void setAirGapPublicKey(const std::string &key)
Setter for air gap public key.
const std::string & getAppVersion() const
Getter for application version.
const std::string & getCustomerAccount() const
Returns customer group (account) code that is required for SSO.
const std::string & getHardwareKeyPin() const
Getter for the YubiKey PIN configured via ExtendedOptions.
const std::string & getClientSecret() const
Getter for OAuth client secret.
static ptr_t Create(const std::string &apiKey, const std::string &sharedKey, const std::string &productCode, const std::string &appName, const std::string &appVersion, const ExtendedOptions &extendedOptions=ExtendedOptions())
Creates shared pointer for configuration object, used for standard authentication with API and shared...
void setNetworkTimeout(long timeoutValue)
Setter for network timeout.
uint32_t getLicenseSpringAPIVersion() const
Getter for LicenseSpring API version.
const std::string & getProductCode() const
Getter for product code.
std::shared_ptr< CryptoProvider > ptr_t
Class for storing useful settings that the Configuration object will inherit.
Class for storing a device's network information.
Class for storing settings when using a proxy server.