Package com.yubico.yubikit.android.ui
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
ConstructorsModifierConstructorDescriptionprotected
YubiKeyPromptConnectionAction
(Class<T> connectionType) Subclasses need to provide a default (no-arg) constructor which calls this parent constructor. -
Method Summary
Modifier and TypeMethodDescriptionprotected void
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.
-
Constructor Details
-
YubiKeyPromptConnectionAction
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 connectionextras
- the extras the Activity was called withcommandState
- 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
Overridable method called if opening a connection to a YubiKey throws an error.- Parameters:
exception
- the Exception raised
-