Skip to content

Commit

Permalink
chore: remove feature guard for token exchange
Browse files Browse the repository at this point in the history
  • Loading branch information
wangsijie committed Jul 15, 2024
1 parent fcd1791 commit 22a96fe
Show file tree
Hide file tree
Showing 6 changed files with 3 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import { useState } from 'react';
import { useFormContext } from 'react-hook-form';
import { useTranslation } from 'react-i18next';

import { isDevFeaturesEnabled } from '@/consts/env';
import { type JwtCustomizerForm } from '@/pages/CustomizeJwtDetails/type';
import {
environmentVariablesCodeExample,
Expand Down Expand Up @@ -79,7 +78,7 @@ function InstructionTab({ isActive }: Props) {
/>
</GuideCard>
)}
{isDevFeaturesEnabled && tokenType === LogtoJwtTokenKeyType.AccessToken && (
{tokenType === LogtoJwtTokenKeyType.AccessToken && (
<GuideCard
name={CardType.GrantData}
isExpanded={expendCard === CardType.GrantData}
Expand Down
3 changes: 1 addition & 2 deletions packages/core/src/routes/subject-token.openapi.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@
{
"name": "Subject tokens",
"description": "The subject token API provides the ability to create a new subject token for the use of impersonating the user."
},
{ "name": "Dev feature" }
}
],
"paths": {
"/api/subject-tokens": {
Expand Down
5 changes: 0 additions & 5 deletions packages/core/src/routes/subject-token.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import { addSeconds } from 'date-fns';
import { object, string } from 'zod';

import { subjectTokenExpiresIn, subjectTokenPrefix } from '#src/constants/index.js';
import { EnvSet } from '#src/env-set/index.js';
import koaGuard from '#src/middleware/koa-guard.js';
import koaQuotaGuard from '#src/middleware/koa-quota-guard.js';

Expand All @@ -24,10 +23,6 @@ export default function subjectTokenRoutes<T extends ManagementApiRouter>(
subjectTokens: { insertSubjectToken },
} = queries;

if (!EnvSet.values.isDevFeaturesEnabled) {
return;
}

router.post(
'/subject-tokens',
koaQuotaGuard({ key: 'subjectTokenEnabled', quota }),
Expand Down
6 changes: 1 addition & 5 deletions packages/core/src/routes/swagger/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -153,11 +153,7 @@ const identifiableEntityNames = Object.freeze([

/** Additional tags that cannot be inferred from the path. */
const additionalTags = Object.freeze(
condArray<string>(
'Organization applications',
EnvSet.values.isDevFeaturesEnabled && 'Subject tokens',
'Organization users'
)
condArray<string>('Organization applications', 'Organization users')
);

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,16 +22,13 @@ import { createUserByAdmin } from '#src/helpers/index.js';
import { OrganizationApiTest } from '#src/helpers/organization.js';
import { enableAllPasswordSignInMethods } from '#src/helpers/sign-in-experience.js';
import {
devFeatureTest,
getAccessTokenPayload,
randomString,
generateName,
generatePassword,
generateUsername,
} from '#src/utils.js';

const { describe, it } = devFeatureTest;

describe('Token Exchange', () => {
const username = generateUsername();
const password = generatePassword();
Expand Down
3 changes: 0 additions & 3 deletions packages/integration-tests/src/tests/api/security.test.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
import { createSubjectToken } from '#src/api/subject-token.js';
import { createUserByAdmin } from '#src/helpers/index.js';
import { devFeatureTest } from '#src/utils.js';

const { describe, it } = devFeatureTest;

describe('subject-tokens', () => {
it('should create a subject token successfully', async () => {
Expand Down

0 comments on commit 22a96fe

Please sign in to comment.