Skip to content
Merged
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
28 changes: 19 additions & 9 deletions types/oidc-provider/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export type FindAccount = (
token?: AuthorizationCode | AccessToken | DeviceCode | BackchannelAuthenticationRequest,
) => CanBePromise<Account | undefined>;
export type TokenFormat = "opaque" | "jwt";
export type FapiProfile = "1.0 ID2" | "1.0 Final";
export type FapiProfile = "1.0 ID2" | "1.0 Final" | "2.0";

export type TTLFunction<T> = (ctx: KoaContextWithOIDC, token: T, client: Client) => number;

Expand Down Expand Up @@ -56,6 +56,7 @@ export interface AllClientMetadata {
redirect_uris?: string[] | undefined;
grant_types?: string[] | undefined;
response_types?: ResponseType[] | undefined;
response_modes?: string[] | undefined;

application_type?: "web" | "native" | undefined;
client_id_issued_at?: number | undefined;
Expand Down Expand Up @@ -103,7 +104,6 @@ export interface AllClientMetadata {
authorization_signed_response_alg?: SigningAlgorithm | undefined;
authorization_encrypted_response_alg?: EncryptionAlgValues | undefined;
authorization_encrypted_response_enc?: EncryptionEncValues | undefined;
web_message_uris?: string[] | undefined;
tls_client_certificate_bound_access_tokens?: boolean | undefined;

require_signed_request_object?: boolean | undefined;
Expand Down Expand Up @@ -604,9 +604,9 @@ declare class IdToken {

declare class Client {
responseTypeAllowed(type: ResponseType): boolean;
responseModeAllowed(type: string, responseType: ResponseType, fapiProfile: FapiProfile | undefined): boolean;
grantTypeAllowed(type: string): boolean;
redirectUriAllowed(redirectUri: string): boolean;
webMessageUriAllowed(webMessageUri: string): boolean;
requestUriAllowed(requestUri: string): boolean;
postLogoutRedirectUriAllowed(postLogoutRedirectUri: string): boolean;
includeSid(): boolean;
Expand All @@ -621,6 +621,7 @@ declare class Client {
readonly grantTypes?: string[] | undefined;
readonly redirectUris?: string[] | undefined;
readonly responseTypes?: ResponseType[] | undefined;
readonly responseModes?: string[] | undefined;

readonly applicationType?: "web" | "native" | undefined;
readonly clientIdIssuedAt?: number | undefined;
Expand Down Expand Up @@ -670,7 +671,6 @@ declare class Client {
readonly authorizationSignedResponseAlg?: string | undefined;
readonly authorizationEncryptedResponseAlg?: string | undefined;
readonly authorizationEncryptedResponseEnc?: string | undefined;
readonly webMessageUris?: string[] | undefined;
readonly tlsClientCertificateBoundAccessTokens?: boolean | undefined;

readonly backchannelUserCodeParameter?: boolean | undefined;
Expand All @@ -681,6 +681,7 @@ declare class Client {
[key: string]: unknown;

static find(id: string): Promise<Client | undefined>;
static validate(metadata: ClientMetadata): Promise<void>;
}

export interface ResourceServer {
Expand Down Expand Up @@ -756,7 +757,6 @@ declare class OIDCContext {
readonly prompts: Set<string>;
readonly result?: InteractionResults | undefined;

readonly webMessageUriCheckPerformed?: boolean | undefined;
readonly redirectUriCheckPerformed?: boolean | undefined;
readonly trusted?: string[] | undefined;
readonly registrationAccessToken?: RegistrationAccessToken | undefined;
Expand Down Expand Up @@ -966,7 +966,11 @@ export interface Configuration {

discovery?: UnknownObject | undefined;

extraParams?: string[] | undefined;
extraParams?: string[] | {
[param: string]:
| null
| ((ctx: KoaContextWithOIDC, value: string | undefined, client: Client) => CanBePromise<void>);
} | undefined;

features?:
| {
Expand All @@ -979,6 +983,13 @@ export interface Configuration {
claimsParameter?:
| {
enabled?: boolean | undefined;
assertClaimsParameter?:
| ((
ctx: KoaContextWithOIDC,
claims: ClaimsParameter,
client: Client,
) => CanBePromise<void>)
| undefined;
}
| undefined;

Expand Down Expand Up @@ -1092,6 +1103,7 @@ export interface Configuration {
enabled?: boolean | undefined;
nonceSecret?: Buffer | undefined;
requireNonce?: (ctx: KoaContextWithOIDC) => boolean;
allowReplay?: boolean;
}
| undefined;

Expand Down Expand Up @@ -1161,6 +1173,7 @@ export interface Configuration {
pushedAuthorizationRequests?:
| {
requirePushedAuthorizationRequests?: boolean | undefined;
allowUnregisteredRedirectUris?: boolean | undefined;
enabled?: boolean | undefined;
}
| undefined;
Expand Down Expand Up @@ -2292,9 +2305,6 @@ export namespace errors {
class UnsupportedResponseType extends OIDCProviderError {
constructor(description?: string, detail?: string);
}
class WebMessageUriMismatch extends OIDCProviderError {
constructor(description?: string, detail?: string);
}
class CustomOIDCProviderError extends OIDCProviderError {
constructor(message: string, description?: string);
}
Expand Down
11 changes: 11 additions & 0 deletions types/oidc-provider/oidc-provider-tests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,17 @@ new Provider("https://op.example.com", {
},
});

new Provider("https://op.example.com", {
extraParams: {
foo: null,
bar: (ctx, value, client) => {
ctx.oidc.issuer.substring(0);
value?.substring(0);
client.clientId.substring(0);
},
},
});

new Provider("https://op.example.com", {
adapter: class Adapter {
name: string;
Expand Down
2 changes: 1 addition & 1 deletion types/oidc-provider/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"private": true,
"name": "@types/oidc-provider",
"version": "8.4.9999",
"version": "8.5.9999",
"projects": [
"https://github.com/panva/node-oidc-provider"
],
Expand Down