diff options
| author | jwijenbergh <jeroenwijenbergh@protonmail.com> | 2022-10-19 17:55:53 +0200 |
|---|---|---|
| committer | jwijenbergh <jeroenwijenbergh@protonmail.com> | 2022-10-19 17:55:53 +0200 |
| commit | 8fa80e56e014d9a77cfb337b2a2b641f1532ff8e (patch) | |
| tree | e7a406a0b8cb05c3b232dd828dc6a5d974ca2fcb /internal/server | |
| parent | 7260aa0cd70195a4679ca3c94204d9e618f947f2 (diff) | |
OAuth + Server: Fix ISS for secure internet
The wrong base url was used. Use the one from the home server NOT the
current location
Diffstat (limited to 'internal/server')
| -rw-r--r-- | internal/server/common.go | 15 | ||||
| -rw-r--r-- | internal/server/instituteaccess.go | 4 | ||||
| -rw-r--r-- | internal/server/secureinternet.go | 2 |
3 files changed, 4 insertions, 17 deletions
diff --git a/internal/server/common.go b/internal/server/common.go index bf6f4ca..e70bee0 100644 --- a/internal/server/common.go +++ b/internal/server/common.go @@ -252,21 +252,8 @@ func ShouldRenewButton(server Server) bool { return true } -func GetISS(server Server) (string, error) { - base, baseErr := server.GetBase() - if baseErr != nil { - return "", types.NewWrappedError("failed getting server ISS", baseErr) - } - // We have already ensured that the base URL ends with a / - return base.URL, nil -} - func GetOAuthURL(server Server, name string) (string, error) { - iss, issErr := GetISS(server) - if issErr != nil { - return "", issErr - } - return server.GetOAuth().GetAuthURL(name, iss, server.GetTemplateAuth()) + return server.GetOAuth().GetAuthURL(name, server.GetTemplateAuth()) } func OAuthExchange(server Server) error { diff --git a/internal/server/instituteaccess.go b/internal/server/instituteaccess.go index 0f097b0..ed0211b 100644 --- a/internal/server/instituteaccess.go +++ b/internal/server/instituteaccess.go @@ -84,7 +84,7 @@ func (institute *InstituteAccessServer) init( serverType string, supportContact []string, ) error { - errorMessage := fmt.Sprintf("failed initializing institute server %s", url) + errorMessage := fmt.Sprintf("failed initializing server %s", url) institute.Base.URL = url institute.Base.DisplayName = displayName institute.Base.SupportContact = supportContact @@ -93,7 +93,7 @@ func (institute *InstituteAccessServer) init( if endpointsErr != nil { return types.NewWrappedError(errorMessage, endpointsErr) } - institute.OAuth.Init(endpoints.API.V3.Authorization, endpoints.API.V3.Token) + institute.OAuth.Init(url, endpoints.API.V3.Authorization, endpoints.API.V3.Token) institute.Base.Endpoints = *endpoints return nil } diff --git a/internal/server/secureinternet.go b/internal/server/secureinternet.go index 93e83cf..b3e2615 100644 --- a/internal/server/secureinternet.go +++ b/internal/server/secureinternet.go @@ -149,7 +149,7 @@ func (secure *SecureInternetHomeServer) init( } // Make sure oauth contains our endpoints - secure.OAuth.Init(base.Endpoints.API.V3.Authorization, base.Endpoints.API.V3.Token) + secure.OAuth.Init(base.URL, base.Endpoints.API.V3.Authorization, base.Endpoints.API.V3.Token) return nil } |
