Initialization of the KSSIDP (Android/iOS)
The KSSIDP SDK initialization process involves setting up the necessary configurations and creating an instance of the KssIdp
. This documentation provides a step-by-step guide for initializing the SDK in your application.
iOS/Swift
For Swift, the following steps can be done to initialize the KssIdpWrapper.
Prerequisites
Ensure that you have the required information from your configuration files, including:
- tenantId: The identifier for the tenant.
- certName: The name of the trusted SSL server certificate.
- baseUrl: The base URL for the IDP server.
- masterController: An instance of the Master Controller.
Initialization Steps
Singleton Instance
static let sharedInstance: KssIdpModel = {
var sharedInstance = KssIdpModel()
return sharedInstance
}()
The sharedInstance is a singleton instance of the KssIdpModel. It ensures a single point of access to the KSSIDP SDK throughout the application.
Configuration Parameters Setup:
guard let tenantId = GlobalConstats.appConfig?.tenantId,
let certName = GlobalConstats.appConfig?.iam?.trustedSslServerCerts?.first,
let baseUrl = GlobalConstats.mcConfig?.iam?.serverUrl,
let masterController = MasterControllerAdapter.sharedInstance.masterController else {
fatalError("unable to resolve required information from configuration files")
}
let certificatePath = "\(Bundle.main.bundlePath)/assets/\(MultiAssets.current)/\(certName)"
Extract the necessary configuration information from your application's global constants or configuration files that is provided assets folder. Generate the path to the SSL server certificate by combining the bundle path, assets folder, and the certificate name.
KssIdp Config Setup:
let idpConfig = KssIdpConfig(certificatePath: certificatePath,
baseUrl: baseUrl,
tenantId: tenantId,
masterController: masterController,
shouldKssIdpHandleTms: true,
shouldHashPin: true)
Create an instance of KssIdpConfig using the extracted configuration information. This includes the certificate path, base URL, tenantID, masterController, and additional flags.
KSSIDP Wrapper Initialization:
do {
self.kssIdpWrapper = try KssIdpWrapper(config: idpConfig)
} catch {
fatalError("unable to initialize KssIdpWrapper. \(error)")
}
Initialize the KssIdpWrapper with the created configuration. Handle any initialization errors, ensuring that the SDK is set up correctly.
NOTE: Now that the SDK is initialized, you can use the KssIdpWrapper instance throughout your application to perform various actions and interactions with the KSSIDP SDK.
Android/Kotlin
The KSSIDP SDK initialization process on Android involves setting up the necessary configurations and initializing the SDK instance. This documentation provides a step-by-step guide for initializing the SDK in your Android application.
Prerequisites
Ensure that you have the required information from your configuration files, including:
- tenantId: The identifier for the tenant.
- certName: The name of the trusted SSL server certificate.
- baseUrl: The base URL for the IAM (Identity and Access Management) server.
Initialization Steps
SDK Instance Retrieval
fun getInstance(): SynchronousEventHandler? {
return KssIdp.getSdkInstance()
}
Retrieve the KSSIDP SDK instance using the getSdkInstance method. This allows you to access the SDK functionalities throughout your Android application.
SDK Initialization
fun init(application: Application) {
// This ensures that your class is notified when the SDK completes an operation.
KssIdp.setOnResultReceivedListener(this)
if (masterController == null) {
// Initialize KssIdpConfig for SDK configuration.
val kssIDPConfig = KssIdpConfig(
certificatePath = ConfigManager.getMcConfigEntityInstance().iam?.trustedSslServerCerts?.get(0).toString(),
baseUrl = ConfigManager.getMcConfigEntityInstance().iam?.serverUrl.toString(),
tenantId = ConfigManager.getAppConfigEntityInstance().tenantId.toString(),
shouldHashPin = true,
shouldKssIdpHandleTms = true
)
// Set the SDK configuration.
KssIdp.setConfig(kssIDPConfig)
// Initialize the KSSIDP SDK.
KssIdp.init(application, kssIDPConfig)
}
}
Conclusion
To sum up, the initialization guide provides a comprehensive overview of the steps involved in initializing the KSSIDP SDK on both platforms. Please focus on prerequisites, configurations, provided code snippets, and detailed explanations for a smooth integration