Using now NonVisualOrImageBased as default to determine user's (suggested) TAN method as it provides a good default for most users
This commit is contained in:
parent
61d8f2c342
commit
6908f52e48
|
@ -12,16 +12,24 @@ open class TanMethodSelector {
|
|||
|
||||
val ImageBased = listOf(TanMethodType.QrCode, TanMethodType.ChipTanQrCode, TanMethodType.photoTan, TanMethodType.ChipTanPhotoTanMatrixCode)
|
||||
|
||||
/**
|
||||
* NonVisualOrImageBased is a good default for most users as it lists the most simplistic ones (which also work with
|
||||
* the command line) first and then continues with image based TAN methods, which for UI applications are easily to display.
|
||||
*/
|
||||
val NonVisualOrImageBased = buildList {
|
||||
// decoupled TAN method is the most simplistic TAN method, user only has to confirm the action in her TAN app, no manual TAN entering required
|
||||
// AppTan is the second most simplistic TAN method: user has to confirm action in her TAN app and then enter the displayed TAN
|
||||
addAll(listOf(TanMethodType.DecoupledTan, TanMethodType.DecoupledPushTan, TanMethodType.AppTan, TanMethodType.SmsTan, TanMethodType.EnterTan))
|
||||
addAll(ImageBased)
|
||||
addAll(listOf(TanMethodType.ChipTanManuell)) // this is quite inconvenient for user, so i added it as last
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
open fun getSuggestedTanMethod(tanMethods: List<TanMethod>): TanMethod? {
|
||||
return tanMethods.firstOrNull { it.type == TanMethodType.DecoupledPushTan || it.type == TanMethodType.DecoupledTan } // decoupled TAN method is the most simplistic TAN method, user only has to confirm the action in her TAN app, no manual TAN entering required
|
||||
?: tanMethods.firstOrNull { it.type == TanMethodType.AppTan } // that's the second most simplistic TAN method: user has to confirm action in her TAN app and then enter the displayed TAN
|
||||
?: tanMethods.firstOrNull { it.type != TanMethodType.ChipTanUsb && it.type != TanMethodType.SmsTan && it.type != TanMethodType.ChipTanManuell }
|
||||
?: tanMethods.firstOrNull { it.type != TanMethodType.ChipTanUsb && it.type != TanMethodType.SmsTan }
|
||||
?: tanMethods.firstOrNull { it.type != TanMethodType.ChipTanUsb }
|
||||
?: first(tanMethods)
|
||||
return findPreferredTanMethod(tanMethods, NonVisualOrImageBased) // we use NonVisualOrImageBased as it provides a good default for most users
|
||||
?: tanMethods.firstOrNull()
|
||||
}
|
||||
|
||||
open fun findPreferredTanMethod(tanMethods: List<TanMethod>, preferredTanMethods: List<TanMethodType>?): TanMethod? {
|
||||
|
@ -34,42 +42,4 @@ open class TanMethodSelector {
|
|||
return null
|
||||
}
|
||||
|
||||
|
||||
open fun nonVisual(tanMethods: List<TanMethod>): TanMethod? {
|
||||
return findPreferredTanMethod(tanMethods, NonVisual)
|
||||
?: tanMethods.firstOrNull { it.displayName.contains("manuell", true) }
|
||||
}
|
||||
|
||||
open fun nonVisualOrFirst(tanMethods: List<TanMethod>): TanMethod? {
|
||||
return nonVisual(tanMethods)
|
||||
?: first(tanMethods)
|
||||
}
|
||||
|
||||
|
||||
open fun imageBased(tanMethods: List<TanMethod>): TanMethod? {
|
||||
return findPreferredTanMethod(tanMethods, ImageBased)
|
||||
}
|
||||
|
||||
open fun imageBasedOrFirst(tanMethods: List<TanMethod>): TanMethod? {
|
||||
return imageBased(tanMethods)
|
||||
?: first(tanMethods)
|
||||
}
|
||||
|
||||
|
||||
open fun nonVisualOrImageBased(tanMethods: List<TanMethod>): TanMethod? {
|
||||
return nonVisual(tanMethods)
|
||||
?: imageBased(tanMethods)
|
||||
}
|
||||
|
||||
open fun nonVisualOrImageBasedOrFirst(tanMethods: List<TanMethod>): TanMethod? {
|
||||
return nonVisual(tanMethods)
|
||||
?: imageBased(tanMethods)
|
||||
?: first(tanMethods)
|
||||
}
|
||||
|
||||
|
||||
open fun first(tanMethods: List<TanMethod>): TanMethod? {
|
||||
return tanMethods.firstOrNull()
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue