fix: Prefer the token_endpoint_auth_method response from DCR registration (#1022)
This commit is contained in:
parent
e74a358728
commit
874aa27a89
1 changed files with 47 additions and 11 deletions
|
|
@ -10,7 +10,8 @@ import {
|
|||
discoverOAuthProtectedResourceMetadata,
|
||||
extractResourceMetadataUrl,
|
||||
auth,
|
||||
type OAuthClientProvider
|
||||
type OAuthClientProvider,
|
||||
selectClientAuthMethod
|
||||
} from './auth.js';
|
||||
import { ServerError } from '../server/auth/errors.js';
|
||||
import { AuthorizationServerMetadata } from '../shared/auth.js';
|
||||
|
|
@ -881,6 +882,25 @@ describe('OAuth Authorization', () => {
|
|||
});
|
||||
});
|
||||
|
||||
describe('selectClientAuthMethod', () => {
|
||||
it('selects the correct client authentication method from client information', () => {
|
||||
const clientInfo = {
|
||||
client_id: 'test-client-id',
|
||||
client_secret: 'test-client-secret',
|
||||
token_endpoint_auth_method: 'client_secret_basic'
|
||||
};
|
||||
const supportedMethods = ['client_secret_post', 'client_secret_basic', 'none'];
|
||||
const authMethod = selectClientAuthMethod(clientInfo, supportedMethods);
|
||||
expect(authMethod).toBe('client_secret_basic');
|
||||
});
|
||||
it('selects the correct client authentication method from supported methods', () => {
|
||||
const clientInfo = { client_id: 'test-client-id' };
|
||||
const supportedMethods = ['client_secret_post', 'client_secret_basic', 'none'];
|
||||
const authMethod = selectClientAuthMethod(clientInfo, supportedMethods);
|
||||
expect(authMethod).toBe('none');
|
||||
});
|
||||
});
|
||||
|
||||
describe('startAuthorization', () => {
|
||||
const validMetadata = {
|
||||
issuer: 'https://auth.example.com',
|
||||
|
|
|
|||
Loading…
Reference in a new issue