gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[libeufin] branch master updated: CLI.


From: gnunet
Subject: [libeufin] branch master updated: CLI.
Date: Tue, 12 Oct 2021 11:05:39 +0200

This is an automated email from the git hooks/post-receive script.

ms pushed a commit to branch master
in repository libeufin.

The following commit(s) were added to refs/heads/master by this push:
     new 1cf856c  CLI.
1cf856c is described below

commit 1cf856ce01962231460efdc135603f13b08f1014
Author: ms <ms@taler.net>
AuthorDate: Tue Oct 12 11:04:46 2021 +0200

    CLI.
    
    Adapt after what "taler-local prepare" needed in
    terms of token-based authentication.  Other parts
    may need to be changed
---
 cli/bin/libeufin-cli | 17 ++++++++++++-----
 1 file changed, 12 insertions(+), 5 deletions(-)

diff --git a/cli/bin/libeufin-cli b/cli/bin/libeufin-cli
index 08bc2bd..ec8a757 100755
--- a/cli/bin/libeufin-cli
+++ b/cli/bin/libeufin-cli
@@ -280,6 +280,11 @@ class SandboxContext:
         self.sandbox_base_url = None
         self.username, self.password = self.require_sandbox_credentials()
 
+    def require_sandbox_admin_token(self):
+        token = os.environ.get("LIBEUFIN_SANDBOX_TOKEN")
+        if not token:
+            raise click.UsageError("Please define LIBEUFIN_SANDBOX_TOKEN in 
the environment")
+        return token
     def require_sandbox_credentials(self):
         sandbox_username = os.environ.get("LIBEUFIN_SANDBOX_USERNAME")
         sandbox_password = os.environ.get("LIBEUFIN_SANDBOX_PASSWORD")
@@ -347,7 +352,7 @@ class NexusContext:
 @click.option("--sandbox-url", help="URL for the sandbox", required=False)
 @click.pass_context
 def sandbox(ctx, sandbox_url):
-    ctx.obj = SandboxContext() # fetches username and password from the 
environment.
+    ctx.obj = SandboxContext()
     ctx.obj.sandbox_base_url = sandbox_url
 
 
@@ -1052,7 +1057,7 @@ def make_ebics_host(obj, host_id):
         resp = post(
             url,
             json=dict(hostID=host_id, ebicsVersion="2.5"),
-            auth=auth.HTTPBasicAuth(obj.username, obj.password)
+            headers={"Authorization": "Bearer " + 
obj.require_sandbox_admin_token()}
         )
     except Exception as e:
         print(e)
@@ -1097,7 +1102,7 @@ def create_ebics_subscriber(obj, host_id, partner_id, 
user_id):
         resp = post(
             url,
             json=dict(hostID=host_id, partnerID=partner_id, userID=user_id),
-            auth=auth.HTTPBasicAuth(obj.username, obj.password)
+            headers={"Authorization": "Bearer " + 
obj.require_sandbox_admin_token()}
         )
     except Exception as e:
         print(e)
@@ -1169,8 +1174,10 @@ def associate_bank_account(
     )
 
     try:
-        resp = post(url, json=body,
-                    auth=auth.HTTPBasicAuth(obj.username, obj.password))
+        resp = post(
+            url, json=body,
+            headers={"Authorization": "Bearer " + 
obj.require_sandbox_admin_token()}
+        )
     except Exception as e:
         print(e)
         print("Could not reach sandbox")

-- 
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]