summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--internal/oauth/oauth.go2
-rw-r--r--internal/server/custom/custom.go4
-rw-r--r--internal/server/institute/institute.go4
-rw-r--r--internal/server/secure/secure.go4
4 files changed, 12 insertions, 2 deletions
diff --git a/internal/oauth/oauth.go b/internal/oauth/oauth.go
index f1cc9fe..d7da299 100644
--- a/internal/oauth/oauth.go
+++ b/internal/oauth/oauth.go
@@ -369,7 +369,7 @@ func (s *exchangeSession) Authcode(url *url.URL) (string, error) {
// first check ISS
iss := q.Get("iss")
- if s.ISS != iss {
+ if s.ISS != "" && s.ISS != iss {
return "", errors.Errorf("failed matching ISS; expected '%s' got '%s'", s.ISS, iss)
}
// Make sure the state is present and matches to protect against cross-site request forgeries
diff --git a/internal/server/custom/custom.go b/internal/server/custom/custom.go
index af6ad67..376bcd6 100644
--- a/internal/server/custom/custom.go
+++ b/internal/server/custom/custom.go
@@ -32,6 +32,8 @@ func New(ctx context.Context, clientID string, u string) (*Server, error) {
API := b.Endpoints.API.V3
s := &Server{Basic: b}
- s.Auth.Init(clientID, u, API.Authorization, API.Token)
+ // we set ISS to empty here as we do not want to have ISS enabled for custom servers
+ // Otherwise we would have to normalise the URL which the user has entered which is error prone
+ s.Auth.Init(clientID, "", API.Authorization, API.Token)
return s, nil
}
diff --git a/internal/server/institute/institute.go b/internal/server/institute/institute.go
index 46977ac..82e51e6 100644
--- a/internal/server/institute/institute.go
+++ b/internal/server/institute/institute.go
@@ -43,6 +43,10 @@ func New(
API := b.Endpoints.API.V3
s := &Server{Basic: b}
+
+ if url == "" {
+ return nil, errors.New("URL passed to OAuth is empty")
+ }
s.Auth.Init(clientID, url, API.Authorization, API.Token)
return s, nil
}
diff --git a/internal/server/secure/secure.go b/internal/server/secure/secure.go
index c60c38e..16479fa 100644
--- a/internal/server/secure/secure.go
+++ b/internal/server/secure/secure.go
@@ -157,6 +157,10 @@ func (s *Server) Init(
return err
}
+ if b.URL == "" {
+ return errors.New("URL passed to OAuth is empty")
+ }
+
// Make sure oauth contains our endpoints
s.Auth.Init(clientID, b.URL, b.Endpoints.API.V3.Authorization, b.Endpoints.API.V3.Token)
return nil