Configuration model
To establish communication with the IDAAS-core, the iOS SDK has to be provided with a correct configuration model. This can be done using the Mobile SDK Configurator. This tool will automatically set all required values and ensure those are aligned with configuration on the IDAAS-core.
To configure the iOS SDK, some data must be provided:
-
Application data:
ONGAppIdentifieris the application identifier used in dynamic client registration.ONGAppPlatformis the application platform used in dynamic client registration.ONGAppVersionis the application version used in dynamic client registration.ONGAppBaseURLis the base URL of the OAuth server installation.ONGResourceBaseURLis the base URL of the resource server.ONGRedirectURLis the redirect URL used to complete registration process.
-
Certificates used for the certificate pinning.
-
Server public key when payload encryption feature is turned on.
What the Mobile SDK Configurator does for you
If the Mobile SDK Configurator was used to apply configuration, then it automatically generates a OneginiConfigModel class with provided data.
An example of the generated file:
@implementation OneginiConfigModel
+ (NSArray *)certificates
{
return @[@"MIIGEz...zlIPK1aEn8="]; //Base64Certificates
}
+ (NSDictionary *)configuration
{
return @{
@"ONGAppIdentifier" : @"ExampleApp",
@"ONGAppPlatform" : @"ios",
@"ONGAppVersion" : @"5.0.0",
@"ONGAppBaseURL" : @"https://demo-msp.onegini.com",
@"ONGResourceBaseURL" : @"https://demo-msp.onegini.com/resources",
@"ONGRedirectURL" : @"oneginiexample://loginsuccess",
};
}
+ (NSString *)serverPublicKey
{
return @"355C555820D47CB2010F601D96CB134A3026BFEC7F23732E0890CD5E62AB2D24";
}
@end
// Swift version of ConfigModel not yet available.
Manual configuration
To configure the cSDK manually, its required to create an instance of the ConfigModel. Then this object needs to be passed to ClientBuilder when creating a client instance. Example:
ONGConfigModel *configModel = [[ONGConfigModel alloc] initWithDictionary:@{
ONGAppIdentifier : @"appIdentifier"
ONGAppPlatform : @"ios"
ONGAppVersion : @"1.0.0"
ONGAppBaseURL : @"https://token-server.com"
ONGResourceBaseURL : @"https://resource-server.com"
ONGRedirectURL : @"appscheme://loginsuccess"
}];
ONGClientBuilder *clientBuilder = [[ONGClientBuilder alloc] init];
self.oneginiClient = [[[clientBuilder setConfigModel:configModel] setX509PEMCertificates:@[certificate]] build];
let model = ConfigModel(dictionary: ["ONGAppIdentifier": "ONGAppIdentifier",
"ONGAppPlatform": "ONGAppPlatform",
"ONGAppVersion": "1.0.0",
"ONGAppBaseURL": "https://...",
"ONGResourceBaseURL": "https://.../",
"ONGRedirectURL": "...://loginsuccess"])!
let publicKey = "XXX" //publicKey can be retrived from JSON exported in config zip from TS
let certs = ["XXX"]
ClientBuilder().setConfigModel(model)
.setX509PEMCertificates(certs)
.setServerPublicKey(publicKey)
.build()
The ConfigModel can also be instantiated from a .plist file using filePath initializer:

ONGConfigModel *configModel = [[ONGConfigModel alloc] initWithContentsOfFile:configurationFilePath];
ONGClientBuilder *clientBuilder = [[ONGClientBuilder alloc] init];
self.oneginiClient = [[[clientBuilder setConfigModel:configModel] setX509PEMCertificates:@[certificate]] build];
let configModel = ConfigModel(filePath: configurationFilePath)
let oneginiClient = ClientBuilder.setConfigModel(configModel)
.setX509PEMCertificates([certificate])
.build()