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

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.

You might also like...
A support library for VectorDrawable and AnimatedVectorDrawable classes introduced in Lollipop

vector-compat A support library for VectorDrawable and AnimatedVectorDrawable introduced in Lollipop with fully backwards compatible tint support (api

Android library for viewing, editing and sharing in app databases.
Android library for viewing, editing and sharing in app databases.

DbInspector DbInspector provides a simple way to view the contents of the in-app database for debugging purposes. There is no need to pull the databas

Android Market In-app Billing Library

Update In-app Billing v2 API is deprecated and will be shut down in January 2015. This library was developed for v2 a long time ago. If your app is st

An Android library allowing images to exhibit a parallax effect that reacts to the device's tilt
An Android library allowing images to exhibit a parallax effect that reacts to the device's tilt

Motion An Android library allowing images to exhibit a parallax effect. By replacing static pictures and backgrounds with a fluid images that reacts t

Android library to easily serialize and cache your objects to disk using key/value pairs.

Deprecated This project is no longer maintained. No new issues or pull requests will be accepted. You can still use the source or fork the project to

Form Validator Library for Android

Android-Validator Form Validator Library for Android [](https://flattr.com/submit/auto?user_id=throrin19&url=https://github.com/throrin19/Android-Vali

A simple library for validating user input in forms using annotations.
A simple library for validating user input in forms using annotations.

ValidationKomensky for Android A simple library for validating user input in forms using annotations. Features: Validate all views at once and show fe

Very easy to use wrapper library for Android SharePreferences

Treasure English document Treasure是一个Android平台上基于SharePreferences的偏好存储库,只需要定义接口,无需编写实现,默认支持Serializable和Parcelable。运行时0反射,不仅使用方便而且性能和原生写法几乎无差别。 使用方法 1

A small library which will save you from writing the same intent creation code again and again for the most simple tasks

Android Intents A small library which will save you from writing the same intent creation code again and again for the most simple tasks. I found myse

Comments
  • Tema dell'app deve discendere da Material Component

    Tema dell'app deve discendere da Material Component

    Buongiorno a tutti, implementando la libreria all'interno della mia app, ad un certo punto mi richiede che la mia app abbia il tema Material Component o essere parent di tale tema. Vorrei sapere se è possibilie eliminare questa condizione, perchè ovviamente la mia app è già sviluppata con un tema suo Grazie.

    opened by GIovaB6 0
  • Generic Error

    Generic Error

    Buongiorno a tutti. Io ho integrato la libreria in Android e l'ho richiamata utilizzando Java. Il problema che sto riscontrando è che al momento che clicco su un qualsiasi IdentityProvider, non si apre la Webview e ricevo direttamente GENERIC_ERROR. "D/MainActivity: onActivityResult: GENERIC ERROR SpidResult(spidEvent=GENERIC_ERROR, spidResponse=null)" Essendo un errore molto vago non so dove possa essere il problema. Avete avuto esperienze simili ?

    opened by GIovaB6 1
  • Configuration parameters

    Configuration parameters

    Buongiorno a tutti, stiamo appunto cercando di integrare in un’app android questo SDK per autenticarsi tramite SPID. Ho inserito l’SDK nella nostra app e sono riuscita ad avviare la procedura di autenticazione, che però termina con un errore di tipo SPID_CONFIG_ERROR. Questo è sicuramente dovuto al fatto che dal materiale che finora sono riuscita a reperire non mi è chiaro come impostare i due URL richiesti nella configurazione di base come da codice sottostante.

    val spidConfig = SpidParams.Config(
              "https://<insert the auth url here>", // TODO
              "https://<insert the callback url here>", // TODO
              60 )
    

    Non mi è chiaro esattamente quale dato vada inserito qui, immagino siano quelli appunto per effettivamente gestire la richiesta/risposta di autenticazione, ma non è chiaro come eventualmente ottenere o configurare questi URL o se ve ne sono alcuni di test da poter utilizzare.

    Ringrazio tutti anticipatamente. Eleonora

    opened by C51-MobileApps 3
  • SPIDlibrary Flutter

    SPIDlibrary Flutter

    Visto che c'e' la libreria sia per iOS che per Android sarebbe utile una libreria scritta in Dart che include i due pacchetti iOS e Android tramite MethodChannel oppure proprio una implementazione completa, considerata anche la possibilita' di includere un pacchetto flutter nello sviluppo di altre app.

    opened by FrancescoPenasa 1
Owner
INPS
Istituto Nazionale della Previdenza Sociale
INPS
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 Aug 29, 2022
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 56 Oct 3, 2022
Migrating from one PostgreSQL to another via S3

Migrating from one PostgreSQL to another via S3 In one terminal start initial setup. ./gradlew buildDockerImage docker-compose up --build dbmig-s3 dbm

Stefan Bissell 1 May 19, 2022
LearningRegex - Parse links from text via RegEx

Parse links from text via RegEx Supported types: Hashtags Urls emails Using in p

Boris 0 Feb 16, 2022
Mi-FreeForm - An APP that is activated through Shizuku/Sui and can display most apps in the form of freeform

Mi-FreeForm 简体中文 Mi-FreeForm is an APP that is activated through Shizuku/Sui and

KindBrive 181 Dec 31, 2022
Android library which makes it easy to handle the different obstacles while calling an API (Web Service) in Android App.

API Calling Flow API Calling Flow is a Android library which can help you to simplify handling different conditions while calling an API (Web Service)

Rohit Surwase 19 Nov 9, 2021
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.9k Dec 27, 2022
Joda-Time library with Android specialization

joda-time-android This library is a version of Joda-Time built with Android in mind. Why Joda-Time? Android has built-in date and time handling - why

Daniel Lew 2.6k Dec 9, 2022
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.6k Jan 4, 2023
:iphone: [Android Library] Get device information in a super easy way.

EasyDeviceInfo Android library to get device information in a super easy way. The library is built for simplicity and approachability. It not only eli

Nishant Srivastava 1.7k Dec 22, 2022