Interface TwoFactorAuthenticationCallback


public interface TwoFactorAuthenticationCallback
Login callback for implementing two factor authentication during login.
  • Method Details

    • selectMethod

      int selectMethod(List<String> methods)
      Select two-factor authentication method.
      Parameters:
      methods - list of available two-factor authentication methods
      Returns:
      index of selected method or -1 to cancel login procedure
    • getUserResponse

      String getUserResponse(String challenge, String qrLabel, boolean trustedDevicesAllowed)
      Get user response with selected authentication method. This method will receive non-null qrLabel if there is text to be displayed to user as QR code. Usually this indicates that new secret was generated for selected authentication method and should be presented to user.
      Parameters:
      challenge - optional challenge text (could be null)
      qrLabel - text to be displayed as QR code for scan (could be null)
      trustedDevicesAllowed - true if trusted devices are allowed by the server
      Returns:
      user's response
    • saveTrustedDeviceToken

      void saveTrustedDeviceToken(long serverId, String username, byte[] token)
      Save trusted device token.
      Parameters:
      serverId - server ID
      username - user name for which token should be provided
      token - trusted device token sent by server
    • getTrustedDeviceToken

      byte[] getTrustedDeviceToken(long serverId, String username)
      Get trusted device token to be provided to the server.
      Parameters:
      serverId - server ID
      username - user name for which token should be provided
      Returns:
      trusted device token to provide to the server or null