Skip to content

SigNoz is an open-source, OpenTelemetry-native observability platform for your team and their AI agents. Get logs, metrics, and traces in one tool with features like APM, distributed tracing, log management, infra monitoring, etc. Combined with SigNoz MCP and a native AI teammate (in SigNoz Cloud) it helps you build more resilient apps.

fix(authdomain): nest config response, rename Updateable→Updatable, return Identifiable on create (#11176)

Pandey8409a9798deb
diff --git a/docs/api/openapi.yml b/docs/api/openapi.yml
index 99dd550ce8..b7265b1727 100644
--- a/docs/api/openapi.yml
+++ b/docs/api/openapi.yml
@@ -301,34 +301,20 @@ components:
type: string
type: object
AuthtypesGettableAuthDomain:
- oneOf:
- - $ref: '#/components/schemas/AuthtypesSamlConfig'
- - $ref: '#/components/schemas/AuthtypesGoogleConfig'
- - $ref: '#/components/schemas/AuthtypesOIDCConfig'
properties:
authNProviderInfo:
$ref: '#/components/schemas/AuthtypesAuthNProviderInfo'
+ config:
+ $ref: '#/components/schemas/AuthtypesAuthDomainConfig'
createdAt:
format: date-time
type: string
- googleAuthConfig:
- $ref: '#/components/schemas/AuthtypesGoogleConfig'
id:
type: string
name:
type: string
- oidcConfig:
- $ref: '#/components/schemas/AuthtypesOIDCConfig'
orgId:
type: string
- roleMapping:
- $ref: '#/components/schemas/AuthtypesRoleMapping'
- samlConfig:
- $ref: '#/components/schemas/AuthtypesSamlConfig'
- ssoEnabled:
- type: boolean
- ssoType:
- $ref: '#/components/schemas/AuthtypesAuthNProvider'
updatedAt:
format: date-time
type: string
@@ -589,7 +575,7 @@ components:
- relation
- object
type: object
- AuthtypesUpdateableAuthDomain:
+ AuthtypesUpdatableAuthDomain:
properties:
config:
$ref: '#/components/schemas/AuthtypesAuthDomainConfig'
@@ -7079,20 +7065,20 @@ paths:
schema:
$ref: '#/components/schemas/AuthtypesPostableAuthDomain'
responses:
- "200":
+ "201":
content:
application/json:
schema:
properties:
data:
- $ref: '#/components/schemas/AuthtypesGettableAuthDomain'
+ $ref: '#/components/schemas/TypesIdentifiable'
status:
type: string
required:
- status
- data
type: object
- description: OK
+ description: Created
"400":
content:
application/json:
@@ -7248,7 +7234,7 @@ paths:
content:
application/json:
schema:
- $ref: '#/components/schemas/AuthtypesUpdateableAuthDomain'
+ $ref: '#/components/schemas/AuthtypesUpdatableAuthDomain'
responses:
"204":
description: No Content
diff --git a/frontend/src/api/generated/services/authdomains/index.ts b/frontend/src/api/generated/services/authdomains/index.ts
index b96440eec8..14b9f0268c 100644
--- a/frontend/src/api/generated/services/authdomains/index.ts
+++ b/frontend/src/api/generated/services/authdomains/index.ts
@@ -19,8 +19,8 @@ import type {
import type {
AuthtypesPostableAuthDomainDTO,
- AuthtypesUpdateableAuthDomainDTO,
- CreateAuthDomain200,
+ AuthtypesUpdatableAuthDomainDTO,
+ CreateAuthDomain201,
DeleteAuthDomainPathParameters,
GetAuthDomain200,
GetAuthDomainPathParameters,
@@ -126,7 +126,7 @@ export const createAuthDomain = (
authtypesPostableAuthDomainDTO: BodyType<AuthtypesPostableAuthDomainDTO>,
signal?: AbortSignal,
) => {
- return GeneratedAPIInstance<CreateAuthDomain200>({
+ return GeneratedAPIInstance<CreateAuthDomain201>({
url: `/api/v1/domains`,
method: 'POST',
headers: { 'Content-Type': 'application/json' },
@@ -388,13 +388,13 @@ export const invalidateGetAuthDomain = async (
*/
export const updateAuthDomain = (
{ id }: UpdateAuthDomainPathParameters,
- authtypesUpdateableAuthDomainDTO: BodyType<AuthtypesUpdateableAuthDomainDTO>,
+ authtypesUpdatableAuthDomainDTO: BodyType<AuthtypesUpdatableAuthDomainDTO>,
) => {
return GeneratedAPIInstance<void>({
url: `/api/v1/domains/${id}`,
method: 'PUT',
headers: { 'Content-Type': 'application/json' },
- data: authtypesUpdateableAuthDomainDTO,
+ data: authtypesUpdatableAuthDomainDTO,
});
};
@@ -407,7 +407,7 @@ export const getUpdateAuthDomainMutationOptions = <
TError,
{
pathParams: UpdateAuthDomainPathParameters;
- data: BodyType<AuthtypesUpdateableAuthDomainDTO>;
+ data: BodyType<AuthtypesUpdatableAuthDomainDTO>;
},
TContext
>;
@@ -416,7 +416,7 @@ export const getUpdateAuthDomainMutationOptions = <
TError,
{
pathParams: UpdateAuthDomainPathParameters;
- data: BodyType<AuthtypesUpdateableAuthDomainDTO>;
+ data: BodyType<AuthtypesUpdatableAuthDomainDTO>;
},
TContext
> => {
@@ -433,7 +433,7 @@ export const getUpdateAuthDomainMutationOptions = <
Awaited<ReturnType<typeof updateAuthDomain>>,
{
pathParams: UpdateAuthDomainPathParameters;
- data: BodyType<AuthtypesUpdateableAuthDomainDTO>;
+ data: BodyType<AuthtypesUpdatableAuthDomainDTO>;
}
> = (props) => {
const { pathParams, data } = props ?? {};
@@ -448,7 +448,7 @@ export type UpdateAuthDomainMutationResult = NonNullable<
Awaited<ReturnType<typeof updateAuthDomain>>
>;
export type UpdateAuthDomainMutationBody =
- BodyType<AuthtypesUpdateableAuthDomainDTO>;
+ BodyType<AuthtypesUpdatableAuthDomainDTO>;
export type UpdateAuthDomainMutationError = ErrorType<RenderErrorResponseDTO>;
/**
@@ -463,7 +463,7 @@ export const useUpdateAuthDomain = <
TError,
{
pathParams: UpdateAuthDomainPathParameters;
- data: BodyType<AuthtypesUpdateableAuthDomainDTO>;
+ data: BodyType<AuthtypesUpdatableAuthDomainDTO>;
},
TContext
>;
@@ -472,7 +472,7 @@ export const useUpdateAuthDomain = <
TError,
{
pathParams: UpdateAuthDomainPathParameters;
- data: BodyType<AuthtypesUpdateableAuthDomainDTO>;
+ data: BodyType<AuthtypesUpdatableAuthDomainDTO>;
},
TContext
> => {
diff --git a/frontend/src/api/generated/services/sigNoz.schemas.ts b/frontend/src/api/generated/services/sigNoz.schemas.ts
index 5fbf5fa5f2..c1bc29f04e 100644
--- a/frontend/src/api/generated/services/sigNoz.schemas.ts
+++ b/frontend/src/api/generated/services/sigNoz.schemas.ts
@@ -1641,109 +1641,32 @@ export interface AuthtypesCallbackAuthNSupportDTO {
url?: string;
}
-export type AuthtypesGettableAuthDomainDTO =
- | (AuthtypesSamlConfigDTO & {
- authNProviderInfo?: AuthtypesAuthNProviderInfoDTO;
- /**
- * @type string
- * @format date-time
- */
- createdAt?: Date;
- googleAuthConfig?: AuthtypesGoogleConfigDTO;
- /**
- * @type string
- */
- id: string;
- /**
- * @type string
- */
- name?: string;
- oidcConfig?: AuthtypesOIDCConfigDTO;
- /**
- * @type string
- */
- orgId?: string;
- roleMapping?: AuthtypesRoleMappingDTO;
- samlConfig?: AuthtypesSamlConfigDTO;
- /**
- * @type boolean
- */
- ssoEnabled?: boolean;
- ssoType?: AuthtypesAuthNProviderDTO;
- /**
- * @type string
- * @format date-time
- */
- updatedAt?: Date;
- })
- | (AuthtypesGoogleConfigDTO & {
- authNProviderInfo?: AuthtypesAuthNProviderInfoDTO;
- /**
- * @type string
- * @format date-time
- */
- createdAt?: Date;
- googleAuthConfig?: AuthtypesGoogleConfigDTO;
- /**
- * @type string
- */
- id: string;
- /**
- * @type string
- */
- name?: string;
- oidcConfig?: AuthtypesOIDCConfigDTO;
- /**
- * @type string
- */
- orgId?: string;
- roleMapping?: AuthtypesRoleMappingDTO;
- samlConfig?: AuthtypesSamlConfigDTO;
- /**
- * @type boolean
- */
- ssoEnabled?: boolean;
- ssoType?: AuthtypesAuthNProviderDTO;
- /**
- * @type string
- * @format date-time
- */
- updatedAt?: Date;
- })
- | (AuthtypesOIDCConfigDTO & {
- authNProviderInfo?: AuthtypesAuthNProviderInfoDTO;
- /**
- * @type string
- * @format date-time
- */
- createdAt?: Date;
- googleAuthConfig?: AuthtypesGoogleConfigDTO;
- /**
- * @type string
- */
- id: string;
- /**
- * @type string
- */
- name?: string;
- oidcConfig?: AuthtypesOIDCConfigDTO;
- /**
- * @type string
- */
- orgId?: string;
- roleMapping?: AuthtypesRoleMappingDTO;
- samlConfig?: AuthtypesSamlConfigDTO;
- /**
- * @type boolean
- */
- ssoEnabled?: boolean;
- ssoType?: AuthtypesAuthNProviderDTO;
- /**
- * @type string
- * @format date-time
- */
- updatedAt?: Date;
- });
+export interface AuthtypesGettableAuthDomainDTO {
+ authNProviderInfo?: AuthtypesAuthNProviderInfoDTO;
+ config?: AuthtypesAuthDomainConfigDTO;
+ /**
+ * @type string
+ * @format date-time
+ */
+ createdAt?: Date;
+ /**
+ * @type string
+ */
+ id: string;
+ /**
+ * @type string
+ */
+ name?: string;
+ /**
+ * @type string
+ */
+ orgId?: string;
+ /**
+ * @type string
+ * @format date-time
+ */
+ updatedAt?: Date;
+}
export interface AuthtypesGettableObjectsDTO {
resource: AuthtypesResourceDTO;
@@ -2067,7 +1990,7 @@ export interface AuthtypesTransactionDTO {
relation: string;
}
-export interface AuthtypesUpdateableAuthDomainDTO {
+export interface AuthtypesUpdatableAuthDomainDTO {
config?: AuthtypesAuthDomainConfigDTO;
}
@@ -8432,8 +8355,8 @@ export type ListAuthDomains200 = {
status: string;
};
-export type CreateAuthDomain200 = {
- data: AuthtypesGettableAuthDomainDTO;
+export type CreateAuthDomain201 = {
+ data: TypesIdentifiableDTO;
/**
* @type string
*/
diff --git a/frontend/src/container/OrganizationSettings/AuthDomain/CreateEdit/CreateEdit.tsx b/frontend/src/container/OrganizationSettings/AuthDomain/CreateEdit/CreateEdit.tsx
index fa4505534e..0de1ab3bd4 100644
--- a/frontend/src/container/OrganizationSettings/AuthDomain/CreateEdit/CreateEdit.tsx
+++ b/frontend/src/container/OrganizationSettings/AuthDomain/CreateEdit/CreateEdit.tsx
@@ -60,7 +60,7 @@ function CreateOrEdit(props: CreateOrEditProps): JSX.Element {
const [form] = Form.useForm<FormValues>();
const [authnProvider, setAuthnProvider] = useState<
AuthtypesAuthNProviderDTO | ''
- >(record?.ssoType || '');
+ >(record?.config?.ssoType || '');
const { showErrorModal } = useErrorModal();
const { featureFlags } = useAppContext();
diff --git a/frontend/src/container/OrganizationSettings/AuthDomain/CreateEdit/CreateEdit.utils.ts b/frontend/src/container/OrganizationSettings/AuthDomain/CreateEdit/CreateEdit.utils.ts
index d37e5515b4..7cf5c4db58 100644
--- a/frontend/src/container/OrganizationSettings/AuthDomain/CreateEdit/CreateEdit.utils.ts
+++ b/frontend/src/container/OrganizationSettings/AuthDomain/CreateEdit/CreateEdit.utils.ts
@@ -112,21 +112,26 @@ export function prepareInitialValues(
};
}
+ const config = record.config ?? {};
return {
- ...record,
- googleAuthConfig: record.googleAuthConfig
+ name: record.name,
+ ssoEnabled: config.ssoEnabled,
+ ssoType: config.ssoType,
+ samlConfig: config.samlConfig ?? undefined,
+ oidcConfig: config.oidcConfig ?? undefined,
+ googleAuthConfig: config.googleAuthConfig
? {
- ...record.googleAuthConfig,
+ ...config.googleAuthConfig,
domainToAdminEmailList: convertDomainMappingsToList(
- record.googleAuthConfig.domainToAdminEmail,
+ config.googleAuthConfig.domainToAdminEmail,
),
}
: undefined,
- roleMapping: record.roleMapping
+ roleMapping: config.roleMapping
? {
- ...record.roleMapping,
+ ...config.roleMapping,
groupMappingsList: convertGroupMappingsToList(
- record.roleMapping.groupMappings,
+ config.roleMapping.groupMappings,
),
}
: undefined,
diff --git a/frontend/src/container/OrganizationSettings/AuthDomain/SSOEnforcementToggle.tsx b/frontend/src/container/OrganizationSettings/AuthDomain/SSOEnforcementToggle.tsx
index 5f5f1aa232..54e6f097d0 100644
--- a/frontend/src/container/OrganizationSettings/AuthDomain/SSOEnforcementToggle.tsx
+++ b/frontend/src/container/OrganizationSettings/AuthDomain/SSOEnforcementToggle.tsx
@@ -43,11 +43,11 @@ function SSOEnforcementToggle({
data: {
config: {
ssoEnabled: checked,
- ssoType: record.ssoType,
- googleAuthConfig: record.googleAuthConfig,
- oidcConfig: record.oidcConfig,
- samlConfig: record.samlConfig,
- roleMapping: record.roleMapping,
+ ssoType: record.config?.ssoType,
+ googleAuthConfig: record.config?.googleAuthConfig,
+ oidcConfig: record.config?.oidcConfig,
+ samlConfig: record.config?.samlConfig,
+ roleMapping: record.config?.roleMapping,
},
},
},
diff --git a/frontend/src/container/OrganizationSettings/AuthDomain/__tests__/SSOEnforcementToggle.test.tsx b/frontend/src/container/OrganizationSettings/AuthDomain/__tests__/SSOEnforcementToggle.test.tsx
index 1f96fe0661..114a0b03ff 100644
--- a/frontend/src/container/OrganizationSettings/AuthDomain/__tests__/SSOEnforcementToggle.test.tsx
+++ b/frontend/src/container/OrganizationSettings/AuthDomain/__tests__/SSOEnforcementToggle.test.tsx
@@ -55,7 +55,10 @@ describe('SSOEnforcementToggle', () => {
render(
<SSOEnforcementToggle
isDefaultChecked={false}
- record={{ ...mockGoogleAuthDomain, ssoEnabled: false }}
+ record={{
+ ...mockGoogleAuthDomain,
+ config: { ...mockGoogleAuthDomain.config, ssoEnabled: false },
+ }}
/>,
);
diff --git a/frontend/src/container/OrganizationSettings/AuthDomain/__tests__/mocks.ts b/frontend/src/container/OrganizationSettings/AuthDomain/__tests__/mocks.ts
index 95230a23e5..324641571e 100644
--- a/frontend/src/container/OrganizationSettings/AuthDomain/__tests__/mocks.ts
+++ b/frontend/src/container/OrganizationSettings/AuthDomain/__tests__/mocks.ts
@@ -13,11 +13,13 @@ export const AUTH_DOMAINS_DELETE_ENDPOINT = '*/api/v1/domains/:id';
export const mockGoogleAuthDomain: AuthtypesGettableAuthDomainDTO = {
id: 'domain-1',
name: 'signoz.io',
- ssoEnabled: true,
- ssoType: AuthtypesAuthNProviderDTO.google_auth,
- googleAuthConfig: {
- clientId: 'test-client-id',
- clientSecret: 'test-client-secret',
+ config: {
+ ssoEnabled: true,
+ ssoType: AuthtypesAuthNProviderDTO.google_auth,
+ googleAuthConfig: {
+ clientId: 'test-client-id',
+ clientSecret: 'test-client-secret',
+ },
},
authNProviderInfo: {
relayStatePath: 'api/v1/sso/relay/domain-1',
@@ -28,12 +30,14 @@ export const mockGoogleAuthDomain: AuthtypesGettableAuthDomainDTO = {
export const mockSamlAuthDomain: AuthtypesGettableAuthDomainDTO = {
id: 'domain-2',
name: 'example.com',
- ssoEnabled: false,
- ssoType: AuthtypesAuthNProviderDTO.saml,
- samlConfig: {
- samlIdp: 'https://idp.example.com/sso',
- samlEntity: 'urn:example:idp',
- samlCert: 'MOCK_CERTIFICATE',
+ config: {
+ ssoEnabled: false,
+ ssoType: AuthtypesAuthNProviderDTO.saml,
+ samlConfig: {
+ samlIdp: 'https://idp.example.com/sso',
+ samlEntity: 'urn:example:idp',
+ samlCert: 'MOCK_CERTIFICATE',
+ },
},
authNProviderInfo: {
relayStatePath: 'api/v1/sso/relay/domain-2',
@@ -44,12 +48,14 @@ export const mockSamlAuthDomain: AuthtypesGettableAuthDomainDTO = {
export const mockOidcAuthDomain: AuthtypesGettableAuthDomainDTO = {
id: 'domain-3',
name: 'corp.io',
- ssoEnabled: true,
- ssoType: AuthtypesAuthNProviderDTO.oidc,
- oidcConfig: {
- issuer: 'https://oidc.corp.io',
- clientId: 'oidc-client-id',
- clientSecret: 'oidc-client-secret',
+ config: {
+ ssoEnabled: true,
+ ssoType: AuthtypesAuthNProviderDTO.oidc,
+ oidcConfig: {
+ issuer: 'https://oidc.corp.io',
+ clientId: 'oidc-client-id',
+ clientSecret: 'oidc-client-secret',
+ },
},
authNProviderInfo: {
relayStatePath: 'api/v1/sso/relay/domain-3',
@@ -60,20 +66,22 @@ export const mockOidcAuthDomain: AuthtypesGettableAuthDomainDTO = {
export const mockDomainWithRoleMapping: AuthtypesGettableAuthDomainDTO = {
id: 'domain-4',
name: 'enterprise.com',
- ssoEnabled: true,
- ssoType: AuthtypesAuthNProviderDTO.saml,
- samlConfig: {
- samlIdp: 'https://idp.enterprise.com/sso',
- samlEntity: 'urn:enterprise:idp',
- samlCert: 'MOCK_CERTIFICATE',
- },
- roleMapping: {
- defaultRole: 'EDITOR',
- useRoleAttribute: false,
- groupMappings: {
- 'admin-group': 'ADMIN',
- 'dev-team': 'EDITOR',
- viewers: 'VIEWER',
+ config: {
+ ssoEnabled: true,
+ ssoType: AuthtypesAuthNProviderDTO.saml,
+ samlConfig: {
+ samlIdp: 'https://idp.enterprise.com/sso',
+ samlEntity: 'urn:enterprise:idp',
+ samlCert: 'MOCK_CERTIFICATE',
+ },
+ roleMapping: {
+ defaultRole: 'EDITOR',
+ useRoleAttribute: false,
+ groupMappings: {
+ 'admin-group': 'ADMIN',
+ 'dev-team': 'EDITOR',
+ viewers: 'VIEWER',
+ },
},
},
authNProviderInfo: {
@@ -86,16 +94,18 @@ export const mockDomainWithDirectRoleAttribute: AuthtypesGettableAuthDomainDTO =
{
id: 'domain-5',
name: 'direct-role.com',
- ssoEnabled: true,
- ssoType: AuthtypesAuthNProviderDTO.oidc,
- oidcConfig: {
- issuer: 'https://oidc.direct-role.com',
- clientId: 'direct-role-client-id',
- clientSecret: 'direct-role-client-secret',
- },
- roleMapping: {
- defaultRole: 'VIEWER',
- useRoleAttribute: true,
+ config: {
+ ssoEnabled: true,
+ ssoType: AuthtypesAuthNProviderDTO.oidc,
+ oidcConfig: {
+ issuer: 'https://oidc.direct-role.com',
+ clientId: 'direct-role-client-id',
+ clientSecret: 'direct-role-client-secret',
+ },
+ roleMapping: {
+ defaultRole: 'VIEWER',
+ useRoleAttribute: true,
+ },
},
authNProviderInfo: {
relayStatePath: 'api/v1/sso/relay/domain-5',
@@ -106,20 +116,22 @@ export const mockDomainWithDirectRoleAttribute: AuthtypesGettableAuthDomainDTO =
export const mockOidcWithClaimMapping: AuthtypesGettableAuthDomainDTO = {
id: 'domain-6',
name: 'oidc-claims.com',
- ssoEnabled: true,
- ssoType: AuthtypesAuthNProviderDTO.oidc,
- oidcConfig: {
- issuer: 'https://oidc.claims.com',
- issuerAlias: 'https://alias.claims.com',
- clientId: 'claims-client-id',
- clientSecret: 'claims-client-secret',
- insecureSkipEmailVerified: true,
- getUserInfo: true,
- claimMapping: {
- email: 'user_email',
- name: 'display_name',
- groups: 'user_groups',
- role: 'user_role',
+ config: {
+ ssoEnabled: true,
+ ssoType: AuthtypesAuthNProviderDTO.oidc,
+ oidcConfig: {
+ issuer: 'https://oidc.claims.com',
+ issuerAlias: 'https://alias.claims.com',
+ clientId: 'claims-client-id',
+ clientSecret: 'claims-client-secret',
+ insecureSkipEmailVerified: true,
+ getUserInfo: true,
+ claimMapping: {
+ email: 'user_email',
+ name: 'display_name',
+ groups: 'user_groups',
+ role: 'user_role',
+ },
},
},
authNProviderInfo: {
@@ -131,17 +143,19 @@ export const mockOidcWithClaimMapping: AuthtypesGettableAuthDomainDTO = {
export const mockSamlWithAttributeMapping: AuthtypesGettableAuthDomainDTO = {
id: 'domain-7',
name: 'saml-attrs.com',
- ssoEnabled: true,
- ssoType: AuthtypesAuthNProviderDTO.saml,
- samlConfig: {
- samlIdp: 'https://idp.saml-attrs.com/sso',
- samlEntity: 'urn:saml-attrs:idp',
- samlCert: 'MOCK_CERTIFICATE_ATTRS',
- insecureSkipAuthNRequestsSigned: true,
- attributeMapping: {
- name: 'user_display_name',
- groups: 'member_of',
- role: 'signoz_role',
+ config: {
+ ssoEnabled: true,
+ ssoType: AuthtypesAuthNProviderDTO.saml,
+ samlConfig: {
+ samlIdp: 'https://idp.saml-attrs.com/sso',
+ samlEntity: 'urn:saml-attrs:idp',
+ samlCert: 'MOCK_CERTIFICATE_ATTRS',
+ insecureSkipAuthNRequestsSigned: true,
+ attributeMapping: {
+ name: 'user_display_name',
+ groups: 'member_of',
+ role: 'signoz_role',
+ },
},
},
authNProviderInfo: {
@@ -154,19 +168,21 @@ export const mockGoogleAuthWithWorkspaceGroups: AuthtypesGettableAuthDomainDTO =
{
id: 'domain-8',
name: 'google-groups.com',
- ssoEnabled: true,
- ssoType: AuthtypesAuthNProviderDTO.google_auth,
- googleAuthConfig: {
- clientId: 'google-groups-client-id',
- clientSecret: 'google-groups-client-secret',
- insecureSkipEmailVerified: false,
- fetchGroups: true,
- serviceAccountJson: '{"type": "service_account"}',
- domainToAdminEmail: {
- 'google-groups.com': '[email protected]',
+ config: {
+ ssoEnabled: true,
+ ssoType: AuthtypesAuthNProviderDTO.google_auth,
+ googleAuthConfig: {
+ clientId: 'google-groups-client-id',
+ clientSecret: 'google-groups-client-secret',
+ insecureSkipEmailVerified: false,
+ fetchGroups: true,
+ serviceAccountJson: '{"type": "service_account"}',
+ domainToAdminEmail: {
+ 'google-groups.com': '[email protected]',
+ },
+ fetchTransitiveGroupMembership: true,
+ allowedGroups: ['allowed-group-1', 'allowed-group-2'],
},
- fetchTransitiveGroupMembership: true,
- allowedGroups: ['allowed-group-1', 'allowed-group-2'],
},
authNProviderInfo: {
relayStatePath: 'api/v1/sso/relay/domain-8',
@@ -191,15 +207,19 @@ export const mockSingleDomainResponse = {
data: [mockGoogleAuthDomain],
};
-// Mock success responses
+// Mock success responses. CreateAuthDomain returns just an Identifiable
+// (the new domain ID); clients re-Read to get the full domain.
export const mockCreateSuccessResponse = {
status: 'success',
- data: mockGoogleAuthDomain,
+ data: { id: mockGoogleAuthDomain.id },
};
export const mockUpdateSuccessResponse = {
status: 'success',
- data: { ...mockGoogleAuthDomain, ssoEnabled: false },
+ data: {
+ ...mockGoogleAuthDomain,
+ config: { ...mockGoogleAuthDomain.config, ssoEnabled: false },
+ },
};
export const mockDeleteSuccessResponse = {
diff --git a/frontend/src/container/OrganizationSettings/AuthDomain/index.tsx b/frontend/src/container/OrganizationSettings/AuthDomain/index.tsx
index 35d466dd9e..71a8fcda6f 100644
--- a/frontend/src/container/OrganizationSettings/AuthDomain/index.tsx
+++ b/frontend/src/container/OrganizationSettings/AuthDomain/index.tsx
@@ -158,7 +158,7 @@ function AuthDomain(): JSX.Element {
onClick={(): void => setRecord(record)}
variant="link"
>
- Configure {SSOType.get(record.ssoType || '')}
+ Configure {SSOType.get(record.config?.ssoType || '')}
</Button>
<Button
className="auth-domain-list-action-link delete"
diff --git a/pkg/apiserver/signozapiserver/authdomain.go b/pkg/apiserver/signozapiserver/authdomain.go
index 63b0da781b..24f17f6d3d 100644
--- a/pkg/apiserver/signozapiserver/authdomain.go
+++ b/pkg/apiserver/signozapiserver/authdomain.go
@@ -34,9 +34,9 @@ func (provider *provider) addAuthDomainRoutes(router *mux.Router) error {
Description: "This endpoint creates an auth domain",
Request: new(authtypes.PostableAuthDomain),
RequestContentType: "application/json",
- Response: new(authtypes.GettableAuthDomain),
+ Response: new(types.Identifiable),
ResponseContentType: "application/json",
- SuccessStatusCode: http.StatusOK,
+ SuccessStatusCode: http.StatusCreated,
ErrorStatusCodes: []int{http.StatusBadRequest, http.StatusConflict},
Deprecated: false,
SecuritySchemes: newSecuritySchemes(types.RoleAdmin),
@@ -66,7 +66,7 @@ func (provider *provider) addAuthDomainRoutes(router *mux.Router) error {
Tags: []string{"authdomains"},
Summary: "Update auth domain",
Description: "This endpoint updates an auth domain",
- Request: new(authtypes.UpdateableAuthDomain),
+ Request: new(authtypes.UpdatableAuthDomain),
RequestContentType: "application/json",
Response: nil,
ResponseContentType: "",
diff --git a/pkg/modules/authdomain/implauthdomain/handler.go b/pkg/modules/authdomain/implauthdomain/handler.go
index 47c32a8db2..8fe8d0eee3 100644
--- a/pkg/modules/authdomain/implauthdomain/handler.go
+++ b/pkg/modules/authdomain/implauthdomain/handler.go
@@ -142,7 +142,7 @@ func (handler *handler) Update(rw http.ResponseWriter, r *http.Request) {
return
}
- body := new(authtypes.UpdateableAuthDomain)
+ body := new(authtypes.UpdatableAuthDomain)
if err := binding.JSON.BindBody(r.Body, body); err != nil {
render.Error(rw, err)
return
diff --git a/pkg/types/authtypes/domain.go b/pkg/types/authtypes/domain.go
index 71821dc0cd..ec3d91a2d4 100644
--- a/pkg/types/authtypes/domain.go
+++ b/pkg/types/authtypes/domain.go
@@ -30,7 +30,7 @@ var (
type GettableAuthDomain struct {
StorableAuthDomain
- AuthDomainConfig
+ Config AuthDomainConfig `json:"config"`
AuthNProviderInfo *AuthNProviderInfo `json:"authNProviderInfo"`
}
@@ -43,7 +43,7 @@ type PostableAuthDomain struct {
Name string `json:"name"`
}
-type UpdateableAuthDomain struct {
+type UpdatableAuthDomain struct {
Config AuthDomainConfig `json:"config"`
}
@@ -121,7 +121,7 @@ func NewAuthDomainFromStorableAuthDomain(storableAuthDomain *StorableAuthDomain)
func NewGettableAuthDomainFromAuthDomain(authDomain *AuthDomain, authNProviderInfo *AuthNProviderInfo) *GettableAuthDomain {
return &GettableAuthDomain{
StorableAuthDomain: *authDomain.StorableAuthDomain(),
- AuthDomainConfig: *authDomain.AuthDomainConfig(),
+ Config: *authDomain.AuthDomainConfig(),
AuthNProviderInfo: authNProviderInfo,
}
}
diff --git a/tests/integration/tests/callbackauthn/01_domain.py b/tests/integration/tests/callbackauthn/01_domain.py
index cba3c47998..2a8207b37a 100644
--- a/tests/integration/tests/callbackauthn/01_domain.py
+++ b/tests/integration/tests/callbackauthn/01_domain.py
@@ -86,7 +86,7 @@ def test_create_and_get_domain(
"domain-google.integration.test",
"domain-saml.integration.test",
]
- assert domain["ssoType"] in ["google_auth", "saml"]
+ assert domain["config"]["ssoType"] in ["google_auth", "saml"]
def test_create_invalid(