Class AuthenticationOptions

java.lang.Object
com.codename1.security.AuthenticationOptions

public final class AuthenticationOptions extends Object

Configures a single call to Biometrics.authenticate(AuthenticationOptions). Setters return this for fluent chaining; only setReason(String) is required (it maps to the iOS localizedReason and the Android BiometricPrompt title fallback).

Not every option is honoured on every platform -- the docs on each setter note where the value is consulted. Unrecognised options are silently ignored, so callers can set the union without platform-checking. On platforms that don't support biometrics at all (desktop deploy, JavaScript), the entire prompt collapses into a BiometricError.NOT_AVAILABLE failure and none of these options matter.

  • Constructor Details

    • AuthenticationOptions

      public AuthenticationOptions()
  • Method Details

    • getReason

      public String getReason()
      The current prompt reason, or null if unset. See setReason(String) for how it is rendered.
    • setReason

      public AuthenticationOptions setReason(String reason)
      The user-facing reason for prompting. On iOS this is the localizedReason passed to LAContext.evaluatePolicy; on Android it is used as the BiometricPrompt title if setTitle(String) is unset. On JavaSE simulator it is shown in the modal prompt body. Required for production use -- platforms typically reject an empty reason.
    • getTitle

      public String getTitle()
      The current Android BiometricPrompt title, or null to fall back to getReason(). Always null on iOS where this property has no effect.
    • setTitle

      public AuthenticationOptions setTitle(String title)
      Android BiometricPrompt title. Ignored on iOS (use setReason(String) there). Ignored on the fallback base class.
    • getSubtitle

      public String getSubtitle()
      The current Android BiometricPrompt subtitle, or null if unset. Always null on iOS where this property has no effect.
    • setSubtitle

      public AuthenticationOptions setSubtitle(String subtitle)
      Android BiometricPrompt subtitle. Ignored on iOS and on the fallback base class.
    • getDescription

      public String getDescription()
      The current Android BiometricPrompt description body, or null if unset. Always null on iOS where this property has no effect.
    • setDescription

      public AuthenticationOptions setDescription(String description)
      Android BiometricPrompt description body. Ignored on iOS and on the fallback base class.
    • getNegativeButtonText

      public String getNegativeButtonText()
      The current Android BiometricPrompt negative button label. Defaults to "Cancel". Ignored on iOS (Apple's prompt has its own system-defined cancel button).
    • setNegativeButtonText

      public AuthenticationOptions setNegativeButtonText(String text)
      Android BiometricPrompt negative button label (defaults to "Cancel"). Ignored on iOS and on the fallback base class.
    • isBiometricOnly

      public boolean isBiometricOnly()
      true when the OS prompt is configured to reject device-credential fallback. See setBiometricOnly(boolean).
    • setBiometricOnly

      public AuthenticationOptions setBiometricOnly(boolean biometricOnly)
      If true, the OS prompt rejects device-credential fallback (PIN / pattern / passcode). Honoured on both platforms; on Android this maps to setAllowedAuthenticators(BIOMETRIC_STRONG) or its legacy equivalent. Ignored on the fallback base class.
    • isSensitiveTransaction

      public boolean isSensitiveTransaction()
      true when the caller has asked for a class-3 ("strong") biometric. See setSensitiveTransaction(boolean).
    • setSensitiveTransaction

      public AuthenticationOptions setSensitiveTransaction(boolean sensitive)
      Hints that the operation guards a sensitive action and a class-3 ("strong") biometric should be required where the platform exposes the distinction. Affects Android API 30+; advisory on iOS (where Face ID / Touch ID are both considered strong). Ignored on the fallback base class.
    • isStickyAuth

      public boolean isStickyAuth()
      true when the Android sticky-auth flag is set. See setStickyAuth(boolean).
    • setStickyAuth

      public AuthenticationOptions setStickyAuth(boolean stickyAuth)
      If true, the in-progress authentication survives the app being backgrounded and resumes on foreground (Android sticky-auth semantics). No effect on iOS or on the fallback base class.
    • isShowDialogOnAndroid

      public boolean isShowDialogOnAndroid()
      true (the default) when Codename One should overlay its own dialog on the legacy Android FingerprintManager path. See setShowDialogOnAndroid(boolean).
    • setShowDialogOnAndroid

      public AuthenticationOptions setShowDialogOnAndroid(boolean show)
      Controls whether the legacy FingerprintManager path (Android 6-9) draws a Codename One Dialog over the system prompt. The modern BiometricPrompt path (Android 10+) provides its own UI and ignores this flag. Ignored on iOS and on the fallback base class.