Skip to content

Commit fc403c3

Browse files
fix critical bug for scope validation
1 parent 74f07c3 commit fc403c3

File tree

3 files changed

+12
-12
lines changed

3 files changed

+12
-12
lines changed

lib/grant-types/authorization-code-grant-type.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -187,10 +187,10 @@ class AuthorizationCodeGrantType extends AbstractGrantType {
187187
* Save token.
188188
*/
189189

190-
async saveToken(user, client, authorizationCode, scope) {
191-
const validatedScope = await this.validateScope(user, client, scope);
192-
const accessToken = await this.generateAccessToken(client, user, scope);
193-
const refreshToken = await this.generateRefreshToken(client, user, scope);
190+
async saveToken(user, client, authorizationCode, requestedScope) {
191+
const validatedScope = await this.validateScope(user, client, requestedScope);
192+
const accessToken = await this.generateAccessToken(client, user, validatedScope);
193+
const refreshToken = await this.generateRefreshToken(client, user, validatedScope);
194194
const accessTokenExpiresAt = await this.getAccessTokenExpiresAt();
195195
const refreshTokenExpiresAt = await this.getRefreshTokenExpiresAt();
196196

lib/grant-types/client-credentials-grant-type.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -68,10 +68,10 @@ class ClientCredentialsGrantType extends AbstractGrantType {
6868
* Save token.
6969
*/
7070

71-
async saveToken(user, client, scope) {
72-
const validatedScope = await this.validateScope(user, client, scope);
73-
const accessToken = await this.generateAccessToken(client, user, scope);
74-
const accessTokenExpiresAt = await this.getAccessTokenExpiresAt(client, user, scope);
71+
async saveToken(user, client, requestedScope) {
72+
const validatedScope = await this.validateScope(user, client, requestedScope);
73+
const accessToken = await this.generateAccessToken(client, user, validatedScope);
74+
const accessTokenExpiresAt = await this.getAccessTokenExpiresAt(client, user, validatedScope);
7575
const token = {
7676
accessToken: accessToken,
7777
accessTokenExpiresAt: accessTokenExpiresAt,

lib/grant-types/password-grant-type.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -86,10 +86,10 @@ class PasswordGrantType extends AbstractGrantType {
8686
* Save token.
8787
*/
8888

89-
async saveToken(user, client, scope) {
90-
const validatedScope = await this.validateScope(user, client, scope);
91-
const accessToken = await this.generateAccessToken(client, user, scope);
92-
const refreshToken = await this.generateRefreshToken(client, user, scope);
89+
async saveToken(user, client, requestedScope) {
90+
const validatedScope = await this.validateScope(user, client, requestedScope);
91+
const accessToken = await this.generateAccessToken(client, user, validatedScope);
92+
const refreshToken = await this.generateRefreshToken(client, user, validatedScope);
9393
const accessTokenExpiresAt = await this.getAccessTokenExpiresAt();
9494
const refreshTokenExpiresAt = await this.getRefreshTokenExpiresAt();
9595

0 commit comments

Comments
 (0)