From 0c14a204ae13f7692a5708451b40f87832f7388a Mon Sep 17 00:00:00 2001 From: jwijenbergh Date: Fri, 1 Sep 2023 16:19:29 +0200 Subject: Client + Server: Increase endpoint update frequency and update secure internet handling --- internal/server/instituteaccess.go | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'internal/server/instituteaccess.go') diff --git a/internal/server/instituteaccess.go b/internal/server/instituteaccess.go index 050e721..a51409f 100644 --- a/internal/server/instituteaccess.go +++ b/internal/server/instituteaccess.go @@ -1,6 +1,7 @@ package server import ( + "github.com/eduvpn/eduvpn-common/internal/discovery" "github.com/eduvpn/eduvpn-common/internal/oauth" "github.com/go-errors/errors" ) @@ -72,6 +73,27 @@ func (ias *InstituteAccessServer) OAuth() *oauth.OAuth { return &ias.Auth } +func (ias *InstituteAccessServer) RefreshEndpoints(_ *discovery.Discovery) error { + // Re-initialize the endpoints + b, err := ias.Base() + if err != nil { + return err + } + + err = b.InitializeEndpoints() + if err != nil { + return err + } + + // update OAuth + auth := ias.OAuth() + if auth != nil { + auth.BaseAuthorizationURL = b.Endpoints.API.V3.Authorization + auth.TokenURL = b.Endpoints.API.V3.Token + } + return nil +} + func (ias *InstituteAccessServer) init( url string, name map[string]string, -- cgit v1.2.3