Swiftpack.co -  Package - INPS-it/SPIDlibraryIOS
Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
INPS-it/SPIDlibraryIOS
SPIDlibraryIOS is a library for logging in via SPID through several different identity providers.
.package(url: "https://github.com/INPS-it/SPIDlibraryIOS.git", from: "1.0.0")

SPIDlibraryIOS

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

Requirements

  • iOS 11.0+
  • Xcode 11+
  • Swift 4+

Usage

  1. Add the following to your Package.swift:
.package(url: "https://github.com/INPS-it/SPIDlibraryIOS", .upToNextMajor(from: "1.0.0"))
  1. Declare import SPIDlibraryIOS in your ViewController.

  2. Implement the SpidDelegate protocol:

public class ViewController: UIViewController, SpidDelegate {

    func loginSuccess(response: SpidResponse) {
        print("Login Success")
    }
    
    func onError(error: SpidError) {
        print("Error")
    }
}
  1. Create a SpidConfig object containing the authPageUrl url, the callbackPageUrl url, the spidPageInfoUrl url, the requestSpidPageUrl url, an optional timeout int value (default value: 30sec), the identityProviderKeys object that contains the identity providers keys and the queryStringParams string:
 let identityProviderKeys = IdentityProviderKeys.init(aruba: Constants.IdentityProvider.aruba,
                                                             infocert: Constants.IdentityProvider.infocert,
                                                             intesa: Constants.IdentityProvider.intesa,
                                                             lepida: Constants.IdentityProvider.lepida,
                                                             namirial: Constants.IdentityProvider.namirial,
                                                             poste: Constants.IdentityProvider.poste,
                                                             sielte: Constants.IdentityProvider.sielte,
                                                             spiditalia: Constants.IdentityProvider.spiditalia,
                                                             tim: Constants.IdentityProvider.tim)
        
let spidConfig = SpidConfig.init(authPageUrl: Constants.authPageUrl, callbackPageUrl: Constants.callbackPageUrl, spidPageInfoUrl: Constants.spidPageInfoUrl, requestSpidPageUrl: Constants.requestSpidPageUrl, identityProviderKeys: identityProviderKeys, queryStringParams: Constants.queryStringParams)
  1. Present the SpidViewController instance:
SpidViewController.present(delegate: self, spidConfig: spidConfig)

License

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

GitHub

link
Stars: 46
Last commit: 1 week ago

Release Notes

First release
1 week ago

First release

Swiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco