diff --git a/backend/src/server/plugins/auth/inject-identity.ts b/backend/src/server/plugins/auth/inject-identity.ts index 11cb24117..a95fca451 100644 --- a/backend/src/server/plugins/auth/inject-identity.ts +++ b/backend/src/server/plugins/auth/inject-identity.ts @@ -99,7 +99,6 @@ export const injectIdentity = fp(async (server: FastifyZodProvider) => { if (!authMode) return; switch (authMode) { - // May or may not have an orgId. If it doesn't have an org ID, it's likely because the token is from an org that doesn't enforce org-level auth. case AuthMode.JWT: { const { user, tokenVersionId, orgId } = await server.services.authToken.fnValidateJwtIdentity(token); req.auth = { authMode: AuthMode.JWT, user, userId: user.id, tokenVersionId, actor, orgId }; @@ -117,7 +116,6 @@ export const injectIdentity = fp(async (server: FastifyZodProvider) => { }; break; } - // Will always contain an orgId. case AuthMode.SERVICE_TOKEN: { const serviceToken = await server.services.serviceToken.fnValidateServiceToken(token); req.auth = { @@ -128,13 +126,11 @@ export const injectIdentity = fp(async (server: FastifyZodProvider) => { }; break; } - // Will never contain an orgId. API keys are not tied to an organization. case AuthMode.API_KEY: { const user = await server.services.apiKey.fnValidateApiKey(token as string); req.auth = { authMode: AuthMode.API_KEY as const, userId: user.id, actor, user }; break; } - // OK case AuthMode.SCIM_TOKEN: { const { orgId, scimTokenId } = await server.services.scim.fnValidateScimToken(token); req.auth = { authMode: AuthMode.SCIM_TOKEN, actor, scimTokenId, orgId };