From: Sebastian Raß <43568284+sebira@users.noreply.github.com> Date: Tue, 7 Jan 2025 16:05:47 +0000 (+0100) Subject: Pin ING to one step authentication (#182) X-Git-Tag: v4.2.4~4 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=28251f07d857d6ef1849e1d27b1da847db1a8138;p=thirdparty%2Fpython-fints.git Pin ING to one step authentication (#182) --- diff --git a/fints/client.py b/fints/client.py index 13400eb..3fcb3b7 100644 --- a/fints/client.py +++ b/fints/client.py @@ -51,6 +51,10 @@ SYSTEM_ID_UNASSIGNED = '0' DATA_BLOB_MAGIC = b'python-fints_DATABLOB' DATA_BLOB_MAGIC_RETRY = b'python-fints_RETRY_DATABLOB' +# workaround for ING not offering PSD2 conform two step authentication +# ING only accepts one step authentication and only allows reading operations +ING_BANK_IDENTIFIER = BankIdentifier(country_identifier='280', bank_code='50010517') + class FinTSOperations(Enum): """This enum is used as keys in the 'supported_operations' member of the get_information() response. @@ -1257,6 +1261,8 @@ class FinTS3PinTanClient(FinTS3Client): return data def is_tan_media_required(self): + if self.bank_identifier == ING_BANK_IDENTIFIER: + return False tan_mechanism = self.get_tan_mechanisms()[self.get_current_tan_mechanism()] return getattr(tan_mechanism, 'supported_media_number', None) is not None and \ tan_mechanism.supported_media_number > 1 and \ @@ -1379,7 +1385,7 @@ class FinTS3PinTanClient(FinTS3Client): return resume_func(challenge.command_seg, response) def _process_response(self, dialog, segment, response): - if response.code == '3920': + if response.code == '3920' and not self.bank_identifier == ING_BANK_IDENTIFIER: self.allowed_security_functions = list(response.parameters) if self.selected_security_function is None or not self.selected_security_function in self.allowed_security_functions: # Select the first available twostep security_function that we support diff --git a/fints/formals.py b/fints/formals.py index 313a839..877c0be 100644 --- a/fints/formals.py +++ b/fints/formals.py @@ -160,6 +160,12 @@ class BankIdentifier(DataElementGroup): country_identifier = DataElementField(type='ctr') bank_code = DataElementField(type='an', max_length=30) + def __eq__(self, other): + if not isinstance(other, BankIdentifier): + return NotImplemented + + return self.country_identifier == other.country_identifier and self.bank_code == other.bank_code + @doc_enum class KeyType(RepresentableEnum):