Skip to content

Inbuilt authenticator

Keval Patel edited this page Apr 15, 2018 · 2 revisions
  • PasscodeView provides two inbuilt authenticators. One for PIN authentication and another for pattern authentication.
    • PasscodeViewPinAuthenticator
    • PasscodeViewPatternAuthenticator

PasscodeViewPinAuthenticator

  • PasscodeViewPinAuthenticator matches each digit into the PIN entered by the user with the correct PIN provided by the application.
  • If both the PIN has same digits in same order, it will mark authentication as successful or else mark it as failed.
  • You can hook PasscodeViewPinAuthenticator with PinView as follow:
      final int[] correctPin = new int[]{1, 2, 3,4};
    
      //Create authenticator with above correct PIN
      final PasscodeViewPinAuthenticator authenticator = new PasscodeViewPinAuthenticator(correctPin)
      pinView.setPinAuthenticator(authenticator);

PasscodeViewPatternAuthenticator

  • PasscodeViewPatternAuthenticator matches each PatternPoint draw by the user with the correct PatternPoint provided by the application.
  • If both the PatternPoint has same row and column numbers in same order, it will mark authentication as successful or else mark it as failed.
  • You can hook PasscodeViewPatternAuthenticator with PatternView as follow:
      final PatternPoint[] correctPattern = new PatternPoint[]{
              new PatternPoint(0, 0),
              new PatternPoint(1, 0),
              new PatternPoint(2, 0),
              new PatternPoint(2, 1)
      };
    
      //Create authenticator with above correct pattern
      final PasscodeViewPatternAuthenticator authenticator = new PasscodeViewPatternAuthenticator(correctPattern)
      patternView.setAuthenticator(authenticator);