diff --git a/types/openid-client/index.d.ts b/types/openid-client/index.d.ts index 4ab686ab42..0d5b3c8122 100644 --- a/types/openid-client/index.d.ts +++ b/types/openid-client/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/panva/node-openid-client // Definitions by: ulrichb // Brandon Shelton +// Richard Honor // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 3.0 @@ -89,6 +90,22 @@ export interface EndSessionUrlParameters { readonly state?: string; } +export interface IntrospectionResponse { + readonly active: boolean; + readonly scope?: string; + readonly client_id?: string; + readonly username?: string; + readonly token_type?: string; + readonly exp?: number; + readonly iat?: number; + readonly nbf?: number; + readonly sub?: string; + readonly aud?: string; + readonly iss?: string; + readonly jti?: string; + readonly [key: string]: unknown; +} + export class Client { static [custom.http_options]: CustomHttpOptionsProvider; @@ -127,7 +144,7 @@ export class Client { token: string, tokenTypeHint?: string, extras?: { readonly introspectBody?: object } - ): Promise<{ readonly [name: string]: {} | null | undefined }>; + ): Promise; } export class TokenSet { diff --git a/types/openid-client/openid-client-tests.ts b/types/openid-client/openid-client-tests.ts index 9ee8784a4a..0dc135a8b1 100644 --- a/types/openid-client/openid-client-tests.ts +++ b/types/openid-client/openid-client-tests.ts @@ -1,5 +1,9 @@ import { IncomingMessage } from 'http'; -import { Issuer, generators, custom } from 'openid-client'; +import { + custom, + generators, + Issuer, +} from 'openid-client'; async (req: IncomingMessage) => { // Custom HTTP options on the `Issuer` _c'tor_ (e.g. used for `Issuer.discover()`): @@ -90,6 +94,7 @@ async (req: IncomingMessage) => { // const introspectResponse = await client.introspect('token'); + const active: boolean = introspectResponse.active; console.log(introspectResponse['some claim name']); client.introspect('token', 'tokenTypeHint');