Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -679,6 +679,18 @@ const res = await descopeClient.management.tenant.generateSSOConfigurationLink(
60 * 60 * 24,
);
console.log(res.adminSSOConfigurationLink);

// Optionally set an actor id, recorded as the audit actor for actions taken inside the SSO
// Suite (instead of the temporary user). It is used as-is for audit attribution and is not validated.
const resWithActor = await descopeClient.management.tenant.generateSSOConfigurationLink(
'my-tenant-id',
60 * 60 * 24,
undefined, // ssoId
undefined, // email
undefined, // templateId
'my-admin-actor-id', // actorId
);
console.log(resWithActor.adminSSOConfigurationLink);
```

### Manage Password
Expand Down
33 changes: 33 additions & 0 deletions lib/management/tenant.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -583,5 +583,38 @@ describe('Management Tenant', () => {
response: httpResponse,
});
});

it('should send the actorId when provided', async () => {
const httpResponse = {
ok: true,
json: () => ({
adminSSOConfigurationLink: 'some link',
}),
clone: () => ({
json: () => Promise.resolve({ adminSSOConfigurationLink: 'some link' }),
}),
status: 200,
};
mockHttpClient.post.mockResolvedValue(httpResponse);

await management.tenant.generateSSOConfigurationLink(
'test',
60 * 60 * 24,
undefined,
undefined,
undefined,
'admin-actor-1',
);

expect(mockHttpClient.post).toHaveBeenCalledWith(
apiPaths.tenant.generateSSOConfigurationLink,
{
tenantId: 'test',
expireTime: 60 * 60 * 24,
actorId: 'admin-actor-1',
},
{},
);
});
});
});
6 changes: 5 additions & 1 deletion lib/management/tenant.ts
Original file line number Diff line number Diff line change
Expand Up @@ -123,11 +123,15 @@ const withTenant = (httpClient: HttpClient) => ({
ssoId?: string,
email?: string,
templateId?: string,
// When provided, actorId is recorded as the audit actor for actions performed inside the
// SSO Setup Suite (instead of the temporary user). It is used as-is for audit attribution
// and is not validated.
actorId?: string,
): Promise<SdkResponse<GenerateSSOConfigurationLinkResponse>> =>
transformResponse<GenerateSSOConfigurationLinkResponse, GenerateSSOConfigurationLinkResponse>(
httpClient.post(
apiPaths.tenant.generateSSOConfigurationLink,
{ tenantId, expireTime: expireDuration, ssoId, email, templateId },
{ tenantId, expireTime: expireDuration, ssoId, email, templateId, actorId },
{},
),
(data) => data,
Expand Down
Loading