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
presentingViewControllerThe view controller from which to present the SafariViewController
onCompleteda block function that will be invoked when the login is completed
userthe user returned in the
onCompletedcallback function. Will be nil if authentication failederrorthe error returned in the
onCompletedcallback 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) -> BoolParameters
urlThe 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
currentUserthe user that should be logged out
onCompleteda block function that will be invoked when the logout is completed.
errorthe error returned in the
onCompletedcallback function. The error will be anoIdentityTokenErrorif 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.
OIDCAuthenticator Class Reference