summaryrefslogtreecommitdiff
path: root/client/client.go
diff options
context:
space:
mode:
authorJeroen Wijenbergh <jeroenwijenbergh@protonmail.com>2024-05-08 11:49:19 +0200
committerJeroen Wijenbergh <46386452+jwijenbergh@users.noreply.github.com>2024-05-08 13:54:45 +0000
commit9ce4e4458794290755c68a180125acc68ab84038 (patch)
treed4211e55bd77d07938651619733c7b435597d53a /client/client.go
parent580f94b4023fba35ab2f58d2e6d7b3b7c40ec139 (diff)
Server: Add a way to pass OAuth start time
Diffstat (limited to 'client/client.go')
-rw-r--r--client/client.go10
1 files changed, 6 insertions, 4 deletions
diff --git a/client/client.go b/client/client.go
index 7a6747b..291b190 100644
--- a/client/client.go
+++ b/client/client.go
@@ -302,9 +302,11 @@ func (c *Client) TrySave() {
}
// AddServer adds a server with identifier and type
-func (c *Client) AddServer(ck *cookie.Cookie, identifier string, _type srvtypes.Type, ni bool) (err error) {
+func (c *Client) AddServer(ck *cookie.Cookie, identifier string, _type srvtypes.Type, ot *int64) (err error) {
c.mu.Lock()
defer c.mu.Unlock()
+ // we are non-interactive if oauth time is non-nil
+ ni := ot != nil
// If we have failed to add the server, we remove it again
// We add the server because we can then obtain it in other callback functions
previousState := c.FSM.Current
@@ -335,17 +337,17 @@ func (c *Client) AddServer(ck *cookie.Cookie, identifier string, _type srvtypes.
switch _type {
case srvtypes.TypeInstituteAccess:
- err = c.Servers.AddInstitute(ck.Context(), c.cfg.Discovery(), identifier, ni)
+ err = c.Servers.AddInstitute(ck.Context(), c.cfg.Discovery(), identifier, ot)
if err != nil {
return i18nerr.Wrapf(err, "The institute access server with URL: '%s' could not be added", identifier)
}
case srvtypes.TypeSecureInternet:
- err = c.Servers.AddSecure(ck.Context(), c.cfg.Discovery(), identifier, ni)
+ err = c.Servers.AddSecure(ck.Context(), c.cfg.Discovery(), identifier, ot)
if err != nil {
return i18nerr.Wrapf(err, "The secure internet server with organisation ID: '%s' could not be added", identifier)
}
case srvtypes.TypeCustom:
- err = c.Servers.AddCustom(ck.Context(), identifier, ni)
+ err = c.Servers.AddCustom(ck.Context(), identifier, ot)
if err != nil {
return i18nerr.Wrapf(err, "The custom server with URL: '%s' could not be added", identifier)
}