]> www.dolda2000.com Git - fulbank.git/commitdiff
Make authentication more flexible and support user-ID-less bankid for fsb. master
authorFredrik Tolf <fredrik@dolda2000.com>
Mon, 1 Dec 2025 01:30:12 +0000 (02:30 +0100)
committerFredrik Tolf <fredrik@dolda2000.com>
Mon, 1 Dec 2025 01:30:12 +0000 (02:30 +0100)
fulbank/fsb.py
netbank

index 8a5dd6c622904acd1e09a7d6eb5798397d9c6283..e379823e1bfa663f83a05ee082dcbaa0a9799cb5 100644 (file)
@@ -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 7f52628fecc3b636195e6228da83e27eb4de9b7d..4e005f4c1284d43412aab5ae8a76be847d1014d3 100755 (executable)
--- 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)