ONGClientBuilder Class Reference
Inherits from | NSObject |
---|---|
Declared in | ONGClientBuilder.h |
Overview
ONGClientBuilder
is responsible for setting up SDK.
SDK setup:
In order to instantiate SDK you have to set at least configModel
and X509PEMCertificates
.
If one or both are not set, ONGClientBuilder
will try to retrieve missing values from OneginiConfigModel
class
generated by SDK configurator tool. If it is impossible to locate OneginiConfigModel
- SDK can not be configured
correctly and exception is raised.
– setConfigModel:
Set instance of ONGConfigModel
used for SDK configuration. This value can not be nil
.
- (instancetype)setConfigModel:(ONGConfigModel *)configModel
Parameters
configModel |
Instance of |
---|
Declared In
ONGClientBuilder.h
– setStoreCookies:
Flag instructing SDK to store cookies between requests. YES
by default.
- (instancetype)setStoreCookies:(BOOL)storeCookies
Parameters
storeCookies |
Whether or not to store cookies between requests. |
---|
Declared In
ONGClientBuilder.h
– setX509PEMCertificates:
For verification of the bundled DER encoded CA X509 certificates, the App must provide a list of matching PEM base64 encoded certificates for each bundled DER encoded CA X509 certificate to this client. The PEM base64 encoded certificates must be stripped from their armor (remove —BEGIN CERTIFICATE— & —END CERTIFICATE—)
- (instancetype)setX509PEMCertificates:(NSArray<NSString*> *)certificates
Parameters
certificates |
Array of PEM base64 encoded certificates without armor |
---|
Discussion
This method must be called before any service request is made, preferably after initialization. If certificate verification fails prior to making a service request, an Exception is thrown.
To convert a DER encoded certificate to PEM, use the following openssl command:
openssl x509 -in
Declared In
ONGClientBuilder.h
– setDeviceConfigCacheDuration:
To reduce frequency of client validation calls, device config stays cached for specified period of time. Setting cache duration to negative or 0 value will disable caching.
- (instancetype)setDeviceConfigCacheDuration:(NSTimeInterval)cacheDuration
Parameters
cacheDuration |
cache duration in seconds. Default value is 300 seconds (5 minutes). |
---|
Discussion
This method must be called before any service request is made, preferably after initialization.
Declared In
ONGClientBuilder.h
– setHttpRequestTimeout:
Configure the HTTP request timeout for all HTTP requests made by the SDK. This goes for both the HTTP calls made by the SDK as for the resource requests that are made using the SDK.
- (instancetype)setHttpRequestTimeout:(NSTimeInterval)requestTimeout
Parameters
requestTimeout |
timeout for a HTTP request |
---|
Declared In
ONGClientBuilder.h
– build
Set up SDK and return configured instance of ONGClient
using builder’s values.
Subsequent calls will not take any effect on the instantiated ONGClient
.
- (ONGClient *)build
Return Value
configured instance of ONGClient
Discussion
Warning: In case ONGClientBuilder
doesn’t have required values (configModel
and X509PEMCertificates
) and can not
retrieve them from OneginiConfigModel
class (generated by SDK Configurator) - ONGSDKInitializationException
will be thrown.
Declared In
ONGClientBuilder.h