| Age | Commit message (Collapse) | Author |
|
|
|
|
|
|
|
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
|
|
|
|
BREAKING CHANGES:
- The following functions need a special "cookie" as the first argument
- Add server (also now has an extra int as last argument, if non 0 run no callbacks, useful for preprovisioned servers)
- Get config
- Set secure location
- Disco servers
- Disco organizations
- Cleanup
- Renew session
- Start failover
Removed functions:
- "CancelOAuth", "CancelFailover" replaced by "CookieCancel"
- SecureLocationList, removed because the secure internet server
from ServerList() now has the locations embedded in the JSON
A cookie is a specialized context that can be used for cancellation
and sending values across a channel. Cancel OAuth and Cancel failover
functions have thus been removed. Instead, create a cookie with
"CookieNew", pass it to the function as the first argument and when you
want to cancel, run "CookieCancel".
The functions mentioned above use network requests, or some other
long running procedure. Even though we have a timeout set to 10
seconds for failover and network requests, it might make sense to make
this longer and just have clients cancel the request.
Cookies that have been created with "CookieNew" must be freed with
CookieDelete, which cancels the cookie and then deletes the underlying
handle.
Because cookies have a channel associated with them, they are used for
replying to state callbacks. When you receive an ASK_PROFILE or
ASK_LOCATION request, you get the same cookie back that you have
created when passed to the function (key "cookie" in the state
data). Reply with your answer (the profile or location) with
"CookieReply" passing in the cookie as first argument and the data as
second.
This means that SetProfileID and SetSecureLocation should
now only be used when not in a state callback. E.g. just changing the
profile or location when triggered by the user.
Finally, when a cookie is canceled, the error that is returned by the
function inherits from the Go context cancellation error:
https://pkg.go.dev/context#pkg-variables ("context canceled")
|
|
- Make sure the global exports state is only set on successful
creating
- Only call discovery when adding a server to ensure we get the most
up to date args. Creating a client should have no network calls. Fixes #12
- Split creating a client in New and Register in the GO api
|
|
|
|
Co-authored-by: rozmansi <simon@rozman.si>
|
|
Reported by: Simon Rozman <simon@rozman.si>
|
|
This is replace with expiry times
|
|
|
|
|
|
|
|
The main change is that we now use JSON from types listed at the
`types` package
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Not useful enought just yet
|
|
|
|
|
|
|
|
|
|
This is possible now as we require Go 1.17
|
|
|
|
|
|
|
|
|
|
|
|
|
|
fixes #6
Signed-off-by: Aleksandar Pesic <peske.nis@gmail.com>
|
|
|
|
|
|
|
|
|
|
|
|
Errors and test files still need to be done. Also some getters are
changed by removing the 'get' prefix
|
|
|
|
|
|
|
|
|
|
|