SPIDlibraryAndroid is a library for logging in via SPID through several different identity providers.

Related tags

SPIDlibraryAndroid
Overview

SPIDlibraryAndroid

SPIDlibraryAndroid is a library for logging in via SPID through several different identity providers.

Requirements

  • Android 4.4+

Usage

  1. Add dependency to your project:
repositories {
   maven {
       url = "https://maven.pkg.github.com/INPS-it/SPIDlibraryAndroid"
       credentials {
           username = GITHUB_USER
           password = GITHUB_TOKEN
       }
   }
}
dependencies {
    implementation("it.inps.spid:library:1.0.3")
}
  1. Declare a variable to register the IdentityProviderSelectorActivityContract contract using the registerForActivityResult(I) method which will give a SpidResult object as a return value:
private val startSpidFlow = registerForActivityResult(IdentityProviderSelectorActivityContract()) { spidResult ->
    when (spidResult.spidEvent) {
        SpidEvent.GENERIC_ERROR -> { /* TODO */ }
        SpidEvent.NETWORK_ERROR -> { /* TODO */ }
        SpidEvent.SESSION_TIMEOUT -> { /* TODO */ }
        SpidEvent.SPID_CONFIG_ERROR -> { /* TODO */ }
        SpidEvent.SUCCESS -> { /* spidResult.spidReponse available */ }
        SpidEvent.USER_CANCELLED -> { /* TODO */ }
    }
}

The SpidResult object consists of a SpidEvent object and an optional SpidResponse object. The SpidResponse object is only available in case of successful login.

  1. Create a SpidParams.Config object containing the authPageUrl url, the callbackPageUrl url and an optional timeout int value (default value: 30sec):
", // TODO "https://", // TODO 60 ) ">
val spidConfig = SpidParams.Config(
                    "https://", // TODO
                    "https://", // TODO
                    60
    )
  1. Use the IdentityProvider.Builder() builder to add the identity providers:
") .addPoste(idpParameter = "") .addTim(idpParameter = "") .addCustomIdentityProvider( "CUSTOM IDENTITY PROVIDER", R.drawable.ic_spid_idp_custom, "" ) // TODO .build() ">
val idpList = IdentityProvider.Builder()
                   .addAruba(idpParameter = "")
                   .addPoste(idpParameter = "")
                   .addTim(idpParameter = "")
                   .addCustomIdentityProvider(
                           "CUSTOM IDENTITY PROVIDER",
                           R.drawable.ic_spid_idp_custom,
                           ""
                   )
                   // TODO
                   .build()
  1. Create a SpidParams object using the spidConfig and idpList objects and call the ActivityResultLauncher.launch(I) method:
startSpidFlow.launch(SpidParams(spidConfig, idpList))

License

SPIDlibraryAndroid is released under the BSD 3-Clause License. See LICENSE for details.

Issues
  • Simplified SpidParams.kt

    Simplified SpidParams.kt

    Simplified SpidParams.kt and add a test in SpidConfigText.kt for mixcase url test

    opened by matteobaccan 0
Owner
INPS
Istituto Nazionale della Previdenza Sociale
INPS
A helper library to ease the most repetitive codes with simple reusable attributes.

ak-universal-android-helper A helper library to ease the most repetitive codes with simple reusable attributes. AKUAH can help you with many repetitiv

Aakash Kumar 20 Jul 7, 2020
Trail is a simple logging system for Java and Android. Create logs using the same API and the library will detect automatically in which platform the code is running.

Trail Trail is a simple logging system for Java and Android. Create logs using the same API and the library will detect automatically in which platfor

Mauricio Togneri 13 Apr 8, 2019
A robust native library loader for Android.

ReLinker A robust native library loader for Android. More information can be found in our blog post Min SDK: 9 JavaDoc Overview The Android PackageMan

Keepsafe 2.5k Aug 2, 2021
A logger with a small, extensible API which provides utility on top of Android's normal Log class.

This is a logger with a small, extensible API which provides utility on top of Android's normal Log class. I copy this class into all the little apps

Jake Wharton 9.1k Jul 28, 2021
Predictable state container for JavaScript apps

Redux is a predictable state container for JavaScript apps. (Not to be confused with a WordPress framework – Redux Framework) It helps you write appli

Redux 56.4k Aug 4, 2021
High level parsing to ensure your input is in the right shape and satisfies all constraints that business logic requires.

Parsix High level parsing to ensure your input is in the right shape and satisfies all constraints that business logic requires. It is highly inspired

null 179 Jul 18, 2021
It's finally easy to take photos/videos via camera or get photos/videos from gallery on Android.

Shutter-Android It's finally easy to take photos/videos via camera or get photos/videos from gallery on Android. What is Shutter? Shutter is an Androi

Levi Bostian 53 Jun 16, 2021
Error handling library for Android and Java

ErrorHandler Error handling library for Android and Java Encapsulate error handling logic into objects that adhere to configurable defaults. Then pass

null 244 Sep 2, 2020
UPnP/DLNA library for Java and Android

Cling EOL: This project is no longer actively maintained, code may be outdated. If you are interested in maintaining and developing this project, comm

4th Line 1.4k Aug 2, 2021
Kotlin matrix class which supports determinant, inverse matrix, matmul, etc.

Kotrix is a set of classes that helps people dealing with linear algebra in Kotlin.

Kanguk Lee 3 Jul 30, 2021
a SharedPreferences replacement for Android with multiprocess support

DEPRECATED - no longer actively maintained Tray - a SharedPreferences replacement for Android If you have read the documentation of the SharedPreferen

HCI @ gcx 2.3k Jul 19, 2021
A beautiful set of predefined colors and a set of color methods to make your Android development life easier.

Colours is a port of the Colours Library for iOS made by my good friend Ben Gordon. You can find that project here. Installation Maven Central Colours

Matthew York 635 Jul 22, 2021
Convert OkHttp requests into curl logs.

Ok2Curl Convert OkHttp requests into curl logs. Usage Add library to project dependencies. Library is hosted on jcenter. repositories { jcenter()

Michal Moczulski 310 Jul 25, 2021
Expirable Disk Lru Cache is a secure(with encryption) wrapper for [DiskLruCache](https://github.com/JakeWharton/DiskLruCache) that allows expiring of key/value pairs by specifying evictionTimeSpan. It has very simple API.

ExpirableDiskLruCache ExpirableDiskLruCache is a wrapper for DiskLruCache that allows expiring of key/value pairs by specifying evictionTimeSpan. It h

Vijay Rawat 23 Jul 4, 2018