iOS
1- Framework setup
Create LocalPods folder if you don't have it.
Add UAEPPASSClient folder in LocalPods folder.
Add pod 'UAEPassClient', :path => "LocalPods/UAEPassClient" to your podfile
2- Should do
In AppDelegate add below : import UAEPassClient
In didFinishLaunchingWithOptions add
UAEPASSRouter.shared.spConfig = SPConfig(redirectUriLogin: "client redirect url",
scope: "client login scope",
state: "RANDOM 24 alpha numeric", //Randomly Generated Code 24 alpha numeric.
successSchemeURL: "UUUUU://", //client success url scheme.
failSchemeURL: "CCCCC://", //client failure url scheme.
signingScope: "urn:safelayer:eidas:sign:process:document") // client signing scope
UAEPASSRouter.shared.environmentConfig = UAEPassConfig(clientID: "your client id", env: .production)
--- env (environment can be : .production or .stg)func application(_: UIApplication, handleOpen url: URL) -> Bool
print("<><><><> appDelegate URL : \(url.absoluteString)")
if url.absoluteString.contains(HandleURLScheme.externalURLSchemeSuccess()) {
if let topViewController = UserInterfaceInfo.topViewController() {
if let webViewController = topViewController as? UAEPassWebViewController {
webViewController.forceReload()
}
}
return true
} else if url.absoluteString.contains(HandleURLScheme.externalURLSchemeFail()) {
guard let webViewController = UserInterfaceInfo.topViewController() as? UAEPassWebViewController else { return false}
webViewController.foreceStop()
let alertController = UIAlertController(title: "Failed to login with UAE PASS Login", message: "Try again later", preferredStyle: .actionSheet)
let okAction = UIAlertAction(title: "OK", style: UIAlertAction.Style.default) { _ in
NSLog("OK Pressed")
webViewController.navigationController?.popViewController(animated: true)
}
alertController.addAction(okAction)
self.window?.rootViewController?.present(alertController, animated: true, completion: nil)
return false
}
return true
}3- Should do
Add UAE Pass scheme in your project info.plist in LSApplicationQueriesSchemes (Already added in this sample): -- -- Production: uaepass -- STG: uaepassstg
For more understanding:
Authentication
After press on login with UAE PASS button you will be asked to select which environment you would like to use for login through UIAlertController and from this action you can trace how it works.
from application(_: UIApplication, handleOpen url: URL) -> Bool in AppDelegate you can force current web view to reload or stop loading incase if success or failure.
This sample contains three view controllers : -
-- ViewController.swift (main screen which contains login button and UIAlertController to select required environment).
UserProfileViewController.swift (Just simple view to show user profile details and it contains sign document scenario as well).
UAEPassWebViewController.swift (Resposible for handling webView requests to generate UAE PASS code to use it for token generation).
Signing flow :
you should have valid pdf file and in this sample you will be able to see sample code for downloading pdf file.
Then we have to generate valid token for signing process from your server
Your backend must fetch this token using your
CLIENT_IDandCLIENT_SECRETand return it to the app.This is NOT the same token used for authentication.
Then we have to upload above valid pdf document to UAE PASS.
After uploading we have to send our request for signing for (signature type (advanced or qualified), on which page signature will be placed, signature coordinates and signature size)
Check
testSignData.json is very important file as this is signing info which you should pass to UAE Pass app and it's expected to be received from the back end and it's required to be reconfigured to add your own app scheme
Note : This sample supports dark mode as well
Last updated
Was this helpful?