Skip to content

Commit

Permalink
Pin ING to one step authentication (#182)
Browse files Browse the repository at this point in the history
  • Loading branch information
sebira authored Jan 7, 2025
1 parent 7a00dbb commit 28251f0
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
8 changes: 7 additions & 1 deletion fints/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,10 @@
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.
Expand Down Expand Up @@ -1257,6 +1261,8 @@ def _deconstruct_v1(self, including_private=False):
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 \
Expand Down Expand Up @@ -1379,7 +1385,7 @@ def send_tan(self, challenge: NeedTANResponse, tan: str):
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
Expand Down
6 changes: 6 additions & 0 deletions fints/formals.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down

0 comments on commit 28251f0

Please sign in to comment.