From 469e87a9237f4af3b36068aa9d0744bafcb64c57 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ivar=20Conradi=20=C3=98sthus?= Date: Tue, 13 Apr 2021 08:45:02 +0200 Subject: [PATCH] fix: remove enableLegacyRoutes option from v2 --- .eslintrc | 2 +- docs/deploy/google-auth-hook.md | 2 -- docs/deploy/migration-guide.md | 8 +++++++- docs/deploy/securing-unleash.md | 3 +-- examples/client-auth-unleash.js | 1 - src/lib/options.js | 1 - src/lib/routes/index.test.js | 1 - 7 files changed, 9 insertions(+), 9 deletions(-) diff --git a/.eslintrc b/.eslintrc index 9c473e41ce..e92dc21da3 100644 --- a/.eslintrc +++ b/.eslintrc @@ -52,5 +52,5 @@ } } ], - "ignorePatterns": ["**/docs/api/oas/"] + "ignorePatterns": ["**/docs/api/oas/", "examples/**"] } diff --git a/docs/deploy/google-auth-hook.md b/docs/deploy/google-auth-hook.md index a1f3f3e172..7a98da6071 100644 --- a/docs/deploy/google-auth-hook.md +++ b/docs/deploy/google-auth-hook.md @@ -85,7 +85,6 @@ Add `googleAdminAuth()` function and other options function googleAdminAuth(app) {} let options = { - enableLegacyRoutes: false, adminAuthentication: 'custom', preRouterHook: googleAdminAuth, }; @@ -242,7 +241,6 @@ function googleAdminAuth(app) { } const options = { - enableLegacyRoutes: false, adminAuthentication: 'custom', preRouterHook: googleAdminAuth, }; diff --git a/docs/deploy/migration-guide.md b/docs/deploy/migration-guide.md index 9319c6bf6e..e9ef981672 100644 --- a/docs/deploy/migration-guide.md +++ b/docs/deploy/migration-guide.md @@ -9,7 +9,7 @@ Generally, the intention is that `unleash-server` should always provide support (Work In Process!) -### Role-based Access Control (RBAC) +### 1. Role-based Access Control (RBAC) We have implemented RBAC in Unleash v4. This has totally changed the permission system in Unleash. @@ -30,6 +30,12 @@ const user = userService.loginUserWithoutPassword( req.session.user = user; ``` +### 3. Legacy v2 routes removed + +Only relevant if you use the `enableLegacyRoutes` option. + +Im v2 you could query feature toggles on `/api/features`. This was deprecated in v4 and we introduced two different endpoints (`/api/admin/features` and `/api/client/features`) to be able to optimize performance and security. In v3 you could still enable the legacy routes via the `enableLegacyRoutes` option. This was removed in v4. + ## Upgrading from v2.x to v3.x The notable change introduced in Unleash v3.x is a strict separation of API paths for client requests and admin requests. This makes it easier to implement different authentication mechanisms for the admin UI and all unleash-clients. You can read more about [securing unleash](https://github.com/Unleash/unleash/blob/master/docs/securing-unleash.md). diff --git a/docs/deploy/securing-unleash.md b/docs/deploy/securing-unleash.md index 59db258f4f..d6cb995103 100644 --- a/docs/deploy/securing-unleash.md +++ b/docs/deploy/securing-unleash.md @@ -3,7 +3,7 @@ id: securing_unleash title: Securing Unleash --- -> This guide is only relevant if you are using Unleash Open-Source. The Enterprise edition does already ship with a secure setup and multiple SSO options. +> This guide is only relevant if you are using Unleash Open-Source. The Enterprise edition does already ship with a secure setup and multiple SSO options. The Unleash API is split into two different paths: `/api/client` and `/api/admin`. This makes it easy to have different authentication strategy for the admin interface and the client-api used by the applications integrating with Unleash. @@ -73,7 +73,6 @@ const sharedSecret = '12312Random'; unleash .start({ databaseUrl: 'postgres://unleash_user:passord@localhost:5432/unleash', - enableLegacyRoutes: false, preRouterHook: app => { app.use('/api/client', (req, res, next) => { if (req.header('authorization') !== sharedSecret) { diff --git a/examples/client-auth-unleash.js b/examples/client-auth-unleash.js index 9c2a1a345f..d7f57959af 100644 --- a/examples/client-auth-unleash.js +++ b/examples/client-auth-unleash.js @@ -9,7 +9,6 @@ const sharedSecret = '12312Random'; unleash .start({ databaseUrl: 'postgres://unleash_user:passord@localhost:5432/unleash', - enableLegacyRoutes: false, preRouterHook: app => { app.use('/api/client', (req, res, next) => { if (req.header('authorization') === sharedSecret) { diff --git a/src/lib/options.js b/src/lib/options.js index 9fa52ed209..bf03690cbb 100644 --- a/src/lib/options.js +++ b/src/lib/options.js @@ -66,7 +66,6 @@ function defaultOptions() { baseUriPath: process.env.BASE_URI_PATH || '', unleashUrl: process.env.UNLEASH_URL || 'http://localhost:4242', serverMetrics: true, - enableLegacyRoutes: false, // deprecated. Remove in v4, publicFolder, versionCheck: { url: diff --git a/src/lib/routes/index.test.js b/src/lib/routes/index.test.js index dbdb73bab0..18dfe2d938 100644 --- a/src/lib/routes/index.test.js +++ b/src/lib/routes/index.test.js @@ -17,7 +17,6 @@ function getSetup() { baseUriPath: base, stores, eventBus, - enableLegacyRoutes: true, getLogger, }; const services = createServices(stores, config);