Skip to content

Commit

Permalink
refactor: remove deprecated pkceMethods configuration property
Browse files Browse the repository at this point in the history
BREAKING CHANGE: The deprecated `pkceMethods` configuration property was
removed, use `pkce.methods` instead.
  • Loading branch information
panva committed May 14, 2020
1 parent 3076f32 commit 65712d0
Show file tree
Hide file tree
Showing 5 changed files with 1 addition and 54 deletions.
12 changes: 0 additions & 12 deletions lib/helpers/configuration.js
Original file line number Diff line number Diff line change
Expand Up @@ -363,12 +363,6 @@ class Configuration {
}

checkPkceMethods() {
if (this.pkceMethods) {
this.pkceMethodsDeprecationNotice();
this.pkce.methods = this.pkceMethods;
delete this.pkceMethods;
}

if (!Array.isArray(this.pkce.methods)) {
throw new TypeError('pkce.methods must be an array');
}
Expand Down Expand Up @@ -535,12 +529,6 @@ class Configuration {
}
}

Configuration.prototype.pkceMethodsDeprecationNotice = deprecate(
/* istanbul ignore next */
() => {},
`pkceMethods is deprecated, use pkce.methods for configuring it instead, see ${docs('pkce')}`,
);

Configuration.prototype.postLogoutSuccessSourceDeprecationNotice = deprecate(
/* istanbul ignore next */
() => {},
Expand Down
1 change: 0 additions & 1 deletion lib/helpers/defaults.js
Original file line number Diff line number Diff line change
Expand Up @@ -2682,7 +2682,6 @@ function getDefaults() {
],
},

pkceMethods: undefined,
postLogoutSuccessSource: undefined,
logoutSource: undefined,
};
Expand Down
39 changes: 1 addition & 38 deletions test/configuration/constructor.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -171,45 +171,8 @@ describe('Provider configuration', () => {
});
});

describe('pkceMethods', () => {
it('validates configuration pkceMethods members', () => {
const throws = [
() => {
new Provider('http://localhost:3000', {
pkceMethods: ['S256', 'plain', 'foobar'],
});
},
() => {
new Provider('http://localhost:3000', {
pkceMethods: ['foobar'],
});
},
];

throws.forEach((fn) => {
expect(fn).to.throw('only plain and S256 code challenge methods are supported');
});
});

it('validates configuration pkceMethods presence', () => {
expect(() => {
new Provider('http://localhost:3000', {
pkceMethods: [],
});
}).to.throw('pkce.methods must not be empty');
});

it('validates configuration pkceMethods type', () => {
expect(() => {
new Provider('http://localhost:3000', {
pkceMethods: 'public',
});
}).to.throw('pkce.methods must be an array');
});
});

describe('pkce.methods', () => {
it('validates configuration pkceMethods members', () => {
it('validates configuration pkce.methods members', () => {
const throws = [
() => {
new Provider('http://localhost:3000', {
Expand Down
2 changes: 0 additions & 2 deletions types/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1035,8 +1035,6 @@ export interface Configuration {

responseTypes?: ResponseType[];

pkceMethods?: PKCEMethods[];

pkce?: {
methods: PKCEMethods[];
required?: (ctx: KoaContextWithOIDC, client: Client) => boolean;
Expand Down
1 change: 0 additions & 1 deletion types/oidc-provider-tests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,6 @@ const provider = new Provider('https://op.example.com', {
],
},
responseTypes: ['code', 'code id_token', 'none'],
pkceMethods: ['plain', 'S256'],
pkce: {
methods: ['plain', 'S256'],
required(ctx, client) {
Expand Down

0 comments on commit 65712d0

Please sign in to comment.