Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(core): remove the requirement of secured app for PAT #6493

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 1 addition & 7 deletions packages/core/src/oidc/grants/token-exchange/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import { handleClientCertificate, handleDPoP, checkOrganizationAccess } from '..

import { validateSubjectToken } from './account.js';
import { handleActorToken } from './actor-token.js';
import { TokenExchangeTokenType, type TokenExchangeAct } from './types.js';
import { type TokenExchangeAct } from './types.js';

const { InvalidClient, InvalidGrant } = errors;

Expand Down Expand Up @@ -67,12 +67,6 @@ export const buildHandler: (
!(await isThirdPartyApplication(queries, client.clientId)),
new InvalidClient('third-party applications are not allowed for this grant type')
);
// Personal access tokens require secured client
assertThat(
params.subject_token_type !== TokenExchangeTokenType.PersonalAccessToken ||
client.tokenEndpointAuthMethod === 'client_secret_basic',
new InvalidClient('third-party applications are not allowed for this grant type')
);

validatePresence(ctx, ...requiredParameters);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -140,20 +140,6 @@ describe('Token Exchange (Personal Access Token)', () => {
expect(payload).toHaveProperty('sub', testUserId);
});

it('should fail with non-secure client authentication method', async () => {
await expect(
oidcApi.post('token', {
headers: formUrlEncodedHeaders,
body: new URLSearchParams({
client_id: testApiResourceId,
grant_type: GrantType.TokenExchange,
subject_token: testToken,
subject_token_type: tokenType,
}),
})
).rejects.toThrow();
});

it('should fail with invalid PAT', async () => {
await expect(
oidcApi.post('token', {
Expand Down
Loading