From f9ab2f0de7ff6b34548c80b58737c48151c2a8cf Mon Sep 17 00:00:00 2001 From: Cameron Date: Mon, 11 Sep 2023 09:09:02 -0400 Subject: [PATCH] satellite/console: prefix oidc paths with /api/v0/ add /api/v0/ prefix to oidc paths to route requests to the api pod with split UI infrastructure. Change-Id: I1e7e691487ab1d4e84434d204d10b7f944ae8873 --- satellite/console/consoleweb/server.go | 10 +++++----- satellite/oidc/endpoint.go | 6 +++--- satellite/oidc/integration_test.go | 8 ++++---- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/satellite/console/consoleweb/server.go b/satellite/console/consoleweb/server.go index becdfc06c..09c8c6c0b 100644 --- a/satellite/console/consoleweb/server.go +++ b/satellite/console/consoleweb/server.go @@ -386,11 +386,11 @@ func NewServer(logger *zap.Logger, config Config, service *console.Service, oidc server.config.OauthCodeExpiry, server.config.OauthAccessTokenExpiry, server.config.OauthRefreshTokenExpiry, ) - router.HandleFunc("/.well-known/openid-configuration", oidc.WellKnownConfiguration) - router.Handle("/oauth/v2/authorize", server.withAuth(http.HandlerFunc(oidc.AuthorizeUser))).Methods(http.MethodPost) - router.Handle("/oauth/v2/tokens", server.ipRateLimiter.Limit(http.HandlerFunc(oidc.Tokens))).Methods(http.MethodPost) - router.Handle("/oauth/v2/userinfo", server.ipRateLimiter.Limit(http.HandlerFunc(oidc.UserInfo))).Methods(http.MethodGet) - router.Handle("/oauth/v2/clients/{id}", server.withAuth(http.HandlerFunc(oidc.GetClient))).Methods(http.MethodGet) + router.HandleFunc("/api/v0/.well-known/openid-configuration", oidc.WellKnownConfiguration) + router.Handle("/api/v0/oauth/v2/authorize", server.withAuth(http.HandlerFunc(oidc.AuthorizeUser))).Methods(http.MethodPost) + router.Handle("/api/v0/oauth/v2/tokens", server.ipRateLimiter.Limit(http.HandlerFunc(oidc.Tokens))).Methods(http.MethodPost) + router.Handle("/api/v0/oauth/v2/userinfo", server.ipRateLimiter.Limit(http.HandlerFunc(oidc.UserInfo))).Methods(http.MethodGet) + router.Handle("/api/v0/oauth/v2/clients/{id}", server.withAuth(http.HandlerFunc(oidc.GetClient))).Methods(http.MethodGet) router.HandleFunc("/invited", server.handleInvited) router.HandleFunc("/activation", server.accountActivationHandler) diff --git a/satellite/oidc/endpoint.go b/satellite/oidc/endpoint.go index 52daacbaa..f775688ab 100644 --- a/satellite/oidc/endpoint.go +++ b/satellite/oidc/endpoint.go @@ -72,9 +72,9 @@ func NewEndpoint( config: ProviderConfig{ NodeURL: nodeURL.String(), Issuer: externalAddress, - AuthURL: externalAddress + "oauth/v2/authorize", - TokenURL: externalAddress + "oauth/v2/tokens", - UserInfoURL: externalAddress + "oauth/v2/userinfo", + AuthURL: externalAddress + "api/v0/oauth/v2/authorize", + TokenURL: externalAddress + "api/v0/oauth/v2/tokens", + UserInfoURL: externalAddress + "api/v0/oauth/v2/userinfo", }, } } diff --git a/satellite/oidc/integration_test.go b/satellite/oidc/integration_test.go index c955fd4f1..51b0a6e20 100644 --- a/satellite/oidc/integration_test.go +++ b/satellite/oidc/integration_test.go @@ -102,9 +102,9 @@ func TestOIDC(t *testing.T) { consoleAddr := sat.API.Console.Listener.Addr().String() issuer := "http://" + consoleAddr + "/" - authEndpoint := "http://" + consoleAddr + "/oauth/v2/authorize" - tokenEndpoint := "http://" + consoleAddr + "/oauth/v2/tokens" - userinfoEndpoint := "http://" + consoleAddr + "/oauth/v2/userinfo" + authEndpoint := "http://" + consoleAddr + "/api/v0/oauth/v2/authorize" + tokenEndpoint := "http://" + consoleAddr + "/api/v0/oauth/v2/tokens" + userinfoEndpoint := "http://" + consoleAddr + "/api/v0/oauth/v2/userinfo" // Setup test user @@ -170,7 +170,7 @@ func TestOIDC(t *testing.T) { // Ensure OpenID Connect's well-known configuration endpoint works. - wellKnownConfig := fmt.Sprintf("http://%s/.well-known/openid-configuration", consoleAddr) + wellKnownConfig := fmt.Sprintf("http://%s/api/v0/.well-known/openid-configuration", consoleAddr) cfg := oidc.ProviderConfig{} send(t, nil, &cfg, http.StatusOK, wellKnownConfig)