diff --git a/CHANGELOG.md b/CHANGELOG.md index 0756bc053..154cf4822 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [unreleased] +## [20.1.1] - 2024-09-10 + +- Fixes an issue with Okta / Active Directory providers where we check for additional config if `oidcDiscoveryEndpoint` is not defined. It would not be necessary in the cases where other endpoints are already provided. + ## [20.1.0] - 2024-09-09 - Add edge compatibility for custom frameworks and Next.JS diff --git a/lib/build/recipe/thirdparty/providers/activeDirectory.js b/lib/build/recipe/thirdparty/providers/activeDirectory.js index 3119966b4..bb48e32c7 100644 --- a/lib/build/recipe/thirdparty/providers/activeDirectory.js +++ b/lib/build/recipe/thirdparty/providers/activeDirectory.js @@ -30,19 +30,15 @@ function ActiveDirectory(input) { const oGetConfig = originalImplementation.getConfigForClientType; originalImplementation.getConfigForClientType = async function ({ clientType, userContext }) { const config = await oGetConfig({ clientType, userContext }); - if (config.additionalConfig == undefined || config.additionalConfig.directoryId == undefined) { - if (config.oidcDiscoveryEndpoint === undefined) { - throw new Error( - "Please provide the directoryId in the additionalConfig of the Active Directory provider." - ); - } - } else { + if (config.additionalConfig !== undefined && config.additionalConfig.directoryId !== undefined) { config.oidcDiscoveryEndpoint = `https://login.microsoftonline.com/${config.additionalConfig.directoryId}/v2.0/.well-known/openid-configuration`; } - // The config could be coming from core where we didn't add the well-known previously - config.oidcDiscoveryEndpoint = utils_1.normaliseOIDCEndpointToIncludeWellKnown( - config.oidcDiscoveryEndpoint - ); + if (config.oidcDiscoveryEndpoint !== undefined) { + // The config could be coming from core where we didn't add the well-known previously + config.oidcDiscoveryEndpoint = utils_1.normaliseOIDCEndpointToIncludeWellKnown( + config.oidcDiscoveryEndpoint + ); + } if (config.scope === undefined) { config.scope = ["openid", "email"]; } diff --git a/lib/build/recipe/thirdparty/providers/okta.js b/lib/build/recipe/thirdparty/providers/okta.js index 84bffd5e4..2fdffd98b 100644 --- a/lib/build/recipe/thirdparty/providers/okta.js +++ b/lib/build/recipe/thirdparty/providers/okta.js @@ -32,19 +32,17 @@ function Okta(input) { const oGetConfig = originalImplementation.getConfigForClientType; originalImplementation.getConfigForClientType = async function (input) { const config = await oGetConfig(input); - if (config.additionalConfig == undefined || config.additionalConfig.oktaDomain == undefined) { - if (config.oidcDiscoveryEndpoint === undefined) { - throw new Error("Please provide the oktaDomain in the additionalConfig of the Okta provider."); - } - } else { + if (config.additionalConfig !== undefined && config.additionalConfig.oktaDomain !== undefined) { const oidcDomain = new normalisedURLDomain_1.default(config.additionalConfig.oktaDomain); const oidcPath = new normalisedURLPath_1.default("/.well-known/openid-configuration"); config.oidcDiscoveryEndpoint = oidcDomain.getAsStringDangerous() + oidcPath.getAsStringDangerous(); } - // The config could be coming from core where we didn't add the well-known previously - config.oidcDiscoveryEndpoint = utils_1.normaliseOIDCEndpointToIncludeWellKnown( - config.oidcDiscoveryEndpoint - ); + if (config.oidcDiscoveryEndpoint !== undefined) { + // The config could be coming from core where we didn't add the well-known previously + config.oidcDiscoveryEndpoint = utils_1.normaliseOIDCEndpointToIncludeWellKnown( + config.oidcDiscoveryEndpoint + ); + } if (config.scope === undefined) { config.scope = ["openid", "email"]; } diff --git a/lib/build/version.d.ts b/lib/build/version.d.ts index 5a7264286..96b4982e6 100644 --- a/lib/build/version.d.ts +++ b/lib/build/version.d.ts @@ -1,4 +1,4 @@ // @ts-nocheck -export declare const version = "20.1.0"; +export declare const version = "20.1.1"; export declare const cdiSupported: string[]; export declare const dashboardVersion = "0.13"; diff --git a/lib/build/version.js b/lib/build/version.js index 3748a4c28..febdb7357 100644 --- a/lib/build/version.js +++ b/lib/build/version.js @@ -15,7 +15,7 @@ exports.dashboardVersion = exports.cdiSupported = exports.version = void 0; * License for the specific language governing permissions and limitations * under the License. */ -exports.version = "20.1.0"; +exports.version = "20.1.1"; exports.cdiSupported = ["5.1"]; // Note: The actual script import for dashboard uses v{DASHBOARD_VERSION} exports.dashboardVersion = "0.13"; diff --git a/lib/ts/recipe/thirdparty/providers/activeDirectory.ts b/lib/ts/recipe/thirdparty/providers/activeDirectory.ts index 410294042..458837465 100644 --- a/lib/ts/recipe/thirdparty/providers/activeDirectory.ts +++ b/lib/ts/recipe/thirdparty/providers/activeDirectory.ts @@ -29,18 +29,14 @@ export default function ActiveDirectory(input: ProviderInput): TypeProvider { originalImplementation.getConfigForClientType = async function ({ clientType, userContext }) { const config = await oGetConfig({ clientType, userContext }); - if (config.additionalConfig == undefined || config.additionalConfig.directoryId == undefined) { - if (config.oidcDiscoveryEndpoint === undefined) { - throw new Error( - "Please provide the directoryId in the additionalConfig of the Active Directory provider." - ); - } - } else { + if (config.additionalConfig !== undefined && config.additionalConfig.directoryId !== undefined) { config.oidcDiscoveryEndpoint = `https://login.microsoftonline.com/${config.additionalConfig.directoryId}/v2.0/.well-known/openid-configuration`; } - // The config could be coming from core where we didn't add the well-known previously - config.oidcDiscoveryEndpoint = normaliseOIDCEndpointToIncludeWellKnown(config.oidcDiscoveryEndpoint); + if (config.oidcDiscoveryEndpoint !== undefined) { + // The config could be coming from core where we didn't add the well-known previously + config.oidcDiscoveryEndpoint = normaliseOIDCEndpointToIncludeWellKnown(config.oidcDiscoveryEndpoint); + } if (config.scope === undefined) { config.scope = ["openid", "email"]; diff --git a/lib/ts/recipe/thirdparty/providers/okta.ts b/lib/ts/recipe/thirdparty/providers/okta.ts index c1eae03eb..f7834ee34 100644 --- a/lib/ts/recipe/thirdparty/providers/okta.ts +++ b/lib/ts/recipe/thirdparty/providers/okta.ts @@ -30,19 +30,17 @@ export default function Okta(input: ProviderInput): TypeProvider { originalImplementation.getConfigForClientType = async function (input) { const config = await oGetConfig(input); - if (config.additionalConfig == undefined || config.additionalConfig.oktaDomain == undefined) { - if (config.oidcDiscoveryEndpoint === undefined) { - throw new Error("Please provide the oktaDomain in the additionalConfig of the Okta provider."); - } - } else { + if (config.additionalConfig !== undefined && config.additionalConfig.oktaDomain !== undefined) { const oidcDomain = new NormalisedURLDomain(config.additionalConfig.oktaDomain); const oidcPath = new NormalisedURLPath("/.well-known/openid-configuration"); config.oidcDiscoveryEndpoint = oidcDomain.getAsStringDangerous() + oidcPath.getAsStringDangerous(); } - // The config could be coming from core where we didn't add the well-known previously - config.oidcDiscoveryEndpoint = normaliseOIDCEndpointToIncludeWellKnown(config.oidcDiscoveryEndpoint); + if (config.oidcDiscoveryEndpoint !== undefined) { + // The config could be coming from core where we didn't add the well-known previously + config.oidcDiscoveryEndpoint = normaliseOIDCEndpointToIncludeWellKnown(config.oidcDiscoveryEndpoint); + } if (config.scope === undefined) { config.scope = ["openid", "email"]; diff --git a/lib/ts/version.ts b/lib/ts/version.ts index 2fa8454e4..c38d1c6d4 100644 --- a/lib/ts/version.ts +++ b/lib/ts/version.ts @@ -12,7 +12,7 @@ * License for the specific language governing permissions and limitations * under the License. */ -export const version = "20.1.0"; +export const version = "20.1.1"; export const cdiSupported = ["5.1"]; diff --git a/package-lock.json b/package-lock.json index 60c16965f..62afbcb58 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "supertokens-node", - "version": "20.1.0", + "version": "20.1.1", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "supertokens-node", - "version": "20.1.0", + "version": "20.1.1", "license": "Apache-2.0", "dependencies": { "buffer": "^6.0.3", diff --git a/package.json b/package.json index ef536ee77..73d76d2e4 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "supertokens-node", - "version": "20.1.0", + "version": "20.1.1", "description": "NodeJS driver for SuperTokens core", "main": "index.js", "scripts": {