diff --git a/src/management/__generated/index.ts b/src/management/__generated/index.ts index 24662fb69..af23ea492 100644 --- a/src/management/__generated/index.ts +++ b/src/management/__generated/index.ts @@ -9,6 +9,7 @@ import { BrandingManager, ClientGrantsManager, ClientsManager, + ConnectionProfilesManager, ConnectionsManager, CustomDomainsManager, DeviceCredentialsManager, @@ -54,6 +55,7 @@ export abstract class ManagementClientBase { public readonly branding = new BrandingManager(this.configuration); public readonly clientGrants = new ClientGrantsManager(this.configuration); public readonly clients = new ClientsManager(this.configuration); + public readonly connectionProfiles = new ConnectionProfilesManager(this.configuration); public readonly connections = new ConnectionsManager(this.configuration); public readonly customDomains = new CustomDomainsManager(this.configuration); public readonly deviceCredentials = new DeviceCredentialsManager(this.configuration); diff --git a/src/management/__generated/managers/connection-profiles-manager.ts b/src/management/__generated/managers/connection-profiles-manager.ts new file mode 100644 index 000000000..7ec7e6804 --- /dev/null +++ b/src/management/__generated/managers/connection-profiles-manager.ts @@ -0,0 +1,222 @@ +import * as runtime from '../../../lib/runtime.js'; +import type { InitOverride, ApiResponse } from '../../../lib/runtime.js'; +import type { + CreateConnectionProfileRequestContent, + CreateConnectionProfileResponseContent, + GetConnectionProfileResponseContent, + GetConnectionProfileTemplateResponseContent, + ListConnectionProfileTemplateResponseContent, + ListConnectionProfilesPaginatedResponseContent, + UpdateConnectionProfileRequestContent, + UpdateConnectionProfileResponseContent, + DeleteConnectionProfilesByIdRequest, + GetConnectionProfileTemplateRequest, + GetConnectionProfilesRequest, + GetConnectionProfilesByIdRequest, + PatchConnectionProfilesByIdRequest, +} from '../models/index.js'; + +const { BaseAPI } = runtime; + +/** + * + */ +export class ConnectionProfilesManager extends BaseAPI { + /** + * Delete a single Connection Profile specified by ID. + * + * Delete Connection Profile + * + * @throws {RequiredError} + */ + async delete( + requestParameters: DeleteConnectionProfilesByIdRequest, + initOverrides?: InitOverride + ): Promise> { + runtime.validateRequiredRequestParams(requestParameters, ['id']); + + const response = await this.request( + { + path: `/connection-profiles/{id}`.replace( + '{id}', + encodeURIComponent(String(requestParameters.id)) + ), + method: 'DELETE', + }, + initOverrides + ); + + return runtime.VoidApiResponse.fromResponse(response); + } + + /** + * Retrieve a Connection Profile Template. + * + * Get Connection Profile Template + * + * @throws {RequiredError} + */ + async getTemplate( + requestParameters: GetConnectionProfileTemplateRequest, + initOverrides?: InitOverride + ): Promise> { + runtime.validateRequiredRequestParams(requestParameters, ['id']); + + const response = await this.request( + { + path: `/connection-profiles/templates/{id}`.replace( + '{id}', + encodeURIComponent(String(requestParameters.id)) + ), + method: 'GET', + }, + initOverrides + ); + + return runtime.JSONApiResponse.fromResponse(response); + } + + /** + * Retrieve a list of Connection Profile Templates. + * + * Get Connection Profile Templates + * + * @throws {RequiredError} + */ + async getAllTemplates( + initOverrides?: InitOverride + ): Promise> { + const response = await this.request( + { + path: `/connection-profiles/templates`, + method: 'GET', + }, + initOverrides + ); + + return runtime.JSONApiResponse.fromResponse(response); + } + + /** + * Retrieve a list of Connection Profiles. This endpoint supports Checkpoint pagination. + * + * Get Connection Profiles + * + * @throws {RequiredError} + */ + async getAll( + requestParameters: GetConnectionProfilesRequest = {}, + initOverrides?: InitOverride + ): Promise> { + const queryParameters = runtime.applyQueryParams(requestParameters, [ + { + key: 'from', + config: {}, + }, + { + key: 'take', + config: {}, + }, + ]); + + const response = await this.request( + { + path: `/connection-profiles`, + method: 'GET', + query: queryParameters, + }, + initOverrides + ); + + return runtime.JSONApiResponse.fromResponse(response); + } + + /** + * Retrieve details about a single Connection Profile specified by ID. + * + * Get Connection Profile + * + * @throws {RequiredError} + */ + async get( + requestParameters: GetConnectionProfilesByIdRequest, + initOverrides?: InitOverride + ): Promise> { + runtime.validateRequiredRequestParams(requestParameters, ['id']); + + const response = await this.request( + { + path: `/connection-profiles/{id}`.replace( + '{id}', + encodeURIComponent(String(requestParameters.id)) + ), + method: 'GET', + }, + initOverrides + ); + + return runtime.JSONApiResponse.fromResponse(response); + } + + /** + * Update the details of a specific Connection Profile. + * + * Modify a Connection Profile + * + * @throws {RequiredError} + */ + async update( + requestParameters: PatchConnectionProfilesByIdRequest, + bodyParameters: UpdateConnectionProfileRequestContent, + initOverrides?: InitOverride + ): Promise> { + runtime.validateRequiredRequestParams(requestParameters, ['id']); + + const headerParameters: runtime.HTTPHeaders = {}; + + headerParameters['Content-Type'] = 'application/json'; + + const response = await this.request( + { + path: `/connection-profiles/{id}`.replace( + '{id}', + encodeURIComponent(String(requestParameters.id)) + ), + method: 'PATCH', + headers: headerParameters, + body: bodyParameters, + }, + initOverrides + ); + + return runtime.JSONApiResponse.fromResponse(response); + } + + /** + * Create a Connection Profile. + * + * Create a connection profile + * + * @throws {RequiredError} + */ + async create( + bodyParameters: CreateConnectionProfileRequestContent, + initOverrides?: InitOverride + ): Promise> { + const headerParameters: runtime.HTTPHeaders = {}; + + headerParameters['Content-Type'] = 'application/json'; + + const response = await this.request( + { + path: `/connection-profiles`, + method: 'POST', + headers: headerParameters, + body: bodyParameters, + }, + initOverrides + ); + + return runtime.JSONApiResponse.fromResponse(response); + } +} diff --git a/src/management/__generated/managers/index.ts b/src/management/__generated/managers/index.ts index da0f12d96..828903131 100644 --- a/src/management/__generated/managers/index.ts +++ b/src/management/__generated/managers/index.ts @@ -5,6 +5,7 @@ export * from './blacklists-manager.js'; export * from './branding-manager.js'; export * from './client-grants-manager.js'; export * from './clients-manager.js'; +export * from './connection-profiles-manager.js'; export * from './connections-manager.js'; export * from './custom-domains-manager.js'; export * from './device-credentials-manager.js'; diff --git a/src/management/__generated/models/index.ts b/src/management/__generated/models/index.ts index e4021f541..05eeba3a0 100644 --- a/src/management/__generated/models/index.ts +++ b/src/management/__generated/models/index.ts @@ -662,6 +662,9 @@ export interface Client { * */ skip_non_verifiable_callback_uri_confirmation_prompt?: boolean; + /** + */ + express_configuration?: ClientExpressConfiguration; /** * Array of notification channels for contacting the user when their approval is required. Valid values are `guardian-push`, `email`. * @@ -1613,6 +1616,9 @@ export interface ClientCreate { * */ skip_non_verifiable_callback_uri_confirmation_prompt?: boolean; + /** + */ + express_configuration?: ClientExpressConfiguration; /** * Array of notification channels for contacting the user when their approval is required. Valid values are `guardian-push`, `email`. * @@ -2614,6 +2620,66 @@ export interface ClientEncryptionKey { */ subject: string; } +/** + * Application specific configuration for use with the OIN Express Configuration feature. + */ +export interface ClientExpressConfiguration { + /** + * The URI users should bookmark to log in to this application. Variable substitution is permitted for the following properties: organization_name, organization_id, and connection_name. + * + */ + initiate_login_uri_template: string; + /** + * The ID of the user attribute profile to use for this application. + * + */ + user_attribute_profile_id: string; + /** + * The ID of the connection profile to use for this application. + * + */ + connection_profile_id: string; + /** + * When true, all connections made via express configuration will be enabled for this application. + * + */ + enable_client: boolean; + /** + * When true, all connections made via express configuration will have the associated organization enabled. + * + */ + enable_organization: boolean; + /** + * List of client IDs that are linked to this express configuration (e.g. web or mobile clients). + * + */ + linked_clients?: Array; + /** + * This is the unique identifier for the Okta OIN Express Configuration Client, which Okta will use for this application. + * + */ + okta_oin_client_id: string; + /** + * This is the domain that admins are expected to log in via for authenticating for express configuration. It can be either the canonical domain or a registered custom domain. + * + */ + admin_login_domain: string; + /** + * The identifier of the published application in the OKTA OIN. + * + */ + oin_submission_id?: string; +} +/** + * Configuration for linked clients in the OIN Express Configuration feature. + */ +export interface ClientExpressConfigurationLinkedClientsInner { + /** + * The ID of the linked client. + * + */ + client_id: string; +} /** * */ @@ -2648,6 +2714,11 @@ export interface ClientGrant { * */ allow_any_organization: boolean; + /** + * If enabled, this grant is a special grant created by Auth0. It cannot be modified or deleted directly. + * + */ + is_system?: boolean; /** */ subject_type?: ClientGrantSubjectTypeEnum; @@ -3226,6 +3297,9 @@ export interface ClientUpdate { * */ skip_non_verifiable_callback_uri_confirmation_prompt?: boolean; + /** + */ + express_configuration?: ClientExpressConfiguration; /** * Array of notification channels for contacting the user when their approval is required. Valid values are `guardian-push`, `email`. * @@ -4383,6 +4457,172 @@ export interface ConnectionForList { */ connected_accounts?: ConnectionConnectedAccounts; } +/** + * + */ +export interface ConnectionProfile { + /** + * Connection Profile identifier. + * + */ + id?: string; + /** + * The name of the connection profile. + * + */ + name?: string; + /** + */ + organization?: ConnectionProfileOrganization; + /** + * Connection name prefix template. + * + */ + connection_name_prefix_template?: string; + /** + */ + enabled_features?: ConnectionProfileEnabledFeatures; + /** + * Connection profile configuration. + * + */ + connection_config?: object; + /** + */ + strategy_overrides?: ConnectionProfileStrategyOverrides; +} +/** + * Enabled features for the connection profile. + */ +export interface ConnectionProfileEnabledFeatures extends Array {} +/** + * The organization of the connection profile. + */ +export interface ConnectionProfileOrganization { + /** + */ + show_as_button?: ConnectionProfileOrganizationShowAsButtonEnum; + /** + */ + assign_membership_on_login?: ConnectionProfileOrganizationAssignMembershipOnLoginEnum; +} + +/** + * Indicates if membership should be assigned on login. + */ +export const ConnectionProfileOrganizationAssignMembershipOnLoginEnum = { + none: 'none', + optional: 'optional', + required: 'required', +} as const; +export type ConnectionProfileOrganizationAssignMembershipOnLoginEnum = + (typeof ConnectionProfileOrganizationAssignMembershipOnLoginEnum)[keyof typeof ConnectionProfileOrganizationAssignMembershipOnLoginEnum]; + +/** + * Indicates if the organization should be shown as a button. + */ +export const ConnectionProfileOrganizationShowAsButtonEnum = { + none: 'none', + optional: 'optional', + required: 'required', +} as const; +export type ConnectionProfileOrganizationShowAsButtonEnum = + (typeof ConnectionProfileOrganizationShowAsButtonEnum)[keyof typeof ConnectionProfileOrganizationShowAsButtonEnum]; + +/** + * Connection Profile Strategy Override + */ +export interface ConnectionProfileStrategyOverride { + /** + */ + enabled_features?: ConnectionProfileStrategyOverridesEnabledFeatures; + /** + * Connection profile strategy overrides connection configuration. + * + */ + connection_config?: object; +} +/** + * Strategy-specific overrides for this attribute + */ +export interface ConnectionProfileStrategyOverrides { + /** + */ + pingfederate?: ConnectionProfileStrategyOverride; + /** + */ + ad?: ConnectionProfileStrategyOverride; + /** + */ + adfs?: ConnectionProfileStrategyOverride; + /** + */ + waad?: ConnectionProfileStrategyOverride; + /** + */ + 'google-apps'?: ConnectionProfileStrategyOverride; + /** + */ + okta?: ConnectionProfileStrategyOverride; + /** + */ + oidc?: ConnectionProfileStrategyOverride; + /** + */ + samlp?: ConnectionProfileStrategyOverride; +} +/** + * Enabled features for a connections profile strategy override. + */ +export interface ConnectionProfileStrategyOverridesEnabledFeatures + extends Array {} +/** + * The structure of the template, which can be used as the payload for creating or updating a Connection Profile. + */ +export interface ConnectionProfileTemplate { + /** + * The name of the connection profile. + * + */ + name?: string; + /** + */ + organization?: ConnectionProfileOrganization; + /** + * Connection name prefix template. + * + */ + connection_name_prefix_template?: string; + /** + */ + enabled_features?: ConnectionProfileEnabledFeatures; + /** + * Connection profile configuration. + * + */ + connection_config?: object; + /** + */ + strategy_overrides?: ConnectionProfileStrategyOverrides; +} +/** + * + */ +export interface ConnectionProfileTemplateItem { + /** + * The id of the template. + * + */ + id?: string; + /** + * The user-friendly name of the template displayed in the UI. + * + */ + display_name?: string; + /** + */ + template?: ConnectionProfileTemplate; +} /** * */ @@ -4540,6 +4780,69 @@ export const ConnectionUpdateOptionsSetUserRootAttributesEnum = { export type ConnectionUpdateOptionsSetUserRootAttributesEnum = (typeof ConnectionUpdateOptionsSetUserRootAttributesEnum)[keyof typeof ConnectionUpdateOptionsSetUserRootAttributesEnum]; +/** + * + */ +export interface CreateConnectionProfileRequestContent { + /** + * The name of the connection profile. + * + */ + name: string; + /** + */ + organization?: ConnectionProfileOrganization; + /** + * Connection name prefix template. + * + */ + connection_name_prefix_template?: string; + /** + */ + enabled_features?: ConnectionProfileEnabledFeatures; + /** + * Connection profile configuration. + * + */ + connection_config?: object; + /** + */ + strategy_overrides?: ConnectionProfileStrategyOverrides; +} +/** + * + */ +export interface CreateConnectionProfileResponseContent { + /** + * Connection Profile identifier. + * + */ + id?: string; + /** + * The name of the connection profile. + * + */ + name?: string; + /** + */ + organization?: ConnectionProfileOrganization; + /** + * Connection name prefix template. + * + */ + connection_name_prefix_template?: string; + /** + */ + enabled_features?: ConnectionProfileEnabledFeatures; + /** + * Connection profile configuration. + * + */ + connection_config?: object; + /** + */ + strategy_overrides?: ConnectionProfileStrategyOverrides; +} /** * */ @@ -5204,6 +5507,15 @@ export const EmailTemplateUpdateTemplateEnum = { export type EmailTemplateUpdateTemplateEnum = (typeof EmailTemplateUpdateTemplateEnum)[keyof typeof EmailTemplateUpdateTemplateEnum]; +/** + * Enum for enabled features. + */ +export const EnabledFeaturesEnum = { + scim: 'scim', + universal_logout: 'universal_logout', +} as const; +export type EnabledFeaturesEnum = (typeof EnabledFeaturesEnum)[keyof typeof EnabledFeaturesEnum]; + /** * */ @@ -6747,6 +7059,58 @@ export interface GetConnectionClients200ResponseClientsInner { */ client_id: string; } +/** + * + */ +export interface GetConnectionProfileResponseContent { + /** + * Connection Profile identifier. + * + */ + id?: string; + /** + * The name of the connection profile. + * + */ + name?: string; + /** + */ + organization?: ConnectionProfileOrganization; + /** + * Connection name prefix template. + * + */ + connection_name_prefix_template?: string; + /** + */ + enabled_features?: ConnectionProfileEnabledFeatures; + /** + * Connection profile configuration. + * + */ + connection_config?: object; + /** + */ + strategy_overrides?: ConnectionProfileStrategyOverrides; +} +/** + * + */ +export interface GetConnectionProfileTemplateResponseContent { + /** + * The id of the template. + * + */ + id?: string; + /** + * The user-friendly name of the template displayed in the UI. + * + */ + display_name?: string; + /** + */ + template?: ConnectionProfileTemplate; +} /** * */ @@ -10764,6 +11128,27 @@ export const JobFormatEnum = { } as const; export type JobFormatEnum = (typeof JobFormatEnum)[keyof typeof JobFormatEnum]; +/** + * + */ +export interface ListConnectionProfileTemplateResponseContent { + /** + */ + connection_profile_templates?: Array; +} +/** + * + */ +export interface ListConnectionProfilesPaginatedResponseContent { + /** + * A cursor to be used as the "from" query parameter for the next page of results. + * + */ + next?: string; + /** + */ + connection_profiles?: Array; +} /** * */ @@ -19724,6 +20109,69 @@ export interface UpdateCaptchaResponseContent { allowlist?: Array; } +/** + * + */ +export interface UpdateConnectionProfileRequestContent { + /** + * The name of the connection profile. + * + */ + name?: string; + /** + */ + organization?: ConnectionProfileOrganization; + /** + * Connection name prefix template. + * + */ + connection_name_prefix_template?: string; + /** + */ + enabled_features?: ConnectionProfileEnabledFeatures; + /** + * Connection profile configuration. + * + */ + connection_config?: object; + /** + */ + strategy_overrides?: ConnectionProfileStrategyOverrides; +} +/** + * + */ +export interface UpdateConnectionProfileResponseContent { + /** + * Connection Profile identifier. + * + */ + id?: string; + /** + * The name of the connection profile. + * + */ + name?: string; + /** + */ + organization?: ConnectionProfileOrganization; + /** + * Connection name prefix template. + * + */ + connection_name_prefix_template?: string; + /** + */ + enabled_features?: ConnectionProfileEnabledFeatures; + /** + * Connection profile configuration. + * + */ + connection_config?: object; + /** + */ + strategy_overrides?: ConnectionProfileStrategyOverrides; +} /** * */ @@ -21369,6 +21817,61 @@ export interface PostRotateSecretRequest { */ client_id: string; } +/** + * + */ +export interface DeleteConnectionProfilesByIdRequest { + /** + * ID of the connection-profile to delete. + * + */ + id: string; +} +/** + * + */ +export interface GetConnectionProfileTemplateRequest { + /** + * ID of the connection-profile-template to retrieve. + * + */ + id: string; +} +/** + * + */ +export interface GetConnectionProfilesRequest { + /** + * Optional Id from which to start selection. + * + */ + from?: string; + /** + * Number of results per page. Defaults to 5. + * + */ + take?: number; +} +/** + * + */ +export interface GetConnectionProfilesByIdRequest { + /** + * ID of the connection-profile to retrieve. + * + */ + id: string; +} +/** + * + */ +export interface PatchConnectionProfilesByIdRequest { + /** + * ID of the connection profile to update. + * + */ + id: string; +} /** * */ diff --git a/test/management/connection-profiles.test.ts b/test/management/connection-profiles.test.ts new file mode 100644 index 000000000..7bd4793cd --- /dev/null +++ b/test/management/connection-profiles.test.ts @@ -0,0 +1,96 @@ +import { + ManagementClient, + ConnectionProfilesManager, + GetConnectionProfilesByIdRequest, + CreateConnectionProfileRequestContent, + UpdateConnectionProfileRequestContent, + DeleteConnectionProfilesByIdRequest, + GetConnectionProfileTemplateRequest, + PatchConnectionProfilesByIdRequest, +} from '../../src/index.js'; + +import { checkMethod } from './tests.util.js'; + +const DOMAIN = `tenant.auth0.com`; +const token = 'TOKEN'; + +describe('ConnectionProfilesManager', () => { + const connectionProfilesManager: ConnectionProfilesManager = new ManagementClient({ + domain: DOMAIN, + token, + }).connectionProfiles; + + describe('getAll', () => { + const operation = connectionProfilesManager.getAll(); + const uri = `/connection-profiles`; + const method = 'get'; + + checkMethod({ operation, uri, method }); + }); + + describe('get', () => { + const requestParameters: GetConnectionProfilesByIdRequest = { + id: 'id', + }; + const operation = connectionProfilesManager.get(requestParameters); + const uri = `/connection-profiles/id`; + const method = 'get'; + + checkMethod({ operation, uri, method }); + }); + + describe('create', () => { + const createPayload: CreateConnectionProfileRequestContent = { + name: 'Test Connection Profile', + }; + const operation = connectionProfilesManager.create(createPayload); + const uri = `/connection-profiles`; + const method = 'post'; + + checkMethod({ operation, uri, method }); + }); + + describe('update', () => { + const requestParameters: PatchConnectionProfilesByIdRequest = { + id: 'id', + }; + const updatePayload: UpdateConnectionProfileRequestContent = { + organization: undefined, + }; + const operation = connectionProfilesManager.update(requestParameters, updatePayload); + const uri = `/connection-profiles/id`; + const method = 'patch'; + + checkMethod({ operation, uri, method }); + }); + + describe('delete', () => { + const requestParameters: DeleteConnectionProfilesByIdRequest = { + id: 'id', + }; + const operation = connectionProfilesManager.delete(requestParameters); + const uri = `/connection-profiles/id`; + const method = 'delete'; + + checkMethod({ operation, uri, method }); + }); + + describe('getAllTemplates', () => { + const operation = connectionProfilesManager.getAllTemplates(); + const uri = `/connection-profiles/templates`; + const method = 'get'; + + checkMethod({ operation, uri, method }); + }); + + describe('getTemplate', () => { + const requestParameters: GetConnectionProfileTemplateRequest = { + id: 'id', + }; + const operation = connectionProfilesManager.getTemplate(requestParameters); + const uri = `/connection-profiles/templates/id`; + const method = 'get'; + + checkMethod({ operation, uri, method }); + }); +});