From 75aa163ccf407e9690f9ea0e548f8fed70073722 Mon Sep 17 00:00:00 2001 From: jwijenbergh Date: Tue, 26 Apr 2022 15:43:35 +0200 Subject: OAuth: Add a Cancel method --- wrappers/python/eduvpncommon/__init__.py | 1 + wrappers/python/eduvpncommon/main.py | 8 ++++++++ 2 files changed, 9 insertions(+) (limited to 'wrappers/python/eduvpncommon') diff --git a/wrappers/python/eduvpncommon/__init__.py b/wrappers/python/eduvpncommon/__init__.py index 67e0d3b..e0fe0d0 100644 --- a/wrappers/python/eduvpncommon/__init__.py +++ b/wrappers/python/eduvpncommon/__init__.py @@ -38,6 +38,7 @@ lib.Deregister.argtypes, lib.Deregister.restype = [], None lib.Register.argtypes, lib.Register.restype = [c_char_p, c_char_p, VPNStateChange, c_int], c_void_p lib.GetOrganizationsList.argtypes, lib.GetOrganizationsList.restype = [], DataError lib.GetServersList.argtypes, lib.GetServersList.restype = [], DataError +lib.CancelOAuth.argtypes, lib.CancelOAuth.restype = [], c_void_p lib.SetProfileID.argtypes, lib.SetProfileID.restype = [c_char_p], c_void_p # We have to use c_void_p instead of c_char_p to free it properly # See https://stackoverflow.com/questions/13445568/python-ctypes-how-to-free-memory-getting-invalid-pointer-error diff --git a/wrappers/python/eduvpncommon/main.py b/wrappers/python/eduvpncommon/main.py index da8b186..eae7014 100644 --- a/wrappers/python/eduvpncommon/main.py +++ b/wrappers/python/eduvpncommon/main.py @@ -18,6 +18,11 @@ def Register(name, config_directory, state_callback, debug): err_string = GetPtrString(ptr_err) return err_string +def CancelOAuth(): + ptr_err = lib.CancelOAuth() + err_string = GetPtrString(ptr_err) + return err_string + def Deregister(): lib.Deregister() @@ -58,6 +63,9 @@ class EduVPN(object): self.config_directory = config_directory register_callback(self) + def cancel_oauth(self) -> str: + return CancelOAuth() + def deregister(self): Deregister() -- cgit v1.2.3