IDPClient

public protocol IDPClient

Identity Provider protocol that should be implemented according to ‘gemSpec_IDP_Dienst’.

  • Load the DiscoveryDocument for the IDPClient

    Declaration

    Swift

    func loadDiscoveryDocument() -> AnyPublisher<DiscoveryDocument, IDPError>

    Return Value

    a stream that emits once either a DiscoveryDocument or IDPError.

  • Request a challenge from the IDP for a specific scope

    Note

    for more info check out ‘gemSpec_IDP_Dienst#3.7’

    Declaration

    Swift

    func requestChallenge( // swiftlint:disable:this function_parameter_count
        codeChallenge: String,
        method: IDPCodeChallengeMode,
        state: String,
        nonce: String,
        using document: DiscoveryDocument,
        redirect: String?
    ) -> AnyPublisher<IDPChallenge, IDPError>

    Parameters

    codeChallenge

    SHA256 hashed verifier code, see exchange(token:).

    method

    codeChallenge hashing method. Must be S256 to indicate SHA256 hashed value.

    state

    OAuth parameter state of high entropy.

    nonce

    OpenID parameter nonce of high entropy.

    document

    use this DiscoveryDocument to resolve the actual endpoint and verify the response(s) [when applicable]

    redirect

    Overwrite the common redirect. Used for ExtAuth where the redirect differs from normal IDP usage.

    Return Value

    response with user content statement and signing challenge

  • Verify a given challenge with the IDP

    Declaration

    Swift

    func verify(
        _ signedChallenge: JWE,
        using document: DiscoveryDocument
    ) -> AnyPublisher<IDPExchangeToken, IDPError>

    Parameters

    signedChallenge

    Encrypted challenge that has been signed with the egk

    document

    Use this DiscoveryDocument to resolve the actual endpoints

    Return Value

    exchange token upon success

  • Refreshes the authentication with a given SSO token. The SSO token must be retrieved by a priorverify and exchange.

    Declaration

    Swift

    func refresh(with unsignedChallenge: IDPChallenge,
                 ssoToken: String,
                 using document: DiscoveryDocument,
                 for redirect: String) -> AnyPublisher<IDPExchangeToken, IDPError>

    Parameters

    unsigned

    The unsigned IDP-Challenge. Generate a new challenge for each sso refresh by using requestChallenge.

    sso

    The SSO token from a prior successful login via verify and exchange.

    document

    The discovery document to use.

    redirect

    The redirect that the refresh is requested for. Must match the initial SSO token redirect.

  • Exchange a token for an actual token

    Declaration

    Swift

    func exchange(token: IDPExchangeToken,
                  verifier: String,
                  redirectURI: String?,
                  encryptedKeyVerifier: JWE,
                  using document: DiscoveryDocument) -> AnyPublisher<TokenPayload, IDPError>

    Parameters

    token

    exchange token

    verifier

    initial verifier generated upon requesting the challenge. Must be at least 43 * 128-bit unreserved characters long. See https://tools.ietf.org/html/rfc7636#section-4.2

    redirectURI

    redirect_uri to use for the backend call.

    encryptedKeyVerifier

    encrypted symmetric key together with the verifier

    document

    use this DiscoveryDocument to resolve the actual endpoint

    Return Value

    the authenticated token

  • Register a new biometric key for alternative authentication.

    Declaration

    Swift

    func registerDevice(_ jwe: JWE,
                        token: IDPToken,
                        using document: DiscoveryDocument)
        -> AnyPublisher<PairingEntry, IDPError>

    Parameters

    jwe

    JWE encrypting the PairingRegistration of the key to register.

    token

    Access token for authentication and authorization for the new key.

    document

    use this DiscoveryDocument to resolve the actual endpoint

    Return Value

    AnyPublisher with aPairingEntry containing registration information upon success.

  • Unregisters a key of the device with the given identifier.

    Declaration

    Swift

    func unregisterDevice(_ keyIdentifier: String,
                          token: IDPToken,
                          using document: DiscoveryDocument) -> AnyPublisher<Bool, IDPError>

    Parameters

    keyIdentifier

    Identifier of the key to remove.

    token

    Authentication token to authenticate the removal.

    document

    use this DiscoveryDocument to resolve the actual endpoint

    Return Value

    AnyPublisher with aBool containing true upon success, false otherwise.

  • List all registered devices.

    Declaration

    Swift

    func listDevices(token: IDPToken, using document: DiscoveryDocument) -> AnyPublisher<PairingEntries, IDPError>

    Parameters

    token

    Authentication token to authenticate the removal.

    document

    use this DiscoveryDocument to resolve the actual endpoint

    Return Value

    AnyPublisher with aPairingEntries containing all registered devices.

  • Verify a given challenge with the IDP using alternative authentication, a.k.a. biometric secured key.

    Declaration

    Swift

    func altVerify(_ encryptedSignedChallenge: JWE,
                   using document: DiscoveryDocument)
        -> AnyPublisher<IDPExchangeToken, IDPError>

    Parameters

    encryptedSignedChallenge

    JWE encrypting a SignedAuthenticationChallenge.

    document

    Use this DiscoveryDocument to resolve the actual endpoints and

    Return Value

    exchange token upon success

  • Load available Insurance companies that are capable of External Authentication (gID).

    Declaration

    Swift

    func loadDirectoryKKApps(using document: DiscoveryDocument) -> AnyPublisher<IDPDirectoryKKApps, IDPError>

    Parameters

    document

    The DiscoveryDocument to resolve the actual endpoint.

  • Initial step for external authentication with insurance company app.

    Declaration

    Swift

    func startExtAuth(_ app: IDPExtAuth, using document: DiscoveryDocument) -> AnyPublisher<URL, IDPError>

    Parameters

    app

    The reference to an insurance company app to user for the authentication.

    document

    The DiscoveryDocument to resolve the actual endpoint.

  • Follow up step whenever an insurance company app authorizes a user login.

    Declaration

    Swift

    func extAuthVerify(_ verify: IDPExtAuthVerify, using document: DiscoveryDocument)
        -> AnyPublisher<IDPExchangeToken, IDPError>

    Parameters

    verify

    Data used to authenticate and authorize the user.

    document

    The DiscoveryDocument to resolve the actual endpoint.