Skip to content

Commit

Permalink
SDK-4541 Add organization support for client credentials to node-auth0 (
Browse files Browse the repository at this point in the history
  • Loading branch information
tusharpandey13 authored Sep 9, 2024
1 parent 1e0fbf0 commit b9eb2d0
Show file tree
Hide file tree
Showing 7 changed files with 634 additions and 78 deletions.
64 changes: 43 additions & 21 deletions src/management/__generated/managers/clients-manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,15 +79,18 @@ export class ClientsManager extends BaseAPI {
}

/**
* Retrieve clients (applications and SSO integrations) matching provided filters. A list of fields to include or exclude
* may also be specified. Note:
* Retrieve clients (applications and SSO integrations) matching provided filters. A list of fields to include or exclude may also be specified.
* For more information, read <a href="https://www.auth0.com/docs/get-started/applications"> Applications in Auth0</a> and <a href="https://www.auth0.com/docs/authenticate/single-sign-on"> Single Sign-On</a>.
*
* <ul>
* <li>
* <code>client_id</code>, <code>app_type</code>, <code>name</code>, and <code>description</code> can be retrieved with
* any scope.
* The following can be retrieved with any scope:
* <code>client_id</code>, <code>app_type</code>, <code>name</code>, and <code>description</code>.
* </li>
* <li>
* <code>callbacks</code>, <code>oidc_backchannel_logout</code>, <code>allowed_origins</code>,
* The following properties can only be retrieved with the <code>read:clients</code> or
* <code>read:client_keys</code> scope:
* <code>callbacks</code>, <code>oidc_logout</code>, <code>allowed_origins</code>,
* <code>web_origins</code>, <code>tenant</code>, <code>global</code>, <code>config_route</code>,
* <code>callback_url_template</code>, <code>jwt_configuration</code>,
* <code>jwt_configuration.lifetime_in_seconds</code>, <code>jwt_configuration.secret_encoded</code>,
Expand All @@ -100,14 +103,13 @@ export class ClientsManager extends BaseAPI {
* <code>is_token_endpoint_ip_header_trusted</code>, <code>initiate_login_uri</code>, <code>grant_types</code>,
* <code>refresh_token</code>, <code>refresh_token.rotation_type</code>, <code>refresh_token.expiration_type</code>,
* <code>refresh_token.leeway</code>, <code>refresh_token.token_lifetime</code>, <code>organization_usage</code>,
* <code>organization_require_behavior</code>
* properties can only be retrieved with the <code>read:clients</code> or
* <code>read:client_keys</code> scope.
* <code>organization_require_behavior</code>.
* </li>
* <li>
* The following properties can only be retrieved with the
* <code>read:client_keys</code> or <code>read:client_credentials</code> scope:
* <code>encryption_key</code>, <code>encryption_key.pub</code>, <code>encryption_key.cert</code>,
* <code>client_secret</code>, <code>client_authentication_methods</code> and <code>signing_key</code> properties can only be retrieved with the
* <code>read:client_keys</code> or <code>read:client_credentials</code> scope.
* <code>client_secret</code>, <code>client_authentication_methods</code> and <code>signing_key</code>.
* </li>
* </ul>
*
Expand Down Expand Up @@ -148,6 +150,14 @@ export class ClientsManager extends BaseAPI {
key: 'include_totals',
config: {},
},
{
key: 'from',
config: {},
},
{
key: 'take',
config: {},
},
{
key: 'is_global',
config: {},
Expand All @@ -160,6 +170,14 @@ export class ClientsManager extends BaseAPI {
key: 'app_type',
config: {},
},
{
key: 'client_ids',
config: {},
},
{
key: 'q',
config: {},
},
]);

const response = await this.request(
Expand All @@ -175,14 +193,17 @@ export class ClientsManager extends BaseAPI {
}

/**
* Retrieve client details. A list of fields to include or exclude may also be specified. Note:
* Retrieve client details by ID. Clients are SSO connections or Applications linked with your Auth0 tenant. A list of fields to include or exclude may also be specified.
* For more information, read <a href="https://www.auth0.com/docs/get-started/applications"> Applications in Auth0</a> and <a href="https://www.auth0.com/docs/authenticate/single-sign-on"> Single Sign-On</a>.
* <ul>
* <li>
* <code>client_id</code>, <code>app_type</code>, <code>name</code>, and <code>description</code> can be retrieved with
* the any of the scopes.
* The following properties can be retrieved with any of the scopes:
* <code>client_id</code>, <code>app_type</code>, <code>name</code>, and <code>description</code>.
* </li>
* <li>
* <code>callbacks</code>, <code>oidc_backchannel_logout</code>, <code>allowed_origins</code>,
* The following properties can only be retrieved with the <code>read:clients</code> or
* <code>read:client_keys</code> scopes:
* <code>callbacks</code>, <code>oidc_logout</code>, <code>allowed_origins</code>,
* <code>web_origins</code>, <code>tenant</code>, <code>global</code>, <code>config_route</code>,
* <code>callback_url_template</code>, <code>jwt_configuration</code>,
* <code>jwt_configuration.lifetime_in_seconds</code>, <code>jwt_configuration.secret_encoded</code>,
Expand All @@ -195,18 +216,16 @@ export class ClientsManager extends BaseAPI {
* <code>is_token_endpoint_ip_header_trusted</code>, <code>initiate_login_uri</code>, <code>grant_types</code>,
* <code>refresh_token</code>, <code>refresh_token.rotation_type</code>, <code>refresh_token.expiration_type</code>,
* <code>refresh_token.leeway</code>, <code>refresh_token.token_lifetime</code>, <code>organization_usage</code>,
* <code>organization_require_behavior</code>
* properties can only be retrieved with the <code>read:clients</code> or
* <code>read:client_keys</code> scope.
* <code>organization_require_behavior</code>.
* </li>
* <li>
* The following properties can only be retrieved with the <code>read:client_keys</code> or <code>read:client_credentials</code> scopes:
* <code>encryption_key</code>, <code>encryption_key.pub</code>, <code>encryption_key.cert</code>,
* <code>client_secret</code>, <code>client_authentication_methods</code> and <code>signing_key</code> properties can only be retrieved with the
* <code>read:client_keys</code> or <code>read:client_credentials</code> scope.
* <code>client_secret</code>, <code>client_authentication_methods</code> and <code>signing_key</code>.
* </li>
* </ul>
*
* Get a client
* Get client by ID
*
* @throws {RequiredError}
*/
Expand Down Expand Up @@ -298,6 +317,8 @@ export class ClientsManager extends BaseAPI {
}

/**
* Updates a client's settings. For more information, read <a href="https://www.auth0.com/docs/get-started/applications"> Applications in Auth0</a> and <a href="https://www.auth0.com/docs/authenticate/single-sign-on"> Single Sign-On</a>.
*
* Notes:
* - The `client_secret` and `signing_key` attributes can only be updated with the `update:client_keys` scope.
* - The <code>client_authentication_methods</code> and <code>token_endpoint_auth_method</code> properties are mutually exclusive. Use
Expand Down Expand Up @@ -371,7 +392,8 @@ export class ClientsManager extends BaseAPI {
}

/**
* Create a new client (application or SSO integration).
* Create a new client (application or SSO integration). For more information, read <a href="https://www.auth0.com/docs/get-started/auth0-overview/create-applications">Create Applications</a>
* <a href="https://www.auth0.com/docs/authenticate/single-sign-on/api-endpoints-for-single-sign-on>">API Endpoints for Single Sign-On</a>.
*
* Notes:
* - We recommend leaving the `client_secret` parameter unspecified to allow the generation of a safe secret.
Expand Down
68 changes: 68 additions & 0 deletions src/management/__generated/managers/organizations-manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import type {
GetInvitations200Response,
GetInvitations200ResponseOneOfInner,
GetMembers200Response,
GetOrganizationClientGrants200Response,
GetOrganizationMemberRoles200Response,
GetOrganizations200Response,
GetOrganizations200ResponseOneOfInner,
Expand All @@ -23,6 +24,8 @@ import type {
GetInvitations200ResponseOneOf,
GetMembers200ResponseOneOf,
GetMembers200ResponseOneOfInner,
GetOrganizationClientGrants200ResponseOneOf,
GetOrganizationClientGrants200ResponseOneOfInner,
GetOrganizationMemberRoles200ResponseOneOf,
GetOrganizationMemberRoles200ResponseOneOfInner,
GetOrganizations200ResponseOneOf,
Expand All @@ -37,6 +40,7 @@ import type {
GetInvitationsByInvitationIdRequest,
GetMembersRequest,
GetNameByNameRequest,
GetOrganizationClientGrantsRequest,
GetOrganizationMemberRolesRequest,
GetOrganizationsRequest,
GetOrganizationsByIdRequest,
Expand Down Expand Up @@ -483,6 +487,70 @@ export class OrganizationsManager extends BaseAPI {
return runtime.JSONApiResponse.fromResponse(response);
}

/**
* Get client grants associated to an organization
*
* @throws {RequiredError}
*/
async getOrganizationClientGrants(
requestParameters: GetOrganizationClientGrantsRequest & { include_totals: true },
initOverrides?: InitOverride
): Promise<ApiResponse<GetOrganizationClientGrants200ResponseOneOf>>;
async getOrganizationClientGrants(
requestParameters?: GetOrganizationClientGrantsRequest,
initOverrides?: InitOverride
): Promise<ApiResponse<Array<GetOrganizationClientGrants200ResponseOneOfInner>>>;
async getOrganizationClientGrants(
requestParameters: GetOrganizationClientGrantsRequest,
initOverrides?: InitOverride
): Promise<ApiResponse<GetOrganizationClientGrants200Response>> {
runtime.validateRequiredRequestParams(requestParameters, ['id']);

const queryParameters = runtime.applyQueryParams(requestParameters, [
{
key: 'audience',
config: {},
},
{
key: 'client_id',
config: {},
},
{
key: 'grant_ids',
config: {
isArray: true,
isCollectionFormatMulti: true,
},
},
{
key: 'page',
config: {},
},
{
key: 'per_page',
config: {},
},
{
key: 'include_totals',
config: {},
},
]);

const response = await this.request(
{
path: `/organizations/{id}/client-grants`.replace(
'{id}',
encodeURIComponent(String(requestParameters.id))
),
method: 'GET',
query: queryParameters,
},
initOverrides
);

return runtime.JSONApiResponse.fromResponse(response);
}

/**
* Get the roles assigned to an organization member
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ export class ResourceServersManager extends BaseAPI {
}

/**
* Retrieve <a href="https://auth0.com/docs/apis">APIs</a> (also known as resource servers) that you can consume from your authorized applications.
* Retrieve details of all APIs associated with your tenant.
* Get resource servers
*
* @throws {RequiredError}
Expand All @@ -63,6 +63,13 @@ export class ResourceServersManager extends BaseAPI {
initOverrides?: InitOverride
): Promise<ApiResponse<GetResourceServers200Response>> {
const queryParameters = runtime.applyQueryParams(requestParameters, [
{
key: 'identifiers',
config: {
isArray: true,
isCollectionFormatMulti: true,
},
},
{
key: 'page',
config: {},
Expand Down
Loading

0 comments on commit b9eb2d0

Please sign in to comment.