diff --git a/config/base/dex/numaflow-dex-server-configmap.yaml b/config/base/dex/numaflow-dex-server-configmap.yaml index f32025ff17..d7c02de5db 100644 --- a/config/base/dex/numaflow-dex-server-configmap.yaml +++ b/config/base/dex/numaflow-dex-server-configmap.yaml @@ -12,7 +12,7 @@ data: staticClients: - id: numaflow-server-app redirectURIs: - - /login + - //login name: 'Numaflow Server App' public: true connectors: diff --git a/config/install.yaml b/config/install.yaml index 5f39fd2c51..8387d5efa1 100644 --- a/config/install.yaml +++ b/config/install.yaml @@ -16373,11 +16373,12 @@ metadata: apiVersion: v1 data: config.yaml: "issuer: /dex\nstorage:\n type: memory\nweb:\n http: 0.0.0.0:5556\nstaticClients:\n - \ - id: numaflow-server-app\n redirectURIs: \n - /login\n name: - 'Numaflow Server App'\n public: true\nconnectors:\n- type: github\n # https://dexidp.io/docs/connectors/github/\n - \ id: github\n name: GitHub\n config:\n clientID: $GITHUB_CLIENT_ID\n clientSecret: - $GITHUB_CLIENT_SECRET\n redirectURI: /dex/callback\n orgs:\n - - name: \n teams:\n - admin\n - readonly\noauth2:\n skipApprovalScreen: + \ - id: numaflow-server-app\n redirectURIs: \n - //login\n + \ name: 'Numaflow Server App'\n public: true\nconnectors:\n- type: github\n + \ # https://dexidp.io/docs/connectors/github/\n id: github\n name: GitHub\n + \ config:\n clientID: $GITHUB_CLIENT_ID\n clientSecret: $GITHUB_CLIENT_SECRET\n + \ redirectURI: /dex/callback\n orgs:\n - name: \n + \ teams:\n - admin\n - readonly\noauth2:\n skipApprovalScreen: true\n" kind: ConfigMap metadata: diff --git a/config/namespace-install.yaml b/config/namespace-install.yaml index 146ff19d34..a34833a09a 100644 --- a/config/namespace-install.yaml +++ b/config/namespace-install.yaml @@ -16279,11 +16279,12 @@ metadata: apiVersion: v1 data: config.yaml: "issuer: /dex\nstorage:\n type: memory\nweb:\n http: 0.0.0.0:5556\nstaticClients:\n - \ - id: numaflow-server-app\n redirectURIs: \n - /login\n name: - 'Numaflow Server App'\n public: true\nconnectors:\n- type: github\n # https://dexidp.io/docs/connectors/github/\n - \ id: github\n name: GitHub\n config:\n clientID: $GITHUB_CLIENT_ID\n clientSecret: - $GITHUB_CLIENT_SECRET\n redirectURI: /dex/callback\n orgs:\n - - name: \n teams:\n - admin\n - readonly\noauth2:\n skipApprovalScreen: + \ - id: numaflow-server-app\n redirectURIs: \n - //login\n + \ name: 'Numaflow Server App'\n public: true\nconnectors:\n- type: github\n + \ # https://dexidp.io/docs/connectors/github/\n id: github\n name: GitHub\n + \ config:\n clientID: $GITHUB_CLIENT_ID\n clientSecret: $GITHUB_CLIENT_SECRET\n + \ redirectURI: /dex/callback\n orgs:\n - name: \n + \ teams:\n - admin\n - readonly\noauth2:\n skipApprovalScreen: true\n" kind: ConfigMap metadata: diff --git a/server/apis/v1/dexauth.go b/server/apis/v1/dexauth.go index 202b17d4b6..7d85df0f4a 100644 --- a/server/apis/v1/dexauth.go +++ b/server/apis/v1/dexauth.go @@ -48,12 +48,12 @@ type DexObject struct { } // NewDexObject returns a new DexObject. -func NewDexObject(baseURL string, proxyURL string) (*DexObject, error) { +func NewDexObject(baseURL string, baseHref string, proxyURL string) (*DexObject, error) { issuerURL, err := url.JoinPath(baseURL, "/dex") if err != nil { return nil, err } - redirectURI, err := url.JoinPath(baseURL, "/login") + redirectURI, err := url.JoinPath(baseURL, baseHref, "/login") if err != nil { return nil, err } diff --git a/server/cmd/start.go b/server/cmd/start.go index ea074937e0..57e64aad82 100644 --- a/server/cmd/start.go +++ b/server/cmd/start.go @@ -85,7 +85,9 @@ func (s *server) Start() { DexServerAddr: s.options.DexServerAddr, DexProxyAddr: s.options.DexProxyAddr, ServerAddr: s.options.ServerAddr, - }) + }, + s.options.BaseHref, + ) router.Use(UrlRewrite(router)) server := http.Server{ Addr: fmt.Sprintf(":%d", s.options.Port), diff --git a/server/routes/routes.go b/server/routes/routes.go index 9ecb2ea1f2..e4c11c34bc 100644 --- a/server/routes/routes.go +++ b/server/routes/routes.go @@ -46,11 +46,11 @@ type AuthInfo struct { var logger = logging.NewLogger().Named("server") -func Routes(r *gin.Engine, sysInfo SystemInfo, authInfo AuthInfo) { +func Routes(r *gin.Engine, sysInfo SystemInfo, authInfo AuthInfo, baseHref string) { r.GET("/livez", func(c *gin.Context) { c.Status(http.StatusOK) }) - dexObj, err := v1.NewDexObject(authInfo.ServerAddr, authInfo.DexProxyAddr) + dexObj, err := v1.NewDexObject(authInfo.ServerAddr, baseHref, authInfo.DexProxyAddr) if err != nil { panic(err) } diff --git a/server/routes/routes_test.go b/server/routes/routes_test.go index 98943b5701..c965d395bb 100644 --- a/server/routes/routes_test.go +++ b/server/routes/routes_test.go @@ -41,7 +41,7 @@ func TestRoutes(t *testing.T) { DisableAuth: false, DexServerAddr: "test-dex-server-addr", } - Routes(router, sysInfo, authInfo) + Routes(router, sysInfo, authInfo, "/") t.Run("/404", func(t *testing.T) { w := httptest.NewRecorder() req, err := http.NewRequest(http.MethodGet, "/404", nil)