Skip to content

Commit

Permalink
fix: critical scope validation bug resolved
Browse files Browse the repository at this point in the history
Merge pull request #228 from jorenvandeweyer/bugfix/validate-scope
  • Loading branch information
jankapunkt authored Aug 26, 2023
2 parents 74f07c3 + fc403c3 commit f460371
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 12 deletions.
8 changes: 4 additions & 4 deletions lib/grant-types/authorization-code-grant-type.js
Original file line number Diff line number Diff line change
Expand Up @@ -187,10 +187,10 @@ class AuthorizationCodeGrantType extends AbstractGrantType {
* Save token.
*/

async saveToken(user, client, authorizationCode, scope) {
const validatedScope = await this.validateScope(user, client, scope);
const accessToken = await this.generateAccessToken(client, user, scope);
const refreshToken = await this.generateRefreshToken(client, user, scope);
async saveToken(user, client, authorizationCode, requestedScope) {
const validatedScope = await this.validateScope(user, client, requestedScope);
const accessToken = await this.generateAccessToken(client, user, validatedScope);
const refreshToken = await this.generateRefreshToken(client, user, validatedScope);
const accessTokenExpiresAt = await this.getAccessTokenExpiresAt();
const refreshTokenExpiresAt = await this.getRefreshTokenExpiresAt();

Expand Down
8 changes: 4 additions & 4 deletions lib/grant-types/client-credentials-grant-type.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,10 +68,10 @@ class ClientCredentialsGrantType extends AbstractGrantType {
* Save token.
*/

async saveToken(user, client, scope) {
const validatedScope = await this.validateScope(user, client, scope);
const accessToken = await this.generateAccessToken(client, user, scope);
const accessTokenExpiresAt = await this.getAccessTokenExpiresAt(client, user, scope);
async saveToken(user, client, requestedScope) {
const validatedScope = await this.validateScope(user, client, requestedScope);
const accessToken = await this.generateAccessToken(client, user, validatedScope);
const accessTokenExpiresAt = await this.getAccessTokenExpiresAt(client, user, validatedScope);
const token = {
accessToken: accessToken,
accessTokenExpiresAt: accessTokenExpiresAt,
Expand Down
8 changes: 4 additions & 4 deletions lib/grant-types/password-grant-type.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,10 +86,10 @@ class PasswordGrantType extends AbstractGrantType {
* Save token.
*/

async saveToken(user, client, scope) {
const validatedScope = await this.validateScope(user, client, scope);
const accessToken = await this.generateAccessToken(client, user, scope);
const refreshToken = await this.generateRefreshToken(client, user, scope);
async saveToken(user, client, requestedScope) {
const validatedScope = await this.validateScope(user, client, requestedScope);
const accessToken = await this.generateAccessToken(client, user, validatedScope);
const refreshToken = await this.generateRefreshToken(client, user, validatedScope);
const accessTokenExpiresAt = await this.getAccessTokenExpiresAt();
const refreshTokenExpiresAt = await this.getRefreshTokenExpiresAt();

Expand Down

0 comments on commit f460371

Please sign in to comment.