Skip to content

Infisical is the open-source platform for securing secrets, certificates, access, and AI Agents.

feat: updated identity login endpoints to use organizationSlug instead of suborganization name parameter

=76399e520120
diff --git a/backend/src/lib/api-docs/constants.ts b/backend/src/lib/api-docs/constants.ts
index 4ac4a0a8cd..cbca7cc02e 100644
--- a/backend/src/lib/api-docs/constants.ts
+++ b/backend/src/lib/api-docs/constants.ts
@@ -199,13 +199,14 @@ export const IDENTITIES = {
}
} as const;
-const IDENTITY_AUTH_SUB_ORGANIZATION_NAME = "sub-organization name to scope the token to";
+const IDENTITY_AUTH_SUB_ORGANIZATION_NAME =
+ "Scopes the login session to the specified sub-organization. If not provided, the session defaults to the organization from which the identity originated.";
export const UNIVERSAL_AUTH = {
LOGIN: {
clientId: "Your Machine Identity Client ID.",
clientSecret: "Your Machine Identity Client Secret.",
- subOrganizationName: IDENTITY_AUTH_SUB_ORGANIZATION_NAME
+ organizationSlug: IDENTITY_AUTH_SUB_ORGANIZATION_NAME
},
ATTACH: {
identityId: "The ID of the machine identity to attach the configuration onto.",
@@ -280,7 +281,7 @@ export const LDAP_AUTH = {
identityId: "The ID of the machine identity to login.",
username: "The username of the LDAP user to login.",
password: "The password of the LDAP user to login.",
- subOrganizationName: IDENTITY_AUTH_SUB_ORGANIZATION_NAME
+ organizationSlug: IDENTITY_AUTH_SUB_ORGANIZATION_NAME
},
ATTACH: {
templateId: "The ID of the identity auth template to attach the configuration onto.",
@@ -346,7 +347,7 @@ export const ALICLOUD_AUTH = {
SignatureVersion: "The signature version. For STS GetCallerIdentity, this should be '1.0'.",
SignatureNonce: "A unique random string to prevent replay attacks.",
Signature: "The signature string calculated based on the request parameters and AccessKey Secret.",
- subOrganizationName: IDENTITY_AUTH_SUB_ORGANIZATION_NAME
+ organizationSlug: IDENTITY_AUTH_SUB_ORGANIZATION_NAME
},
ATTACH: {
identityId: "The ID of the machine identity to attach the configuration onto.",
@@ -375,7 +376,7 @@ export const ALICLOUD_AUTH = {
export const TLS_CERT_AUTH = {
LOGIN: {
identityId: "The ID of the machine identity to login.",
- subOrganizationName: IDENTITY_AUTH_SUB_ORGANIZATION_NAME
+ organizationSlug: IDENTITY_AUTH_SUB_ORGANIZATION_NAME
},
ATTACH: {
identityId: "The ID of the machine identity to attach the configuration onto.",
@@ -414,7 +415,7 @@ export const AWS_AUTH = {
iamRequestBody:
"The base64-encoded body of the signed request. Most likely, the base64-encoding of Action=GetCallerIdentity&Version=2011-06-15.",
iamRequestHeaders: "The base64-encoded headers of the sts:GetCallerIdentity signed request.",
- subOrganizationName: IDENTITY_AUTH_SUB_ORGANIZATION_NAME
+ organizationSlug: IDENTITY_AUTH_SUB_ORGANIZATION_NAME
},
ATTACH: {
identityId: "The ID of the machine identity to attach the configuration onto.",
@@ -453,7 +454,7 @@ export const OCI_AUTH = {
identityId: "The ID of the machine identity to login.",
userOcid: "The OCID of the user attempting login.",
headers: "The headers of the signed request.",
- subOrganizationName: IDENTITY_AUTH_SUB_ORGANIZATION_NAME
+ organizationSlug: IDENTITY_AUTH_SUB_ORGANIZATION_NAME
},
ATTACH: {
identityId: "The ID of the machine identity to attach the configuration onto.",
@@ -486,7 +487,7 @@ export const OCI_AUTH = {
export const AZURE_AUTH = {
LOGIN: {
identityId: "The ID of the machine identity to login.",
- subOrganizationName: IDENTITY_AUTH_SUB_ORGANIZATION_NAME
+ organizationSlug: IDENTITY_AUTH_SUB_ORGANIZATION_NAME
},
ATTACH: {
identityId: "The ID of the machine identity to attach the configuration onto.",
@@ -521,7 +522,7 @@ export const AZURE_AUTH = {
export const GCP_AUTH = {
LOGIN: {
identityId: "The ID of the machine identity to login.",
- subOrganizationName: IDENTITY_AUTH_SUB_ORGANIZATION_NAME
+ organizationSlug: IDENTITY_AUTH_SUB_ORGANIZATION_NAME
},
ATTACH: {
identityId: "The ID of the machine identity to attach the configuration onto.",
@@ -560,7 +561,7 @@ export const GCP_AUTH = {
export const KUBERNETES_AUTH = {
LOGIN: {
identityId: "The ID of the machine identity to login.",
- subOrganizationName: IDENTITY_AUTH_SUB_ORGANIZATION_NAME
+ organizationSlug: IDENTITY_AUTH_SUB_ORGANIZATION_NAME
},
ATTACH: {
identityId: "The ID of the machine identity to attach the configuration onto.",
@@ -641,7 +642,7 @@ export const TOKEN_AUTH = {
CREATE_TOKEN: {
identityId: "The ID of the machine identity to create the token for.",
name: "The name of the token to create.",
- subOrganizationName: "The sub organization name to scope the token to."
+ organizationSlug: "The sub organization name to scope the token to."
},
UPDATE_TOKEN: {
tokenId: "The ID of the token to update metadata for.",
@@ -655,7 +656,7 @@ export const TOKEN_AUTH = {
export const OIDC_AUTH = {
LOGIN: {
identityId: "The ID of the machine identity to login.",
- subOrganizationName: IDENTITY_AUTH_SUB_ORGANIZATION_NAME
+ organizationSlug: IDENTITY_AUTH_SUB_ORGANIZATION_NAME
},
ATTACH: {
identityId: "The ID of the machine identity to attach the configuration onto.",
@@ -696,7 +697,7 @@ export const OIDC_AUTH = {
export const JWT_AUTH = {
LOGIN: {
identityId: "The ID of the machine identity to login.",
- subOrganizationName: IDENTITY_AUTH_SUB_ORGANIZATION_NAME
+ organizationSlug: IDENTITY_AUTH_SUB_ORGANIZATION_NAME
},
ATTACH: {
identityId: "The ID of the machine identity to attach the configuration onto.",
diff --git a/backend/src/server/routes/v1/identity-alicloud-auth-router.ts b/backend/src/server/routes/v1/identity-alicloud-auth-router.ts
index 129684ce33..2f693260ea 100644
--- a/backend/src/server/routes/v1/identity-alicloud-auth-router.ts
+++ b/backend/src/server/routes/v1/identity-alicloud-auth-router.ts
@@ -40,7 +40,7 @@ export const registerIdentityAliCloudAuthRouter = async (server: FastifyZodProvi
message: "AccessKeyId must be alphanumeric"
})
.describe(ALICLOUD_AUTH.LOGIN.AccessKeyId),
- subOrganizationName: slugSchema().optional().describe(ALICLOUD_AUTH.LOGIN.subOrganizationName),
+ organizationSlug: slugSchema().optional().describe(ALICLOUD_AUTH.LOGIN.organizationSlug),
SignatureMethod: z.enum(["HMAC-SHA1"]).describe(ALICLOUD_AUTH.LOGIN.SignatureMethod),
Timestamp: z
.string()
diff --git a/backend/src/server/routes/v1/identity-aws-iam-auth-router.ts b/backend/src/server/routes/v1/identity-aws-iam-auth-router.ts
index cf9cc0695e..1f98145e5b 100644
--- a/backend/src/server/routes/v1/identity-aws-iam-auth-router.ts
+++ b/backend/src/server/routes/v1/identity-aws-iam-auth-router.ts
@@ -31,7 +31,7 @@ export const registerIdentityAwsAuthRouter = async (server: FastifyZodProvider)
iamHttpRequestMethod: z.string().default("POST").describe(AWS_AUTH.LOGIN.iamHttpRequestMethod),
iamRequestBody: z.string().describe(AWS_AUTH.LOGIN.iamRequestBody),
iamRequestHeaders: z.string().describe(AWS_AUTH.LOGIN.iamRequestHeaders),
- subOrganizationName: slugSchema().optional().describe(AWS_AUTH.LOGIN.subOrganizationName)
+ organizationSlug: slugSchema().optional().describe(AWS_AUTH.LOGIN.organizationSlug)
}),
response: {
200: z.object({
diff --git a/backend/src/server/routes/v1/identity-azure-auth-router.ts b/backend/src/server/routes/v1/identity-azure-auth-router.ts
index 1f9a21c37c..3aae1f57c2 100644
--- a/backend/src/server/routes/v1/identity-azure-auth-router.ts
+++ b/backend/src/server/routes/v1/identity-azure-auth-router.ts
@@ -26,7 +26,7 @@ export const registerIdentityAzureAuthRouter = async (server: FastifyZodProvider
body: z.object({
identityId: z.string().trim().describe(AZURE_AUTH.LOGIN.identityId),
jwt: z.string(),
- subOrganizationName: slugSchema().optional().describe(AZURE_AUTH.LOGIN.subOrganizationName)
+ organizationSlug: slugSchema().optional().describe(AZURE_AUTH.LOGIN.organizationSlug)
}),
response: {
200: z.object({
diff --git a/backend/src/server/routes/v1/identity-gcp-auth-router.ts b/backend/src/server/routes/v1/identity-gcp-auth-router.ts
index d8d6121eab..f82cd9767e 100644
--- a/backend/src/server/routes/v1/identity-gcp-auth-router.ts
+++ b/backend/src/server/routes/v1/identity-gcp-auth-router.ts
@@ -26,7 +26,7 @@ export const registerIdentityGcpAuthRouter = async (server: FastifyZodProvider)
body: z.object({
identityId: z.string().trim().describe(GCP_AUTH.LOGIN.identityId),
jwt: z.string(),
- subOrganizationName: slugSchema().optional().describe(GCP_AUTH.LOGIN.subOrganizationName)
+ organizationSlug: slugSchema().optional().describe(GCP_AUTH.LOGIN.organizationSlug)
}),
response: {
200: z.object({
diff --git a/backend/src/server/routes/v1/identity-jwt-auth-router.ts b/backend/src/server/routes/v1/identity-jwt-auth-router.ts
index 7ad3bd5bc8..06bab6aa98 100644
--- a/backend/src/server/routes/v1/identity-jwt-auth-router.ts
+++ b/backend/src/server/routes/v1/identity-jwt-auth-router.ts
@@ -102,7 +102,7 @@ export const registerIdentityJwtAuthRouter = async (server: FastifyZodProvider)
body: z.object({
identityId: z.string().trim().describe(JWT_AUTH.LOGIN.identityId),
jwt: z.string().trim(),
- subOrganizationName: slugSchema().optional().describe(JWT_AUTH.LOGIN.subOrganizationName)
+ organizationSlug: slugSchema().optional().describe(JWT_AUTH.LOGIN.organizationSlug)
}),
response: {
200: z.object({
diff --git a/backend/src/server/routes/v1/identity-kubernetes-auth-router.ts b/backend/src/server/routes/v1/identity-kubernetes-auth-router.ts
index 0e63485b11..2cdfd64f95 100644
--- a/backend/src/server/routes/v1/identity-kubernetes-auth-router.ts
+++ b/backend/src/server/routes/v1/identity-kubernetes-auth-router.ts
@@ -47,7 +47,7 @@ export const registerIdentityKubernetesRouter = async (server: FastifyZodProvide
body: z.object({
identityId: z.string().trim().describe(KUBERNETES_AUTH.LOGIN.identityId),
jwt: z.string().trim(),
- subOrganizationName: slugSchema().optional().describe(KUBERNETES_AUTH.LOGIN.subOrganizationName)
+ organizationSlug: slugSchema().optional().describe(KUBERNETES_AUTH.LOGIN.organizationSlug)
}),
response: {
200: z.object({
diff --git a/backend/src/server/routes/v1/identity-ldap-auth-router.ts b/backend/src/server/routes/v1/identity-ldap-auth-router.ts
index b5030af6db..70700f6806 100644
--- a/backend/src/server/routes/v1/identity-ldap-auth-router.ts
+++ b/backend/src/server/routes/v1/identity-ldap-auth-router.ts
@@ -154,7 +154,7 @@ export const registerIdentityLdapAuthRouter = async (server: FastifyZodProvider)
identityId: z.string().trim().uuid("Identity ID must be a valid UUID").describe(LDAP_AUTH.LOGIN.identityId),
username: z.string().trim().nonempty("Username is required").describe(LDAP_AUTH.LOGIN.username),
password: z.string().trim().nonempty("Password is required").describe(LDAP_AUTH.LOGIN.password),
- subOrganizationName: slugSchema().optional().describe(LDAP_AUTH.LOGIN.subOrganizationName)
+ organizationSlug: slugSchema().optional().describe(LDAP_AUTH.LOGIN.organizationSlug)
}),
response: {
200: z.object({
@@ -186,7 +186,7 @@ export const registerIdentityLdapAuthRouter = async (server: FastifyZodProvider)
const { accessToken, identityLdapAuth, identity } = await server.services.identityLdapAuth.login({
identityId: authIdentityId,
- subOrganizationName: req.body.subOrganizationName
+ organizationSlug: req.body.organizationSlug
});
await server.services.auditLog.createAuditLog({
diff --git a/backend/src/server/routes/v1/identity-oci-auth-router.ts b/backend/src/server/routes/v1/identity-oci-auth-router.ts
index 3150c8d471..3868afb686 100644
--- a/backend/src/server/routes/v1/identity-oci-auth-router.ts
+++ b/backend/src/server/routes/v1/identity-oci-auth-router.ts
@@ -43,7 +43,7 @@ export const registerIdentityOciAuthRouter = async (server: FastifyZodProvider)
}
})
.describe(OCI_AUTH.LOGIN.headers),
- subOrganizationName: slugSchema().optional().describe(OCI_AUTH.LOGIN.subOrganizationName)
+ organizationSlug: slugSchema().optional().describe(OCI_AUTH.LOGIN.organizationSlug)
}),
response: {
200: z.object({
diff --git a/backend/src/server/routes/v1/identity-oidc-auth-router.ts b/backend/src/server/routes/v1/identity-oidc-auth-router.ts
index d6dd8fa8e9..2b86a3ba6c 100644
--- a/backend/src/server/routes/v1/identity-oidc-auth-router.ts
+++ b/backend/src/server/routes/v1/identity-oidc-auth-router.ts
@@ -50,7 +50,7 @@ export const registerIdentityOidcAuthRouter = async (server: FastifyZodProvider)
body: z.object({
identityId: z.string().trim().describe(OIDC_AUTH.LOGIN.identityId),
jwt: z.string().trim(),
- subOrganizationName: slugSchema().optional().describe(OIDC_AUTH.LOGIN.subOrganizationName)
+ organizationSlug: slugSchema().optional().describe(OIDC_AUTH.LOGIN.organizationSlug)
}),
response: {
200: z.object({
diff --git a/backend/src/server/routes/v1/identity-tls-cert-auth-router.ts b/backend/src/server/routes/v1/identity-tls-cert-auth-router.ts
index 62ff18ea13..b93151e560 100644
--- a/backend/src/server/routes/v1/identity-tls-cert-auth-router.ts
+++ b/backend/src/server/routes/v1/identity-tls-cert-auth-router.ts
@@ -49,7 +49,7 @@ export const registerIdentityTlsCertAuthRouter = async (server: FastifyZodProvid
description: "Login with TLS Certificate Auth for machine identity",
body: z.object({
identityId: z.string().trim().describe(TLS_CERT_AUTH.LOGIN.identityId),
- subOrganizationName: slugSchema().optional().describe(TLS_CERT_AUTH.LOGIN.subOrganizationName)
+ organizationSlug: slugSchema().optional().describe(TLS_CERT_AUTH.LOGIN.organizationSlug)
}),
response: {
200: z.object({
diff --git a/backend/src/server/routes/v1/identity-token-auth-router.ts b/backend/src/server/routes/v1/identity-token-auth-router.ts
index 155cf5c02c..dad7a91ace 100644
--- a/backend/src/server/routes/v1/identity-token-auth-router.ts
+++ b/backend/src/server/routes/v1/identity-token-auth-router.ts
@@ -314,7 +314,7 @@ export const registerIdentityTokenAuthRouter = async (server: FastifyZodProvider
}),
body: z.object({
name: z.string().optional().describe(TOKEN_AUTH.CREATE_TOKEN.name),
- subOrganizationName: slugSchema().optional().describe(TOKEN_AUTH.CREATE_TOKEN.subOrganizationName)
+ organizationSlug: slugSchema().optional().describe(TOKEN_AUTH.CREATE_TOKEN.organizationSlug)
}),
response: {
200: z.object({
diff --git a/backend/src/server/routes/v1/identity-universal-auth-router.ts b/backend/src/server/routes/v1/identity-universal-auth-router.ts
index ddea56724b..5afb2a6c43 100644
--- a/backend/src/server/routes/v1/identity-universal-auth-router.ts
+++ b/backend/src/server/routes/v1/identity-universal-auth-router.ts
@@ -38,7 +38,7 @@ export const registerIdentityUaRouter = async (server: FastifyZodProvider) => {
body: z.object({
clientId: z.string().trim().describe(UNIVERSAL_AUTH.LOGIN.clientId),
clientSecret: z.string().trim().describe(UNIVERSAL_AUTH.LOGIN.clientSecret),
- subOrganizationName: slugSchema().optional().describe(UNIVERSAL_AUTH.LOGIN.subOrganizationName)
+ organizationSlug: slugSchema().optional().describe(UNIVERSAL_AUTH.LOGIN.organizationSlug)
}),
response: {
200: z.object({
diff --git a/backend/src/services/identity-alicloud-auth/identity-alicloud-auth-service.ts b/backend/src/services/identity-alicloud-auth/identity-alicloud-auth-service.ts
index 79b6ef5252..3a22da3c1d 100644
--- a/backend/src/services/identity-alicloud-auth/identity-alicloud-auth-service.ts
+++ b/backend/src/services/identity-alicloud-auth/identity-alicloud-auth-service.ts
@@ -67,7 +67,7 @@ export const identityAliCloudAuthServiceFactory = ({
permissionService,
orgDAL
}: TIdentityAliCloudAuthServiceFactoryDep) => {
- const login = async ({ identityId, subOrganizationName, ...params }: TLoginAliCloudAuthDTO) => {
+ const login = async ({ identityId, organizationSlug, ...params }: TLoginAliCloudAuthDTO) => {
const appCfg = getConfig();
const identityAliCloudAuth = await identityAliCloudAuthDAL.findOne({ identityId });
if (!identityAliCloudAuth) {
@@ -82,7 +82,7 @@ export const identityAliCloudAuthServiceFactory = ({
const org = await orgDAL.findById(identity.orgId);
const isSubOrgIdentity = Boolean(org.rootOrgId);
- // If the identity is a sub-org identity, then the scope is always the org.id, and if it's a root org identity, then we need to resolve the scope if a subOrganizationName is specified
+ // If the identity is a sub-org identity, then the scope is always the org.id, and if it's a root org identity, then we need to resolve the scope if a organizationSlug is specified
let subOrganizationId = isSubOrgIdentity ? org.id : null;
try {
@@ -107,12 +107,12 @@ export const identityAliCloudAuthServiceFactory = ({
});
}
- if (subOrganizationName) {
+ if (organizationSlug) {
if (!isSubOrgIdentity) {
- const subOrg = await orgDAL.findOne({ rootOrgId: org.id, slug: subOrganizationName });
+ const subOrg = await orgDAL.findOne({ rootOrgId: org.id, slug: organizationSlug });
if (!subOrg) {
- throw new NotFoundError({ message: `Sub organization with name ${subOrganizationName} not found` });
+ throw new NotFoundError({ message: `Sub organization with slug ${organizationSlug} not found` });
}
const subOrgMembership = await membershipIdentityDAL.findOne({
@@ -123,7 +123,7 @@ export const identityAliCloudAuthServiceFactory = ({
if (!subOrgMembership) {
throw new UnauthorizedError({
- message: `Identity not authorized to access sub organization ${subOrganizationName}`
+ message: `Identity not authorized to access sub organization ${organizationSlug}`
});
}
diff --git a/backend/src/services/identity-alicloud-auth/identity-alicloud-auth-types.ts b/backend/src/services/identity-alicloud-auth/identity-alicloud-auth-types.ts
index 575341dd35..2363ce66c9 100644
--- a/backend/src/services/identity-alicloud-auth/identity-alicloud-auth-types.ts
+++ b/backend/src/services/identity-alicloud-auth/identity-alicloud-auth-types.ts
@@ -11,7 +11,7 @@ export type TLoginAliCloudAuthDTO = {
SignatureVersion: string;
SignatureNonce: string;
Signature: string;
- subOrganizationName?: string;
+ organizationSlug?: string;
};
export type TAttachAliCloudAuthDTO = {
diff --git a/backend/src/services/identity-aws-auth/identity-aws-auth-service.ts b/backend/src/services/identity-aws-auth/identity-aws-auth-service.ts
index b102362b37..e027957d39 100644
--- a/backend/src/services/identity-aws-auth/identity-aws-auth-service.ts
+++ b/backend/src/services/identity-aws-auth/identity-aws-auth-service.ts
@@ -106,7 +106,7 @@ export const identityAwsAuthServiceFactory = ({
iamHttpRequestMethod,
iamRequestBody,
iamRequestHeaders,
- subOrganizationName
+ organizationSlug
}: TLoginAwsAuthDTO) => {
const appCfg = getConfig();
const identityAwsAuth = await identityAwsAuthDAL.findOne({ identityId });
@@ -120,7 +120,7 @@ export const identityAwsAuthServiceFactory = ({
const org = await orgDAL.findById(identity.orgId);
const isSubOrgIdentity = Boolean(org.rootOrgId);
- // If the identity is a sub-org identity, then the scope is always the org.id, and if it's a root org identity, then we need to resolve the scope if a subOrganizationName is specified
+ // If the identity is a sub-org identity, then the scope is always the org.id, and if it's a root org identity, then we need to resolve the scope if a organizationSlug is specified
let subOrganizationId = isSubOrgIdentity ? org.id : null;
try {
@@ -190,12 +190,12 @@ export const identityAwsAuthServiceFactory = ({
}
}
- if (subOrganizationName) {
+ if (organizationSlug) {
if (!isSubOrgIdentity) {
- const subOrg = await orgDAL.findOne({ rootOrgId: org.id, slug: subOrganizationName });
+ const subOrg = await orgDAL.findOne({ rootOrgId: org.id, slug: organizationSlug });
if (!subOrg) {
- throw new NotFoundError({ message: `Sub organization with name ${subOrganizationName} not found` });
+ throw new NotFoundError({ message: `Sub organization with slug ${organizationSlug} not found` });
}
const subOrgMembership = await membershipIdentityDAL.findOne({
@@ -206,7 +206,7 @@ export const identityAwsAuthServiceFactory = ({
if (!subOrgMembership) {
throw new UnauthorizedError({
- message: `Identity not authorized to access sub organization ${subOrganizationName}`
+ message: `Identity not authorized to access sub organization ${organizationSlug}`
});
}
diff --git a/backend/src/services/identity-aws-auth/identity-aws-auth-types.ts b/backend/src/services/identity-aws-auth/identity-aws-auth-types.ts
index 4570932f07..8f3e0d9156 100644
--- a/backend/src/services/identity-aws-auth/identity-aws-auth-types.ts
+++ b/backend/src/services/identity-aws-auth/identity-aws-auth-types.ts
@@ -5,7 +5,7 @@ export type TLoginAwsAuthDTO = {
iamHttpRequestMethod: string;
iamRequestBody: string;
iamRequestHeaders: string;
- subOrganizationName?: string;
+ organizationSlug?: string;
};
export type TAttachAwsAuthDTO = {
diff --git a/backend/src/services/identity-azure-auth/identity-azure-auth-service.ts b/backend/src/services/identity-azure-auth/identity-azure-auth-service.ts
index c205d76c86..ac885d230b 100644
--- a/backend/src/services/identity-azure-auth/identity-azure-auth-service.ts
+++ b/backend/src/services/identity-azure-auth/identity-azure-auth-service.ts
@@ -63,7 +63,7 @@ export const identityAzureAuthServiceFactory = ({
licenseService,
orgDAL
}: TIdentityAzureAuthServiceFactoryDep) => {
- const login = async ({ identityId, jwt: azureJwt, subOrganizationName }: TLoginAzureAuthDTO) => {
+ const login = async ({ identityId, jwt: azureJwt, organizationSlug }: TLoginAzureAuthDTO) => {
const appCfg = getConfig();
const identityAzureAuth = await identityAzureAuthDAL.findOne({ identityId });
if (!identityAzureAuth) {
@@ -76,7 +76,7 @@ export const identityAzureAuthServiceFactory = ({
const org = await orgDAL.findById(identity.orgId);
const isSubOrgIdentity = Boolean(org.rootOrgId);
- // If the identity is a sub-org identity, then the scope is always the org.id, and if it's a root org identity, then we need to resolve the scope if a subOrganizationName is specified
+ // If the identity is a sub-org identity, then the scope is always the org.id, and if it's a root org identity, then we need to resolve the scope if a organizationSlug is specified
let subOrganizationId = isSubOrgIdentity ? org.id : null;
try {
@@ -102,12 +102,12 @@ export const identityAzureAuthServiceFactory = ({
}
}
- if (subOrganizationName) {
+ if (organizationSlug) {
if (!isSubOrgIdentity) {
- const subOrg = await orgDAL.findOne({ rootOrgId: org.id, slug: subOrganizationName });
+ const subOrg = await orgDAL.findOne({ rootOrgId: org.id, slug: organizationSlug });
if (!subOrg) {
- throw new NotFoundError({ message: `Sub organization with name ${subOrganizationName} not found` });
+ throw new NotFoundError({ message: `Sub organization with slug ${organizationSlug} not found` });
}
const subOrgMembership = await membershipIdentityDAL.findOne({
@@ -118,7 +118,7 @@ export const identityAzureAuthServiceFactory = ({
if (!subOrgMembership) {
throw new UnauthorizedError({
- message: `Identity not authorized to access sub organization ${subOrganizationName}`
+ message: `Identity not authorized to access sub organization ${organizationSlug}`
});
}
diff --git a/backend/src/services/identity-azure-auth/identity-azure-auth-types.ts b/backend/src/services/identity-azure-auth/identity-azure-auth-types.ts
index 78d99dd555..9f1854aca1 100644
--- a/backend/src/services/identity-azure-auth/identity-azure-auth-types.ts
+++ b/backend/src/services/identity-azure-auth/identity-azure-auth-types.ts
@@ -3,7 +3,7 @@ import { TProjectPermission } from "@app/lib/types";
export type TLoginAzureAuthDTO = {
identityId: string;
jwt: string;
- subOrganizationName?: string;
+ organizationSlug?: string;
};
export type TAttachAzureAuthDTO = {
diff --git a/backend/src/services/identity-gcp-auth/identity-gcp-auth-service.ts b/backend/src/services/identity-gcp-auth/identity-gcp-auth-service.ts
index 471f5a5423..e2555ec6d2 100644
--- a/backend/src/services/identity-gcp-auth/identity-gcp-auth-service.ts
+++ b/backend/src/services/identity-gcp-auth/identity-gcp-auth-service.ts
@@ -61,7 +61,7 @@ export const identityGcpAuthServiceFactory = ({
licenseService,
orgDAL
}: TIdentityGcpAuthServiceFactoryDep) => {
- const login = async ({ identityId, jwt: gcpJwt, subOrganizationName }: TLoginGcpAuthDTO) => {
+ const login = async ({ identityId, jwt: gcpJwt, organizationSlug }: TLoginGcpAuthDTO) => {
const appCfg = getConfig();
const identityGcpAuth = await identityGcpAuthDAL.findOne({ identityId });
if (!identityGcpAuth) {
@@ -74,7 +74,7 @@ export const identityGcpAuthServiceFactory = ({
const org = await orgDAL.findById(identity.orgId);
const isSubOrgIdentity = Boolean(org.rootOrgId);
- // If the identity is a sub-org identity, then the scope is always the org.id, and if it's a root org identity, then we need to resolve the scope if a subOrganizationName is specified
+ // If the identity is a sub-org identity, then the scope is always the org.id, and if it's a root org identity, then we need to resolve the scope if a organizationSlug is specified
let subOrganizationId = isSubOrgIdentity ? org.id : null;
try {
@@ -143,12 +143,12 @@ export const identityGcpAuthServiceFactory = ({
});
}
- if (subOrganizationName) {
+ if (organizationSlug) {
if (!isSubOrgIdentity) {
- const subOrg = await orgDAL.findOne({ rootOrgId: org.id, slug: subOrganizationName });
+ const subOrg = await orgDAL.findOne({ rootOrgId: org.id, slug: organizationSlug });
if (!subOrg) {
- throw new NotFoundError({ message: `Sub organization with name ${subOrganizationName} not found` });
+ throw new NotFoundError({ message: `Sub organization with slug ${organizationSlug} not found` });
}
const subOrgMembership = await membershipIdentityDAL.findOne({
@@ -159,7 +159,7 @@ export const identityGcpAuthServiceFactory = ({
if (!subOrgMembership) {
throw new UnauthorizedError({
- message: `Identity not authorized to access sub organization ${subOrganizationName}`
+ message: `Identity not authorized to access sub organization ${organizationSlug}`
});
}
diff --git a/backend/src/services/identity-gcp-auth/identity-gcp-auth-types.ts b/backend/src/services/identity-gcp-auth/identity-gcp-auth-types.ts
index b26fa65396..c28611735c 100644
--- a/backend/src/services/identity-gcp-auth/identity-gcp-auth-types.ts
+++ b/backend/src/services/identity-gcp-auth/identity-gcp-auth-types.ts
@@ -3,7 +3,7 @@ import { TProjectPermission } from "@app/lib/types";
export type TLoginGcpAuthDTO = {
identityId: string;
jwt: string;
- subOrganizationName?: string;
+ organizationSlug?: string;
};
export type TAttachGcpAuthDTO = {
diff --git a/backend/src/services/identity-jwt-auth/identity-jwt-auth-service.ts b/backend/src/services/identity-jwt-auth/identity-jwt-auth-service.ts
index 2d68f10dda..6f011e8928 100644
--- a/backend/src/services/identity-jwt-auth/identity-jwt-auth-service.ts
+++ b/backend/src/services/identity-jwt-auth/identity-jwt-auth-service.ts
@@ -75,7 +75,7 @@ export const identityJwtAuthServiceFactory = ({
kmsService,
orgDAL
}: TIdentityJwtAuthServiceFactoryDep) => {
- const login = async ({ identityId, jwt: jwtValue, subOrganizationName }: TLoginJwtAuthDTO) => {
+ const login = async ({ identityId, jwt: jwtValue, organizationSlug }: TLoginJwtAuthDTO) => {
const appCfg = getConfig();
const identityJwtAuth = await identityJwtAuthDAL.findOne({ identityId });
if (!identityJwtAuth) {
@@ -88,7 +88,7 @@ export const identityJwtAuthServiceFactory = ({
const org = await orgDAL.findById(identity.orgId);
const isSubOrgIdentity = Boolean(org.rootOrgId);
- // If the identity is a sub-org identity, then the scope is always the org.id, and if it's a root org identity, then we need to resolve the scope if a subOrganizationName is specified
+ // If the identity is a sub-org identity, then the scope is always the org.id, and if it's a root org identity, then we need to resolve the scope if a organizationSlug is specified
let subOrganizationId = isSubOrgIdentity ? org.id : null;
try {
@@ -223,12 +223,12 @@ export const identityJwtAuthServiceFactory = ({
});
}
- if (subOrganizationName) {
+ if (organizationSlug) {
if (!isSubOrgIdentity) {
- const subOrg = await orgDAL.findOne({ rootOrgId: org.id, slug: subOrganizationName });
+ const subOrg = await orgDAL.findOne({ rootOrgId: org.id, slug: organizationSlug });
if (!subOrg) {
- throw new NotFoundError({ message: `Sub organization with name ${subOrganizationName} not found` });
+ throw new NotFoundError({ message: `Sub organization with slug ${organizationSlug} not found` });
}
const subOrgMembership = await membershipIdentityDAL.findOne({
@@ -239,7 +239,7 @@ export const identityJwtAuthServiceFactory = ({
if (!subOrgMembership) {
throw new UnauthorizedError({
- message: `Identity not authorized to access sub organization ${subOrganizationName}`
+ message: `Identity not authorized to access sub organization ${organizationSlug}`
});
}
diff --git a/backend/src/services/identity-jwt-auth/identity-jwt-auth-types.ts b/backend/src/services/identity-jwt-auth/identity-jwt-auth-types.ts
index 54d9a928d4..341fae399f 100644
--- a/backend/src/services/identity-jwt-auth/identity-jwt-auth-types.ts
+++ b/backend/src/services/identity-jwt-auth/identity-jwt-auth-types.ts
@@ -49,5 +49,5 @@ export type TRevokeJwtAuthDTO = {
export type TLoginJwtAuthDTO = {
identityId: string;
jwt: string;
- subOrganizationName?: string;
+ organizationSlug?: string;
};
diff --git a/backend/src/services/identity-kubernetes-auth/identity-kubernetes-auth-service.ts b/backend/src/services/identity-kubernetes-auth/identity-kubernetes-auth-service.ts
index b2b06dced2..1baf964092 100644
--- a/backend/src/services/identity-kubernetes-auth/identity-kubernetes-auth-service.ts
+++ b/backend/src/services/identity-kubernetes-auth/identity-kubernetes-auth-service.ts
@@ -256,7 +256,7 @@ export const identityKubernetesAuthServiceFactory = ({
};
};
- const login = async ({ identityId, jwt: serviceAccountJwt, subOrganizationName }: TLoginKubernetesAuthDTO) => {
+ const login = async ({ identityId, jwt: serviceAccountJwt, organizationSlug }: TLoginKubernetesAuthDTO) => {
const appCfg = getConfig();
const identityKubernetesAuth = await identityKubernetesAuthDAL.findOne({ identityId });
if (!identityKubernetesAuth) {
@@ -271,7 +271,7 @@ export const identityKubernetesAuthServiceFactory = ({
const org = await orgDAL.findById(identity.orgId);
const isSubOrgIdentity = Boolean(org.rootOrgId);
- // If the identity is a sub-org identity, then the scope is always the org.id, and if it's a root org identity, then we need to resolve the scope if a subOrganizationName is specified
+ // If the identity is a sub-org identity, then the scope is always the org.id, and if it's a root org identity, then we need to resolve the scope if a organizationSlug is specified
let subOrganizationId = isSubOrgIdentity ? org.id : null;
try {
@@ -544,12 +544,12 @@ export const identityKubernetesAuthServiceFactory = ({
});
}
- if (subOrganizationName) {
+ if (organizationSlug) {
if (!isSubOrgIdentity) {
- const subOrg = await orgDAL.findOne({ rootOrgId: org.id, slug: subOrganizationName });
+ const subOrg = await orgDAL.findOne({ rootOrgId: org.id, slug: organizationSlug });
if (!subOrg) {
- throw new NotFoundError({ message: `Sub organization with name ${subOrganizationName} not found` });
+ throw new NotFoundError({ message: `Sub organization with slug ${organizationSlug} not found` });
}
const subOrgMembership = await membershipIdentityDAL.findOne({
@@ -560,7 +560,7 @@ export const identityKubernetesAuthServiceFactory = ({
if (!subOrgMembership) {
throw new UnauthorizedError({
- message: `Identity not authorized to access sub organization ${subOrganizationName}`
+ message: `Identity not authorized to access sub organization ${organizationSlug}`
});
}
diff --git a/backend/src/services/identity-kubernetes-auth/identity-kubernetes-auth-types.ts b/backend/src/services/identity-kubernetes-auth/identity-kubernetes-auth-types.ts
index decb2957e4..8f06bfd5d3 100644
--- a/backend/src/services/identity-kubernetes-auth/identity-kubernetes-auth-types.ts
+++ b/backend/src/services/identity-kubernetes-auth/identity-kubernetes-auth-types.ts
@@ -3,7 +3,7 @@ import { TProjectPermission } from "@app/lib/types";
export type TLoginKubernetesAuthDTO = {
identityId: string;
jwt: string;
- subOrganizationName?: string;
+ organizationSlug?: string;
};
export enum IdentityKubernetesAuthTokenReviewMode {
diff --git a/backend/src/services/identity-ldap-auth/identity-ldap-auth-service.ts b/backend/src/services/identity-ldap-auth/identity-ldap-auth-service.ts
index 92b754e5a7..df318c4140 100644
--- a/backend/src/services/identity-ldap-auth/identity-ldap-auth-service.ts
+++ b/backend/src/services/identity-ldap-auth/identity-ldap-auth-service.ts
@@ -153,7 +153,7 @@ export const identityLdapAuthServiceFactory = ({
return { opts, ldapConfig };
};
- const login = async ({ identityId, subOrganizationName }: TLoginLdapAuthDTO) => {
+ const login = async ({ identityId, organizationSlug }: TLoginLdapAuthDTO) => {
const appCfg = getConfig();
const identityLdapAuth = await identityLdapAuthDAL.findOne({ identityId });
@@ -169,7 +169,7 @@ export const identityLdapAuthServiceFactory = ({
const org = await orgDAL.findById(identity.orgId);
const isSubOrgIdentity = Boolean(org.rootOrgId);
- // If the identity is a sub-org identity, then the scope is always the org.id, and if it's a root org identity, then we need to resolve the scope if a subOrganizationName is specified
+ // If the identity is a sub-org identity, then the scope is always the org.id, and if it's a root org identity, then we need to resolve the scope if a organizationSlug is specified
let subOrganizationId = isSubOrgIdentity ? org.id : null;
const plan = await licenseService.getPlan(identity.orgId);
@@ -179,12 +179,12 @@ export const identityLdapAuthServiceFactory = ({
"Failed to login to identity due to plan restriction. Upgrade plan to login to use LDAP authentication."
});
}
- if (subOrganizationName) {
+ if (organizationSlug) {
if (!isSubOrgIdentity) {
- const subOrg = await orgDAL.findOne({ rootOrgId: org.id, slug: subOrganizationName });
+ const subOrg = await orgDAL.findOne({ rootOrgId: org.id, slug: organizationSlug });
if (!subOrg) {
- throw new NotFoundError({ message: `Sub organization with name ${subOrganizationName} not found` });
+ throw new NotFoundError({ message: `Sub organization with slug ${organizationSlug} not found` });
}
const subOrgMembership = await membershipIdentityDAL.findOne({
@@ -195,7 +195,7 @@ export const identityLdapAuthServiceFactory = ({
if (!subOrgMembership) {
throw new UnauthorizedError({
- message: `Identity not authorized to access sub organization ${subOrganizationName}`
+ message: `Identity not authorized to access sub organization ${organizationSlug}`
});
}
diff --git a/backend/src/services/identity-ldap-auth/identity-ldap-auth-types.ts b/backend/src/services/identity-ldap-auth/identity-ldap-auth-types.ts
index b438c937f6..26e118073f 100644
--- a/backend/src/services/identity-ldap-auth/identity-ldap-auth-types.ts
+++ b/backend/src/services/identity-ldap-auth/identity-ldap-auth-types.ts
@@ -59,7 +59,7 @@ export type TGetLdapAuthDTO = {
export type TLoginLdapAuthDTO = {
identityId: string;
- subOrganizationName?: string;
+ organizationSlug?: string;
};
export type TRevokeLdapAuthDTO = {
diff --git a/backend/src/services/identity-oci-auth/identity-oci-auth-service.ts b/backend/src/services/identity-oci-auth/identity-oci-auth-service.ts
index 18f01e83e9..1c12a71b42 100644
--- a/backend/src/services/identity-oci-auth/identity-oci-auth-service.ts
+++ b/backend/src/services/identity-oci-auth/identity-oci-auth-service.ts
@@ -65,7 +65,7 @@ export const identityOciAuthServiceFactory = ({
permissionService,
orgDAL
}: TIdentityOciAuthServiceFactoryDep) => {
- const login = async ({ identityId, headers, userOcid, subOrganizationName }: TLoginOciAuthDTO) => {
+ const login = async ({ identityId, headers, userOcid, organizationSlug }: TLoginOciAuthDTO) => {
const appCfg = getConfig();
const identityOciAuth = await identityOciAuthDAL.findOne({ identityId });
if (!identityOciAuth) {
@@ -78,7 +78,7 @@ export const identityOciAuthServiceFactory = ({
const org = await orgDAL.findById(identity.orgId);
const isSubOrgIdentity = Boolean(org.rootOrgId);
- // If the identity is a sub-org identity, then the scope is always the org.id, and if it's a root org identity, then we need to resolve the scope if a subOrganizationName is specified
+ // If the identity is a sub-org identity, then the scope is always the org.id, and if it's a root org identity, then we need to resolve the scope if a organizationSlug is specified
let subOrganizationId = isSubOrgIdentity ? org.id : null;
try {
@@ -113,12 +113,12 @@ export const identityOciAuthServiceFactory = ({
});
}
- if (subOrganizationName) {
+ if (organizationSlug) {
if (!isSubOrgIdentity) {
- const subOrg = await orgDAL.findOne({ rootOrgId: org.id, slug: subOrganizationName });
+ const subOrg = await orgDAL.findOne({ rootOrgId: org.id, slug: organizationSlug });
if (!subOrg) {
- throw new NotFoundError({ message: `Sub organization with name ${subOrganizationName} not found` });
+ throw new NotFoundError({ message: `Sub organization with slug ${organizationSlug} not found` });
}
const subOrgMembership = await membershipIdentityDAL.findOne({
@@ -129,7 +129,7 @@ export const identityOciAuthServiceFactory = ({
if (!subOrgMembership) {
throw new UnauthorizedError({
- message: `Identity not authorized to access sub organization ${subOrganizationName}`
+ message: `Identity not authorized to access sub organization ${organizationSlug}`
});
}
diff --git a/backend/src/services/identity-oci-auth/identity-oci-auth-types.ts b/backend/src/services/identity-oci-auth/identity-oci-auth-types.ts
index 0ac043ab83..8c1d6d4826 100644
--- a/backend/src/services/identity-oci-auth/identity-oci-auth-types.ts
+++ b/backend/src/services/identity-oci-auth/identity-oci-auth-types.ts
@@ -9,7 +9,7 @@ export type TLoginOciAuthDTO = {
"x-date"?: string;
date?: string;
};
- subOrganizationName?: string;
+ organizationSlug?: string;
};
export type TAttachOciAuthDTO = {
diff --git a/backend/src/services/identity-oidc-auth/identity-oidc-auth-service.ts b/backend/src/services/identity-oidc-auth/identity-oidc-auth-service.ts
index 1e033d6624..261153f1d8 100644
--- a/backend/src/services/identity-oidc-auth/identity-oidc-auth-service.ts
+++ b/backend/src/services/identity-oidc-auth/identity-oidc-auth-service.ts
@@ -76,7 +76,7 @@ export const identityOidcAuthServiceFactory = ({
kmsService,
orgDAL
}: TIdentityOidcAuthServiceFactoryDep) => {
- const login = async ({ identityId, jwt: oidcJwt, subOrganizationName }: TLoginOidcAuthDTO) => {
+ const login = async ({ identityId, jwt: oidcJwt, organizationSlug }: TLoginOidcAuthDTO) => {
const appCfg = getConfig();
const identityOidcAuth = await identityOidcAuthDAL.findOne({ identityId });
if (!identityOidcAuth) {
@@ -89,7 +89,7 @@ export const identityOidcAuthServiceFactory = ({
const org = await orgDAL.findById(identity.orgId);
const isSubOrgIdentity = Boolean(org.rootOrgId);
- // If the identity is a sub-org identity, then the scope is always the org.id, and if it's a root org identity, then we need to resolve the scope if a subOrganizationName is specified
+ // If the identity is a sub-org identity, then the scope is always the org.id, and if it's a root org identity, then we need to resolve the scope if a organizationSlug is specified
let subOrganizationId = isSubOrgIdentity ? org.id : null;
try {
@@ -291,12 +291,12 @@ export const identityOidcAuthServiceFactory = ({
});
}
- if (subOrganizationName) {
+ if (organizationSlug) {
if (!isSubOrgIdentity) {
- const subOrg = await orgDAL.findOne({ rootOrgId: org.id, slug: subOrganizationName });
+ const subOrg = await orgDAL.findOne({ rootOrgId: org.id, slug: organizationSlug });
if (!subOrg) {
- throw new NotFoundError({ message: `Sub organization with name ${subOrganizationName} not found` });
+ throw new NotFoundError({ message: `Sub organization with slug ${organizationSlug} not found` });
}
const subOrgMembership = await membershipIdentityDAL.findOne({
@@ -307,7 +307,7 @@ export const identityOidcAuthServiceFactory = ({
if (!subOrgMembership) {
throw new UnauthorizedError({
- message: `Identity not authorized to access sub organization ${subOrganizationName}`
+ message: `Identity not authorized to access sub organization ${organizationSlug}`
});
}
diff --git a/backend/src/services/identity-oidc-auth/identity-oidc-auth-types.ts b/backend/src/services/identity-oidc-auth/identity-oidc-auth-types.ts
index 5d06d778cd..5904151afd 100644
--- a/backend/src/services/identity-oidc-auth/identity-oidc-auth-types.ts
+++ b/backend/src/services/identity-oidc-auth/identity-oidc-auth-types.ts
@@ -38,7 +38,7 @@ export type TGetOidcAuthDTO = {
export type TLoginOidcAuthDTO = {
identityId: string;
jwt: string;
- subOrganizationName?: string;
+ organizationSlug?: string;
};
export type TRevokeOidcAuthDTO = {
diff --git a/backend/src/services/identity-tls-cert-auth/identity-tls-cert-auth-service.ts b/backend/src/services/identity-tls-cert-auth/identity-tls-cert-auth-service.ts
index bfa4db14d9..934de01481 100644
--- a/backend/src/services/identity-tls-cert-auth/identity-tls-cert-auth-service.ts
+++ b/backend/src/services/identity-tls-cert-auth/identity-tls-cert-auth-service.ts
@@ -71,7 +71,7 @@ export const identityTlsCertAuthServiceFactory = ({
const login: TIdentityTlsCertAuthServiceFactory["login"] = async ({
identityId,
clientCertificate,
- subOrganizationName
+ organizationSlug
}) => {
const appCfg = getConfig();
const identityTlsCertAuth = await identityTlsCertAuthDAL.findOne({ identityId });
@@ -87,7 +87,7 @@ export const identityTlsCertAuthServiceFactory = ({
const org = await orgDAL.findById(identity.orgId);
const isSubOrgIdentity = Boolean(org.rootOrgId);
- // If the identity is a sub-org identity, then the scope is always the org.id, and if it's a root org identity, then we need to resolve the scope if a subOrganizationName is specified
+ // If the identity is a sub-org identity, then the scope is always the org.id, and if it's a root org identity, then we need to resolve the scope if a organizationSlug is specified
let subOrganizationId = isSubOrgIdentity ? org.id : null;
try {
@@ -136,12 +136,12 @@ export const identityTlsCertAuthServiceFactory = ({
}
}
- if (subOrganizationName) {
+ if (organizationSlug) {
if (!isSubOrgIdentity) {
- const subOrg = await orgDAL.findOne({ rootOrgId: org.id, slug: subOrganizationName });
+ const subOrg = await orgDAL.findOne({ rootOrgId: org.id, slug: organizationSlug });
if (!subOrg) {
- throw new NotFoundError({ message: `Sub organization with name ${subOrganizationName} not found` });
+ throw new NotFoundError({ message: `Sub organization with slug ${organizationSlug} not found` });
}
const subOrgMembership = await membershipIdentityDAL.findOne({
@@ -152,7 +152,7 @@ export const identityTlsCertAuthServiceFactory = ({
if (!subOrgMembership) {
throw new UnauthorizedError({
- message: `Identity not authorized to access sub organization ${subOrganizationName}`
+ message: `Identity not authorized to access sub organization ${organizationSlug}`
});
}
diff --git a/backend/src/services/identity-tls-cert-auth/identity-tls-cert-auth-types.ts b/backend/src/services/identity-tls-cert-auth/identity-tls-cert-auth-types.ts
index 77932042b6..b2b6d2b8a8 100644
--- a/backend/src/services/identity-tls-cert-auth/identity-tls-cert-auth-types.ts
+++ b/backend/src/services/identity-tls-cert-auth/identity-tls-cert-auth-types.ts
@@ -4,7 +4,7 @@ import { TProjectPermission } from "@app/lib/types";
export type TLoginTlsCertAuthDTO = {
identityId: string;
clientCertificate: string;
- subOrganizationName?: string;
+ organizationSlug?: string;
};
export type TAttachTlsCertAuthDTO = {
diff --git a/backend/src/services/identity-token-auth/identity-token-auth-service.ts b/backend/src/services/identity-token-auth/identity-token-auth-service.ts
index bda66e6e1e..9ddb876dee 100644
--- a/backend/src/services/identity-token-auth/identity-token-auth-service.ts
+++ b/backend/src/services/identity-token-auth/identity-token-auth-service.ts
@@ -425,7 +425,7 @@ export const identityTokenAuthServiceFactory = ({
actorOrgId,
name,
isActorSuperAdmin,
- subOrganizationName
+ organizationSlug
}: TCreateTokenAuthTokenDTO) => {
await validateIdentityUpdateForSuperAdminPrivileges(identityId, isActorSuperAdmin);
@@ -507,15 +507,15 @@ export const identityTokenAuthServiceFactory = ({
const org = await orgDAL.findById(identity.orgId);
const isSubOrgIdentity = Boolean(org.rootOrgId);
- // If the identity is a sub-org identity, then the scope is always the org.id, and if it's a root org identity, then we need to resolve the scope if a subOrganizationName is specified
+ // If the identity is a sub-org identity, then the scope is always the org.id, and if it's a root org identity, then we need to resolve the scope if a organizationSlug is specified
let subOrganizationId = isSubOrgIdentity ? org.id : null;
- if (subOrganizationName) {
+ if (organizationSlug) {
if (!isSubOrgIdentity) {
- const subOrg = await orgDAL.findOne({ rootOrgId: org.id, slug: subOrganizationName });
+ const subOrg = await orgDAL.findOne({ rootOrgId: org.id, slug: organizationSlug });
if (!subOrg) {
- throw new NotFoundError({ message: `Sub organization with name ${subOrganizationName} not found` });
+ throw new NotFoundError({ message: `Sub organization with slug ${organizationSlug} not found` });
}
const subOrgMembership = await membershipIdentityDAL.findOne({
@@ -526,7 +526,7 @@ export const identityTokenAuthServiceFactory = ({
if (!subOrgMembership) {
throw new UnauthorizedError({
- message: `Identity not authorized to access sub organization ${subOrganizationName}`
+ message: `Identity not authorized to access sub organization ${organizationSlug}`
});
}
diff --git a/backend/src/services/identity-token-auth/identity-token-auth-types.ts b/backend/src/services/identity-token-auth/identity-token-auth-types.ts
index 14fc95fa95..f8ea304d29 100644
--- a/backend/src/services/identity-token-auth/identity-token-auth-types.ts
+++ b/backend/src/services/identity-token-auth/identity-token-auth-types.ts
@@ -30,7 +30,7 @@ export type TRevokeTokenAuthDTO = {
export type TCreateTokenAuthTokenDTO = {
identityId: string;
name?: string;
- subOrganizationName?: string;
+ organizationSlug?: string;
isActorSuperAdmin?: boolean;
} & Omit<TProjectPermission, "projectId">;
diff --git a/backend/src/services/identity-ua/identity-ua-service.ts b/backend/src/services/identity-ua/identity-ua-service.ts
index d47b930490..26fd8829fb 100644
--- a/backend/src/services/identity-ua/identity-ua-service.ts
+++ b/backend/src/services/identity-ua/identity-ua-service.ts
@@ -80,7 +80,7 @@ export const identityUaServiceFactory = ({
keyStore,
identityDAL
}: TIdentityUaServiceFactoryDep) => {
- const login = async ({ clientId, clientSecret, ip, subOrganizationName }: TLoginUaDTO) => {
+ const login = async ({ clientId, clientSecret, ip, organizationSlug }: TLoginUaDTO) => {
const appCfg = getConfig();
const identityUa = await identityUaDAL.findOne({ clientId });
if (!identityUa) {
@@ -234,12 +234,12 @@ export const identityUaServiceFactory = ({
accessTokenMaxTTL: 1000000000
};
- if (subOrganizationName) {
+ if (organizationSlug) {
if (!isSubOrgIdentity) {
- const subOrg = await orgDAL.findOne({ rootOrgId: org.id, slug: subOrganizationName });
+ const subOrg = await orgDAL.findOne({ rootOrgId: org.id, slug: organizationSlug });
if (!subOrg) {
- throw new NotFoundError({ message: `Sub organization with name ${subOrganizationName} not found` });
+ throw new NotFoundError({ message: `Sub organization with name ${organizationSlug} not found` });
}
const subOrgMembership = await membershipIdentityDAL.findOne({
@@ -250,7 +250,7 @@ export const identityUaServiceFactory = ({
if (!subOrgMembership) {
throw new UnauthorizedError({
- message: `Identity not authorized to access sub organization ${subOrganizationName}`
+ message: `Identity not authorized to access sub organization ${organizationSlug}`
});
}
diff --git a/backend/src/services/identity-ua/identity-ua-types.ts b/backend/src/services/identity-ua/identity-ua-types.ts
index 3ff8f5cc5a..138690ca41 100644
--- a/backend/src/services/identity-ua/identity-ua-types.ts
+++ b/backend/src/services/identity-ua/identity-ua-types.ts
@@ -4,7 +4,7 @@ export type TLoginUaDTO = {
clientId: string;
clientSecret: string;
ip: string;
- subOrganizationName?: string;
+ organizationSlug?: string;
};
export type TAttachUaDTO = {