Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Passing validated scope into generateAccessToken. #620

Open
wants to merge 1 commit into
base: v5-dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions lib/grant-types/authorization-code-grant-type.ts
Original file line number Diff line number Diff line change
Expand Up @@ -183,8 +183,8 @@ export class AuthorizationCodeGrantType extends AbstractGrantType {
scope: string,
) {
const accessScope = await this.validateScope(user, client, scope);
const accessToken = await this.generateAccessToken(client, user, scope);
const refreshToken = await this.generateRefreshToken(client, user, scope);
const accessToken = await this.generateAccessToken(client, user, accessScope);
const refreshToken = await this.generateRefreshToken(client, user, accessScope);
const accessTokenExpiresAt = this.getAccessTokenExpiresAt();
const refreshTokenExpiresAt = this.getRefreshTokenExpiresAt();

Expand Down
2 changes: 1 addition & 1 deletion lib/grant-types/client-credentials-grant-type.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ export class ClientCredentialsGrantType extends AbstractGrantType {

async saveToken(user: User, client: Client, scope: string) {
const accessScope = await this.validateScope(user, client, scope);
const accessToken = await this.generateAccessToken(client, user, scope);
const accessToken = await this.generateAccessToken(client, user, accessScope);
const accessTokenExpiresAt = this.getAccessTokenExpiresAt();

const token = {
Expand Down
6 changes: 3 additions & 3 deletions lib/grant-types/implicit-grant-type.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,14 +48,14 @@ export class ImplicitGrantType extends AbstractGrantType {
*/

async saveToken(user: User, client: Client, scope: string) {
const validatedScope = await this.validateScope(user, client, scope);
const accessToken = await this.generateAccessToken(client, user, scope);
const accessScope = await this.validateScope(user, client, scope);
const accessToken = await this.generateAccessToken(client, user, accessScope);
const accessTokenExpiresAt = this.getAccessTokenExpiresAt();

const token = {
accessToken,
accessTokenExpiresAt,
scope: validatedScope,
scope: accessScope,
} as Token;

return this.model.saveToken(token, client, user);
Expand Down
4 changes: 2 additions & 2 deletions lib/grant-types/password-grant-type.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,8 @@ export class PasswordGrantType extends AbstractGrantType {

async saveToken(user: User, client: Client, scope: string) {
const accessScope = await this.validateScope(user, client, scope);
const accessToken = await this.generateAccessToken(client, user, scope);
const refreshToken = await this.generateRefreshToken(client, user, scope);
const accessToken = await this.generateAccessToken(client, user, accessScope);
const refreshToken = await this.generateRefreshToken(client, user, accessScope);
const accessTokenExpiresAt = this.getAccessTokenExpiresAt();
const refreshTokenExpiresAt = this.getRefreshTokenExpiresAt();

Expand Down