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
This commit is contained in:
Cameron 2023-09-11 09:09:02 -04:00 committed by Storj Robot
parent 487f64e164
commit f9ab2f0de7
3 changed files with 12 additions and 12 deletions

View File

@ -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)

View File

@ -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",
},
}
}

View File

@ -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)