oidc-provider (main) doxdox documentation

OAuth 2.0 Authorization Server implementation for Node.js with OpenID Connect

# constructor(name)

Creates an instance of MyAdapter for an oidc-provider model.

Parameters

Name Types Description
name string Name of the oidc-provider model. One of "Grant, "Session", "AccessToken", "AuthorizationCode", "RefreshToken", "ClientCredentials", "Client", "InitialAccessToken", "RegistrationAccessToken", "DeviceCode", "Interaction", "ReplayDetection", "BackchannelAuthenticationRequest", or "PushedAuthorizationRequest"

# consume(id)

Mark a stored oidc-provider model as consumed (not yet expired though!). Future finds for this id should be fulfilled with an object containing additional property named "consumed" with a truthy value (timestamp, date, boolean, etc).

Parameters

Name Types Description
id string Identifier of oidc-provider model

Returns

Promise

Promise fulfilled when the operation succeeded. Rejected with error when encountered.

# destroy(id)

Destroy/Drop/Remove a stored oidc-provider model. Future finds for this id should be fulfilled with falsy values.

Parameters

Name Types Description
id string Identifier of oidc-provider model

Returns

Promise

Promise fulfilled when the operation succeeded. Rejected with error when encountered.

# find(id)

Return previously stored instance of an oidc-provider model.

Parameters

Name Types Description
id string Identifier of oidc-provider model

Returns

Promise

Promise fulfilled with what was previously stored for the id (when found and not dropped yet due to expiration) or falsy value when not found anymore. Rejected with error when encountered.

# findByUid(uid)

Return previously stored instance of Session by its uid reference property.

Parameters

Name Types Description
uid string the uid value associated with a Session instance

Returns

Promise

Promise fulfilled with the stored session object (when found and not dropped yet due to expiration) or falsy value when not found anymore. Rejected with error when encountered.

# findByUserCode(userCode)

Return previously stored instance of DeviceCode by the end-user entered user code. You only need this method for the deviceFlow feature

Parameters

Name Types Description
userCode string the user_code value associated with a DeviceCode instance

Returns

Promise

Promise fulfilled with the stored device code object (when found and not dropped yet due to expiration) or falsy value when not found anymore. Rejected with error when encountered.

# revokeByGrantId(grantId)

Destroy/Drop/Remove a stored oidc-provider model by its grantId property reference. Future finds for all tokens having this grantId value should be fulfilled with falsy values.

Parameters

Name Types Description
grantId string the grantId value associated with a this model's instance

Returns

Promise

Promise fulfilled when the operation succeeded. Rejected with error when encountered.

# upsert(id, payload, expiresIn)

Update or Create an instance of an oidc-provider model.

Parameters

Name Types Description
id string Identifier that oidc-provider will use to reference this model instance for future operations.
payload object Object with all properties intended for storage.
expiresIn integer Number of seconds intended for this model to be stored.

Returns

Promise

Promise fulfilled when the operation succeeded. Rejected with error when encountered.

# claims(use, scope)

Parameters

Name Types Description
use - can either be "id_token" or "userinfo", depending on where the specific claims are intended to be put in.
scope - the intended scope, while oidc-provider will mask claims depending on the scope automatically you might want to skip loading some claims from external resources etc. based on this detail or not return them in id tokens but only userinfo and so on.

# allowClient()

features.clientIdMetadataDocument.allowClient description: Specifies a helper function that shall be invoked every time a client resolved from a metadata document is about to be used, including when served from cache. This function enables per-request evaluation of trust and authorization policies for metadata-document-resolved clients. Return true to allow the client, or false to reject it.

# allowFetch()

features.clientIdMetadataDocument.allowFetch description: Specifies a helper function that shall be invoked before fetching a client metadata document from a client_id URL. This function enables enforcement of domain allowlisting, rate limiting, or other security policies. Return true to allow the fetch, or false to reject the client_id.

# cacheDuration()

features.clientIdMetadataDocument.cacheDuration description: Specifies the minimum and maximum cache duration bounds (in seconds) applied to HTTP cache headers when caching fetched client metadata documents. Cache-Control and Expires response headers are respected within these bounds.

# interactionDetails()

# tSubmission()

# tSubmission()