SPIDlibraryIOS is a library for logging in via SPID through several different identity providers.
- iOS 11.0+
- Xcode 11+
- Swift 4+
- Add the following to your Package.swift:
.package(url: "https://github.com/INPS-it/SPIDlibraryIOS", .upToNextMajor(from: "1.0.8"))
-
Declare
import SPIDlibraryIOS
in your ViewController. -
Implement the
SpidDelegate
protocol:
public class ViewController: UIViewController, SpidDelegate {
func loginSuccess(response: SpidResponse) {
print("Login Success")
}
func onError(error: SpidError) {
print("Error")
}
}
- Create a
SpidConfig
object containing theauthPageUrl
url, thecallbackPageUrl
url, thespidPageInfoUrl
url, therequestSpidPageUrl
url, an optional timeoutint
value (default value: 30sec), theidentityProviderKeys
object that contains the identity providers keys and thequeryStringParams
string:
let identityProviderKeys = IdentityProviderKeys.init(aruba: Constants.IdentityProvider.aruba,
etna: Constants.IdentityProvider.etna,
infocamere: Constants.IdentityProvider.infocamere,
infocert: Constants.IdentityProvider.infocert,
lepida: Constants.IdentityProvider.lepida,
namirial: Constants.IdentityProvider.namirial,
poste: Constants.IdentityProvider.poste,
sielte: Constants.IdentityProvider.sielte,
spiditalia: Constants.IdentityProvider.spiditalia,
teamsystem: Constants.IdentityProvider.teamsystem,
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)
- Present the
SpidViewController
instance:
SpidViewController.present(delegate: self, spidConfig: spidConfig)
SPIDlibraryIOS is released under the BSD 3-Clause License See LICENSE for details.