ProvideCredentialsAuthenticationHandlerDelegate

public protocol ProvideCredentialsAuthenticationHandlerDelegate : class

Authentication handlers that rely on external user interaction to provide authentication credentials will support this delegate to gather the user’s credentials, and alert the user if those credentials are not valid.

  • Implementation Required

    Will be called when/if during the authentication process the manager requires the user’s username and password.

    Implementers will complete this flow by calling the AuthenticationCredentialsProvider completionHandler with the appropriate credentials.

    • Example:

      func provideAuthenticationCredentials(_ authenticationHandler: AuthenticationHandler, provideCredentialsWithCompletionHandler completionHandler: @escaping AuthenticationCredentialsProvider) {
         // UI interaction to get user's credentials, perhaps validating them according to business rules
         let username =  usernameTextField.text ?? ""
         let password = passwordTextField.text ?? ""
      
         completionHandler(username, password)
      }
      

    Declaration

    Swift

    func authenticationHandler(_ authenticationHandler: AuthenticationHandler, provideCredentialsWithCompletionHandler completionHandler: @escaping AuthenticationCredentialsProvider)

    Parameters

    authenticationHandler

    the AuthenticationHandler associated with this delegate

    completionHandler

    AuthenticationCredentialsProvider to invoke when user’s username and password have been gathered.

  • Implementation Optional

    When credentials have been provided via calling the completionHandler on provideAuthenticationCredentials(completionHandler: ), if the credentials are invalid, this method will be called just before provideAuthenticationCredentials(completionHandler: ) is called again.

    This method can be used to prompt users to re-enter their credentials, or keep track of the number of times a user has input invalid credentials.

    Default Implementation

    If no implementation is provided, there is no behavior.

    Declaration

    Swift

    func authenticationHandlerProvidedCredentialsWereInvalid(_ authenticationHandler: AuthenticationHandler)

    Parameters

    authenticationHandler

    the AuthenticationHandler associated with this delegate