Skip to content

Commit 2612f5e

Browse files
committed
refactor: rename config options to authenticateIntrospect & authenticateRevoke
1 parent eedd548 commit 2612f5e

File tree

6 files changed

+15
-15
lines changed

6 files changed

+15
-15
lines changed

docs/docs/authorization_server/configuration.mdx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ The authorization server has a few optional settings with the following default
1515
| `notBeforeLeeway` | number | 0 | Implementers MAY provide for some small leeway, usually no more than a few minutes, to account for clock skew. Its value MUST be a number containing a NumericDate value. |
1616
| `tokenCID` | "id" or "name" | "id" | Sets the JWT `accessToken.cid` to either the `client.id` or `client.name`.<br /><br />In 3.x the default is **"id"**, in v2.x the default was **"name"**. [[Learn more]][token-cid] |
1717
| `issuer` | string \| undefined | undefined | Sets the JWT `accessToken.iss` to this value. |
18-
| `introspectWithClientCredentials` | boolean | false | Authorize [the /introspect endpoint](../endpoints/introspect.mdx) using `client_credentials`, this requires users to pass in a valid client_id and client_secret (or Authorization header) |
19-
| `revokeWithClientCredentials` | boolean | false | Authorize [the /revoke endpoint](../endpoints/revoke.mdx) using `client_credentials`, this requires users to pass in a valid client_id and client_secret (or Authorization header) |
18+
| `authenticateIntrospect` | boolean | false | Authorize [the /introspect endpoint](../endpoints/introspect.mdx) using `client_credentials`, this requires users to pass in a valid client_id and client_secret (or Authorization header) |
19+
| `authenticateRevoke` | boolean | false | Authorize [the /revoke endpoint](../endpoints/revoke.mdx) using `client_credentials`, this requires users to pass in a valid client_id and client_secret (or Authorization header) |
2020

2121
```ts
2222
type AuthorizationServerOptions = {
@@ -25,8 +25,8 @@ type AuthorizationServerOptions = {
2525
notBeforeLeeway: 0;
2626
tokenCID: "id" | "name";
2727
issuer: undefined;
28-
introspectWithClientCredentials: boolean;
29-
revokeWithClientCredentials: boolean;
28+
authenticateIntrospect: boolean;
29+
authenticateRevoke: boolean;
3030
};
3131
```
3232

src/authorization_server.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@ export interface AuthorizationServerOptions {
3030
tokenCID: "id" | "name";
3131
issuer?: string;
3232
scopeDelimiter: string;
33-
introspectWithClientCredentials: boolean;
34-
revokeWithClientCredentials: boolean;
33+
authenticateIntrospect: boolean;
34+
authenticateRevoke: boolean;
3535
}
3636

3737
export type EnableableGrants =

src/grants/auth_code.grant.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -314,7 +314,7 @@ export class AuthCodeGrant extends AbstractAuthorizedGrant {
314314
async respondToRevokeRequest(req: RequestInterface): Promise<ResponseInterface> {
315315
req.body["grant_type"] = this.identifier;
316316

317-
if (this.options.revokeWithClientCredentials) await this.validateClient(req);
317+
if (this.options.authenticateRevoke) await this.validateClient(req);
318318

319319
const token = this.getRequestParameter("token", req);
320320

src/grants/client_credentials.grant.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ export class ClientCredentialsGrant extends AbstractGrant {
3232
async respondToIntrospectRequest(req: RequestInterface): Promise<ResponseInterface> {
3333
req.body["grant_type"] = this.identifier;
3434

35-
if (this.options.introspectWithClientCredentials) await this.validateClient(req);
35+
if (this.options.authenticateIntrospect) await this.validateClient(req);
3636

3737
const { parsedToken, oauthToken, expiresAt, tokenType } = await this.tokenFromRequest(req);
3838

@@ -60,7 +60,7 @@ export class ClientCredentialsGrant extends AbstractGrant {
6060
async respondToRevokeRequest(req: RequestInterface): Promise<ResponseInterface> {
6161
req.body["grant_type"] = this.identifier;
6262

63-
if (this.options.revokeWithClientCredentials) await this.validateClient(req);
63+
if (this.options.authenticateRevoke) await this.validateClient(req);
6464

6565
let { oauthToken } = await this.tokenFromRequest(req);
6666

src/options.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,6 @@ export const DEFAULT_AUTHORIZATION_SERVER_OPTIONS: AuthorizationServerOptions =
77
tokenCID: "id",
88
issuer: undefined,
99
scopeDelimiter: " ",
10-
introspectWithClientCredentials: false,
11-
revokeWithClientCredentials: false,
10+
authenticateIntrospect: false,
11+
authenticateRevoke: false,
1212
};

test/e2e/authorization_server.spec.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -361,15 +361,15 @@ describe("authorization_server", () => {
361361
inMemoryDatabase.clients[client.id] = client;
362362
});
363363

364-
describe("without option introspectWithClientCredentials=false", () => {
364+
describe("without option authenticateIntrospect=false", () => {
365365
it("does not require client credentials", async () => {
366366
authorizationServer = new AuthorizationServer(
367367
inMemoryClientRepository,
368368
inMemoryAccessTokenRepository,
369369
inMemoryScopeRepository,
370370
new JwtService("secret-key"),
371371
{
372-
introspectWithClientCredentials: false,
372+
authenticateIntrospect: false,
373373
},
374374
);
375375

@@ -556,15 +556,15 @@ describe("authorization_server", () => {
556556
inMemoryDatabase.clients[client.id] = client;
557557
});
558558

559-
describe("without option revokeWithClientCredentials=false", () => {
559+
describe("without option authenticateRevoke=false", () => {
560560
it("does not require client credentials", async () => {
561561
const authorizationServer = new AuthorizationServer(
562562
inMemoryClientRepository,
563563
inMemoryAccessTokenRepository,
564564
inMemoryScopeRepository,
565565
new JwtService("secret-key"),
566566
{
567-
revokeWithClientCredentials: false,
567+
authenticateRevoke: false,
568568
},
569569
);
570570

0 commit comments

Comments
 (0)