OIDCAuthenticator

public class OIDCAuthenticator : Authenticator

Represents openid authentication actions like logout and login.

  • Perform the logoin operation. It will open a browser to the configured login url. If the login is successful, it will save the credential data automatically and invoke the onCompleted function with the logged in user. Otherwise it will invoke the onCompleted callback with an error.

    Declaration

    Swift

    public func authenticate(presentingViewController: UIViewController, onCompleted: @escaping (_ user: User?, _ error: Error?) -> Void)

    Parameters

    presentingViewController

    The view controller from which to present the SafariViewController

    onCompleted

    a block function that will be invoked when the login is completed

    user

    the user returned in the onCompleted callback function. Will be nil if authentication failed

    error

    the error returned in the onCompleted callback function. Will be nil if authentication was successful

  • Resumes the authentication process. This function should be called when a user has finished logging in via the browser and is redirected back to the app that started the login.

    Declaration

    Swift

    public func resumeAuth(url: URL) -> Bool

    Parameters

    url

    The redirect url passed backed from the login process

    Return Value

    true if the authentication can be resumed, false otherwise

  • Perform the logout operation. It will send a HTTP request to the server to invalidate the session for the user. If the request is successful, it will remove the local credential data automatically and invoke the onCompleted function. Otherwise it will invoke the onCompleted callback with an error.

    Declaration

    Swift

    public func logout(currentUser: User, onCompleted: @escaping (_ error: Error?) -> Void)

    Parameters

    currentUser

    the user that should be logged out

    onCompleted

    a block function that will be invoked when the logout is completed.

    error

    the error returned in the onCompleted callback function. The error will be a noIdentityTokenError if there is no identity token for the current user, a network error if there was a network failure. If no error occured the error will be nil.