@@ -49,6 +49,7 @@ export async function registerSupertokensAtHome(
4949 accessTokenKey : string ;
5050 } ,
5151 workloadIdentityFederation : WorkloadIdentityFederationProvider | null ,
52+ isSCIMEnabled : boolean ,
5253) {
5354 const supertokensStore = new SuperTokensStore ( storage . pool , server . log ) ;
5455
@@ -1656,7 +1657,10 @@ export async function registerSupertokensAtHome(
16561657 if ( ! supertokenUser ) {
16571658 req . log . debug ( 'no existing user found.' ) ;
16581659
1659- if ( organization . featureFlags . scim && oidcIntegration . userProvisioningRequired ) {
1660+ if (
1661+ ( organization . featureFlags . scim || isSCIMEnabled ) &&
1662+ oidcIntegration . userProvisioningRequired
1663+ ) {
16601664 req . log . debug ( 'oidc integration settings requires user being provisioned.' ) ;
16611665 return rep . status ( 200 ) . send ( {
16621666 status : 'SIGN_IN_UP_NOT_ALLOWED' ,
@@ -1676,7 +1680,7 @@ export async function registerSupertokensAtHome(
16761680 superTokensUserId : supertokenUser . userId ,
16771681 } ) ;
16781682
1679- if ( organization . featureFlags . scim ) {
1683+ if ( organization . featureFlags . scim || isSCIMEnabled ) {
16801684 if ( maybeHiveUser ?. provisioningStatus === 'active' && maybeHiveUser . deactivatedAt ) {
16811685 req . log . debug ( 'user is deactivated.' ) ;
16821686 return rep . status ( 200 ) . send ( {
@@ -1702,7 +1706,10 @@ export async function registerSupertokensAtHome(
17021706
17031707 // only perform these updates if the user is not provisioned
17041708 // if the user is provisioned the SCIM provider is the source of truth for all attributes
1705- if ( ! organization . featureFlags . scim || ! maybeHiveUser ?. provisionedByOrganizationId ) {
1709+ if (
1710+ ( ! organization . featureFlags . scim && ! isSCIMEnabled ) ||
1711+ ! maybeHiveUser ?. provisionedByOrganizationId
1712+ ) {
17061713 if ( supertokenUser . email !== email . data ) {
17071714 req . log . debug ( 'providers email has changed. Update record.' ) ;
17081715 supertokenUser = await supertokensStore . updateOIDCUserEmail ( {
0 commit comments