Skip to content

Commit

Permalink
Added new dependecy undici for typechecking & updated mtls related te…
Browse files Browse the repository at this point in the history
…mplate string
  • Loading branch information
gyaneshgouraw-okta committed May 6, 2024
1 parent ffba4af commit 0d041f4
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 9 deletions.
18 changes: 17 additions & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@
"ts-jest": "^29.1.0",
"ts-node": "^10.9.1",
"typedoc": "^0.24.6",
"typescript": "4.9.5"
"typescript": "4.9.5",
"undici": "^6.15.0"
}
}
2 changes: 1 addition & 1 deletion src/auth/oauth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,7 @@ export class OAuth extends BaseAuthAPI {
constructor(options: AuthenticationClientOptions) {
super({
...options,
domain: options.useMTLS ? `${mtlsPrefix}.` + options.domain : options.domain,
domain: options.useMTLS ? `${mtlsPrefix}.${options.domain}` : options.domain,
});
this.idTokenValidator = new IDTokenValidator(options);
}
Expand Down
4 changes: 2 additions & 2 deletions src/lib/models.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { RetryConfiguration } from './retry.js';
import { Dispatcher } from 'undici';

/**
* @private
Expand All @@ -25,8 +26,7 @@ export interface Configuration {
/**
* Pass your own http agent to support proxies.
*/
// https://github.com/octokit/types.ts/blob/v10.0.0/src/RequestRequestOptions.ts#L13
agent?: unknown;
agent?: Dispatcher;
/**
* Custom headers that will be added to every request.
*/
Expand Down
8 changes: 4 additions & 4 deletions test/auth/client-authentication.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { jest } from '@jest/globals';
import * as jose from 'jose';
import { AuthenticationClient } from '../../src/index.js';
import { TEST_PUBLIC_KEY, TEST_PRIVATE_KEY } from '../constants.js';

import { Agent } from 'undici';
const URL = 'https://tenant.auth0.com/';
const clientId = 'test-client-id';
const verifyOpts = {
Expand Down Expand Up @@ -241,9 +241,9 @@ describe('mTLS-authentication', () => {
const auth0 = new AuthenticationClient({
domain: 'tenant.auth0.com',
clientId,
agent: {
options: { key: 'my-key', cert: 'my-cert' },
},
agent: new Agent({
connect: { cert: 'my-cert', key: 'my-key' },
}),
useMTLS: true,
});
await auth0.oauth.clientCredentialsGrant({
Expand Down

0 comments on commit 0d041f4

Please sign in to comment.