Configuration Model

To establish communication with the Token Server, the iOS SDK has to be provided with a correct configuration model. This can be done using the SDK Configurator. This tool will automatically set all required values and ensure those are aligned with configuration on the token server. The process is explained in our developer quickstart.

In order to configure the SDK, some data needs to be provided:

  1. Application data:
    • 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.
  2. Certificates used for the certificate pinning.
  3. Server public key when Payload Encryption feature is turned on.

What the SDK configurator does for you

If the SDK Configurator was used to apply configuration then it automaticlly generates OneginiConfigModel class with provided data.

An example of the generated file

@implementation OneginiConfigModel

+ (NSArray *)certificates
{
    return @[@"MIIGEzCCA/ugAwIBAgIQfVtRJrR2uhHbdBYLvFMNpzANBgkqhkiG9w0BAQwFADCBiDELMAkGA1UEBhMCVVMxEzARBgNVBAgTCk5ldyBKZXJzZXkxFDASBgNVBAcTC0plcnNleSBDaXR5MR4wHAYDVQQKExVUaGUgVVNFUlRSVVNUIE5ldHdvcmsxLjAsBgNVBAMTJVVTRVJUcnVzdCBSU0EgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkwHhcNMTgxMTAyMDAwMDAwWhcNMzAxMjMxMjM1OTU5WjCBjzELMAkGA1UEBhMCR0IxGzAZBgNVBAgTEkdyZWF0ZXIgTWFuY2hlc3RlcjEQMA4GA1UEBxMHU2FsZm9yZDEYMBYGA1UEChMPU2VjdGlnbyBMaW1pdGVkMTcwNQYDVQQDEy5TZWN0aWdvIFJTQSBEb21haW4gVmFsaWRhdGlvbiBTZWN1cmUgU2VydmVyIENBMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA1nMz1tc8INAA0hdFuNY+B6I/x0HuMjDJsGz99J/LEpgPLT+NTQEMgg8Xf2Iu6bhIefsWg06t1zIlk7cHv7lQP6lMw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EJCaOEDKNyJOuB56DPi/Z+fVGjmO+wea03KbNIaiGCpXZLoUmGv38sbZXQm2V0TP2ORQGgkE49Y9Y3IBbpNV9lXj9p5v//cWoaasm56ekBYdbqbe4oyALl6lFhd2zi+WJN44pDfwGF/Y4QA5C5BIG+3vzxhFoYt/jmPQT2BVPi7Fp2RBgvGQq6jG35LWjOhSbJuMLe/0CjraZwTiXWTb2qHSihrZe68Zk6s+go/lunrotEbaGmAhYLcmsJWTyXnW0OMGuf1pGg+pRyrbxmRE1a6Vqe8YAsOf4vmSyrcjC8azjUeqkk+B5yOGBQMkKW+ESPMFgKuOXwIlCypTPRpgSabuY0MLTDXJLR27lk8QyKGOHQ+SwMj4K00u/I5sUKUErmgQfky3xxzlIPK1aEn8="]; //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

Manual configuration

To configure Onegini SDK manually its required to create an 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];

results matching ""

    No results matching ""