Skip to content

Commit

Permalink
fix(typescript): added revokeByGrantId types to appropriate models
Browse files Browse the repository at this point in the history
  • Loading branch information
fiznool committed Mar 30, 2020
1 parent ec9b741 commit 883b038
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
8 changes: 8 additions & 0 deletions types/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -376,6 +376,8 @@ declare class RefreshToken extends BaseToken {
totalLifetime(): number;
isSenderConstrained(): boolean;
consume(): Promise<void>;

static revokeByGrantId(grantId: string): Promise<void>;
}

declare class AuthorizationCode extends BaseToken {
Expand Down Expand Up @@ -422,6 +424,8 @@ declare class AuthorizationCode extends BaseToken {
gty?: string;

consume(): Promise<void>;

static revokeByGrantId(grantId: string): Promise<void>;
}

declare class DeviceCode extends BaseToken {
Expand Down Expand Up @@ -461,6 +465,8 @@ declare class DeviceCode extends BaseToken {
consumed: any;

consume(): Promise<void>;

static revokeByGrantId(grantId: string): Promise<void>;
}

declare class ClientCredentials extends BaseToken {
Expand Down Expand Up @@ -531,6 +537,8 @@ declare class AccessToken extends BaseToken {

setAudiences(audience: string | string[]): void;
isSenderConstrained(): boolean;

static revokeByGrantId(grantId: string): Promise<void>;
}

declare class IdToken {
Expand Down
9 changes: 9 additions & 0 deletions types/oidc-provider-tests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -544,4 +544,13 @@ provider.use(async (ctx, next) => {
if (accessToken !== undefined) {
accessToken.jti.substring(0);
}

try {
await Promise.all([
provider.AccessToken.revokeByGrantId('grantId'),
provider.AuthorizationCode.revokeByGrantId('grantId'),
provider.DeviceCode.revokeByGrantId('grantId'),
provider.RefreshToken.revokeByGrantId('grantId'),
]);
} catch(e) {}
})();

0 comments on commit 883b038

Please sign in to comment.