# Android

Signicat offers a mobile SDK to easily connect Android devices to the Signicat Identity Broker. Here is how to integrate the Android SDK into your application.

# Requirements

The requirements for the Android SDK are:

  • the Android SDK is build with androidx. Therefore. you must have an androidx application to use the AndroidSDK
  • minimum API level: 23
  • if you have a Java based Android application, you must include the "org.jetbrains.kotlin:kotlin-stdlib:1.3.50" dependency to your project
  • The target phone's default browser must support cookies, otherwise a browser that supports cookies must be set as default

# Quick Start

To start using the Android SDK:

  • include the "android-sdk-${version}.aar" library in your project
  • set up app links for your application by following the next section

The Android SDK uses app links as a mechanism for connecting to the broker. For this reason, an app link configuration needs to be set up on your tenant. This can be easily configured from the UI by filling in the Android App package name and fingerprint under your service provider configuration.

Once the configuration is done, you can view the result at:

https://<YOUR_TENANT_DOMAIN>/.well-known/assetlinks.json

This will take care of the web server configuration. Now in order for your app to work you will need to configure the activities matching the URLs (the demo example provides the configuration already) inside your Android manifest and to make sure you have autoVerify true.

<activity
            android:name="SDK_ACTIVITY"
            android:windowSoftInputMode="stateHidden">
            <intent-filter android:autoVerify="true">
                <action android:name="android.intent.action.VIEW" />

                <category android:name="android.intent.category.DEFAULT" />
                <category android:name="android.intent.category.BROWSABLE" />

                <data
                    android:scheme="https"
                    android:host="YOUR_TENANT_DOMAIN"
                    android:pathPrefix="PATH_PREFIX" />
            </intent-filter>
        </activity>

SDK_ACTIVITY, YOUR_TENANT_DOMAIN and PATH_PREFIX will need to be filled in with the appropriate values (Please follow the demo application).

# API

The Android SDK offers 3 basic methods that can be called from the base class: "com.connectis.sdk.ConnectisSDK".

# Login

fun login(
            sdkConfiguration: ConnectisSDKConfiguration,
            caller: Context,
            delegate: AuthenticationResponseDelegate,
            errorResponseDelegate: ErrorResponseDelegate? = null
            allowDeviceAuthentication: Boolean = false
        )

Where ConnectisSDKConfiguration is a basic data class:

data class ConnectisSDKConfiguration(
    val issuer: String,
    val clientId: String,
    val redirectUri: String,
    val scopes: String? = null,
    val brokerAppAcs: String? = null,
    val brokerDigidAppAcs: String? = null,
    val loginFlow: LoginFlow = LoginFlow.WEB
)

and AuthenticationResponseDelegate is a interface where you can handle the response:

interface AuthenticationResponseDelegate{
    fun handleResponse(authenticatonResponse: AuthenticationResponse)
    fun onCancel()
}

the AuthenticationResponse is the class you will receive after a login was made in the CIB.

data class AuthenticationResponse(
    val isSuccess: Boolean,
    val error: String?,
    val nameIdentifier: String?,
    val attributes: List<Attribute>
)

Properties definition:

  • issuer - the endpoint of the CIB that you want to connect to. Given by Connectis Technical Support.
  • clientId - the client-id that you provided to Connectis Technical Support.
  • redirectUri - must be set to the app link value
  • scopes - can be set if you want to do idp scoping (bypass the idp selection screen or for app2app)
  • brokerAppAcs - must be set for app2app openid: broker endpoint for processing app2app openid flows
  • brokerDigidAppAcs - must be set for app2app DigID: broker endpoint for processing app2app DigID flow
  • loginFlow - can be set to either WEB or APP_TO_APP, default is WEB
  • caller - The activity context where you call the ConnectisSDK from
  • delegate - your implementation of the AuthenticationResponseDelegate interface
  • errorResponseDelegate - optional implementation for handling errors (if none is provided, exceptions will be thrown on error)
  • allowDeviceAuthentication - true if you wish to enable device authentication in your application, false otherwise

# OpenId Access Token

The API provides access to a valid OpenId access token

fun useAccessToken(
            caller: Context,
            accessTokenDelegate: AccessTokenDelegate
        )

where AccessTokenDelegate is an interface:

interface AccessTokenDelegate {
    fun handleAccessToken(accessToken : Token)
    fun onError(errorMessage: String)
}

Note: for security reasons, the OpenId Access Token should be treated as a secret in the software.

# Device Authentication

The Android SDK offers the possibility to authenticate the users, once the user logged in at least once, using the mobile phone device authentication supported methods(face unlock, fingerprint, pin code)

To enable the device authentication flow call the following method after the user logged in using the CIB:

fun enableDeviceAuthentication(originalContext: Context)

If you wish to disable the device authentication you can call the following function:

fun disableDeviceAuthentication(originalConte
Last updated: 3/1/24, 10:39:52 AM UTC