From: Fredrik Tolf Date: Mon, 1 Dec 2025 01:30:12 +0000 (+0100) Subject: Make authentication more flexible and support user-ID-less bankid for fsb. X-Git-Url: http://www.dolda2000.com/gitweb/?a=commitdiff_plain;h=6c4596d58a3c0cc2c0e8f6dd01d91e04f890c1ce;p=fulbank.git Make authentication more flexible and support user-ID-less bankid for fsb. --- diff --git a/fulbank/fsb.py b/fulbank/fsb.py index 8a5dd6c..e379823 100644 --- a/fulbank/fsb.py +++ b/fulbank/fsb.py @@ -250,7 +250,7 @@ class session(data.session): raise fmterror("no identified user even after successful authentication") self.userid = uid - def auth_token(self, user, conv=None): + def auth_token(self, user, *, conv=None): if conv is None: conv = auth.default() try: @@ -287,12 +287,11 @@ class session(data.session): raise fmterror("unexpected token challenge: type: " + data.get("type")) self._postlogin() - def auth_bankid(self, user, conv=None): + def auth_bankid(self, *, conv=None): if conv is None: conv = auth.default() try: data = self._jreq(apicall, "cross-channel/customer-security/authentication/v1/bankid/authentication", data={ - "userId": user, "idMethod": "MOBILE_BANKID", "generateEasyLogin": False, "mockedAuthencation": False, diff --git a/netbank b/netbank index 7f52628..4e005f4 100755 --- a/netbank +++ b/netbank @@ -32,12 +32,9 @@ def cmd_login(cmd, args): else: sys.stderr.write("netbank: %s: unknown authentication type\n" % (args[1])) sys.exit(1) - if len(args) < 3: - sys.stderr.write("usage: login bankid USER-ID\n") - sys.exit(1) with auth.ttyconv() as conv: try: - authfun(args[2], conv) + authfun(*args[2:], conv=conv) except auth.autherror as err: sys.stderr.write("netbank: authentication failed: %s\n" % err) sys.exit(1)