Configuration Model

To establish communication with Token Server the SDK has to be provided with correct configuration model. In order to configure Onegini SDK following properties have to be configured properly:

  • ONGAppIdentifier - Application identifier used in dynamic client registration.
  • ONGAppPlatform - Application platform used in dynamic client registration.
  • ONGAppVersion - Application version used in dynamic client registration.
  • ONGAppBaseURL - Base url of the OAuth Server installation.
  • ONGResourceBaseURL - Base url of the resource server.
  • ONGRedirectURL - Redirect url used to complete registration process.

All of the above values provided to the SDK have to be aligned with the application configuration and application versions configuration created on the token server.

Recommended way of configuring Onegini SDK is using SDK Configurator, which will automatically set all required values and ensure those are aligned with configuration on the token server.

To configure Onegini SDK manually its required to create instance of ONGConfigModel. Then this object needs to be passed to ONGClientBuilder when creating ONGClient 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];

ONGConfigModel can also be instantiated from a .plist file using - (id)initWithContentsOfFile:(NSString *)path; initializer:

Configuration plist

ONGConfigModel *configModel = [[ONGConfigModel alloc] initWithContentsOfFile:configurationFilePath];
ONGClientBuilder *clientBuilder = [[ONGClientBuilder alloc] init];
self.oneginiClient = [[[clientBuilder setConfigModel:configModel] setX509PEMCertificates:@[certificate]] build];