Skip to content

Commit 56c9d68

Browse files
committed
refactor: revert method rename
1 parent fe86d0d commit 56c9d68

File tree

7 files changed

+9
-9
lines changed

7 files changed

+9
-9
lines changed

src/authorization_server.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ export class AuthorizationServer {
114114

115115
validateAuthorizationRequest(req: RequestInterface): Promise<AuthorizationRequest> {
116116
for (const grant of Object.values(this.enabledGrantTypes)) {
117-
if (grant.handlesResponseTypeForAuthorizationRequest(req)) {
117+
if (grant.canRespondToAuthorizationRequest(req)) {
118118
return grant.validateAuthorizationRequest(req);
119119
}
120120
}

src/grants/abstract/abstract.grant.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -267,7 +267,7 @@ export abstract class AbstractGrant implements GrantInterface {
267267
return this.getRequestParameter("grant_type", request) === this.identifier;
268268
}
269269

270-
handlesResponseTypeForAuthorizationRequest(_request: RequestInterface): boolean {
270+
canRespondToAuthorizationRequest(_request: RequestInterface): boolean {
271271
return false;
272272
}
273273

src/grants/abstract/grant.interface.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ export interface GrantInterface {
1515

1616
respondToAccessTokenRequest(request: RequestInterface, accessTokenTTL: DateInterval): Promise<ResponseInterface>;
1717

18-
handlesResponseTypeForAuthorizationRequest(request: RequestInterface): boolean;
18+
canRespondToAuthorizationRequest(request: RequestInterface): boolean;
1919

2020
validateAuthorizationRequest(request: RequestInterface): Promise<AuthorizationRequest>;
2121

src/grants/auth_code.grant.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ export class AuthCodeGrant extends AbstractAuthorizedGrant {
118118
return await this.makeBearerTokenResponse(client, accessToken, scopes, extraJwtFields);
119119
}
120120

121-
handlesResponseTypeForAuthorizationRequest(request: RequestInterface): boolean {
121+
canRespondToAuthorizationRequest(request: RequestInterface): boolean {
122122
return this.getQueryStringParameter("response_type", request) === "code"
123123
}
124124

src/grants/implicit.grant.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ export class ImplicitGrant extends AbstractAuthorizedGrant {
1616
throw OAuthException.badRequest("The implicit grant can't respond to access token requests");
1717
}
1818

19-
handlesResponseTypeForAuthorizationRequest(request: RequestInterface): boolean {
19+
canRespondToAuthorizationRequest(request: RequestInterface): boolean {
2020
return this.getQueryStringParameter("response_type", request) === "token"
2121
}
2222

test/unit/grants/auth_code.grant.spec.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ describe("authorization_code grant", () => {
8383
it("returns true for valid request", async () => {
8484
request = new OAuthRequest({ query: validQueryData });
8585

86-
expect(grant.handlesResponseTypeForAuthorizationRequest(request)).toBe(true);
86+
expect(grant.canRespondToAuthorizationRequest(request)).toBe(true);
8787
});
8888

8989
it("returns false when response_type !== code", async () => {
@@ -94,7 +94,7 @@ describe("authorization_code grant", () => {
9494
},
9595
});
9696

97-
expect(grant.handlesResponseTypeForAuthorizationRequest(request)).toBe(false);
97+
expect(grant.canRespondToAuthorizationRequest(request)).toBe(false);
9898
});
9999
});
100100

test/unit/grants/implicit.grant.spec.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,7 @@ describe("implicit grant", () => {
216216
});
217217

218218
// act
219-
const canRespond = grant.handlesResponseTypeForAuthorizationRequest(request);
219+
const canRespond = grant.canRespondToAuthorizationRequest(request);
220220

221221
// assert
222222
expect(canRespond).toBeTruthy();
@@ -227,7 +227,7 @@ describe("implicit grant", () => {
227227
request = new OAuthRequest({ query: {} });
228228

229229
// assert
230-
expect(grant.handlesResponseTypeForAuthorizationRequest(request)).toBeFalsy();
230+
expect(grant.canRespondToAuthorizationRequest(request)).toBeFalsy();
231231
expect(grant.canRespondToAccessTokenRequest(request)).toBeFalsy();
232232
});
233233
});

0 commit comments

Comments
 (0)