From f6f4396a81ce662eb5fb50c4f9fef92ffaadb333 Mon Sep 17 00:00:00 2001 From: jwijenbergh Date: Thu, 13 Apr 2023 15:25:42 +0200 Subject: All: Implement a token handler This implements a token handler for OAuth tokens. Clients can use the SetTokenHandler function in exports to set a token handler. It needs two arguments, a getter and a setter. The getter is a callback with three arguments: - The server to get the tokens for, in types.server.current as JSON - The output buffer - The output buffer maximum length The tokens should be written to the output buffer with maximum length. The type should be types.server.Tokens and be marshalled as JSON. If no tokens are available, leave the output buffer intact The token setter is a callback with two arguments: - The server for which to set the tokens for, in types.server.Current as JSON - The tokens, defined in types.server.Tokens as JSON Breaking changes: - No more tokens as arguments, was already deprecated in previous commits - Tokens are no longer returned in types.server.Configuration --- types/server/server.go | 3 --- 1 file changed, 3 deletions(-) (limited to 'types/server') diff --git a/types/server/server.go b/types/server/server.go index 1578f29..aea496d 100644 --- a/types/server/server.go +++ b/types/server/server.go @@ -130,9 +130,6 @@ type Configuration struct { Protocol protocol.Protocol `json:"protocol"` // DefaultGateway is a boolean that indicates whether or not this configuration should be configured as a default gateway DefaultGateway bool `json:"default_gateway"` - // Tokens is the updated tokens that we get back from the VPN configuration - // They should be used by the client to save them in e.g. the keyring - Tokens Tokens `json:"tokens"` } // Current is the struct that defines the current server -- cgit v1.2.3