Skip to content

Custom authenticator

Keval Patel edited this page Apr 15, 2018 · 5 revisions

How to create custom authenticator?

  • PasscodeView supports custom authentication methods for authenticating the user using PIN or pattern.
  • An application can provide their own PIN or pattern authentication algorithms and hook it into the PinView or PatternView.
  • In another case, the application can create authenticator to send PIN/Pattern entered by the user to the server for the authentication.

Custom pin authentication:

  • Implement PinAuthenticator to the custom authenticator class.
  • Implement isValidPin() method with your custom authentication logic. This method will be run in the background thread.
  • isValidPin() can provide three different outputs based on the authentication status.
    • PinAuthenticationState.NEED_MORE_DIGIT - If the PIN is incomplete. PinView will let the user enter another digit. For the dynamic PIN size, this method will let authenticator decide the correct PIN size.
    • PinAuthenticationState.SUCCESS - This indicates that the user authentication completed and the user is authenticated.
    • PinAuthenticationState.FAIL - This indicates that the user authentication completed. But the user is not authorized.
Sample:

Custom pattern authentication:

  • Implement PatternAuthenticator to the custom authenticator class.
  • Implement isValidPattern() method with your custom authentication logic. This method will be run in the background thread.
  • isValidPattern() will return boolean.
    • True indicates that the user is authenticated successfully.
    • False indicates that authentication process completed and the user is not authorized.
Sample: