SAP Fiori Client Guide

Building and Running an iOS Project

Build and run an iOS project for an X.509 certificate provider.

Context

This task references the sample X509FileCertificateProvider project. Alternately, you can use these steps to build your own certificate provider project. The sample X509FileCertificateProvider project and the sample Hybrid SDK (Kapsel) application are available for download at https://github.com/SAP/mobilesdk-certificateproviderInformation published on non-SAP site in the ios/X509FileCertificateProviderSample2 subfolder.

Procedure

  1. Create a Hybrid SDK (Kapsel) iOS project with the Logon plugin, and optionally the AuthProxy plugin with the following steps:
    cordova create X509KapselSample X509KapselSample com.sample.x509
    cordova platform add ios
    cordova -d plugin add com.sap.mp.cordova.plugins.logon –searchpath {YourKapselSDKPluginInstallationFolder}
    cordova -d plugin add com.sap.mp.cordova.plugins.authproxy -- searchpath {YourKapselSDKPluginInstallationFolder}
    cordova -d prepare ios
    

    Replace the index.html in both the www folder and the platform/ios/www folder with the index.html in the X509FileCertificateProvider/resource folder.

  2. Add the sample provider project (or your own certificate provider project) into the Hybrid SDK (Kapsel) project, and update the project's link library to include the provider target from the project settings' "Build Phases > link binary with library" section.
  3. Edit the Kapsel project's info plist file, and add a string item, where the value is the provider class that implements the certificate provider interface, and where the key is the last parameter set in the logon.init method to specify the selected certificate provider. To use the sample certificate provider project, set both the value and the key as "X509FileCertificateProvider".
  4. Copy the client certificate p12 file to the Kybrid SDK (Kapsel) project resource folder, and select Target Membership to the target of the main project. The sample X509FileCertificateProvider will retrieve the client certificate from the p12 file from the application bundle.
  5. Copy the X509FileCertScreen.storyboard used by the certificate provider to the main project's resource bundle, and make sure its target membership is set to the main Hybrid SDK (Kapsel) project
  6. If modifying the build settings for an iOS7 or iOS7.1 Deployment Target, you may get a library link error. You can manually add the libstdc++.6.0.9.dylib to fix the issue.
  7. In your own application's JavaScript or HTML file set the logonContext and appDelegate objects and call sap.logon.startLogonInit method. Note that for certificate registration, the logonContext.smpConfig property must specify the serverHost, serverPort and https properties, as for certificate registration, the registration setting screen will not show to let the user enter the server settings. The appConfig property must specify the appID, isForSMP and certificate id properties.
  8. Build and run the Kapsel project and it prompts for the file certificate settings. Enter the certificate file name and password and verify that the registration succeeds.
    After the registration is done, verify that all Hybrid SDK (Kapsel) plugins can automatically use the certificate to communicate to the server, for example, the AuthProxy plugin can access backend OData, or the AppUpdate plugin can retrieve the new version.