summaryrefslogtreecommitdiff
path: root/wrappers/python/eduvpn_common/server.py
diff options
context:
space:
mode:
Diffstat (limited to 'wrappers/python/eduvpn_common/server.py')
-rw-r--r--wrappers/python/eduvpn_common/server.py14
1 files changed, 13 insertions, 1 deletions
diff --git a/wrappers/python/eduvpn_common/server.py b/wrappers/python/eduvpn_common/server.py
index 068dc61..55eadcd 100644
--- a/wrappers/python/eduvpn_common/server.py
+++ b/wrappers/python/eduvpn_common/server.py
@@ -392,6 +392,19 @@ def get_locations(lib: CDLL, ptr: c_void_p) -> Optional[List[str]]:
return None
+def get_tokens(lib: CDLL, ptr: c_void_p) -> Optional[Token]:
+ if ptr:
+ toks = cast(ptr, POINTER(cToken)).contents
+ access = toks.access.decode("utf-8")
+ refresh = toks.refresh.decode("utf-8")
+ expired = toks.expired
+ lib.FreeTokens(ptr)
+ return Token(
+ access, refresh, expired
+ )
+ return None
+
+
def get_config(lib: CDLL, ptr: c_void_p) -> Optional[Config]:
"""Get the config from the Go library as a C structure and return a Python usable structure
@@ -403,7 +416,6 @@ def get_config(lib: CDLL, ptr: c_void_p) -> Optional[Config]:
:return: The configuration if there is any
:rtype: Optional[Config]
"""
- # TODO: FREE
if ptr:
config = cast(ptr, POINTER(cConfig)).contents
cfg = config.config.decode("utf-8")