Class YubiKeyPromptConnectionAction<T extends com.yubico.yubikit.core.YubiKeyConnection>

java.lang.Object
com.yubico.yubikit.android.ui.YubiKeyPromptAction
com.yubico.yubikit.android.ui.YubiKeyPromptConnectionAction<T>
Type Parameters:
T - The connection type to handle

public abstract class YubiKeyPromptConnectionAction<T extends com.yubico.yubikit.core.YubiKeyConnection> extends YubiKeyPromptAction
Action to be performed by a YubiKeyPromptActivity when a YubiKey is attached.

Extend this class to handle an attached YubiKey from a YubiKeyPromptActivity, capable of providing a specific type of connection.

  • Field Summary

    Fields inherited from class com.yubico.yubikit.android.ui.YubiKeyPromptAction

    CONTINUE, RESULT_CONTINUE
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
    protected
    Subclasses need to provide a default (no-arg) constructor which calls this parent constructor.
  • Method Summary

    Modifier and Type
    Method
    Description
    protected void
    onError(Exception exception)
    Overridable method called if opening a connection to a YubiKey throws an error.
    protected abstract com.yubico.yubikit.core.util.Pair<Integer,android.content.Intent>
    onYubiKeyConnection(T connection, android.os.Bundle extras, com.yubico.yubikit.core.application.CommandState commandState)
    Called when a YubiKey supporting the desired connection type is connected.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • YubiKeyPromptConnectionAction

      protected YubiKeyPromptConnectionAction(Class<T> connectionType)
      Subclasses need to provide a default (no-arg) constructor which calls this parent constructor.
      Parameters:
      connectionType - the type of connection used
  • Method Details

    • onYubiKeyConnection

      @WorkerThread protected abstract com.yubico.yubikit.core.util.Pair<Integer,android.content.Intent> onYubiKeyConnection(T connection, android.os.Bundle extras, com.yubico.yubikit.core.application.CommandState commandState)
      Called when a YubiKey supporting the desired connection type is connected.

      Subclasses should override this method to react to a connected YubiKey. Return a value to cause the dialog to finish, returning the Intent to the caller, using the given result code. Return YubiKeyPromptAction.CONTINUE to keep the dialog open to process additional connections. The CommandState can be used to update the dialog UI based on status of the operation, and is cancelled if the user presses the cancel button. NOTE: Subclasses should not close the connection, as it will be closed automatically.

      Parameters:
      connection - A YubiKey connection
      extras - the extras the Activity was called with
      commandState - a CommandState that is hooked up to the activity.
      Returns:
      the result of the operation, as a Pair of result code and Intent with extras, or null
    • onError

      @WorkerThread protected void onError(Exception exception)
      Overridable method called if opening a connection to a YubiKey throws an error.
      Parameters:
      exception - the Exception raised