Use case – App

Contents


The use case

Step-by-Step

Alternate process steps

Programmatic start of Net iD Access

Restarting your app under iOS

Restarting your app under Android

Abbreviations and naming conventions in this documentation:
NiA = Net iD Access (The App used for login and signing)
NiAS = Net iD Access Server (The Web Service communicating with the service and with Net iD Access)
The Service = The core of your solution with webservers, application servers, databases etc.

The use case


Lets say you want to use Net iD Access (NiA) for smart card login (and possibly signing) on the same device as where your own app is running. In this case your app can start NiA on the device and via your applications serverside start login- and signing processes by sending web service calls to Net iD Access Server (NiAS)

Step-by-step


1. The user enters his or her UserID in an app, if not saved since earlier. (If signing the user enters what should be signed or is presented with the data that should be signed)

2. The service sends a login (or signing) request to  skickar legitimerings-/underskriftsbegäran to NiAS using “Authenticate“.

3. If an error code is returned the process stops and your app should not start NiA.

4. You app starts NiA programatically (described below in section “Start the Net iD Access app programatically”). Access app programatically”).

5. NiAS sends a login/sign- request to NiA.

6. NiA shows the name of the application/service and states what type

7. NiA starts you app.
– On iOS the URL-parameter “redirect ” that was sent by your app earlier (4) is used by NiA to start your app.
– On Android onActivityResult() is called in your app when NiA has finished the activity initiated by your app.
– If your app does not support background processing you have to implement a method for storing the state when NiA is started and thereafter re-create this state since your app might be closed when you call NiA. The exact behaviour depends on platform and your implementation.

8. The service calls NiAS for an answer.

Alternate process steps


1. NiA is not installed in the device. The call in 4 (above) returns an error code, (NO in iOS and android.content.ActivityNotFoundException in Android) and the process should be cancelled by your app. A message should then be displayed to the user, for example; “You don’t have Net iD Access installed on your device”

2. User exits the NiA before NiA have restarted your app. User has to manually restart your app.

3. The Login- or Sign-request in 2 fails. The process is cancelled and you should not start NiA..

Other errors are described in chapter Interface – Overview.

Programmatic start of Net iD Access


iOS

openURL:[NSURL URLWithString: @”netid:// redirect=your_app_x://company_x”]

Android

Intent intent = new Intent();
intent.setPackage(“com.secmaker.access”); CHECK THIS LINE! IS IT CORRECT?
intent.setAction(Intent.ACTION_VIEW);
intent.addCategory(Intent.CATEGORY_BROWSABLE); //optional
intent.addCategory(Intent.CATEGORY_DEFAULT); //optional
intent.setType(“netid”);
intent.setData(Uri.parse(“bankid://www.www.secmaker.com?redirect=null”));
startActivityForResult(intent, 0);

Make sure to UTF-8 encode the URL after “redirect=”

Sample of redirect before URL UTF8-encoding:
https://www.company_x.com/path?p1=v1&p2=v2

The same redirect but URL UTF-8-encoded:
https%3A%2F%2Fwww.company_x.com%2Fpath%3Fp1%3Dv1%26p2%3Dv2

Full link:
netid://redirect=https%3A%2F%2Fwww.company_x.com%2Fpath%3Fp1%3Dv1%26p2%3Dv2

Restarting your app under iOS

To make sure that NiA shall be able to restart your app after login/sign you have to:
1. Register a unique URL-scheme for your app, and
2. Handle the case when your app is started with the URL-scheme procedure.

In exemples we use the URL-scheme your_app_x.

Register a scheme

1. Start Xcode
2. Open Info.plist.
2. Right click and select ”Add Row” and ”URL Types”.
3. Open ”Item 0” and enter ”URL Identifier”, (reversed domain name; com.company.appname)
4. Right click ”Item 0”, select ”Add Row” and ”URL Schemes”.
5. Give the key URL Schemes / Item 1 the value your_app_x.

Restarting your app under Android

On Android no special actions like URL-scheme registering is required. After finished or cancelled login/sign Net iD Access exits and your app is once again in the foreground and onResume() can be called.