diff --git a/example/my_adapter.js b/example/my_adapter.js index fcee2bf9e..730eedb3b 100644 --- a/example/my_adapter.js +++ b/example/my_adapter.js @@ -10,7 +10,8 @@ class MyAdapter { * @constructor * @param {string} name Name of the oidc-provider model. One of "Grant, "Session", "AccessToken", * "AuthorizationCode", "RefreshToken", "ClientCredentials", "Client", "InitialAccessToken", - * "RegistrationAccessToken", "DeviceCode", "Interaction", "ReplayDetection", or "PushedAuthorizationRequest" + * "RegistrationAccessToken", "DeviceCode", "Interaction", "ReplayDetection", + * "BackchannelAuthenticationRequest", or "PushedAuthorizationRequest" * */ constructor(name) { @@ -71,15 +72,16 @@ class MyAdapter { * - gty {string} - [AccessToken, RefreshToken only] space delimited grant values, indicating * the grant type(s) they originate from (implicit, authorization_code, refresh_token or * device_code) the original one is always first, second is refresh_token if refreshed - * - params {object} - [DeviceCode only] an object with the authorization request parameters - * as requested by the client with device_authorization_endpoint + * - params {object} - [DeviceCode and BackchannelAuthenticationRequest only] an object with the + * authorization request parameters as requested by the client with device_authorization_endpoint * - userCode {string} - [DeviceCode only] user code value * - deviceInfo {object} - [DeviceCode only] an object with details about the * device_authorization_endpoint request * - inFlight {boolean} - [DeviceCode only] - * - error {string} - [DeviceCode only] - error from authnz to be returned to the polling client - * - errorDescription {string} - [DeviceCode only] - error_description from authnz to be returned - * to the polling client + * - error {string} - [DeviceCode and BackchannelAuthenticationRequest only] - error from authnz to be + * returned to the polling client + * - errorDescription {string} - [DeviceCode and BackchannelAuthenticationRequest only] - error_description + * from authnz to be returned to the polling client * - policies {string[]} - [InitialAccessToken, RegistrationAccessToken only] array of policies * - request {string} - [PushedAuthorizationRequest only] Pushed Request Object value * diff --git a/lib/adapters/memory_adapter.js b/lib/adapters/memory_adapter.js index 9d3be0e4b..51239539f 100644 --- a/lib/adapters/memory_adapter.js +++ b/lib/adapters/memory_adapter.js @@ -16,6 +16,14 @@ function userCodeKeyFor(userCode) { return `userCode:${userCode}`; } +const grantable = new Set([ + 'AccessToken', + 'AuthorizationCode', + 'RefreshToken', + 'DeviceCode', + 'BackchannelAuthenticationRequest', +]); + class MemoryAdapter { constructor(model) { this.model = model; @@ -56,7 +64,7 @@ class MemoryAdapter { } const { grantId, userCode } = payload; - if (grantId) { + if (grantable.has(this.name) && grantId) { const grantKey = grantKeyFor(grantId); const grant = storage.get(grantKey); if (!grant) {