diff --git a/frontend/src/component/user/Profile/Profile.tsx b/frontend/src/component/user/Profile/Profile.tsx index 44e814fb0d..bb9f4e14a6 100644 --- a/frontend/src/component/user/Profile/Profile.tsx +++ b/frontend/src/component/user/Profile/Profile.tsx @@ -1,7 +1,6 @@ import { ConditionallyRender } from 'component/common/ConditionallyRender/ConditionallyRender'; import { ITab, VerticalTabs } from 'component/common/VerticalTabs/VerticalTabs'; import { useAuthUser } from 'hooks/api/getters/useAuth/useAuthUser'; -import useUiConfig from 'hooks/api/getters/useUiConfig/useUiConfig'; import { useEffect, useState } from 'react'; import { useLocation, useNavigate } from 'react-router-dom'; import { PasswordTab } from './PasswordTab/PasswordTab'; @@ -13,8 +12,6 @@ export const Profile = () => { const location = useLocation(); const navigate = useNavigate(); - const { uiConfig } = useUiConfig(); - const tabs = [ { id: 'profile', label: 'Profile' }, { id: 'password', label: 'Change password', path: 'change-password' }, @@ -22,7 +19,6 @@ export const Profile = () => { id: 'pat', label: 'Personal API tokens', path: 'personal-api-tokens', - hidden: !uiConfig.flags.personalAccessTokens, }, ]; diff --git a/frontend/src/interfaces/uiConfig.ts b/frontend/src/interfaces/uiConfig.ts index 895fd9e0ac..ddf36de905 100644 --- a/frontend/src/interfaces/uiConfig.ts +++ b/frontend/src/interfaces/uiConfig.ts @@ -41,7 +41,6 @@ export interface IFlags { ENABLE_DARK_MODE_SUPPORT?: boolean; embedProxyFrontend?: boolean; publicSignup?: boolean; - personalAccessTokens?: boolean; syncSSOGroups?: boolean; suggestChanges?: boolean; cloneEnvironment?: boolean; diff --git a/src/lib/__snapshots__/create-config.test.ts.snap b/src/lib/__snapshots__/create-config.test.ts.snap index 13cc4fa01e..840700b78c 100644 --- a/src/lib/__snapshots__/create-config.test.ts.snap +++ b/src/lib/__snapshots__/create-config.test.ts.snap @@ -72,7 +72,6 @@ exports[`should create default config 1`] = ` "cloneEnvironment": false, "embedProxy": false, "embedProxyFrontend": false, - "personalAccessTokens": false, "publicSignup": false, "responseTimeWithAppName": false, "suggestChanges": false, @@ -87,7 +86,6 @@ exports[`should create default config 1`] = ` "cloneEnvironment": false, "embedProxy": false, "embedProxyFrontend": false, - "personalAccessTokens": false, "publicSignup": false, "responseTimeWithAppName": false, "suggestChanges": false, diff --git a/src/lib/middleware/pat-middleware.test.ts b/src/lib/middleware/pat-middleware.test.ts index 4dc26a4a0f..aea580e1bf 100644 --- a/src/lib/middleware/pat-middleware.test.ts +++ b/src/lib/middleware/pat-middleware.test.ts @@ -1,5 +1,4 @@ import getLogger from '../../test/fixtures/no-logger'; -import { createTestConfig } from '../../test/config/test-config'; import patMiddleware from './pat-middleware'; import User from '../types/user'; @@ -83,39 +82,6 @@ test('should add user if known token', async () => { expect(req.user).toBe(apiUser); }); -test('should not add user if disabled', async () => { - const apiUser = new User({ - id: 44, - username: 'my-user', - }); - const userService = { - getUserByPersonalAccessToken: jest.fn().mockReturnValue(apiUser), - }; - - const disabledConfig = createTestConfig({ - getLogger, - experimental: { - flags: { - personalAccessTokens: false, - }, - }, - }); - - const func = patMiddleware(disabledConfig, { userService }); - - const cb = jest.fn(); - - const req = { - header: jest.fn().mockReturnValue('user:some-known-token'), - user: undefined, - }; - - await func(req, undefined, cb); - - expect(cb).toHaveBeenCalled(); - expect(req.user).toBeFalsy(); -}); - test('should call next if userService throws exception', async () => { getLogger.setMuteError(true); const userService = { diff --git a/src/lib/middleware/pat-middleware.ts b/src/lib/middleware/pat-middleware.ts index 84277ddbc9..c2009fabbb 100644 --- a/src/lib/middleware/pat-middleware.ts +++ b/src/lib/middleware/pat-middleware.ts @@ -3,19 +3,12 @@ import { IAuthRequest } from '../routes/unleash-types'; /* eslint-disable @typescript-eslint/explicit-module-boundary-types */ const patMiddleware = ( - { - getLogger, - flagResolver, - }: Pick, + { getLogger }: Pick, { userService }: any, ): any => { const logger = getLogger('/middleware/pat-middleware.ts'); logger.debug('Enabling PAT middleware'); - if (!flagResolver.isEnabled('personalAccessTokens')) { - return (req, res, next) => next(); - } - return async (req: IAuthRequest, res, next) => { try { const apiToken = req.header('authorization'); diff --git a/src/lib/types/experimental.ts b/src/lib/types/experimental.ts index 066f1cebcf..5ee74b9bcb 100644 --- a/src/lib/types/experimental.ts +++ b/src/lib/types/experimental.ts @@ -10,10 +10,6 @@ export const defaultExperimentalOptions = { process.env.UNLEASH_EXPERIMENTAL_EMBED_PROXY, false, ), - personalAccessTokens: parseEnvVarBoolean( - process.env.UNLEASH_EXPERIMENTAL_PERSONAL_ACCESS_TOKENS, - false, - ), suggestChanges: parseEnvVarBoolean( process.env.UNLEASH_EXPERIMENTAL_SUGGEST_CHANGES, false, @@ -54,7 +50,6 @@ export interface IExperimentalOptions { embedProxyFrontend?: boolean; batchMetrics?: boolean; anonymiseEventLog?: boolean; - personalAccessTokens?: boolean; syncSSOGroups?: boolean; suggestChanges?: boolean; cloneEnvironment?: boolean; diff --git a/src/server-dev.ts b/src/server-dev.ts index 4d7673a8fa..bc9a6a29c9 100644 --- a/src/server-dev.ts +++ b/src/server-dev.ts @@ -38,7 +38,6 @@ process.nextTick(async () => { batchMetrics: true, anonymiseEventLog: false, responseTimeWithAppName: true, - personalAccessTokens: true, syncSSOGroups: true, suggestChanges: true, cloneEnvironment: true, diff --git a/src/test/config/test-config.ts b/src/test/config/test-config.ts index ef2496a59e..5d7ceb9345 100644 --- a/src/test/config/test-config.ts +++ b/src/test/config/test-config.ts @@ -27,7 +27,6 @@ export function createTestConfig(config?: IUnleashOptions): IUnleashConfig { embedProxy: true, embedProxyFrontend: true, batchMetrics: true, - personalAccessTokens: true, syncSSOGroups: true, suggestChanges: true, cloneEnvironment: true, diff --git a/src/test/e2e/api/admin/user/pat.e2e.test.ts b/src/test/e2e/api/admin/user/pat.e2e.test.ts index 5c217593f6..a58bf4aab6 100644 --- a/src/test/e2e/api/admin/user/pat.e2e.test.ts +++ b/src/test/e2e/api/admin/user/pat.e2e.test.ts @@ -16,9 +16,7 @@ tomorrow.setDate(tomorrow.getDate() + 1); beforeAll(async () => { db = await dbInit('user_pat', getLogger); patStore = db.stores.patStore; - app = await setupAppWithAuth(db.stores, { - experimental: { flags: { personalAccessTokens: true } }, - }); + app = await setupAppWithAuth(db.stores); await app.request .post(`/auth/demo/login`)