Skip to content

Commit 28251f0

Browse files
authored
Pin ING to one step authentication (#182)
1 parent 7a00dbb commit 28251f0

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

fints/client.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,10 @@
5151
DATA_BLOB_MAGIC = b'python-fints_DATABLOB'
5252
DATA_BLOB_MAGIC_RETRY = b'python-fints_RETRY_DATABLOB'
5353

54+
# workaround for ING not offering PSD2 conform two step authentication
55+
# ING only accepts one step authentication and only allows reading operations
56+
ING_BANK_IDENTIFIER = BankIdentifier(country_identifier='280', bank_code='50010517')
57+
5458

5559
class FinTSOperations(Enum):
5660
"""This enum is used as keys in the 'supported_operations' member of the get_information() response.
@@ -1257,6 +1261,8 @@ def _deconstruct_v1(self, including_private=False):
12571261
return data
12581262

12591263
def is_tan_media_required(self):
1264+
if self.bank_identifier == ING_BANK_IDENTIFIER:
1265+
return False
12601266
tan_mechanism = self.get_tan_mechanisms()[self.get_current_tan_mechanism()]
12611267
return getattr(tan_mechanism, 'supported_media_number', None) is not None and \
12621268
tan_mechanism.supported_media_number > 1 and \
@@ -1379,7 +1385,7 @@ def send_tan(self, challenge: NeedTANResponse, tan: str):
13791385
return resume_func(challenge.command_seg, response)
13801386

13811387
def _process_response(self, dialog, segment, response):
1382-
if response.code == '3920':
1388+
if response.code == '3920' and not self.bank_identifier == ING_BANK_IDENTIFIER:
13831389
self.allowed_security_functions = list(response.parameters)
13841390
if self.selected_security_function is None or not self.selected_security_function in self.allowed_security_functions:
13851391
# Select the first available twostep security_function that we support

fints/formals.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,12 @@ class BankIdentifier(DataElementGroup):
160160
country_identifier = DataElementField(type='ctr')
161161
bank_code = DataElementField(type='an', max_length=30)
162162

163+
def __eq__(self, other):
164+
if not isinstance(other, BankIdentifier):
165+
return NotImplemented
166+
167+
return self.country_identifier == other.country_identifier and self.bank_code == other.bank_code
168+
163169

164170
@doc_enum
165171
class KeyType(RepresentableEnum):

0 commit comments

Comments
 (0)