diff options
| author | jwijenbergh <jeroenwijenbergh@protonmail.com> | 2023-03-29 11:58:46 +0200 |
|---|---|---|
| committer | Jeroen Wijenbergh <46386452+jwijenbergh@users.noreply.github.com> | 2023-04-18 14:05:19 +0200 |
| commit | 537a09d4334f1555b80d87b7d935328963a21739 (patch) | |
| tree | 071eeb52a4ed79a1e1b49831c80d6a2336cee7cf /wrappers/python/eduvpn_common/server.py | |
| parent | 61871cb9ea7605e5350e9612edf8c9d603da2883 (diff) | |
Client + Server: Implement a token updater callback
Diffstat (limited to 'wrappers/python/eduvpn_common/server.py')
| -rw-r--r-- | wrappers/python/eduvpn_common/server.py | 14 |
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") |
