diff --git a/reference.md b/reference.md index ea29afbb5..590850d31 100644 --- a/reference.md +++ b/reference.md @@ -534,7 +534,7 @@ await client.Branding.UpdateAsync(new UpdateBrandingRequestContent());
-Retrieve a list of client grants, including the scopes associated with the application/API pair. +Retrieve a list of [client grants](https://auth0.com/docs/get-started/applications/application-access-to-apis-client-grants), including the scopes associated with the application/API pair.
@@ -599,7 +599,7 @@ await client.ClientGrants.ListAsync(
-Create a client grant for a machine-to-machine login flow. To learn more, read Client Credential Flow. +Create a client grant for a machine-to-machine login flow. To learn more, read [Client Credential Flow](https://www.auth0.com/docs/get-started/authentication-and-authorization-flow/client-credentials-flow).
@@ -655,7 +655,7 @@ await client.ClientGrants.CreateAsync(
-Retrieve a single client grant, including the +Retrieve a single [client grant](https://auth0.com/docs/get-started/applications/application-access-to-apis-client-grants), including the scopes associated with the application/API pair.
@@ -710,7 +710,7 @@ await client.ClientGrants.GetAsync("id");
-Delete the Client Credential Flow from your machine-to-machine application. +Delete the [Client Credential Flow](https://www.auth0.com/docs/get-started/authentication-and-authorization-flow/client-credentials-flow) from your machine-to-machine application.
@@ -828,38 +828,30 @@ await client.ClientGrants.UpdateAsync("id", new UpdateClientGrantRequestContent(
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 Applications in Auth0 and Single Sign-On. +For more information, read [Applications in Auth0](https://www.auth0.com/docs/get-started/applications) and [Single Sign-On](https://www.auth0.com/docs/authenticate/single-sign-on). - +- The following can be retrieved with any scope: + `client_id`, `app_type`, `name`, and `description`. +- The following properties can only be retrieved with the `read:clients` or + `read:client_keys` scope: + `callbacks`, `oidc_logout`, `allowed_origins`, + `web_origins`, `tenant`, `global`, `config_route`, + `callback_url_template`, `jwt_configuration`, + `jwt_configuration.lifetime_in_seconds`, `jwt_configuration.secret_encoded`, + `jwt_configuration.scopes`, `jwt_configuration.alg`, `api_type`, + `logo_uri`, `allowed_clients`, `owners`, `custom_login_page`, + `custom_login_page_off`, `sso`, `addons`, `form_template`, + `custom_login_page_codeview`, `resource_servers`, `client_metadata`, + `mobile`, `mobile.android`, `mobile.ios`, `allowed_logout_urls`, + `token_endpoint_auth_method`, `is_first_party`, `oidc_conformant`, + `is_token_endpoint_ip_header_trusted`, `initiate_login_uri`, `grant_types`, + `refresh_token`, `refresh_token.rotation_type`, `refresh_token.expiration_type`, + `refresh_token.leeway`, `refresh_token.token_lifetime`, `refresh_token.policies`, `organization_usage`, + `organization_require_behavior`. +- The following properties can only be retrieved with the + `read:client_keys` or `read:client_credentials` scope: + `encryption_key`, `encryption_key.pub`, `encryption_key.cert`, + `client_secret`, `client_authentication_methods` and `signing_key`.
@@ -927,20 +919,20 @@ await client.Clients.ListAsync(
-Create a new client (application or SSO integration). For more information, read Create Applications -API Endpoints for Single Sign-On. +Create a new client (application or SSO integration). For more information, read [Create Applications](https://www.auth0.com/docs/get-started/auth0-overview/create-applications) +[API Endpoints for Single Sign-On](https://www.auth0.com/docs/authenticate/single-sign-on/api-endpoints-for-single-sign-on). Notes: - We recommend leaving the `client_secret` parameter unspecified to allow the generation of a safe secret. -- The client_authentication_methods and token_endpoint_auth_method properties are mutually exclusive. Use -client_authentication_methods to configure the client with Private Key JWT authentication method. Otherwise, use token_endpoint_auth_method +- The `client_authentication_methods` and `token_endpoint_auth_method` properties are mutually exclusive. Use +`client_authentication_methods` to configure the client with Private Key JWT authentication method. Otherwise, use `token_endpoint_auth_method` to configure the client with client secret (basic or post) or with no authentication method (none). -- When using client_authentication_methods to configure the client with Private Key JWT authentication method, specify fully defined credentials. +- When using `client_authentication_methods` to configure the client with Private Key JWT authentication method, specify fully defined credentials. These credentials will be automatically enabled for Private Key JWT authentication on the client. -- To configure client_authentication_methods, the create:client_credentials scope is required. -- To configure client_authentication_methods, the property jwt_configuration.alg must be set to RS256. +- To configure `client_authentication_methods`, the `create:client_credentials` scope is required. +- To configure `client_authentication_methods`, the property `jwt_configuration.alg` must be set to RS256. -
SSO Integrations created via this endpoint will accept login requests and share user profile information.
+SSO Integrations created via this endpoint will accept login requests and share user profile information.
@@ -1123,36 +1115,29 @@ await client.Clients.RegisterCimdClientAsync(
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 Applications in Auth0 and Single Sign-On. - +For more information, read [Applications in Auth0](https://www.auth0.com/docs/get-started/applications) and [Single Sign-On](https://www.auth0.com/docs/authenticate/single-sign-on). + +- The following properties can be retrieved with any of the scopes: + `client_id`, `app_type`, `name`, and `description`. +- The following properties can only be retrieved with the `read:clients` or + `read:client_keys` scopes: + `callbacks`, `oidc_logout`, `allowed_origins`, + `web_origins`, `tenant`, `global`, `config_route`, + `callback_url_template`, `jwt_configuration`, + `jwt_configuration.lifetime_in_seconds`, `jwt_configuration.secret_encoded`, + `jwt_configuration.scopes`, `jwt_configuration.alg`, `api_type`, + `logo_uri`, `allowed_clients`, `owners`, `custom_login_page`, + `custom_login_page_off`, `sso`, `addons`, `form_template`, + `custom_login_page_codeview`, `resource_servers`, `client_metadata`, + `mobile`, `mobile.android`, `mobile.ios`, `allowed_logout_urls`, + `token_endpoint_auth_method`, `is_first_party`, `oidc_conformant`, + `is_token_endpoint_ip_header_trusted`, `initiate_login_uri`, `grant_types`, + `refresh_token`, `refresh_token.rotation_type`, `refresh_token.expiration_type`, + `refresh_token.leeway`, `refresh_token.token_lifetime`, `refresh_token.policies`, `organization_usage`, + `organization_require_behavior`. +- The following properties can only be retrieved with the `read:client_keys` or `read:client_credentials` scopes: + `encryption_key`, `encryption_key.pub`, `encryption_key.cert`, + `client_secret`, `client_authentication_methods` and `signing_key`.
@@ -1271,15 +1256,15 @@ await client.Clients.DeleteAsync("id");
-Updates a client's settings. For more information, read Applications in Auth0 and Single Sign-On. +Updates a client's settings. For more information, read [Applications in Auth0](https://www.auth0.com/docs/get-started/applications) and [Single Sign-On](https://www.auth0.com/docs/authenticate/single-sign-on). Notes: - The `client_secret` and `signing_key` attributes can only be updated with the `update:client_keys` scope. -- The client_authentication_methods and token_endpoint_auth_method properties are mutually exclusive. Use client_authentication_methods to configure the client with Private Key JWT authentication method. Otherwise, use token_endpoint_auth_method to configure the client with client secret (basic or post) or with no authentication method (none). -- When using client_authentication_methods to configure the client with Private Key JWT authentication method, only specify the credential IDs that were generated when creating the credentials on the client. -- To configure client_authentication_methods, the update:client_credentials scope is required. -- To configure client_authentication_methods, the property jwt_configuration.alg must be set to RS256. -- To change a client's is_first_party property to false, the organization_usage and organization_require_behavior properties must be unset. +- The `client_authentication_methods` and `token_endpoint_auth_method` properties are mutually exclusive. Use `client_authentication_methods` to configure the client with Private Key JWT authentication method. Otherwise, use `token_endpoint_auth_method` to configure the client with client secret (basic or post) or with no authentication method (none). +- When using `client_authentication_methods` to configure the client with Private Key JWT authentication method, only specify the credential IDs that were generated when creating the credentials on the client. +- To configure `client_authentication_methods`, the `update:client_credentials` scope is required. +- To configure `client_authentication_methods`, the property `jwt_configuration.alg` must be set to RS256. +- To change a client's `is_first_party` property to `false`, the `organization_usage` and `organization_require_behavior` properties must be unset.
@@ -1345,7 +1330,7 @@ Rotate a client secret. This endpoint cannot be used with clients configured with Private Key JWT authentication method (client_authentication_methods configured with private_key_jwt). The generated secret is NOT base64 encoded. -For more information, read Rotate Client Secrets. +For more information, read [Rotate Client Secrets](https://www.auth0.com/docs/get-started/applications/rotate-client-secret). @@ -2704,7 +2689,7 @@ await client.CustomDomains.VerifyAsync("id");
-Retrieve device credential information (public_key, refresh_token, or rotating_refresh_token) associated with a specific user. +Retrieve device credential information (`public_key`, `refresh_token`, or `rotating_refresh_token`) associated with a specific user.
@@ -2770,9 +2755,9 @@ await client.DeviceCredentials.ListAsync(
-Create a device credential public key to manage refresh token rotation for a given user_id. Device Credentials APIs are designed for ad-hoc administrative use only and paging is by default enabled for GET requests. +Create a device credential public key to manage refresh token rotation for a given `user_id`. Device Credentials APIs are designed for ad-hoc administrative use only and paging is by default enabled for GET requests. -When refresh token rotation is enabled, the endpoint becomes consistent. For more information, read Signing Keys. +When refresh token rotation is enabled, the endpoint becomes consistent. For more information, read [Signing Keys](https://auth0.com/docs/get-started/tenant-settings/signing-keys).
@@ -3952,7 +3937,7 @@ await client.Forms.UpdateAsync("id", new UpdateFormRequestContent());
-Retrieve the grants associated with your account. +Retrieve the [grants](https://auth0.com/docs/api-auth/which-oauth-flow-to-use) associated with your account.
@@ -4016,7 +4001,7 @@ await client.UserGrants.ListAsync(
-Delete a grant associated with your account. +Delete a grant associated with your account.
@@ -4072,7 +4057,7 @@ await client.UserGrants.DeleteByUserIdAsync(
-Delete a grant associated with your account. +Delete a grant associated with your account.
@@ -5940,22 +5925,20 @@ await client.NetworkAcls.UpdateAsync("id", new UpdateNetworkAclRequestContent()) Retrieve detailed list of all Organizations available in your tenant. For more information, see Auth0 Organizations. This endpoint supports two types of pagination: - + +- Offset pagination +- Checkpoint pagination Checkpoint pagination must be used if you need to retrieve more than 1000 organizations. -

Checkpoint Pagination

+**Checkpoint Pagination** To search by checkpoint, use the following parameters: - -Note: The first time you call this endpoint using checkpoint pagination, omit the from parameter. If there are more results, a next value is included in the response. You can use this for subsequent API calls. When next is no longer included in the response, no pages are remaining. +- `from`: Optional id from which to start selection. +- `take`: The total number of entries to retrieve when using the `from` parameter. Defaults to 50. + +**Note**: The first time you call this endpoint using checkpoint pagination, omit the `from` parameter. If there are more results, a `next` value is included in the response. You can use this for subsequent API calls. When `next` is no longer included in the response, no pages are remaining. @@ -6016,7 +5999,7 @@ await client.Organizations.ListAsync(
-Create a new Organization within your tenant. To learn more about Organization settings, behavior, and configuration options, review Create Your First Organization. +Create a new Organization within your tenant. To learn more about Organization settings, behavior, and configuration options, review [Create Your First Organization](https://auth0.com/docs/manage-users/organizations/create-first-organization).
@@ -6124,7 +6107,7 @@ await client.Organizations.GetByNameAsync("name");
-Retrieve details about a single Organization specified by ID. +Retrieve details about a single Organization specified by ID.
@@ -6180,7 +6163,7 @@ await client.Organizations.GetAsync("id"); Remove an Organization from your tenant. This action cannot be undone. -Note: Members are automatically disassociated from an Organization when it is deleted. However, this action does not delete these users from your tenant. +**Note**: Members are automatically disassociated from an Organization when it is deleted. However, this action does **not** delete these users from your tenant. @@ -6234,7 +6217,7 @@ await client.Organizations.DeleteAsync("id");
-Update the details of a specific Organization, such as name and display name, branding options, and metadata. +Update the details of a specific [Organization](https://auth0.com/docs/manage-users/organizations/configure-organizations/create-organizations), such as name and display name, branding options, and metadata.
@@ -8786,15 +8769,14 @@ await client.Tickets.ChangePasswordAsync(new ChangePasswordTicketRequestContent( Retrieve a list of all Token Exchange Profiles available in your tenant. -By using this feature, you agree to the applicable Free Trial terms in Okta’s Master Subscription Agreement. It is your responsibility to securely validate the user’s subject_token. See User Guide for more details. +By using this feature, you agree to the applicable Free Trial terms in [Okta’s Master Subscription Agreement](https://www.okta.com/legal/). It is your responsibility to securely validate the user’s subject_token. See [User Guide](https://auth0.com/docs/authenticate/custom-token-exchange) for more details. This endpoint supports Checkpoint pagination. To search by checkpoint, use the following parameters: - -Note: The first time you call this endpoint using checkpoint pagination, omit the from parameter. If there are more results, a next value is included in the response. You can use this for subsequent API calls. When next is no longer included in the response, no pages are remaining. +- `from`: Optional id from which to start selection. +- `take`: The total amount of entries to retrieve when using the from parameter. Defaults to 50. + +**Note**: The first time you call this endpoint using checkpoint pagination, omit the `from` parameter. If there are more results, a `next` value is included in the response. You can use this for subsequent API calls. When `next` is no longer included in the response, no pages are remaining. @@ -8852,7 +8834,7 @@ await client.TokenExchangeProfiles.ListAsync( Create a new Token Exchange Profile within your tenant. -By using this feature, you agree to the applicable Free Trial terms in Okta’s Master Subscription Agreement. It is your responsibility to securely validate the user’s subject_token. See User Guide for more details. +By using this feature, you agree to the applicable Free Trial terms in [Okta’s Master Subscription Agreement](https://www.okta.com/legal/). It is your responsibility to securely validate the user’s subject_token. See [User Guide](https://auth0.com/docs/authenticate/custom-token-exchange) for more details. @@ -8916,7 +8898,7 @@ await client.TokenExchangeProfiles.CreateAsync( Retrieve details about a single Token Exchange Profile specified by ID. -By using this feature, you agree to the applicable Free Trial terms in Okta’s Master Subscription Agreement. It is your responsibility to securely validate the user’s subject_token. See User Guide for more details. +By using this feature, you agree to the applicable Free Trial terms in [Okta’s Master Subscription Agreement](https://www.okta.com/legal/). It is your responsibility to securely validate the user’s subject_token. See [User Guide](https://auth0.com/docs/authenticate/custom-token-exchange) for more details. @@ -8972,8 +8954,7 @@ await client.TokenExchangeProfiles.GetAsync("id"); Delete a Token Exchange Profile within your tenant. -By using this feature, you agree to the applicable Free Trial terms in Okta's Master Subscription Agreement. It is your responsibility to securely validate the user's subject_token. See User Guide for more details. - +By using this feature, you agree to the applicable Free Trial terms in [Okta's Master Subscription Agreement](https://www.okta.com/legal/). It is your responsibility to securely validate the user's subject_token. See [User Guide](https://auth0.com/docs/authenticate/custom-token-exchange) for more details. @@ -9029,8 +9010,7 @@ await client.TokenExchangeProfiles.DeleteAsync("id"); Update a Token Exchange Profile within your tenant. -By using this feature, you agree to the applicable Free Trial terms in Okta's Master Subscription Agreement. It is your responsibility to securely validate the user's subject_token. See User Guide for more details. - +By using this feature, you agree to the applicable Free Trial terms in [Okta's Master Subscription Agreement](https://www.okta.com/legal/). It is your responsibility to securely validate the user's subject_token. See [User Guide](https://auth0.com/docs/authenticate/custom-token-exchange) for more details. @@ -9494,7 +9474,7 @@ await client.UserAttributeProfiles.UpdateAsync(
-Retrieve details of all Brute-force Protection blocks for a user with the given identifier (username, phone number, or email). +Retrieve details of all [Brute-force Protection](https://auth0.com/docs/secure/attack-protection/brute-force-protection) blocks for a user with the given identifier (username, phone number, or email).
@@ -9554,9 +9534,9 @@ await client.UserBlocks.ListByIdentifierAsync(
-Remove all Brute-force Protection blocks for the user with the given identifier (username, phone number, or email). +Remove all [Brute-force Protection](https://auth0.com/docs/secure/attack-protection/brute-force-protection) blocks for the user with the given identifier (username, phone number, or email). -Note: This endpoint does not unblock users that were blocked by a tenant administrator. +Note: This endpoint does not unblock users that were [blocked by a tenant administrator](https://auth0.com/docs/user-profile#block-and-unblock-a-user).
@@ -9612,7 +9592,7 @@ await client.UserBlocks.DeleteByIdentifierAsync(
-Retrieve details of all Brute-force Protection blocks for the user with the given ID. +Retrieve details of all [Brute-force Protection](https://auth0.com/docs/secure/attack-protection/brute-force-protection) blocks for the user with the given ID.
@@ -9677,9 +9657,9 @@ await client.UserBlocks.ListAsync(
-Remove all Brute-force Protection blocks for the user with the given ID. +Remove all [Brute-force Protection](https://auth0.com/docs/secure/attack-protection/brute-force-protection) blocks for the user with the given ID. -Note: This endpoint does not unblock users that were blocked by a tenant administrator. +Note: This endpoint does not unblock users that were [blocked by a tenant administrator](https://auth0.com/docs/user-profile#block-and-unblock-a-user).
@@ -13165,7 +13145,7 @@ await client.ClientGrants.Organizations.ListAsync( Get the details of a client credential. -Important: To enable credentials to be used for a client authentication method, set the client_authentication_methods property on the client. To enable credentials to be used for JWT-Secured Authorization requests set the signed_request_object property on the client. +**Important**: To enable credentials to be used for a client authentication method, set the `client_authentication_methods` property on the client. To enable credentials to be used for JWT-Secured Authorization requests set the `signed_request_object` property on the client. @@ -13221,37 +13201,61 @@ await client.Clients.Credentials.ListAsync("client_id"); Create a client credential associated to your application. Credentials can be used to configure Private Key JWT and mTLS authentication methods, as well as for JWT-secured Authorization requests. -
Public Key
Public Key credentials can be used to set up Private Key JWT client authentication and JWT-secured Authorization requests. +**Public Key** -Sample:
{
+Public Key credentials can be used to set up Private Key JWT client authentication and JWT-secured Authorization requests.
+
+Sample: 
+
+```json
+{
   "credential_type": "public_key",
   "name": "string",
   "pem": "string",
   "alg": "RS256",
   "parse_expiry_from_cert": false,
   "expires_at": "2022-12-31T23:59:59Z"
-}
-
Certificate (CA-signed & self-signed)
Certificate credentials can be used to set up mTLS client authentication. CA-signed certificates can be configured either with a signed certificate or with just the certificate Subject DN. +} +``` + +**Certificate (CA-signed & self-signed)** + +Certificate credentials can be used to set up mTLS client authentication. CA-signed certificates can be configured either with a signed certificate or with just the certificate Subject DN. -CA-signed Certificate Sample (pem):
{
+CA-signed Certificate Sample (pem): 
+
+```json
+{
   "credential_type": "x509_cert",
   "name": "string",
   "pem": "string"
-}
CA-signed Certificate Sample (subject_dn):
{
+}
+```
+
+CA-signed Certificate Sample (subject_dn): 
+
+```json
+{
   "credential_type": "cert_subject_dn",
   "name": "string",
   "subject_dn": "string"
-}
Self-signed Certificate Sample:
{
+}
+```
+
+Self-signed Certificate Sample: 
+
+```json
+{
   "credential_type": "cert_subject_dn",
   "name": "string",
   "pem": "string"
-}
+} +``` The credential will be created but not yet enabled for use until you set the corresponding properties in the client: - + +- To enable the credential for Private Key JWT or mTLS authentication methods, set the `client_authentication_methods` property on the client. For more information, read [Configure Private Key JWT Authentication](https://auth0.com/docs/get-started/applications/configure-private-key-jwt) and [Configure mTLS Authentication](https://auth0.com/docs/get-started/applications/configure-mtls) +- To enable the credential for JWT-secured Authorization requests, set the `signed_request_object`property on the client. For more information, read [Configure JWT-secured Authorization Requests (JAR)](https://auth0.com/docs/get-started/applications/configure-jar) @@ -13318,7 +13322,7 @@ await client.Clients.Credentials.CreateAsync( Get the details of a client credential. -Important: To enable credentials to be used for a client authentication method, set the client_authentication_methods property on the client. To enable credentials to be used for JWT-Secured Authorization requests set the signed_request_object property on the client. +**Important**: To enable credentials to be used for a client authentication method, set the `client_authentication_methods` property on the client. To enable credentials to be used for JWT-Secured Authorization requests set the `signed_request_object` property on the client. @@ -13517,15 +13521,10 @@ await client.Clients.Credentials.UpdateAsync(
-Retrieve all connections that are enabled for the specified Application, using checkpoint pagination. A list of fields to include or exclude for each connection may also be specified. - +Retrieve all connections that are enabled for the specified [Application](https://www.auth0.com/docs/get-started/applications), using checkpoint pagination. A list of fields to include or exclude for each connection may also be specified. + +- This endpoint requires the `read:connections` scope and any one of `read:clients` or `read:client_summary`. +- **Note**: The first time you call this endpoint, omit the `from` parameter. If there are more results, a `next` value is included in the response. You can use this for subsequent API calls. When `next` is no longer included in the response, no further results are remaining.
@@ -19901,7 +19900,7 @@ await client.Organizations.DiscoveryDomains.GetAsync("id", "discovery_domain_id"
-Remove a discovery domain from an organization. This action cannot be undone. +Remove a discovery domain from an organization. This action cannot be undone.
@@ -19963,7 +19962,7 @@ await client.Organizations.DiscoveryDomains.DeleteAsync("id", "discovery_domain_
-Update the verification status and/or use_for_organization_discovery for an organization discovery domain. The status field must be either pending or verified. The use_for_organization_discovery field can be true or false (default: true). +Update the verification status and/or use_for_organization_discovery for an organization discovery domain. The `status` field must be either `pending` or `verified`. The `use_for_organization_discovery` field can be `true` or `false` (default: `true`).
@@ -20110,7 +20109,7 @@ await client.Organizations.EnabledConnections.ListAsync( Enable a specific connection for a given Organization. To enable a connection, it must already exist within your tenant; connections cannot be created through this action. -Connections represent the relationship between Auth0 and a source of users. Available types of connections include database, enterprise, and social. +[Connections](https://auth0.com/docs/authenticate/identity-providers) represent the relationship between Auth0 and a source of users. Available types of connections include database, enterprise, and social. @@ -20239,7 +20238,7 @@ await client.Organizations.EnabledConnections.GetAsync("id", "connectionId"); Disable a specific connection for an Organization. Once disabled, Organization members can no longer use that connection to authenticate. -Note: This action does not remove the connection from your tenant. +**Note**: This action does not remove the connection from your tenant. @@ -20376,7 +20375,7 @@ await client.Organizations.EnabledConnections.UpdateAsync(
-Retrieve a detailed list of invitations sent to users for a specific Organization. The list includes details such as inviter and invitee information, invitation URLs, and dates of creation and expiration. To learn more about Organization invitations, review Invite Organization Members. +Retrieve a detailed list of invitations sent to users for a specific Organization. The list includes details such as inviter and invitee information, invitation URLs, and dates of creation and expiration. To learn more about Organization invitations, review [Invite Organization Members](https://auth0.com/docs/manage-users/organizations/configure-organizations/invite-members).
@@ -20449,7 +20448,7 @@ await client.Organizations.Invitations.ListAsync(
-Create a user invitation for a specific Organization. Upon creation, the listed user receives an email inviting them to join the Organization. To learn more about Organization invitations, review Invite Organization Members. +Create a user invitation for a specific Organization. Upon creation, the listed user receives an email inviting them to join the Organization. To learn more about Organization invitations, review [Invite Organization Members](https://auth0.com/docs/manage-users/organizations/configure-organizations/invite-members).
@@ -20631,14 +20630,8 @@ await client.Organizations.Invitations.DeleteAsync("id", "invitation_id"); List organization members. This endpoint is subject to eventual consistency. New users may not be immediately included in the response and deleted users may not be immediately removed from it. - +- Use the `fields` parameter to optionally define the specific member details retrieved. If `fields` is left blank, all fields (except roles) are returned. +- Member roles are not sent by default. Use `fields=roles` to retrieve the roles assigned to each listed member. To use this parameter, you must include the `read:organization_member_roles` scope in the token. This endpoint supports two types of pagination: @@ -20647,9 +20640,9 @@ This endpoint supports two types of pagination: Checkpoint pagination must be used if you need to retrieve more than 1000 organization members. -

Checkpoint Pagination

+**Checkpoint Pagination** -To search by checkpoint, use the following parameters: - from: Optional id from which to start selection. - take: The total amount of entries to retrieve when using the from parameter. Defaults to 50. Note: The first time you call this endpoint using Checkpoint Pagination, you should omit the from parameter. If there are more results, a next value will be included in the response. You can use this for subsequent API calls. When next is no longer included in the response, this indicates there are no more pages remaining. +To search by checkpoint, use the following parameters: - from: Optional id from which to start selection. - take: The total amount of entries to retrieve when using the from parameter. Defaults to 50. Note: The first time you call this endpoint using Checkpoint Pagination, you should omit the `from` parameter. If there are more results, a `next` value will be included in the response. You can use this for subsequent API calls. When `next` is no longer included in the response, this indicates there are no more pages remaining. @@ -20720,9 +20713,9 @@ await client.Organizations.Members.ListAsync(
-Set one or more existing users as members of a specific Organization. +Set one or more existing users as members of a specific [Organization](https://auth0.com/docs/manage-users/organizations). -To add a user to an Organization through this action, the user must already exist in your tenant. If a user does not yet exist, you can invite them to create an account, manually create them through the Auth0 Dashboard, or use the Management API. +To add a user to an Organization through this action, the user must already exist in your tenant. If a user does not yet exist, you can [invite them to create an account](https://auth0.com/docs/manage-users/organizations/configure-organizations/invite-members), manually create them through the Auth0 Dashboard, or use the Management API.
@@ -20826,8 +20819,8 @@ await client.Organizations.Members.DeleteAsync( -## Organizations Members Roles -
client.Organizations.Members.Roles.ListAsync(id, userId, ListOrganizationMemberRolesRequestParameters { ... }) -> Pager<Role> +## Organizations Groups +
client.Organizations.Groups.ListAsync(organizationId, ListOrganizationGroupsRequestParameters { ... }) -> Pager<Group>
@@ -20839,9 +20832,7 @@ await client.Organizations.Members.DeleteAsync(
-Retrieve detailed list of roles assigned to a given user within the context of a specific Organization. - -Users can be members of multiple Organizations with unique roles assigned for each membership. This action only returns the roles associated with the specified Organization; any roles assigned to the user within other Organizations are not included. +Lists the groups that are assigned to the specified organization.
@@ -20856,15 +20847,9 @@ Users can be members of multiple Organizations with unique roles assigned for ea
```csharp -await client.Organizations.Members.Roles.ListAsync( - "id", - "user_id", - new ListOrganizationMemberRolesRequestParameters - { - Page = 1, - PerPage = 1, - IncludeTotals = true, - } +await client.Organizations.Groups.ListAsync( + "organization_id", + new ListOrganizationGroupsRequestParameters { From = "from", Take = 1 } ); ```
@@ -20880,15 +20865,7 @@ await client.Organizations.Members.Roles.ListAsync(
-**id:** `string` — Organization identifier. - -
-
- -
-
- -**userId:** `string` — ID of the user to associate roles with. +**organizationId:** `string` — ID of the organization
@@ -20896,7 +20873,7 @@ await client.Organizations.Members.Roles.ListAsync(
-**request:** `ListOrganizationMemberRolesRequestParameters` +**request:** `ListOrganizationGroupsRequestParameters`
@@ -20908,7 +20885,8 @@ await client.Organizations.Members.Roles.ListAsync(
-
client.Organizations.Members.Roles.AssignAsync(id, userId, AssignOrganizationMemberRolesRequestContent { ... }) +## Organizations Groups Roles +
client.Organizations.Groups.Roles.ListAsync(organizationId, groupId, ListOrganizationGroupRolesRequestParameters { ... }) -> Pager<Role>
@@ -20920,9 +20898,7 @@ await client.Organizations.Members.Roles.ListAsync(
-Assign one or more roles to a user to determine their access for a specific Organization. - -Users can be members of multiple Organizations with unique roles assigned for each membership. This action assigns roles to a user only for the specified Organization. Roles cannot be assigned to a user across multiple Organizations in the same call. +Lists the roles assigned to the specified group in the context of an organization.
@@ -20937,10 +20913,10 @@ Users can be members of multiple Organizations with unique roles assigned for ea
```csharp -await client.Organizations.Members.Roles.AssignAsync( - "id", - "user_id", - new AssignOrganizationMemberRolesRequestContent { Roles = new List() { "roles" } } +await client.Organizations.Groups.Roles.ListAsync( + "organization_id", + "group_id", + new ListOrganizationGroupRolesRequestParameters { From = "from", Take = 1 } ); ```
@@ -20956,7 +20932,7 @@ await client.Organizations.Members.Roles.AssignAsync(
-**id:** `string` — Organization identifier. +**organizationId:** `string` — ID of the organization
@@ -20964,7 +20940,7 @@ await client.Organizations.Members.Roles.AssignAsync(
-**userId:** `string` — ID of the user to associate roles with. +**groupId:** `string` — ID of the group
@@ -20972,7 +20948,7 @@ await client.Organizations.Members.Roles.AssignAsync(
-**request:** `AssignOrganizationMemberRolesRequestContent` +**request:** `ListOrganizationGroupRolesRequestParameters`
@@ -20984,7 +20960,7 @@ await client.Organizations.Members.Roles.AssignAsync(
-
client.Organizations.Members.Roles.DeleteAsync(id, userId, DeleteOrganizationMemberRolesRequestContent { ... }) +
client.Organizations.Groups.Roles.CreateAsync(organizationId, groupId, CreateOrganizationGroupRolesRequestContent { ... })
@@ -20996,9 +20972,7 @@ await client.Organizations.Members.Roles.AssignAsync(
-Remove one or more Organization-specific roles from a given user. - -Users can be members of multiple Organizations with unique roles assigned for each membership. This action removes roles from a user in relation to the specified Organization. Roles assigned to the user within a different Organization cannot be managed in the same call. +Assign one or more roles to a specified group in the context of an organization.
@@ -21013,10 +20987,10 @@ Users can be members of multiple Organizations with unique roles assigned for ea
```csharp -await client.Organizations.Members.Roles.DeleteAsync( - "id", - "user_id", - new DeleteOrganizationMemberRolesRequestContent { Roles = new List() { "roles" } } +await client.Organizations.Groups.Roles.CreateAsync( + "organization_id", + "group_id", + new CreateOrganizationGroupRolesRequestContent { Roles = new List() { "roles" } } ); ```
@@ -21032,7 +21006,7 @@ await client.Organizations.Members.Roles.DeleteAsync(
-**id:** `string` — Organization identifier. +**organizationId:** `string` — ID of the organization
@@ -21040,7 +21014,7 @@ await client.Organizations.Members.Roles.DeleteAsync(
-**userId:** `string` — User ID of the organization member to remove roles from. +**groupId:** `string` — ID of the group
@@ -21048,7 +21022,7 @@ await client.Organizations.Members.Roles.DeleteAsync(
-**request:** `DeleteOrganizationMemberRolesRequestContent` +**request:** `CreateOrganizationGroupRolesRequestContent`
@@ -21060,8 +21034,7 @@ await client.Organizations.Members.Roles.DeleteAsync(
-## Prompts Rendering -
client.Prompts.Rendering.ListAsync(ListAculsRequestParameters { ... }) -> Pager<ListAculsResponseContentItem> +
client.Organizations.Groups.Roles.DeleteAsync(organizationId, groupId, DeleteOrganizationGroupRolesRequestContent { ... })
@@ -21073,7 +21046,7 @@ await client.Organizations.Members.Roles.DeleteAsync(
-Get render setting configurations for all screens. +Unassign one or more roles from a specified group in the context of an organization.
@@ -21088,18 +21061,10 @@ Get render setting configurations for all screens.
```csharp -await client.Prompts.Rendering.ListAsync( - new ListAculsRequestParameters - { - Fields = "fields", - IncludeFields = true, - Page = 1, - PerPage = 1, - IncludeTotals = true, - Prompt = "prompt", - Screen = "screen", - RenderingMode = AculRenderingModeEnum.Advanced, - } +await client.Organizations.Groups.Roles.DeleteAsync( + "organization_id", + "group_id", + new DeleteOrganizationGroupRolesRequestContent { Roles = new List() { "roles" } } ); ```
@@ -21115,7 +21080,23 @@ await client.Prompts.Rendering.ListAsync(
-**request:** `ListAculsRequestParameters` +**organizationId:** `string` — ID of the organization + +
+
+ +
+
+ +**groupId:** `string` — ID of the group + +
+
+ +
+
+ +**request:** `DeleteOrganizationGroupRolesRequestContent`
@@ -21127,7 +21108,8 @@ await client.Prompts.Rendering.ListAsync(
-
client.Prompts.Rendering.BulkUpdateAsync(BulkUpdateAculRequestContent { ... }) -> WithRawResponseTask<BulkUpdateAculResponseContent> +## Organizations Members EffectiveRoles +
client.Organizations.Members.EffectiveRoles.ListAsync(id, userId, ListOrganizationMemberEffectiveRolesRequestParameters { ... }) -> Pager<OrganizationMemberEffectiveRole>
@@ -21139,7 +21121,7 @@ await client.Prompts.Rendering.ListAsync(
-Learn more about [configuring render settings](https://auth0.com/docs/customize/login-pages/advanced-customizations/getting-started/configure-acul-screens) for advanced customization. +Lists the roles assigned to an organization member directly or through group membership.
@@ -21154,18 +21136,10 @@ Learn more about [configuring render settings](https://auth0.com/docs/customize/
```csharp -await client.Prompts.Rendering.BulkUpdateAsync( - new BulkUpdateAculRequestContent - { - Configs = new List() - { - new AculConfigsItem - { - Prompt = PromptGroupNameEnum.Login, - Screen = ScreenGroupNameEnum.Login, - }, - }, - } +await client.Organizations.Members.EffectiveRoles.ListAsync( + "id", + "user_id", + new ListOrganizationMemberEffectiveRolesRequestParameters { From = "from", Take = 1 } ); ```
@@ -21181,7 +21155,23 @@ await client.Prompts.Rendering.BulkUpdateAsync(
-**request:** `BulkUpdateAculRequestContent` +**id:** `string` — Organization identifier. + +
+
+ +
+
+ +**userId:** `string` — ID of the user to list effective roles for. + +
+
+ +
+
+ +**request:** `ListOrganizationMemberEffectiveRolesRequestParameters`
@@ -21193,7 +21183,8 @@ await client.Prompts.Rendering.BulkUpdateAsync(
-
client.Prompts.Rendering.GetAsync(prompt, screen) -> WithRawResponseTask<GetAculResponseContent> +## Organizations Members Roles +
client.Organizations.Members.Roles.ListAsync(id, userId, ListOrganizationMemberRolesRequestParameters { ... }) -> Pager<Role>
@@ -21205,7 +21196,9 @@ await client.Prompts.Rendering.BulkUpdateAsync(
-Get render settings for a screen. +Retrieve detailed list of roles assigned to a given user within the context of a specific Organization. + +Users can be members of multiple Organizations with unique roles assigned for each membership. This action only returns the roles associated with the specified Organization; any roles assigned to the user within other Organizations are not included.
@@ -21220,7 +21213,16 @@ Get render settings for a screen.
```csharp -await client.Prompts.Rendering.GetAsync(PromptGroupNameEnum.Login, ScreenGroupNameEnum.Login); +await client.Organizations.Members.Roles.ListAsync( + "id", + "user_id", + new ListOrganizationMemberRolesRequestParameters + { + Page = 1, + PerPage = 1, + IncludeTotals = true, + } +); ```
@@ -21235,7 +21237,7 @@ await client.Prompts.Rendering.GetAsync(PromptGroupNameEnum.Login, ScreenGroupNa
-**prompt:** `PromptGroupNameEnum` — Name of the prompt +**id:** `string` — Organization identifier.
@@ -21243,7 +21245,15 @@ await client.Prompts.Rendering.GetAsync(PromptGroupNameEnum.Login, ScreenGroupNa
-**screen:** `ScreenGroupNameEnum` — Name of the screen +**userId:** `string` — ID of the user to associate roles with. + +
+
+ +
+
+ +**request:** `ListOrganizationMemberRolesRequestParameters`
@@ -21255,7 +21265,7 @@ await client.Prompts.Rendering.GetAsync(PromptGroupNameEnum.Login, ScreenGroupNa
-
client.Prompts.Rendering.UpdateAsync(prompt, screen, UpdateAculRequestContent { ... }) -> WithRawResponseTask<UpdateAculResponseContent> +
client.Organizations.Members.Roles.AssignAsync(id, userId, AssignOrganizationMemberRolesRequestContent { ... })
@@ -21267,7 +21277,9 @@ await client.Prompts.Rendering.GetAsync(PromptGroupNameEnum.Login, ScreenGroupNa
-Learn more about [configuring render settings](https://auth0.com/docs/customize/login-pages/advanced-customizations/getting-started/configure-acul-screens) for advanced customization. +Assign one or more [roles](https://auth0.com/docs/manage-users/access-control/rbac) to a user to determine their access for a specific Organization. + +Users can be members of multiple Organizations with unique roles assigned for each membership. This action assigns roles to a user only for the specified Organization. Roles cannot be assigned to a user across multiple Organizations in the same call.
@@ -21282,10 +21294,10 @@ Learn more about [configuring render settings](https://auth0.com/docs/customize/
```csharp -await client.Prompts.Rendering.UpdateAsync( - PromptGroupNameEnum.Login, - ScreenGroupNameEnum.Login, - new UpdateAculRequestContent() +await client.Organizations.Members.Roles.AssignAsync( + "id", + "user_id", + new AssignOrganizationMemberRolesRequestContent { Roles = new List() { "roles" } } ); ```
@@ -21301,7 +21313,7 @@ await client.Prompts.Rendering.UpdateAsync(
-**prompt:** `PromptGroupNameEnum` — Name of the prompt +**id:** `string` — Organization identifier.
@@ -21309,7 +21321,7 @@ await client.Prompts.Rendering.UpdateAsync(
-**screen:** `ScreenGroupNameEnum` — Name of the screen +**userId:** `string` — ID of the user to associate roles with.
@@ -21317,7 +21329,7 @@ await client.Prompts.Rendering.UpdateAsync(
-**request:** `UpdateAculRequestContent` +**request:** `AssignOrganizationMemberRolesRequestContent`
@@ -21329,8 +21341,7 @@ await client.Prompts.Rendering.UpdateAsync(
-## Prompts CustomText -
client.Prompts.CustomText.GetAsync(prompt, language) -> WithRawResponseTask<Dictionary<string, object?>> +
client.Organizations.Members.Roles.DeleteAsync(id, userId, DeleteOrganizationMemberRolesRequestContent { ... })
@@ -21342,7 +21353,9 @@ await client.Prompts.Rendering.UpdateAsync(
-Retrieve custom text for a specific prompt and language. +Remove one or more Organization-specific [roles](https://auth0.com/docs/manage-users/access-control/rbac) from a given user. + +Users can be members of multiple Organizations with unique roles assigned for each membership. This action removes roles from a user in relation to the specified Organization. Roles assigned to the user within a different Organization cannot be managed in the same call.
@@ -21357,7 +21370,11 @@ Retrieve custom text for a specific prompt and language.
```csharp -await client.Prompts.CustomText.GetAsync(PromptGroupNameEnum.Login, PromptLanguageEnum.Am); +await client.Organizations.Members.Roles.DeleteAsync( + "id", + "user_id", + new DeleteOrganizationMemberRolesRequestContent { Roles = new List() { "roles" } } +); ```
@@ -21372,7 +21389,7 @@ await client.Prompts.CustomText.GetAsync(PromptGroupNameEnum.Login, PromptLangua
-**prompt:** `PromptGroupNameEnum` — Name of the prompt. +**id:** `string` — Organization identifier.
@@ -21380,17 +21397,437 @@ await client.Prompts.CustomText.GetAsync(PromptGroupNameEnum.Login, PromptLangua
-**language:** `PromptLanguageEnum` — Language to update. +**userId:** `string` — User ID of the organization member to remove roles from.
- - +
+
+**request:** `DeleteOrganizationMemberRolesRequestContent` + +
+
+ + + + + + +
+ +## Organizations Members EffectiveRoles Sources Groups +
client.Organizations.Members.EffectiveRoles.Sources.Groups.ListAsync(id, userId, ListOrganizationMemberRoleSourceGroupsRequestParameters { ... }) -> Pager<Group> +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Lists the groups which grant the org member a given role. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```csharp +await client.Organizations.Members.EffectiveRoles.Sources.Groups.ListAsync( + "id", + "user_id", + new ListOrganizationMemberRoleSourceGroupsRequestParameters + { + From = "from", + Take = 1, + RoleId = "role_id", + } +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**id:** `string` — Organization identifier. + +
+
+ +
+
+ +**userId:** `string` — ID of the user to list role source groups for. + +
+
+ +
+
+ +**request:** `ListOrganizationMemberRoleSourceGroupsRequestParameters` + +
+
+
+
+ + +
+
+
+ +## Prompts Rendering +
client.Prompts.Rendering.ListAsync(ListAculsRequestParameters { ... }) -> Pager<ListAculsResponseContentItem> +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Get render setting configurations for all screens. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```csharp +await client.Prompts.Rendering.ListAsync( + new ListAculsRequestParameters + { + Fields = "fields", + IncludeFields = true, + Page = 1, + PerPage = 1, + IncludeTotals = true, + Prompt = "prompt", + Screen = "screen", + RenderingMode = AculRenderingModeEnum.Advanced, + } +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `ListAculsRequestParameters` + +
+
+
+
+ + +
+
+
+ +
client.Prompts.Rendering.BulkUpdateAsync(BulkUpdateAculRequestContent { ... }) -> WithRawResponseTask<BulkUpdateAculResponseContent> +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Learn more about [configuring render settings](https://auth0.com/docs/customize/login-pages/advanced-customizations/getting-started/configure-acul-screens) for advanced customization. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```csharp +await client.Prompts.Rendering.BulkUpdateAsync( + new BulkUpdateAculRequestContent + { + Configs = new List() + { + new AculConfigsItem + { + Prompt = PromptGroupNameEnum.Login, + Screen = ScreenGroupNameEnum.Login, + }, + }, + } +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `BulkUpdateAculRequestContent` + +
+
+
+
+ + +
+
+
+ +
client.Prompts.Rendering.GetAsync(prompt, screen) -> WithRawResponseTask<GetAculResponseContent> +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Get render settings for a screen. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```csharp +await client.Prompts.Rendering.GetAsync(PromptGroupNameEnum.Login, ScreenGroupNameEnum.Login); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**prompt:** `PromptGroupNameEnum` — Name of the prompt + +
+
+ +
+
+ +**screen:** `ScreenGroupNameEnum` — Name of the screen + +
+
+
+
+ + +
+
+
+ +
client.Prompts.Rendering.UpdateAsync(prompt, screen, UpdateAculRequestContent { ... }) -> WithRawResponseTask<UpdateAculResponseContent> +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Learn more about [configuring render settings](https://auth0.com/docs/customize/login-pages/advanced-customizations/getting-started/configure-acul-screens) for advanced customization. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```csharp +await client.Prompts.Rendering.UpdateAsync( + PromptGroupNameEnum.Login, + ScreenGroupNameEnum.Login, + new UpdateAculRequestContent() +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**prompt:** `PromptGroupNameEnum` — Name of the prompt + +
+
+ +
+
+ +**screen:** `ScreenGroupNameEnum` — Name of the screen + +
+
+ +
+
+ +**request:** `UpdateAculRequestContent` + +
+
+
+
+ + +
+
+
+ +## Prompts CustomText +
client.Prompts.CustomText.GetAsync(prompt, language) -> WithRawResponseTask<Dictionary<string, object?>> +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Retrieve custom text for a specific prompt and language. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```csharp +await client.Prompts.CustomText.GetAsync(PromptGroupNameEnum.Login, PromptLanguageEnum.Am); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**prompt:** `PromptGroupNameEnum` — Name of the prompt. + +
+
+ +
+
+ +**language:** `PromptLanguageEnum` — Language to update. + +
+
-
+ + + + +
client.Prompts.CustomText.SetAsync(prompt, language, Dictionary<string, object?> { ... })
@@ -21766,7 +22203,200 @@ await client.RiskAssessments.Settings.NewDevice.UpdateAsync(
-**request:** `UpdateRiskAssessmentsSettingsNewDeviceRequestContent` +**request:** `UpdateRiskAssessmentsSettingsNewDeviceRequestContent` + +
+
+ +
+ + + + +
+ +## Roles Groups +
client.Roles.Groups.GetAsync(id, ListRoleGroupsParameters { ... }) -> Pager<Group> +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Lists the groups to which the specified role is assigned. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```csharp +await client.Roles.Groups.GetAsync("id", new ListRoleGroupsParameters { From = "from", Take = 1 }); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**id:** `string` — Unique identifier for the role (service-generated). + +
+
+ +
+
+ +**request:** `ListRoleGroupsParameters` + +
+
+
+
+ + +
+
+
+ +
client.Roles.Groups.CreateAsync(id, AssignRoleGroupsRequestContent { ... }) +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Assign one or more groups to a specified role. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```csharp +await client.Roles.Groups.CreateAsync( + "id", + new AssignRoleGroupsRequestContent { Groups = new List() { "groups" } } +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**id:** `string` — Unique identifier for the role (service-generated). + +
+
+ +
+
+ +**request:** `AssignRoleGroupsRequestContent` + +
+
+
+
+ + +
+
+
+ +
client.Roles.Groups.DeleteAsync(id, DeleteRoleGroupsRequestContent { ... }) +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Unassign one or more groups from a specified role. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```csharp +await client.Roles.Groups.DeleteAsync( + "id", + new DeleteRoleGroupsRequestContent { Groups = new List() { "groups" } } +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**id:** `string` — Unique identifier for the role (service-generated). + +
+
+ +
+
+ +**request:** `DeleteRoleGroupsRequestContent`
@@ -23110,6 +23740,143 @@ await client.Users.ConnectedAccounts.ListAsync(
+
+
+
+ +## Users EffectivePermissions +
client.Users.EffectivePermissions.ListAsync(id, ListUserEffectivePermissionsRequestParameters { ... }) -> Pager<UserEffectivePermissionResponseContent> +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Returns the list of effective permissions for a user, taking into account permissions granted directly to the user, as well as those inherited through roles and group memberships. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```csharp +await client.Users.EffectivePermissions.ListAsync( + "id", + new ListUserEffectivePermissionsRequestParameters + { + From = "from", + Take = 1, + ResourceServerIdentifier = "resource_server_identifier", + } +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**id:** `string` — ID of the user to retrieve the permissions for. + +
+
+ +
+
+ +**request:** `ListUserEffectivePermissionsRequestParameters` + +
+
+
+
+ + +
+
+
+ +## Users EffectiveRoles +
client.Users.EffectiveRoles.ListAsync(id, ListUserEffectiveRolesRequestParameters { ... }) -> Pager<UserEffectiveRole> +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Retrieve detailed list of effective roles for a user, including roles assigned directly and through group memberships. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```csharp +await client.Users.EffectiveRoles.ListAsync( + "id", + new ListUserEffectiveRolesRequestParameters { From = "from", Take = 1 } +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**id:** `string` — ID of the user to list effective roles for. + +
+
+ +
+
+ +**request:** `ListUserEffectiveRolesRequestParameters` + +
+
+
+
+ +
@@ -24507,6 +25274,149 @@ await client.Users.Sessions.DeleteAsync("user_id"); + + +
+ +## Users EffectivePermissions Sources Roles +
client.Users.EffectivePermissions.Sources.Roles.ListAsync(id, ListUserEffectivePermissionRoleSourceRequestParameters { ... }) -> Pager<UserEffectivePermissionRoleSourceResponseContent> +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Lists the roles which grant the user a given permission, including roles assigned directly to the user and those inherited through group memberships. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```csharp +await client.Users.EffectivePermissions.Sources.Roles.ListAsync( + "id", + new ListUserEffectivePermissionRoleSourceRequestParameters + { + From = "from", + Take = 1, + ResourceServerIdentifier = "resource_server_identifier", + PermissionName = "permission_name", + } +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**id:** `string` — ID of the user to retrieve the permissions for. + +
+
+ +
+
+ +**request:** `ListUserEffectivePermissionRoleSourceRequestParameters` + +
+
+
+
+ + +
+
+
+ +## Users EffectiveRoles Sources Groups +
client.Users.EffectiveRoles.Sources.Groups.ListAsync(id, ListUserRoleSourceGroupsRequestParameters { ... }) -> Pager<Group> +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Lists the groups that grant a user a specific role. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```csharp +await client.Users.EffectiveRoles.Sources.Groups.ListAsync( + "id", + new ListUserRoleSourceGroupsRequestParameters + { + RoleId = "role_id", + From = "from", + Take = 1, + } +); +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**id:** `string` — ID of the user to list role source groups for. + +
+
+ +
+
+ +**request:** `ListUserRoleSourceGroupsRequestParameters` + +
+
+
+
+ +
diff --git a/src/Auth0.ManagementApi/ClientGrants/ClientGrantsClient.cs b/src/Auth0.ManagementApi/ClientGrants/ClientGrantsClient.cs index 3138acb5c..490e71cc3 100644 --- a/src/Auth0.ManagementApi/ClientGrants/ClientGrantsClient.cs +++ b/src/Auth0.ManagementApi/ClientGrants/ClientGrantsClient.cs @@ -16,7 +16,7 @@ internal ClientGrantsClient(RawClient client) public Auth0.ManagementApi.ClientGrants.IOrganizationsClient Organizations { get; } /// - /// Retrieve a list of client grants, including the scopes associated with the application/API pair. + /// Retrieve a list of [client grants](https://auth0.com/docs/get-started/applications/application-access-to-apis-client-grants), including the scopes associated with the application/API pair. /// private WithRawResponseTask ListInternalAsync( ListClientGrantsRequestParameters request, @@ -401,7 +401,7 @@ private async Task> UpdateAsyn } /// - /// Retrieve a list of client grants, including the scopes associated with the application/API pair. + /// Retrieve a list of [client grants](https://auth0.com/docs/get-started/applications/application-access-to-apis-client-grants), including the scopes associated with the application/API pair. /// /// /// await client.ClientGrants.ListAsync( @@ -452,7 +452,7 @@ await ListInternalAsync(request, options, cancellationToken).WithRawResponse(), } /// - /// Create a client grant for a machine-to-machine login flow. To learn more, read Client Credential Flow. + /// Create a client grant for a machine-to-machine login flow. To learn more, read [Client Credential Flow](https://www.auth0.com/docs/get-started/authentication-and-authorization-flow/client-credentials-flow). /// /// /// await client.ClientGrants.CreateAsync( @@ -471,7 +471,7 @@ public WithRawResponseTask CreateAsync( } /// - /// Retrieve a single client grant, including the + /// Retrieve a single [client grant](https://auth0.com/docs/get-started/applications/application-access-to-apis-client-grants), including the /// scopes associated with the application/API pair. /// /// @@ -489,7 +489,7 @@ public WithRawResponseTask GetAsync( } /// - /// Delete the Client Credential Flow from your machine-to-machine application. + /// Delete the [Client Credential Flow](https://www.auth0.com/docs/get-started/authentication-and-authorization-flow/client-credentials-flow) from your machine-to-machine application. /// /// /// await client.ClientGrants.DeleteAsync("id"); diff --git a/src/Auth0.ManagementApi/ClientGrants/IClientGrantsClient.cs b/src/Auth0.ManagementApi/ClientGrants/IClientGrantsClient.cs index 0b298afff..169118473 100644 --- a/src/Auth0.ManagementApi/ClientGrants/IClientGrantsClient.cs +++ b/src/Auth0.ManagementApi/ClientGrants/IClientGrantsClient.cs @@ -7,7 +7,7 @@ public partial interface IClientGrantsClient public Auth0.ManagementApi.ClientGrants.IOrganizationsClient Organizations { get; } /// - /// Retrieve a list of client grants, including the scopes associated with the application/API pair. + /// Retrieve a list of [client grants](https://auth0.com/docs/get-started/applications/application-access-to-apis-client-grants), including the scopes associated with the application/API pair. /// Task> ListAsync( ListClientGrantsRequestParameters request, @@ -16,7 +16,7 @@ Task> ListAsync( ); /// - /// Create a client grant for a machine-to-machine login flow. To learn more, read Client Credential Flow. + /// Create a client grant for a machine-to-machine login flow. To learn more, read [Client Credential Flow](https://www.auth0.com/docs/get-started/authentication-and-authorization-flow/client-credentials-flow). /// WithRawResponseTask CreateAsync( CreateClientGrantRequestContent request, @@ -25,7 +25,7 @@ WithRawResponseTask CreateAsync( ); /// - /// Retrieve a single client grant, including the + /// Retrieve a single [client grant](https://auth0.com/docs/get-started/applications/application-access-to-apis-client-grants), including the /// scopes associated with the application/API pair. /// WithRawResponseTask GetAsync( @@ -35,7 +35,7 @@ WithRawResponseTask GetAsync( ); /// - /// Delete the Client Credential Flow from your machine-to-machine application. + /// Delete the [Client Credential Flow](https://www.auth0.com/docs/get-started/authentication-and-authorization-flow/client-credentials-flow) from your machine-to-machine application. /// Task DeleteAsync( string id, diff --git a/src/Auth0.ManagementApi/Clients/ClientsClient.cs b/src/Auth0.ManagementApi/Clients/ClientsClient.cs index a0f3e638d..92c5ad6f4 100644 --- a/src/Auth0.ManagementApi/Clients/ClientsClient.cs +++ b/src/Auth0.ManagementApi/Clients/ClientsClient.cs @@ -21,38 +21,30 @@ internal ClientsClient(RawClient client) /// /// 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 Applications in Auth0 and Single Sign-On. + /// For more information, read [Applications in Auth0](https://www.auth0.com/docs/get-started/applications) and [Single Sign-On](https://www.auth0.com/docs/authenticate/single-sign-on). /// - /// - /// - /// The following can be retrieved with any scope: - /// client_id, app_type, name, and description. - /// - /// - /// The following properties can only be retrieved with the read:clients or - /// read:client_keys scope: - /// callbacks, oidc_logout, allowed_origins, - /// web_origins, tenant, global, config_route, - /// callback_url_template, jwt_configuration, - /// jwt_configuration.lifetime_in_seconds, jwt_configuration.secret_encoded, - /// jwt_configuration.scopes, jwt_configuration.alg, api_type, - /// logo_uri, allowed_clients, owners, custom_login_page, - /// custom_login_page_off, sso, addons, form_template, - /// custom_login_page_codeview, resource_servers, client_metadata, - /// mobile, mobile.android, mobile.ios, allowed_logout_urls, - /// token_endpoint_auth_method, is_first_party, oidc_conformant, - /// is_token_endpoint_ip_header_trusted, initiate_login_uri, grant_types, - /// refresh_token, refresh_token.rotation_type, refresh_token.expiration_type, - /// refresh_token.leeway, refresh_token.token_lifetime, refresh_token.policies, organization_usage, - /// organization_require_behavior. - /// - /// - /// The following properties can only be retrieved with the - /// read:client_keys or read:client_credentials scope: - /// encryption_key, encryption_key.pub, encryption_key.cert, - /// client_secret, client_authentication_methods and signing_key. - /// - /// + /// - The following can be retrieved with any scope: + /// `client_id`, `app_type`, `name`, and `description`. + /// - The following properties can only be retrieved with the `read:clients` or + /// `read:client_keys` scope: + /// `callbacks`, `oidc_logout`, `allowed_origins`, + /// `web_origins`, `tenant`, `global`, `config_route`, + /// `callback_url_template`, `jwt_configuration`, + /// `jwt_configuration.lifetime_in_seconds`, `jwt_configuration.secret_encoded`, + /// `jwt_configuration.scopes`, `jwt_configuration.alg`, `api_type`, + /// `logo_uri`, `allowed_clients`, `owners`, `custom_login_page`, + /// `custom_login_page_off`, `sso`, `addons`, `form_template`, + /// `custom_login_page_codeview`, `resource_servers`, `client_metadata`, + /// `mobile`, `mobile.android`, `mobile.ios`, `allowed_logout_urls`, + /// `token_endpoint_auth_method`, `is_first_party`, `oidc_conformant`, + /// `is_token_endpoint_ip_header_trusted`, `initiate_login_uri`, `grant_types`, + /// `refresh_token`, `refresh_token.rotation_type`, `refresh_token.expiration_type`, + /// `refresh_token.leeway`, `refresh_token.token_lifetime`, `refresh_token.policies`, `organization_usage`, + /// `organization_require_behavior`. + /// - The following properties can only be retrieved with the + /// `read:client_keys` or `read:client_credentials` scope: + /// `encryption_key`, `encryption_key.pub`, `encryption_key.cert`, + /// `client_secret`, `client_authentication_methods` and `signing_key`. /// private WithRawResponseTask ListInternalAsync( ListClientsRequestParameters request, @@ -726,38 +718,30 @@ private async Task> RotateSec /// /// 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 Applications in Auth0 and Single Sign-On. + /// For more information, read [Applications in Auth0](https://www.auth0.com/docs/get-started/applications) and [Single Sign-On](https://www.auth0.com/docs/authenticate/single-sign-on). /// - /// - /// - /// The following can be retrieved with any scope: - /// client_id, app_type, name, and description. - /// - /// - /// The following properties can only be retrieved with the read:clients or - /// read:client_keys scope: - /// callbacks, oidc_logout, allowed_origins, - /// web_origins, tenant, global, config_route, - /// callback_url_template, jwt_configuration, - /// jwt_configuration.lifetime_in_seconds, jwt_configuration.secret_encoded, - /// jwt_configuration.scopes, jwt_configuration.alg, api_type, - /// logo_uri, allowed_clients, owners, custom_login_page, - /// custom_login_page_off, sso, addons, form_template, - /// custom_login_page_codeview, resource_servers, client_metadata, - /// mobile, mobile.android, mobile.ios, allowed_logout_urls, - /// token_endpoint_auth_method, is_first_party, oidc_conformant, - /// is_token_endpoint_ip_header_trusted, initiate_login_uri, grant_types, - /// refresh_token, refresh_token.rotation_type, refresh_token.expiration_type, - /// refresh_token.leeway, refresh_token.token_lifetime, refresh_token.policies, organization_usage, - /// organization_require_behavior. - /// - /// - /// The following properties can only be retrieved with the - /// read:client_keys or read:client_credentials scope: - /// encryption_key, encryption_key.pub, encryption_key.cert, - /// client_secret, client_authentication_methods and signing_key. - /// - /// + /// - The following can be retrieved with any scope: + /// `client_id`, `app_type`, `name`, and `description`. + /// - The following properties can only be retrieved with the `read:clients` or + /// `read:client_keys` scope: + /// `callbacks`, `oidc_logout`, `allowed_origins`, + /// `web_origins`, `tenant`, `global`, `config_route`, + /// `callback_url_template`, `jwt_configuration`, + /// `jwt_configuration.lifetime_in_seconds`, `jwt_configuration.secret_encoded`, + /// `jwt_configuration.scopes`, `jwt_configuration.alg`, `api_type`, + /// `logo_uri`, `allowed_clients`, `owners`, `custom_login_page`, + /// `custom_login_page_off`, `sso`, `addons`, `form_template`, + /// `custom_login_page_codeview`, `resource_servers`, `client_metadata`, + /// `mobile`, `mobile.android`, `mobile.ios`, `allowed_logout_urls`, + /// `token_endpoint_auth_method`, `is_first_party`, `oidc_conformant`, + /// `is_token_endpoint_ip_header_trusted`, `initiate_login_uri`, `grant_types`, + /// `refresh_token`, `refresh_token.rotation_type`, `refresh_token.expiration_type`, + /// `refresh_token.leeway`, `refresh_token.token_lifetime`, `refresh_token.policies`, `organization_usage`, + /// `organization_require_behavior`. + /// - The following properties can only be retrieved with the + /// `read:client_keys` or `read:client_credentials` scope: + /// `encryption_key`, `encryption_key.pub`, `encryption_key.cert`, + /// `client_secret`, `client_authentication_methods` and `signing_key`. /// /// /// await client.Clients.ListAsync( @@ -811,18 +795,18 @@ await ListInternalAsync(request, options, cancellationToken).WithRawResponse(), } /// - /// Create a new client (application or SSO integration). For more information, read Create Applications - /// . + /// Create a new client (application or SSO integration). For more information, read [Create Applications](https://www.auth0.com/docs/get-started/auth0-overview/create-applications) + /// [API Endpoints for Single Sign-On](https://www.auth0.com/docs/authenticate/single-sign-on/api-endpoints-for-single-sign-on). /// /// Notes: /// - We recommend leaving the `client_secret` parameter unspecified to allow the generation of a safe secret. - /// - The client_authentication_methods and token_endpoint_auth_method properties are mutually exclusive. Use - /// client_authentication_methods to configure the client with Private Key JWT authentication method. Otherwise, use token_endpoint_auth_method + /// - The `client_authentication_methods` and `token_endpoint_auth_method` properties are mutually exclusive. Use + /// `client_authentication_methods` to configure the client with Private Key JWT authentication method. Otherwise, use `token_endpoint_auth_method` /// to configure the client with client secret (basic or post) or with no authentication method (none). - /// - When using client_authentication_methods to configure the client with Private Key JWT authentication method, specify fully defined credentials. + /// - When using `client_authentication_methods` to configure the client with Private Key JWT authentication method, specify fully defined credentials. /// These credentials will be automatically enabled for Private Key JWT authentication on the client. - /// - To configure client_authentication_methods, the create:client_credentials scope is required. - /// - To configure client_authentication_methods, the property jwt_configuration.alg must be set to RS256. + /// - To configure `client_authentication_methods`, the `create:client_credentials` scope is required. + /// - To configure `client_authentication_methods`, the property `jwt_configuration.alg` must be set to RS256. /// /// SSO Integrations created via this endpoint will accept login requests and share user profile information. /// @@ -894,36 +878,29 @@ public WithRawResponseTask RegisterCimdClient /// /// 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 Applications in Auth0 and Single Sign-On. - /// - /// - /// The following properties can be retrieved with any of the scopes: - /// client_id, app_type, name, and description. - /// - /// - /// The following properties can only be retrieved with the read:clients or - /// read:client_keys scopes: - /// callbacks, oidc_logout, allowed_origins, - /// web_origins, tenant, global, config_route, - /// callback_url_template, jwt_configuration, - /// jwt_configuration.lifetime_in_seconds, jwt_configuration.secret_encoded, - /// jwt_configuration.scopes, jwt_configuration.alg, api_type, - /// logo_uri, allowed_clients, owners, custom_login_page, - /// custom_login_page_off, sso, addons, form_template, - /// custom_login_page_codeview, resource_servers, client_metadata, - /// mobile, mobile.android, mobile.ios, allowed_logout_urls, - /// token_endpoint_auth_method, is_first_party, oidc_conformant, - /// is_token_endpoint_ip_header_trusted, initiate_login_uri, grant_types, - /// refresh_token, refresh_token.rotation_type, refresh_token.expiration_type, - /// refresh_token.leeway, refresh_token.token_lifetime, refresh_token.policies, organization_usage, - /// organization_require_behavior. - /// - /// - /// The following properties can only be retrieved with the read:client_keys or read:client_credentials scopes: - /// encryption_key, encryption_key.pub, encryption_key.cert, - /// client_secret, client_authentication_methods and signing_key. - /// - /// + /// For more information, read [Applications in Auth0](https://www.auth0.com/docs/get-started/applications) and [Single Sign-On](https://www.auth0.com/docs/authenticate/single-sign-on). + /// + /// - The following properties can be retrieved with any of the scopes: + /// `client_id`, `app_type`, `name`, and `description`. + /// - The following properties can only be retrieved with the `read:clients` or + /// `read:client_keys` scopes: + /// `callbacks`, `oidc_logout`, `allowed_origins`, + /// `web_origins`, `tenant`, `global`, `config_route`, + /// `callback_url_template`, `jwt_configuration`, + /// `jwt_configuration.lifetime_in_seconds`, `jwt_configuration.secret_encoded`, + /// `jwt_configuration.scopes`, `jwt_configuration.alg`, `api_type`, + /// `logo_uri`, `allowed_clients`, `owners`, `custom_login_page`, + /// `custom_login_page_off`, `sso`, `addons`, `form_template`, + /// `custom_login_page_codeview`, `resource_servers`, `client_metadata`, + /// `mobile`, `mobile.android`, `mobile.ios`, `allowed_logout_urls`, + /// `token_endpoint_auth_method`, `is_first_party`, `oidc_conformant`, + /// `is_token_endpoint_ip_header_trusted`, `initiate_login_uri`, `grant_types`, + /// `refresh_token`, `refresh_token.rotation_type`, `refresh_token.expiration_type`, + /// `refresh_token.leeway`, `refresh_token.token_lifetime`, `refresh_token.policies`, `organization_usage`, + /// `organization_require_behavior`. + /// - The following properties can only be retrieved with the `read:client_keys` or `read:client_credentials` scopes: + /// `encryption_key`, `encryption_key.pub`, `encryption_key.cert`, + /// `client_secret`, `client_authentication_methods` and `signing_key`. /// /// /// await client.Clients.GetAsync( @@ -1008,15 +985,15 @@ public async Task DeleteAsync( } /// - /// Updates a client's settings. For more information, read Applications in Auth0 and Single Sign-On. + /// Updates a client's settings. For more information, read [Applications in Auth0](https://www.auth0.com/docs/get-started/applications) and [Single Sign-On](https://www.auth0.com/docs/authenticate/single-sign-on). /// /// Notes: /// - The `client_secret` and `signing_key` attributes can only be updated with the `update:client_keys` scope. - /// - The client_authentication_methods and token_endpoint_auth_method properties are mutually exclusive. Use client_authentication_methods to configure the client with Private Key JWT authentication method. Otherwise, use token_endpoint_auth_method to configure the client with client secret (basic or post) or with no authentication method (none). - /// - When using client_authentication_methods to configure the client with Private Key JWT authentication method, only specify the credential IDs that were generated when creating the credentials on the client. - /// - To configure client_authentication_methods, the update:client_credentials scope is required. - /// - To configure client_authentication_methods, the property jwt_configuration.alg must be set to RS256. - /// - To change a client's is_first_party property to false, the organization_usage and organization_require_behavior properties must be unset. + /// - The `client_authentication_methods` and `token_endpoint_auth_method` properties are mutually exclusive. Use `client_authentication_methods` to configure the client with Private Key JWT authentication method. Otherwise, use `token_endpoint_auth_method` to configure the client with client secret (basic or post) or with no authentication method (none). + /// - When using `client_authentication_methods` to configure the client with Private Key JWT authentication method, only specify the credential IDs that were generated when creating the credentials on the client. + /// - To configure `client_authentication_methods`, the `update:client_credentials` scope is required. + /// - To configure `client_authentication_methods`, the property `jwt_configuration.alg` must be set to RS256. + /// - To change a client's `is_first_party` property to `false`, the `organization_usage` and `organization_require_behavior` properties must be unset. /// /// /// await client.Clients.UpdateAsync("id", new UpdateClientRequestContent()); @@ -1038,7 +1015,7 @@ public WithRawResponseTask UpdateAsync( /// /// This endpoint cannot be used with clients configured with Private Key JWT authentication method (client_authentication_methods configured with private_key_jwt). The generated secret is NOT base64 encoded. /// - /// For more information, read Rotate Client Secrets. + /// For more information, read [Rotate Client Secrets](https://www.auth0.com/docs/get-started/applications/rotate-client-secret). /// /// /// await client.Clients.RotateSecretAsync("id"); diff --git a/src/Auth0.ManagementApi/Clients/Connections/ConnectionsClient.cs b/src/Auth0.ManagementApi/Clients/Connections/ConnectionsClient.cs index df29fc159..25ac076fb 100644 --- a/src/Auth0.ManagementApi/Clients/Connections/ConnectionsClient.cs +++ b/src/Auth0.ManagementApi/Clients/Connections/ConnectionsClient.cs @@ -14,15 +14,10 @@ internal ConnectionsClient(RawClient client) } /// - /// Retrieve all connections that are enabled for the specified Application, using checkpoint pagination. A list of fields to include or exclude for each connection may also be specified. - /// - /// - /// This endpoint requires the read:connections scope and any one of read:clients or read:client_summary. - /// - /// - /// Note: The first time you call this endpoint, omit the from parameter. If there are more results, a next value is included in the response. You can use this for subsequent API calls. When next is no longer included in the response, no further results are remaining. - /// - /// + /// Retrieve all connections that are enabled for the specified [Application](https://www.auth0.com/docs/get-started/applications), using checkpoint pagination. A list of fields to include or exclude for each connection may also be specified. + /// + /// - This endpoint requires the `read:connections` scope and any one of `read:clients` or `read:client_summary`. + /// - **Note**: The first time you call this endpoint, omit the `from` parameter. If there are more results, a `next` value is included in the response. You can use this for subsequent API calls. When `next` is no longer included in the response, no further results are remaining. /// private WithRawResponseTask GetInternalAsync( string id, @@ -140,15 +135,10 @@ private async Task> GetInt } /// - /// Retrieve all connections that are enabled for the specified Application, using checkpoint pagination. A list of fields to include or exclude for each connection may also be specified. - /// - /// - /// This endpoint requires the read:connections scope and any one of read:clients or read:client_summary. - /// - /// - /// Note: The first time you call this endpoint, omit the from parameter. If there are more results, a next value is included in the response. You can use this for subsequent API calls. When next is no longer included in the response, no further results are remaining. - /// - /// + /// Retrieve all connections that are enabled for the specified [Application](https://www.auth0.com/docs/get-started/applications), using checkpoint pagination. A list of fields to include or exclude for each connection may also be specified. + /// + /// - This endpoint requires the `read:connections` scope and any one of `read:clients` or `read:client_summary`. + /// - **Note**: The first time you call this endpoint, omit the `from` parameter. If there are more results, a `next` value is included in the response. You can use this for subsequent API calls. When `next` is no longer included in the response, no further results are remaining. /// /// /// await client.Clients.Connections.GetAsync( diff --git a/src/Auth0.ManagementApi/Clients/Connections/IConnectionsClient.cs b/src/Auth0.ManagementApi/Clients/Connections/IConnectionsClient.cs index 4450b9300..9264856a3 100644 --- a/src/Auth0.ManagementApi/Clients/Connections/IConnectionsClient.cs +++ b/src/Auth0.ManagementApi/Clients/Connections/IConnectionsClient.cs @@ -6,15 +6,10 @@ namespace Auth0.ManagementApi.Clients; public partial interface IConnectionsClient { /// - /// Retrieve all connections that are enabled for the specified Application, using checkpoint pagination. A list of fields to include or exclude for each connection may also be specified. - /// - /// - /// This endpoint requires the read:connections scope and any one of read:clients or read:client_summary. - /// - /// - /// Note: The first time you call this endpoint, omit the from parameter. If there are more results, a next value is included in the response. You can use this for subsequent API calls. When next is no longer included in the response, no further results are remaining. - /// - /// + /// Retrieve all connections that are enabled for the specified [Application](https://www.auth0.com/docs/get-started/applications), using checkpoint pagination. A list of fields to include or exclude for each connection may also be specified. + /// + /// - This endpoint requires the `read:connections` scope and any one of `read:clients` or `read:client_summary`. + /// - **Note**: The first time you call this endpoint, omit the `from` parameter. If there are more results, a `next` value is included in the response. You can use this for subsequent API calls. When `next` is no longer included in the response, no further results are remaining. /// Task> GetAsync( string id, diff --git a/src/Auth0.ManagementApi/Clients/Credentials/CredentialsClient.cs b/src/Auth0.ManagementApi/Clients/Credentials/CredentialsClient.cs index 7c8b38dc4..95f0eaf9f 100644 --- a/src/Auth0.ManagementApi/Clients/Credentials/CredentialsClient.cs +++ b/src/Auth0.ManagementApi/Clients/Credentials/CredentialsClient.cs @@ -382,7 +382,7 @@ private async Task> Update /// /// Get the details of a client credential. /// - /// Important: To enable credentials to be used for a client authentication method, set the client_authentication_methods property on the client. To enable credentials to be used for JWT-Secured Authorization requests set the signed_request_object property on the client. + /// **Important**: To enable credentials to be used for a client authentication method, set the `client_authentication_methods` property on the client. To enable credentials to be used for JWT-Secured Authorization requests set the `signed_request_object` property on the client. /// /// /// await client.Clients.Credentials.ListAsync("client_id"); @@ -401,37 +401,61 @@ public WithRawResponseTask> ListAsync( /// /// Create a client credential associated to your application. Credentials can be used to configure Private Key JWT and mTLS authentication methods, as well as for JWT-secured Authorization requests. /// - /// Public KeyPublic Key credentials can be used to set up Private Key JWT client authentication and JWT-secured Authorization requests. + /// **Public Key** /// - /// Sample: { + /// Public Key credentials can be used to set up Private Key JWT client authentication and JWT-secured Authorization requests. + /// + /// Sample: + /// + /// ```json + /// { /// "credential_type": "public_key", /// "name": "string", /// "pem": "string", /// "alg": "RS256", /// "parse_expiry_from_cert": false, /// "expires_at": "2022-12-31T23:59:59Z" - /// } - /// Certificate (CA-signed & self-signed)Certificate credentials can be used to set up mTLS client authentication. CA-signed certificates can be configured either with a signed certificate or with just the certificate Subject DN. + /// } + /// ``` + /// + /// **Certificate (CA-signed & self-signed)** + /// + /// Certificate credentials can be used to set up mTLS client authentication. CA-signed certificates can be configured either with a signed certificate or with just the certificate Subject DN. + /// + /// CA-signed Certificate Sample (pem): /// - /// CA-signed Certificate Sample (pem): { + /// ```json + /// { /// "credential_type": "x509_cert", /// "name": "string", /// "pem": "string" - /// }CA-signed Certificate Sample (subject_dn): { + /// } + /// ``` + /// + /// CA-signed Certificate Sample (subject_dn): + /// + /// ```json + /// { /// "credential_type": "cert_subject_dn", /// "name": "string", /// "subject_dn": "string" - /// }Self-signed Certificate Sample: { + /// } + /// ``` + /// + /// Self-signed Certificate Sample: + /// + /// ```json + /// { /// "credential_type": "cert_subject_dn", /// "name": "string", /// "pem": "string" - /// } + /// } + /// ``` /// /// The credential will be created but not yet enabled for use until you set the corresponding properties in the client: - /// - /// To enable the credential for Private Key JWT or mTLS authentication methods, set the client_authentication_methods property on the client. For more information, read Configure Private Key JWT Authentication and Configure mTLS Authentication - /// To enable the credential for JWT-secured Authorization requests, set the signed_request_objectproperty on the client. For more information, read Configure JWT-secured Authorization Requests (JAR) - /// + /// + /// - To enable the credential for Private Key JWT or mTLS authentication methods, set the `client_authentication_methods` property on the client. For more information, read [Configure Private Key JWT Authentication](https://auth0.com/docs/get-started/applications/configure-private-key-jwt) and [Configure mTLS Authentication](https://auth0.com/docs/get-started/applications/configure-mtls) + /// - To enable the credential for JWT-secured Authorization requests, set the `signed_request_object`property on the client. For more information, read [Configure JWT-secured Authorization Requests (JAR)](https://auth0.com/docs/get-started/applications/configure-jar) /// /// /// await client.Clients.Credentials.CreateAsync( @@ -454,7 +478,7 @@ public WithRawResponseTask CreateAsync( /// /// Get the details of a client credential. /// - /// Important: To enable credentials to be used for a client authentication method, set the client_authentication_methods property on the client. To enable credentials to be used for JWT-Secured Authorization requests set the signed_request_object property on the client. + /// **Important**: To enable credentials to be used for a client authentication method, set the `client_authentication_methods` property on the client. To enable credentials to be used for JWT-Secured Authorization requests set the `signed_request_object` property on the client. /// /// /// await client.Clients.Credentials.GetAsync("client_id", "credential_id"); diff --git a/src/Auth0.ManagementApi/Clients/Credentials/ICredentialsClient.cs b/src/Auth0.ManagementApi/Clients/Credentials/ICredentialsClient.cs index 65e657cd6..d267a38c3 100644 --- a/src/Auth0.ManagementApi/Clients/Credentials/ICredentialsClient.cs +++ b/src/Auth0.ManagementApi/Clients/Credentials/ICredentialsClient.cs @@ -7,7 +7,7 @@ public partial interface ICredentialsClient /// /// Get the details of a client credential. /// - /// Important: To enable credentials to be used for a client authentication method, set the client_authentication_methods property on the client. To enable credentials to be used for JWT-Secured Authorization requests set the signed_request_object property on the client. + /// **Important**: To enable credentials to be used for a client authentication method, set the `client_authentication_methods` property on the client. To enable credentials to be used for JWT-Secured Authorization requests set the `signed_request_object` property on the client. /// WithRawResponseTask> ListAsync( string clientId, @@ -18,37 +18,61 @@ WithRawResponseTask> ListAsync( /// /// Create a client credential associated to your application. Credentials can be used to configure Private Key JWT and mTLS authentication methods, as well as for JWT-secured Authorization requests. /// - /// Public KeyPublic Key credentials can be used to set up Private Key JWT client authentication and JWT-secured Authorization requests. + /// **Public Key** /// - /// Sample: { + /// Public Key credentials can be used to set up Private Key JWT client authentication and JWT-secured Authorization requests. + /// + /// Sample: + /// + /// ```json + /// { /// "credential_type": "public_key", /// "name": "string", /// "pem": "string", /// "alg": "RS256", /// "parse_expiry_from_cert": false, /// "expires_at": "2022-12-31T23:59:59Z" - /// } - /// Certificate (CA-signed & self-signed)Certificate credentials can be used to set up mTLS client authentication. CA-signed certificates can be configured either with a signed certificate or with just the certificate Subject DN. + /// } + /// ``` + /// + /// **Certificate (CA-signed & self-signed)** + /// + /// Certificate credentials can be used to set up mTLS client authentication. CA-signed certificates can be configured either with a signed certificate or with just the certificate Subject DN. + /// + /// CA-signed Certificate Sample (pem): /// - /// CA-signed Certificate Sample (pem): { + /// ```json + /// { /// "credential_type": "x509_cert", /// "name": "string", /// "pem": "string" - /// }CA-signed Certificate Sample (subject_dn): { + /// } + /// ``` + /// + /// CA-signed Certificate Sample (subject_dn): + /// + /// ```json + /// { /// "credential_type": "cert_subject_dn", /// "name": "string", /// "subject_dn": "string" - /// }Self-signed Certificate Sample: { + /// } + /// ``` + /// + /// Self-signed Certificate Sample: + /// + /// ```json + /// { /// "credential_type": "cert_subject_dn", /// "name": "string", /// "pem": "string" - /// } + /// } + /// ``` /// /// The credential will be created but not yet enabled for use until you set the corresponding properties in the client: - /// - /// To enable the credential for Private Key JWT or mTLS authentication methods, set the client_authentication_methods property on the client. For more information, read Configure Private Key JWT Authentication and Configure mTLS Authentication - /// To enable the credential for JWT-secured Authorization requests, set the signed_request_objectproperty on the client. For more information, read Configure JWT-secured Authorization Requests (JAR) - /// + /// + /// - To enable the credential for Private Key JWT or mTLS authentication methods, set the `client_authentication_methods` property on the client. For more information, read [Configure Private Key JWT Authentication](https://auth0.com/docs/get-started/applications/configure-private-key-jwt) and [Configure mTLS Authentication](https://auth0.com/docs/get-started/applications/configure-mtls) + /// - To enable the credential for JWT-secured Authorization requests, set the `signed_request_object`property on the client. For more information, read [Configure JWT-secured Authorization Requests (JAR)](https://auth0.com/docs/get-started/applications/configure-jar) /// WithRawResponseTask CreateAsync( string clientId, @@ -60,7 +84,7 @@ WithRawResponseTask CreateAsync( /// /// Get the details of a client credential. /// - /// Important: To enable credentials to be used for a client authentication method, set the client_authentication_methods property on the client. To enable credentials to be used for JWT-Secured Authorization requests set the signed_request_object property on the client. + /// **Important**: To enable credentials to be used for a client authentication method, set the `client_authentication_methods` property on the client. To enable credentials to be used for JWT-Secured Authorization requests set the `signed_request_object` property on the client. /// WithRawResponseTask GetAsync( string clientId, diff --git a/src/Auth0.ManagementApi/Clients/IClientsClient.cs b/src/Auth0.ManagementApi/Clients/IClientsClient.cs index b414be580..1d29160d1 100644 --- a/src/Auth0.ManagementApi/Clients/IClientsClient.cs +++ b/src/Auth0.ManagementApi/Clients/IClientsClient.cs @@ -10,38 +10,30 @@ public partial interface IClientsClient /// /// 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 Applications in Auth0 and Single Sign-On. + /// For more information, read [Applications in Auth0](https://www.auth0.com/docs/get-started/applications) and [Single Sign-On](https://www.auth0.com/docs/authenticate/single-sign-on). /// - /// - /// - /// The following can be retrieved with any scope: - /// client_id, app_type, name, and description. - /// - /// - /// The following properties can only be retrieved with the read:clients or - /// read:client_keys scope: - /// callbacks, oidc_logout, allowed_origins, - /// web_origins, tenant, global, config_route, - /// callback_url_template, jwt_configuration, - /// jwt_configuration.lifetime_in_seconds, jwt_configuration.secret_encoded, - /// jwt_configuration.scopes, jwt_configuration.alg, api_type, - /// logo_uri, allowed_clients, owners, custom_login_page, - /// custom_login_page_off, sso, addons, form_template, - /// custom_login_page_codeview, resource_servers, client_metadata, - /// mobile, mobile.android, mobile.ios, allowed_logout_urls, - /// token_endpoint_auth_method, is_first_party, oidc_conformant, - /// is_token_endpoint_ip_header_trusted, initiate_login_uri, grant_types, - /// refresh_token, refresh_token.rotation_type, refresh_token.expiration_type, - /// refresh_token.leeway, refresh_token.token_lifetime, refresh_token.policies, organization_usage, - /// organization_require_behavior. - /// - /// - /// The following properties can only be retrieved with the - /// read:client_keys or read:client_credentials scope: - /// encryption_key, encryption_key.pub, encryption_key.cert, - /// client_secret, client_authentication_methods and signing_key. - /// - /// + /// - The following can be retrieved with any scope: + /// `client_id`, `app_type`, `name`, and `description`. + /// - The following properties can only be retrieved with the `read:clients` or + /// `read:client_keys` scope: + /// `callbacks`, `oidc_logout`, `allowed_origins`, + /// `web_origins`, `tenant`, `global`, `config_route`, + /// `callback_url_template`, `jwt_configuration`, + /// `jwt_configuration.lifetime_in_seconds`, `jwt_configuration.secret_encoded`, + /// `jwt_configuration.scopes`, `jwt_configuration.alg`, `api_type`, + /// `logo_uri`, `allowed_clients`, `owners`, `custom_login_page`, + /// `custom_login_page_off`, `sso`, `addons`, `form_template`, + /// `custom_login_page_codeview`, `resource_servers`, `client_metadata`, + /// `mobile`, `mobile.android`, `mobile.ios`, `allowed_logout_urls`, + /// `token_endpoint_auth_method`, `is_first_party`, `oidc_conformant`, + /// `is_token_endpoint_ip_header_trusted`, `initiate_login_uri`, `grant_types`, + /// `refresh_token`, `refresh_token.rotation_type`, `refresh_token.expiration_type`, + /// `refresh_token.leeway`, `refresh_token.token_lifetime`, `refresh_token.policies`, `organization_usage`, + /// `organization_require_behavior`. + /// - The following properties can only be retrieved with the + /// `read:client_keys` or `read:client_credentials` scope: + /// `encryption_key`, `encryption_key.pub`, `encryption_key.cert`, + /// `client_secret`, `client_authentication_methods` and `signing_key`. /// Task> ListAsync( ListClientsRequestParameters request, @@ -50,18 +42,18 @@ Task> ListAsync( ); /// - /// Create a new client (application or SSO integration). For more information, read Create Applications - /// . + /// Create a new client (application or SSO integration). For more information, read [Create Applications](https://www.auth0.com/docs/get-started/auth0-overview/create-applications) + /// [API Endpoints for Single Sign-On](https://www.auth0.com/docs/authenticate/single-sign-on/api-endpoints-for-single-sign-on). /// /// Notes: /// - We recommend leaving the `client_secret` parameter unspecified to allow the generation of a safe secret. - /// - The client_authentication_methods and token_endpoint_auth_method properties are mutually exclusive. Use - /// client_authentication_methods to configure the client with Private Key JWT authentication method. Otherwise, use token_endpoint_auth_method + /// - The `client_authentication_methods` and `token_endpoint_auth_method` properties are mutually exclusive. Use + /// `client_authentication_methods` to configure the client with Private Key JWT authentication method. Otherwise, use `token_endpoint_auth_method` /// to configure the client with client secret (basic or post) or with no authentication method (none). - /// - When using client_authentication_methods to configure the client with Private Key JWT authentication method, specify fully defined credentials. + /// - When using `client_authentication_methods` to configure the client with Private Key JWT authentication method, specify fully defined credentials. /// These credentials will be automatically enabled for Private Key JWT authentication on the client. - /// - To configure client_authentication_methods, the create:client_credentials scope is required. - /// - To configure client_authentication_methods, the property jwt_configuration.alg must be set to RS256. + /// - To configure `client_authentication_methods`, the `create:client_credentials` scope is required. + /// - To configure `client_authentication_methods`, the property `jwt_configuration.alg` must be set to RS256. /// /// SSO Integrations created via this endpoint will accept login requests and share user profile information. /// @@ -105,36 +97,29 @@ WithRawResponseTask RegisterCimdClientAsync( /// /// 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 Applications in Auth0 and Single Sign-On. - /// - /// - /// The following properties can be retrieved with any of the scopes: - /// client_id, app_type, name, and description. - /// - /// - /// The following properties can only be retrieved with the read:clients or - /// read:client_keys scopes: - /// callbacks, oidc_logout, allowed_origins, - /// web_origins, tenant, global, config_route, - /// callback_url_template, jwt_configuration, - /// jwt_configuration.lifetime_in_seconds, jwt_configuration.secret_encoded, - /// jwt_configuration.scopes, jwt_configuration.alg, api_type, - /// logo_uri, allowed_clients, owners, custom_login_page, - /// custom_login_page_off, sso, addons, form_template, - /// custom_login_page_codeview, resource_servers, client_metadata, - /// mobile, mobile.android, mobile.ios, allowed_logout_urls, - /// token_endpoint_auth_method, is_first_party, oidc_conformant, - /// is_token_endpoint_ip_header_trusted, initiate_login_uri, grant_types, - /// refresh_token, refresh_token.rotation_type, refresh_token.expiration_type, - /// refresh_token.leeway, refresh_token.token_lifetime, refresh_token.policies, organization_usage, - /// organization_require_behavior. - /// - /// - /// The following properties can only be retrieved with the read:client_keys or read:client_credentials scopes: - /// encryption_key, encryption_key.pub, encryption_key.cert, - /// client_secret, client_authentication_methods and signing_key. - /// - /// + /// For more information, read [Applications in Auth0](https://www.auth0.com/docs/get-started/applications) and [Single Sign-On](https://www.auth0.com/docs/authenticate/single-sign-on). + /// + /// - The following properties can be retrieved with any of the scopes: + /// `client_id`, `app_type`, `name`, and `description`. + /// - The following properties can only be retrieved with the `read:clients` or + /// `read:client_keys` scopes: + /// `callbacks`, `oidc_logout`, `allowed_origins`, + /// `web_origins`, `tenant`, `global`, `config_route`, + /// `callback_url_template`, `jwt_configuration`, + /// `jwt_configuration.lifetime_in_seconds`, `jwt_configuration.secret_encoded`, + /// `jwt_configuration.scopes`, `jwt_configuration.alg`, `api_type`, + /// `logo_uri`, `allowed_clients`, `owners`, `custom_login_page`, + /// `custom_login_page_off`, `sso`, `addons`, `form_template`, + /// `custom_login_page_codeview`, `resource_servers`, `client_metadata`, + /// `mobile`, `mobile.android`, `mobile.ios`, `allowed_logout_urls`, + /// `token_endpoint_auth_method`, `is_first_party`, `oidc_conformant`, + /// `is_token_endpoint_ip_header_trusted`, `initiate_login_uri`, `grant_types`, + /// `refresh_token`, `refresh_token.rotation_type`, `refresh_token.expiration_type`, + /// `refresh_token.leeway`, `refresh_token.token_lifetime`, `refresh_token.policies`, `organization_usage`, + /// `organization_require_behavior`. + /// - The following properties can only be retrieved with the `read:client_keys` or `read:client_credentials` scopes: + /// `encryption_key`, `encryption_key.pub`, `encryption_key.cert`, + /// `client_secret`, `client_authentication_methods` and `signing_key`. /// WithRawResponseTask GetAsync( string id, @@ -153,15 +138,15 @@ Task DeleteAsync( ); /// - /// Updates a client's settings. For more information, read Applications in Auth0 and Single Sign-On. + /// Updates a client's settings. For more information, read [Applications in Auth0](https://www.auth0.com/docs/get-started/applications) and [Single Sign-On](https://www.auth0.com/docs/authenticate/single-sign-on). /// /// Notes: /// - The `client_secret` and `signing_key` attributes can only be updated with the `update:client_keys` scope. - /// - The client_authentication_methods and token_endpoint_auth_method properties are mutually exclusive. Use client_authentication_methods to configure the client with Private Key JWT authentication method. Otherwise, use token_endpoint_auth_method to configure the client with client secret (basic or post) or with no authentication method (none). - /// - When using client_authentication_methods to configure the client with Private Key JWT authentication method, only specify the credential IDs that were generated when creating the credentials on the client. - /// - To configure client_authentication_methods, the update:client_credentials scope is required. - /// - To configure client_authentication_methods, the property jwt_configuration.alg must be set to RS256. - /// - To change a client's is_first_party property to false, the organization_usage and organization_require_behavior properties must be unset. + /// - The `client_authentication_methods` and `token_endpoint_auth_method` properties are mutually exclusive. Use `client_authentication_methods` to configure the client with Private Key JWT authentication method. Otherwise, use `token_endpoint_auth_method` to configure the client with client secret (basic or post) or with no authentication method (none). + /// - When using `client_authentication_methods` to configure the client with Private Key JWT authentication method, only specify the credential IDs that were generated when creating the credentials on the client. + /// - To configure `client_authentication_methods`, the `update:client_credentials` scope is required. + /// - To configure `client_authentication_methods`, the property `jwt_configuration.alg` must be set to RS256. + /// - To change a client's `is_first_party` property to `false`, the `organization_usage` and `organization_require_behavior` properties must be unset. /// WithRawResponseTask UpdateAsync( string id, @@ -175,7 +160,7 @@ WithRawResponseTask UpdateAsync( /// /// This endpoint cannot be used with clients configured with Private Key JWT authentication method (client_authentication_methods configured with private_key_jwt). The generated secret is NOT base64 encoded. /// - /// For more information, read Rotate Client Secrets. + /// For more information, read [Rotate Client Secrets](https://www.auth0.com/docs/get-started/applications/rotate-client-secret). /// WithRawResponseTask RotateSecretAsync( string id, diff --git a/src/Auth0.ManagementApi/DeviceCredentials/DeviceCredentialsClient.cs b/src/Auth0.ManagementApi/DeviceCredentials/DeviceCredentialsClient.cs index 913c34fbe..75dacd5a0 100644 --- a/src/Auth0.ManagementApi/DeviceCredentials/DeviceCredentialsClient.cs +++ b/src/Auth0.ManagementApi/DeviceCredentials/DeviceCredentialsClient.cs @@ -13,7 +13,7 @@ internal DeviceCredentialsClient(RawClient client) } /// - /// Retrieve device credential information (public_key, refresh_token, or rotating_refresh_token) associated with a specific user. + /// Retrieve device credential information (`public_key`, `refresh_token`, or `rotating_refresh_token`) associated with a specific user. /// private WithRawResponseTask ListInternalAsync( ListDeviceCredentialsRequestParameters request, @@ -225,7 +225,7 @@ private async Task< } /// - /// Retrieve device credential information (public_key, refresh_token, or rotating_refresh_token) associated with a specific user. + /// Retrieve device credential information (`public_key`, `refresh_token`, or `rotating_refresh_token`) associated with a specific user. /// /// /// await client.DeviceCredentials.ListAsync( @@ -277,9 +277,9 @@ await ListInternalAsync(request, options, cancellationToken).WithRawResponse(), } /// - /// Create a device credential public key to manage refresh token rotation for a given user_id. Device Credentials APIs are designed for ad-hoc administrative use only and paging is by default enabled for GET requests. + /// Create a device credential public key to manage refresh token rotation for a given `user_id`. Device Credentials APIs are designed for ad-hoc administrative use only and paging is by default enabled for GET requests. /// - /// When refresh token rotation is enabled, the endpoint becomes consistent. For more information, read Signing Keys. + /// When refresh token rotation is enabled, the endpoint becomes consistent. For more information, read [Signing Keys](https://auth0.com/docs/get-started/tenant-settings/signing-keys). /// /// /// await client.DeviceCredentials.CreatePublicKeyAsync( diff --git a/src/Auth0.ManagementApi/DeviceCredentials/IDeviceCredentialsClient.cs b/src/Auth0.ManagementApi/DeviceCredentials/IDeviceCredentialsClient.cs index cdbe0ed51..2eab6be27 100644 --- a/src/Auth0.ManagementApi/DeviceCredentials/IDeviceCredentialsClient.cs +++ b/src/Auth0.ManagementApi/DeviceCredentials/IDeviceCredentialsClient.cs @@ -5,7 +5,7 @@ namespace Auth0.ManagementApi; public partial interface IDeviceCredentialsClient { /// - /// Retrieve device credential information (public_key, refresh_token, or rotating_refresh_token) associated with a specific user. + /// Retrieve device credential information (`public_key`, `refresh_token`, or `rotating_refresh_token`) associated with a specific user. /// Task> ListAsync( ListDeviceCredentialsRequestParameters request, @@ -14,9 +14,9 @@ Task> ListAsync( ); /// - /// Create a device credential public key to manage refresh token rotation for a given user_id. Device Credentials APIs are designed for ad-hoc administrative use only and paging is by default enabled for GET requests. + /// Create a device credential public key to manage refresh token rotation for a given `user_id`. Device Credentials APIs are designed for ad-hoc administrative use only and paging is by default enabled for GET requests. /// - /// When refresh token rotation is enabled, the endpoint becomes consistent. For more information, read Signing Keys. + /// When refresh token rotation is enabled, the endpoint becomes consistent. For more information, read [Signing Keys](https://auth0.com/docs/get-started/tenant-settings/signing-keys). /// WithRawResponseTask CreatePublicKeyAsync( CreatePublicKeyDeviceCredentialRequestContent request, diff --git a/src/Auth0.ManagementApi/Organizations/DiscoveryDomains/DiscoveryDomainsClient.cs b/src/Auth0.ManagementApi/Organizations/DiscoveryDomains/DiscoveryDomainsClient.cs index 30766708f..ed442be47 100644 --- a/src/Auth0.ManagementApi/Organizations/DiscoveryDomains/DiscoveryDomainsClient.cs +++ b/src/Auth0.ManagementApi/Organizations/DiscoveryDomains/DiscoveryDomainsClient.cs @@ -682,7 +682,7 @@ public async Task DeleteAsync( } /// - /// Update the verification status and/or use_for_organization_discovery for an organization discovery domain. The status field must be either pending or verified. The use_for_organization_discovery field can be true or false (default: true). + /// Update the verification status and/or use_for_organization_discovery for an organization discovery domain. The `status` field must be either `pending` or `verified`. The `use_for_organization_discovery` field can be `true` or `false` (default: `true`). /// /// /// await client.Organizations.DiscoveryDomains.UpdateAsync( diff --git a/src/Auth0.ManagementApi/Organizations/DiscoveryDomains/IDiscoveryDomainsClient.cs b/src/Auth0.ManagementApi/Organizations/DiscoveryDomains/IDiscoveryDomainsClient.cs index 69784c167..ee89effd0 100644 --- a/src/Auth0.ManagementApi/Organizations/DiscoveryDomains/IDiscoveryDomainsClient.cs +++ b/src/Auth0.ManagementApi/Organizations/DiscoveryDomains/IDiscoveryDomainsClient.cs @@ -59,7 +59,7 @@ Task DeleteAsync( ); /// - /// Update the verification status and/or use_for_organization_discovery for an organization discovery domain. The status field must be either pending or verified. The use_for_organization_discovery field can be true or false (default: true). + /// Update the verification status and/or use_for_organization_discovery for an organization discovery domain. The `status` field must be either `pending` or `verified`. The `use_for_organization_discovery` field can be `true` or `false` (default: `true`). /// WithRawResponseTask UpdateAsync( string id, diff --git a/src/Auth0.ManagementApi/Organizations/EnabledConnections/EnabledConnectionsClient.cs b/src/Auth0.ManagementApi/Organizations/EnabledConnections/EnabledConnectionsClient.cs index 4455b9263..a885f54b9 100644 --- a/src/Auth0.ManagementApi/Organizations/EnabledConnections/EnabledConnectionsClient.cs +++ b/src/Auth0.ManagementApi/Organizations/EnabledConnections/EnabledConnectionsClient.cs @@ -458,7 +458,7 @@ await ListInternalAsync(id, request, options, cancellationToken) /// /// Enable a specific connection for a given Organization. To enable a connection, it must already exist within your tenant; connections cannot be created through this action. /// - /// Connections represent the relationship between Auth0 and a source of users. Available types of connections include database, enterprise, and social. + /// [Connections](https://auth0.com/docs/authenticate/identity-providers) represent the relationship between Auth0 and a source of users. Available types of connections include database, enterprise, and social. /// /// /// await client.Organizations.EnabledConnections.AddAsync( @@ -499,7 +499,7 @@ public WithRawResponseTask GetAsync( /// /// Disable a specific connection for an Organization. Once disabled, Organization members can no longer use that connection to authenticate. /// - /// Note: This action does not remove the connection from your tenant. + /// **Note**: This action does not remove the connection from your tenant. /// /// /// await client.Organizations.EnabledConnections.DeleteAsync("id", "connectionId"); diff --git a/src/Auth0.ManagementApi/Organizations/EnabledConnections/IEnabledConnectionsClient.cs b/src/Auth0.ManagementApi/Organizations/EnabledConnections/IEnabledConnectionsClient.cs index 19a9cd4fd..b8151e249 100644 --- a/src/Auth0.ManagementApi/Organizations/EnabledConnections/IEnabledConnectionsClient.cs +++ b/src/Auth0.ManagementApi/Organizations/EnabledConnections/IEnabledConnectionsClient.cs @@ -18,7 +18,7 @@ Task> ListAsync( /// /// Enable a specific connection for a given Organization. To enable a connection, it must already exist within your tenant; connections cannot be created through this action. /// - /// Connections represent the relationship between Auth0 and a source of users. Available types of connections include database, enterprise, and social. + /// [Connections](https://auth0.com/docs/authenticate/identity-providers) represent the relationship between Auth0 and a source of users. Available types of connections include database, enterprise, and social. /// WithRawResponseTask AddAsync( string id, @@ -40,7 +40,7 @@ WithRawResponseTask GetAsync( /// /// Disable a specific connection for an Organization. Once disabled, Organization members can no longer use that connection to authenticate. /// - /// Note: This action does not remove the connection from your tenant. + /// **Note**: This action does not remove the connection from your tenant. /// Task DeleteAsync( string id, diff --git a/src/Auth0.ManagementApi/Organizations/Groups/GroupsClient.cs b/src/Auth0.ManagementApi/Organizations/Groups/GroupsClient.cs new file mode 100644 index 000000000..54712abb8 --- /dev/null +++ b/src/Auth0.ManagementApi/Organizations/Groups/GroupsClient.cs @@ -0,0 +1,175 @@ +using Auth0.ManagementApi; +using Auth0.ManagementApi.Core; +using global::System.Text.Json; + +namespace Auth0.ManagementApi.Organizations; + +public partial class GroupsClient : IGroupsClient +{ + private readonly RawClient _client; + + internal GroupsClient(RawClient client) + { + _client = client; + Roles = new Auth0.ManagementApi.Organizations.Groups.RolesClient(_client); + } + + public Auth0.ManagementApi.Organizations.Groups.IRolesClient Roles { get; } + + /// + /// Lists the groups that are assigned to the specified organization. + /// + private WithRawResponseTask ListInternalAsync( + string organizationId, + ListOrganizationGroupsRequestParameters request, + RequestOptions? options = null, + CancellationToken cancellationToken = default + ) + { + return new WithRawResponseTask( + ListInternalAsyncCore(organizationId, request, options, cancellationToken) + ); + } + + private async Task< + WithRawResponse + > ListInternalAsyncCore( + string organizationId, + ListOrganizationGroupsRequestParameters request, + RequestOptions? options = null, + CancellationToken cancellationToken = default + ) + { + var _queryString = new Auth0.ManagementApi.Core.QueryStringBuilder.Builder(capacity: 2) + .Add("from", request.From.IsDefined ? request.From.Value : null) + .Add("take", request.Take.IsDefined ? request.Take.Value : null) + .MergeAdditional(options?.AdditionalQueryParameters) + .Build(); + var _headers = await new Auth0.ManagementApi.Core.HeadersBuilder.Builder() + .Add(_client.Options.Headers) + .Add(_client.Options.AdditionalHeaders) + .Add(options?.AdditionalHeaders) + .BuildAsync() + .ConfigureAwait(false); + var response = await _client + .SendRequestAsync( + new JsonRequest + { + Method = HttpMethod.Get, + Path = string.Format( + "organizations/{0}/groups", + ValueConvert.ToPathParameterString(organizationId) + ), + QueryString = _queryString, + Headers = _headers, + Options = options, + }, + cancellationToken + ) + .ConfigureAwait(false); + if (response.StatusCode is >= 200 and < 400) + { + var responseBody = await response + .Raw.Content.ReadAsStringAsync(cancellationToken) + .ConfigureAwait(false); + try + { + var responseData = JsonUtils.Deserialize( + responseBody + )!; + return new WithRawResponse() + { + Data = responseData, + RawResponse = new RawResponse() + { + StatusCode = response.Raw.StatusCode, + Url = response.Raw.RequestMessage?.RequestUri ?? new Uri("about:blank"), + Headers = ResponseHeaders.FromHttpResponseMessage(response.Raw), + }, + }; + } + catch (JsonException e) + { + throw new ManagementApiException( + "Failed to deserialize response", + response.StatusCode, + null, + e + ); + } + } + { + var responseBody = await response + .Raw.Content.ReadAsStringAsync(cancellationToken) + .ConfigureAwait(false); + try + { + switch (response.StatusCode) + { + case 400: + throw new BadRequestError(JsonUtils.Deserialize(responseBody)); + case 401: + throw new UnauthorizedError(JsonUtils.Deserialize(responseBody)); + case 403: + throw new ForbiddenError(JsonUtils.Deserialize(responseBody)); + case 429: + throw new TooManyRequestsError(JsonUtils.Deserialize(responseBody)); + } + } + catch (JsonException) + { + // unable to map error response, throwing generic error + } + throw new ManagementApiException( + $"Error with status code {response.StatusCode}", + response.StatusCode, + responseBody + ); + } + } + + /// + /// Lists the groups that are assigned to the specified organization. + /// + /// + /// await client.Organizations.Groups.ListAsync( + /// "organization_id", + /// new ListOrganizationGroupsRequestParameters { From = "from", Take = 1 } + /// ); + /// + public async Task> ListAsync( + string organizationId, + ListOrganizationGroupsRequestParameters request, + RequestOptions? options = null, + CancellationToken cancellationToken = default + ) + { + if (request is not null) + { + request = request with { }; + } + var pager = await CursorPager< + ListOrganizationGroupsRequestParameters, + RequestOptions?, + ListOrganizationGroupsResponseContent, + string?, + Group + > + .CreateInstanceAsync( + request, + options, + async (request, options, cancellationToken) => + await ListInternalAsync(organizationId, request, options, cancellationToken) + .WithRawResponse(), + (request, cursor) => + { + request.From = cursor; + }, + response => response.Next, + response => response.Groups?.ToList(), + cancellationToken + ) + .ConfigureAwait(false); + return pager; + } +} diff --git a/src/Auth0.ManagementApi/Organizations/Groups/IGroupsClient.cs b/src/Auth0.ManagementApi/Organizations/Groups/IGroupsClient.cs new file mode 100644 index 000000000..9a9e06872 --- /dev/null +++ b/src/Auth0.ManagementApi/Organizations/Groups/IGroupsClient.cs @@ -0,0 +1,19 @@ +using Auth0.ManagementApi; +using Auth0.ManagementApi.Core; + +namespace Auth0.ManagementApi.Organizations; + +public partial interface IGroupsClient +{ + public Auth0.ManagementApi.Organizations.Groups.IRolesClient Roles { get; } + + /// + /// Lists the groups that are assigned to the specified organization. + /// + Task> ListAsync( + string organizationId, + ListOrganizationGroupsRequestParameters request, + RequestOptions? options = null, + CancellationToken cancellationToken = default + ); +} diff --git a/src/Auth0.ManagementApi/Organizations/Groups/Requests/ListOrganizationGroupsRequestParameters.cs b/src/Auth0.ManagementApi/Organizations/Groups/Requests/ListOrganizationGroupsRequestParameters.cs new file mode 100644 index 000000000..720acf2f6 --- /dev/null +++ b/src/Auth0.ManagementApi/Organizations/Groups/Requests/ListOrganizationGroupsRequestParameters.cs @@ -0,0 +1,26 @@ +using Auth0.ManagementApi.Core; +using global::System.Text.Json.Serialization; + +namespace Auth0.ManagementApi.Organizations; + +[Serializable] +public record ListOrganizationGroupsRequestParameters +{ + /// + /// Optional Id from which to start selection. + /// + [JsonIgnore] + public Optional From { get; set; } + + /// + /// Number of results per page. Defaults to 50. + /// + [JsonIgnore] + public Optional Take { get; set; } = 50; + + /// + public override string ToString() + { + return JsonUtils.Serialize(this); + } +} diff --git a/src/Auth0.ManagementApi/Organizations/Groups/Roles/IRolesClient.cs b/src/Auth0.ManagementApi/Organizations/Groups/Roles/IRolesClient.cs new file mode 100644 index 000000000..c9ff8d153 --- /dev/null +++ b/src/Auth0.ManagementApi/Organizations/Groups/Roles/IRolesClient.cs @@ -0,0 +1,40 @@ +using Auth0.ManagementApi; +using Auth0.ManagementApi.Core; + +namespace Auth0.ManagementApi.Organizations.Groups; + +public partial interface IRolesClient +{ + /// + /// Lists the roles assigned to the specified group in the context of an organization. + /// + Task> ListAsync( + string organizationId, + string groupId, + ListOrganizationGroupRolesRequestParameters request, + RequestOptions? options = null, + CancellationToken cancellationToken = default + ); + + /// + /// Assign one or more roles to a specified group in the context of an organization. + /// + Task CreateAsync( + string organizationId, + string groupId, + CreateOrganizationGroupRolesRequestContent request, + RequestOptions? options = null, + CancellationToken cancellationToken = default + ); + + /// + /// Unassign one or more roles from a specified group in the context of an organization. + /// + Task DeleteAsync( + string organizationId, + string groupId, + DeleteOrganizationGroupRolesRequestContent request, + RequestOptions? options = null, + CancellationToken cancellationToken = default + ); +} diff --git a/src/Auth0.ManagementApi/Organizations/Groups/Roles/Requests/CreateOrganizationGroupRolesRequestContent.cs b/src/Auth0.ManagementApi/Organizations/Groups/Roles/Requests/CreateOrganizationGroupRolesRequestContent.cs new file mode 100644 index 000000000..b294f90a5 --- /dev/null +++ b/src/Auth0.ManagementApi/Organizations/Groups/Roles/Requests/CreateOrganizationGroupRolesRequestContent.cs @@ -0,0 +1,20 @@ +using Auth0.ManagementApi.Core; +using global::System.Text.Json.Serialization; + +namespace Auth0.ManagementApi.Organizations.Groups; + +[Serializable] +public record CreateOrganizationGroupRolesRequestContent +{ + /// + /// Array of role IDs to assign to organization group. + /// + [JsonPropertyName("roles")] + public IEnumerable Roles { get; set; } = new List(); + + /// + public override string ToString() + { + return JsonUtils.Serialize(this); + } +} diff --git a/src/Auth0.ManagementApi/Organizations/Groups/Roles/Requests/DeleteOrganizationGroupRolesRequestContent.cs b/src/Auth0.ManagementApi/Organizations/Groups/Roles/Requests/DeleteOrganizationGroupRolesRequestContent.cs new file mode 100644 index 000000000..c4fee3ae2 --- /dev/null +++ b/src/Auth0.ManagementApi/Organizations/Groups/Roles/Requests/DeleteOrganizationGroupRolesRequestContent.cs @@ -0,0 +1,20 @@ +using Auth0.ManagementApi.Core; +using global::System.Text.Json.Serialization; + +namespace Auth0.ManagementApi.Organizations.Groups; + +[Serializable] +public record DeleteOrganizationGroupRolesRequestContent +{ + /// + /// Array of role IDs to delete from organization group. + /// + [JsonPropertyName("roles")] + public IEnumerable Roles { get; set; } = new List(); + + /// + public override string ToString() + { + return JsonUtils.Serialize(this); + } +} diff --git a/src/Auth0.ManagementApi/Organizations/Groups/Roles/Requests/ListOrganizationGroupRolesRequestParameters.cs b/src/Auth0.ManagementApi/Organizations/Groups/Roles/Requests/ListOrganizationGroupRolesRequestParameters.cs new file mode 100644 index 000000000..bc46520dd --- /dev/null +++ b/src/Auth0.ManagementApi/Organizations/Groups/Roles/Requests/ListOrganizationGroupRolesRequestParameters.cs @@ -0,0 +1,26 @@ +using Auth0.ManagementApi.Core; +using global::System.Text.Json.Serialization; + +namespace Auth0.ManagementApi.Organizations.Groups; + +[Serializable] +public record ListOrganizationGroupRolesRequestParameters +{ + /// + /// Optional Id from which to start selection. + /// + [JsonIgnore] + public Optional From { get; set; } + + /// + /// Number of results per page. Defaults to 50. + /// + [JsonIgnore] + public Optional Take { get; set; } = 50; + + /// + public override string ToString() + { + return JsonUtils.Serialize(this); + } +} diff --git a/src/Auth0.ManagementApi/Organizations/Groups/Roles/RolesClient.cs b/src/Auth0.ManagementApi/Organizations/Groups/Roles/RolesClient.cs new file mode 100644 index 000000000..23348c294 --- /dev/null +++ b/src/Auth0.ManagementApi/Organizations/Groups/Roles/RolesClient.cs @@ -0,0 +1,337 @@ +using Auth0.ManagementApi; +using Auth0.ManagementApi.Core; +using global::System.Text.Json; + +namespace Auth0.ManagementApi.Organizations.Groups; + +public partial class RolesClient : IRolesClient +{ + private readonly RawClient _client; + + internal RolesClient(RawClient client) + { + _client = client; + } + + /// + /// Lists the roles assigned to the specified group in the context of an organization. + /// + private WithRawResponseTask ListInternalAsync( + string organizationId, + string groupId, + ListOrganizationGroupRolesRequestParameters request, + RequestOptions? options = null, + CancellationToken cancellationToken = default + ) + { + return new WithRawResponseTask( + ListInternalAsyncCore(organizationId, groupId, request, options, cancellationToken) + ); + } + + private async Task< + WithRawResponse + > ListInternalAsyncCore( + string organizationId, + string groupId, + ListOrganizationGroupRolesRequestParameters request, + RequestOptions? options = null, + CancellationToken cancellationToken = default + ) + { + var _queryString = new Auth0.ManagementApi.Core.QueryStringBuilder.Builder(capacity: 2) + .Add("from", request.From.IsDefined ? request.From.Value : null) + .Add("take", request.Take.IsDefined ? request.Take.Value : null) + .MergeAdditional(options?.AdditionalQueryParameters) + .Build(); + var _headers = await new Auth0.ManagementApi.Core.HeadersBuilder.Builder() + .Add(_client.Options.Headers) + .Add(_client.Options.AdditionalHeaders) + .Add(options?.AdditionalHeaders) + .BuildAsync() + .ConfigureAwait(false); + var response = await _client + .SendRequestAsync( + new JsonRequest + { + Method = HttpMethod.Get, + Path = string.Format( + "organizations/{0}/groups/{1}/roles", + ValueConvert.ToPathParameterString(organizationId), + ValueConvert.ToPathParameterString(groupId) + ), + QueryString = _queryString, + Headers = _headers, + Options = options, + }, + cancellationToken + ) + .ConfigureAwait(false); + if (response.StatusCode is >= 200 and < 400) + { + var responseBody = await response + .Raw.Content.ReadAsStringAsync(cancellationToken) + .ConfigureAwait(false); + try + { + var responseData = JsonUtils.Deserialize( + responseBody + )!; + return new WithRawResponse() + { + Data = responseData, + RawResponse = new RawResponse() + { + StatusCode = response.Raw.StatusCode, + Url = response.Raw.RequestMessage?.RequestUri ?? new Uri("about:blank"), + Headers = ResponseHeaders.FromHttpResponseMessage(response.Raw), + }, + }; + } + catch (JsonException e) + { + throw new ManagementApiException( + "Failed to deserialize response", + response.StatusCode, + null, + e + ); + } + } + { + var responseBody = await response + .Raw.Content.ReadAsStringAsync(cancellationToken) + .ConfigureAwait(false); + try + { + switch (response.StatusCode) + { + case 400: + throw new BadRequestError(JsonUtils.Deserialize(responseBody)); + case 401: + throw new UnauthorizedError(JsonUtils.Deserialize(responseBody)); + case 403: + throw new ForbiddenError(JsonUtils.Deserialize(responseBody)); + case 429: + throw new TooManyRequestsError(JsonUtils.Deserialize(responseBody)); + } + } + catch (JsonException) + { + // unable to map error response, throwing generic error + } + throw new ManagementApiException( + $"Error with status code {response.StatusCode}", + response.StatusCode, + responseBody + ); + } + } + + /// + /// Lists the roles assigned to the specified group in the context of an organization. + /// + /// + /// await client.Organizations.Groups.Roles.ListAsync( + /// "organization_id", + /// "group_id", + /// new ListOrganizationGroupRolesRequestParameters { From = "from", Take = 1 } + /// ); + /// + public async Task> ListAsync( + string organizationId, + string groupId, + ListOrganizationGroupRolesRequestParameters request, + RequestOptions? options = null, + CancellationToken cancellationToken = default + ) + { + if (request is not null) + { + request = request with { }; + } + var pager = await CursorPager< + ListOrganizationGroupRolesRequestParameters, + RequestOptions?, + ListOrganizationGroupRolesResponseContent, + string?, + Role + > + .CreateInstanceAsync( + request, + options, + async (request, options, cancellationToken) => + await ListInternalAsync( + organizationId, + groupId, + request, + options, + cancellationToken + ) + .WithRawResponse(), + (request, cursor) => + { + request.From = cursor; + }, + response => response.Next, + response => response.Roles?.ToList(), + cancellationToken + ) + .ConfigureAwait(false); + return pager; + } + + /// + /// Assign one or more roles to a specified group in the context of an organization. + /// + /// + /// await client.Organizations.Groups.Roles.CreateAsync( + /// "organization_id", + /// "group_id", + /// new CreateOrganizationGroupRolesRequestContent { Roles = new List<string>() { "roles" } } + /// ); + /// + public async Task CreateAsync( + string organizationId, + string groupId, + CreateOrganizationGroupRolesRequestContent request, + RequestOptions? options = null, + CancellationToken cancellationToken = default + ) + { + var _headers = await new Auth0.ManagementApi.Core.HeadersBuilder.Builder() + .Add(_client.Options.Headers) + .Add(_client.Options.AdditionalHeaders) + .Add(options?.AdditionalHeaders) + .BuildAsync() + .ConfigureAwait(false); + var response = await _client + .SendRequestAsync( + new JsonRequest + { + Method = HttpMethod.Post, + Path = string.Format( + "organizations/{0}/groups/{1}/roles", + ValueConvert.ToPathParameterString(organizationId), + ValueConvert.ToPathParameterString(groupId) + ), + Body = request, + Headers = _headers, + ContentType = "application/json", + Options = options, + }, + cancellationToken + ) + .ConfigureAwait(false); + if (response.StatusCode is >= 200 and < 400) + { + return; + } + { + var responseBody = await response + .Raw.Content.ReadAsStringAsync(cancellationToken) + .ConfigureAwait(false); + try + { + switch (response.StatusCode) + { + case 400: + throw new BadRequestError(JsonUtils.Deserialize(responseBody)); + case 401: + throw new UnauthorizedError(JsonUtils.Deserialize(responseBody)); + case 403: + throw new ForbiddenError(JsonUtils.Deserialize(responseBody)); + case 409: + throw new ConflictError(JsonUtils.Deserialize(responseBody)); + case 429: + throw new TooManyRequestsError(JsonUtils.Deserialize(responseBody)); + } + } + catch (JsonException) + { + // unable to map error response, throwing generic error + } + throw new ManagementApiException( + $"Error with status code {response.StatusCode}", + response.StatusCode, + responseBody + ); + } + } + + /// + /// Unassign one or more roles from a specified group in the context of an organization. + /// + /// + /// await client.Organizations.Groups.Roles.DeleteAsync( + /// "organization_id", + /// "group_id", + /// new DeleteOrganizationGroupRolesRequestContent { Roles = new List<string>() { "roles" } } + /// ); + /// + public async Task DeleteAsync( + string organizationId, + string groupId, + DeleteOrganizationGroupRolesRequestContent request, + RequestOptions? options = null, + CancellationToken cancellationToken = default + ) + { + var _headers = await new Auth0.ManagementApi.Core.HeadersBuilder.Builder() + .Add(_client.Options.Headers) + .Add(_client.Options.AdditionalHeaders) + .Add(options?.AdditionalHeaders) + .BuildAsync() + .ConfigureAwait(false); + var response = await _client + .SendRequestAsync( + new JsonRequest + { + Method = HttpMethod.Delete, + Path = string.Format( + "organizations/{0}/groups/{1}/roles", + ValueConvert.ToPathParameterString(organizationId), + ValueConvert.ToPathParameterString(groupId) + ), + Body = request, + Headers = _headers, + ContentType = "application/json", + Options = options, + }, + cancellationToken + ) + .ConfigureAwait(false); + if (response.StatusCode is >= 200 and < 400) + { + return; + } + { + var responseBody = await response + .Raw.Content.ReadAsStringAsync(cancellationToken) + .ConfigureAwait(false); + try + { + switch (response.StatusCode) + { + case 400: + throw new BadRequestError(JsonUtils.Deserialize(responseBody)); + case 401: + throw new UnauthorizedError(JsonUtils.Deserialize(responseBody)); + case 403: + throw new ForbiddenError(JsonUtils.Deserialize(responseBody)); + case 429: + throw new TooManyRequestsError(JsonUtils.Deserialize(responseBody)); + } + } + catch (JsonException) + { + // unable to map error response, throwing generic error + } + throw new ManagementApiException( + $"Error with status code {response.StatusCode}", + response.StatusCode, + responseBody + ); + } + } +} diff --git a/src/Auth0.ManagementApi/Organizations/IOrganizationsClient.cs b/src/Auth0.ManagementApi/Organizations/IOrganizationsClient.cs index 10c50049a..459edcef0 100644 --- a/src/Auth0.ManagementApi/Organizations/IOrganizationsClient.cs +++ b/src/Auth0.ManagementApi/Organizations/IOrganizationsClient.cs @@ -11,27 +11,26 @@ public partial interface IOrganizationsClient public IEnabledConnectionsClient EnabledConnections { get; } public IInvitationsClient Invitations { get; } public Auth0.ManagementApi.Organizations.IMembersClient Members { get; } + public Auth0.ManagementApi.Organizations.IGroupsClient Groups { get; } /// /// Retrieve detailed list of all Organizations available in your tenant. For more information, see Auth0 Organizations. /// /// This endpoint supports two types of pagination: - /// - /// Offset pagination - /// Checkpoint pagination - /// + /// + /// - Offset pagination + /// - Checkpoint pagination /// /// Checkpoint pagination must be used if you need to retrieve more than 1000 organizations. /// - /// Checkpoint Pagination + /// **Checkpoint Pagination** /// /// To search by checkpoint, use the following parameters: - /// - /// from: Optional id from which to start selection. - /// take: The total number of entries to retrieve when using the from parameter. Defaults to 50. - /// /// - /// Note: The first time you call this endpoint using checkpoint pagination, omit the from parameter. If there are more results, a next value is included in the response. You can use this for subsequent API calls. When next is no longer included in the response, no pages are remaining. + /// - `from`: Optional id from which to start selection. + /// - `take`: The total number of entries to retrieve when using the `from` parameter. Defaults to 50. + /// + /// **Note**: The first time you call this endpoint using checkpoint pagination, omit the `from` parameter. If there are more results, a `next` value is included in the response. You can use this for subsequent API calls. When `next` is no longer included in the response, no pages are remaining. /// Task> ListAsync( ListOrganizationsRequestParameters request, @@ -40,7 +39,7 @@ Task> ListAsync( ); /// - /// Create a new Organization within your tenant. To learn more about Organization settings, behavior, and configuration options, review Create Your First Organization. + /// Create a new Organization within your tenant. To learn more about Organization settings, behavior, and configuration options, review [Create Your First Organization](https://auth0.com/docs/manage-users/organizations/create-first-organization). /// WithRawResponseTask CreateAsync( CreateOrganizationRequestContent request, @@ -69,7 +68,7 @@ WithRawResponseTask GetAsync( /// /// Remove an Organization from your tenant. This action cannot be undone. /// - /// Note: Members are automatically disassociated from an Organization when it is deleted. However, this action does not delete these users from your tenant. + /// **Note**: Members are automatically disassociated from an Organization when it is deleted. However, this action does **not** delete these users from your tenant. /// Task DeleteAsync( string id, @@ -78,7 +77,7 @@ Task DeleteAsync( ); /// - /// Update the details of a specific Organization, such as name and display name, branding options, and metadata. + /// Update the details of a specific [Organization](https://auth0.com/docs/manage-users/organizations/configure-organizations/create-organizations), such as name and display name, branding options, and metadata. /// WithRawResponseTask UpdateAsync( string id, diff --git a/src/Auth0.ManagementApi/Organizations/Invitations/IInvitationsClient.cs b/src/Auth0.ManagementApi/Organizations/Invitations/IInvitationsClient.cs index 7c6dceb5c..653b70739 100644 --- a/src/Auth0.ManagementApi/Organizations/Invitations/IInvitationsClient.cs +++ b/src/Auth0.ManagementApi/Organizations/Invitations/IInvitationsClient.cs @@ -6,7 +6,7 @@ namespace Auth0.ManagementApi.Organizations; public partial interface IInvitationsClient { /// - /// Retrieve a detailed list of invitations sent to users for a specific Organization. The list includes details such as inviter and invitee information, invitation URLs, and dates of creation and expiration. To learn more about Organization invitations, review Invite Organization Members. + /// Retrieve a detailed list of invitations sent to users for a specific Organization. The list includes details such as inviter and invitee information, invitation URLs, and dates of creation and expiration. To learn more about Organization invitations, review [Invite Organization Members](https://auth0.com/docs/manage-users/organizations/configure-organizations/invite-members). /// Task> ListAsync( string id, @@ -16,7 +16,7 @@ Task> ListAsync( ); /// - /// Create a user invitation for a specific Organization. Upon creation, the listed user receives an email inviting them to join the Organization. To learn more about Organization invitations, review Invite Organization Members. + /// Create a user invitation for a specific Organization. Upon creation, the listed user receives an email inviting them to join the Organization. To learn more about Organization invitations, review [Invite Organization Members](https://auth0.com/docs/manage-users/organizations/configure-organizations/invite-members). /// WithRawResponseTask CreateAsync( string id, diff --git a/src/Auth0.ManagementApi/Organizations/Invitations/InvitationsClient.cs b/src/Auth0.ManagementApi/Organizations/Invitations/InvitationsClient.cs index 06e74dadc..03bff51c1 100644 --- a/src/Auth0.ManagementApi/Organizations/Invitations/InvitationsClient.cs +++ b/src/Auth0.ManagementApi/Organizations/Invitations/InvitationsClient.cs @@ -14,7 +14,7 @@ internal InvitationsClient(RawClient client) } /// - /// Retrieve a detailed list of invitations sent to users for a specific Organization. The list includes details such as inviter and invitee information, invitation URLs, and dates of creation and expiration. To learn more about Organization invitations, review Invite Organization Members. + /// Retrieve a detailed list of invitations sent to users for a specific Organization. The list includes details such as inviter and invitee information, invitation URLs, and dates of creation and expiration. To learn more about Organization invitations, review [Invite Organization Members](https://auth0.com/docs/manage-users/organizations/configure-organizations/invite-members). /// private WithRawResponseTask ListInternalAsync( string id, @@ -337,7 +337,7 @@ private async Task> Ge } /// - /// Retrieve a detailed list of invitations sent to users for a specific Organization. The list includes details such as inviter and invitee information, invitation URLs, and dates of creation and expiration. To learn more about Organization invitations, review Invite Organization Members. + /// Retrieve a detailed list of invitations sent to users for a specific Organization. The list includes details such as inviter and invitee information, invitation URLs, and dates of creation and expiration. To learn more about Organization invitations, review [Invite Organization Members](https://auth0.com/docs/manage-users/organizations/configure-organizations/invite-members). /// /// /// await client.Organizations.Invitations.ListAsync( @@ -390,7 +390,7 @@ await ListInternalAsync(id, request, options, cancellationToken) } /// - /// Create a user invitation for a specific Organization. Upon creation, the listed user receives an email inviting them to join the Organization. To learn more about Organization invitations, review Invite Organization Members. + /// Create a user invitation for a specific Organization. Upon creation, the listed user receives an email inviting them to join the Organization. To learn more about Organization invitations, review [Invite Organization Members](https://auth0.com/docs/manage-users/organizations/configure-organizations/invite-members). /// /// /// await client.Organizations.Invitations.CreateAsync( diff --git a/src/Auth0.ManagementApi/Organizations/Members/EffectiveRoles/EffectiveRolesClient.cs b/src/Auth0.ManagementApi/Organizations/Members/EffectiveRoles/EffectiveRolesClient.cs new file mode 100644 index 000000000..3dff3af77 --- /dev/null +++ b/src/Auth0.ManagementApi/Organizations/Members/EffectiveRoles/EffectiveRolesClient.cs @@ -0,0 +1,184 @@ +using Auth0.ManagementApi; +using Auth0.ManagementApi.Core; +using global::System.Text.Json; + +namespace Auth0.ManagementApi.Organizations.Members; + +public partial class EffectiveRolesClient : IEffectiveRolesClient +{ + private readonly RawClient _client; + + internal EffectiveRolesClient(RawClient client) + { + _client = client; + Sources = + new Auth0.ManagementApi.Organizations.Members.EffectiveRoles.Sources.SourcesClient( + _client + ); + } + + public Auth0.ManagementApi.Organizations.Members.EffectiveRoles.Sources.ISourcesClient Sources { get; } + + /// + /// Lists the roles assigned to an organization member directly or through group membership. + /// + private WithRawResponseTask ListInternalAsync( + string id, + string userId, + ListOrganizationMemberEffectiveRolesRequestParameters request, + RequestOptions? options = null, + CancellationToken cancellationToken = default + ) + { + return new WithRawResponseTask( + ListInternalAsyncCore(id, userId, request, options, cancellationToken) + ); + } + + private async Task< + WithRawResponse + > ListInternalAsyncCore( + string id, + string userId, + ListOrganizationMemberEffectiveRolesRequestParameters request, + RequestOptions? options = null, + CancellationToken cancellationToken = default + ) + { + var _queryString = new Auth0.ManagementApi.Core.QueryStringBuilder.Builder(capacity: 2) + .Add("from", request.From.IsDefined ? request.From.Value : null) + .Add("take", request.Take.IsDefined ? request.Take.Value : null) + .MergeAdditional(options?.AdditionalQueryParameters) + .Build(); + var _headers = await new Auth0.ManagementApi.Core.HeadersBuilder.Builder() + .Add(_client.Options.Headers) + .Add(_client.Options.AdditionalHeaders) + .Add(options?.AdditionalHeaders) + .BuildAsync() + .ConfigureAwait(false); + var response = await _client + .SendRequestAsync( + new JsonRequest + { + Method = HttpMethod.Get, + Path = string.Format( + "organizations/{0}/members/{1}/effective-roles", + ValueConvert.ToPathParameterString(id), + ValueConvert.ToPathParameterString(userId) + ), + QueryString = _queryString, + Headers = _headers, + Options = options, + }, + cancellationToken + ) + .ConfigureAwait(false); + if (response.StatusCode is >= 200 and < 400) + { + var responseBody = await response + .Raw.Content.ReadAsStringAsync(cancellationToken) + .ConfigureAwait(false); + try + { + var responseData = + JsonUtils.Deserialize( + responseBody + )!; + return new WithRawResponse() + { + Data = responseData, + RawResponse = new RawResponse() + { + StatusCode = response.Raw.StatusCode, + Url = response.Raw.RequestMessage?.RequestUri ?? new Uri("about:blank"), + Headers = ResponseHeaders.FromHttpResponseMessage(response.Raw), + }, + }; + } + catch (JsonException e) + { + throw new ManagementApiException( + "Failed to deserialize response", + response.StatusCode, + null, + e + ); + } + } + { + var responseBody = await response + .Raw.Content.ReadAsStringAsync(cancellationToken) + .ConfigureAwait(false); + try + { + switch (response.StatusCode) + { + case 400: + throw new BadRequestError(JsonUtils.Deserialize(responseBody)); + case 401: + throw new UnauthorizedError(JsonUtils.Deserialize(responseBody)); + case 403: + throw new ForbiddenError(JsonUtils.Deserialize(responseBody)); + case 429: + throw new TooManyRequestsError(JsonUtils.Deserialize(responseBody)); + } + } + catch (JsonException) + { + // unable to map error response, throwing generic error + } + throw new ManagementApiException( + $"Error with status code {response.StatusCode}", + response.StatusCode, + responseBody + ); + } + } + + /// + /// Lists the roles assigned to an organization member directly or through group membership. + /// + /// + /// await client.Organizations.Members.EffectiveRoles.ListAsync( + /// "id", + /// "user_id", + /// new ListOrganizationMemberEffectiveRolesRequestParameters { From = "from", Take = 1 } + /// ); + /// + public async Task> ListAsync( + string id, + string userId, + ListOrganizationMemberEffectiveRolesRequestParameters request, + RequestOptions? options = null, + CancellationToken cancellationToken = default + ) + { + if (request is not null) + { + request = request with { }; + } + var pager = await CursorPager< + ListOrganizationMemberEffectiveRolesRequestParameters, + RequestOptions?, + ListOrganizationMemberEffectiveRolesResponseContent, + string?, + OrganizationMemberEffectiveRole + > + .CreateInstanceAsync( + request, + options, + async (request, options, cancellationToken) => + await ListInternalAsync(id, userId, request, options, cancellationToken) + .WithRawResponse(), + (request, cursor) => + { + request.From = cursor; + }, + response => response.Next, + response => response.Roles?.ToList(), + cancellationToken + ) + .ConfigureAwait(false); + return pager; + } +} diff --git a/src/Auth0.ManagementApi/Organizations/Members/EffectiveRoles/IEffectiveRolesClient.cs b/src/Auth0.ManagementApi/Organizations/Members/EffectiveRoles/IEffectiveRolesClient.cs new file mode 100644 index 000000000..020d3f842 --- /dev/null +++ b/src/Auth0.ManagementApi/Organizations/Members/EffectiveRoles/IEffectiveRolesClient.cs @@ -0,0 +1,20 @@ +using Auth0.ManagementApi; +using Auth0.ManagementApi.Core; + +namespace Auth0.ManagementApi.Organizations.Members; + +public partial interface IEffectiveRolesClient +{ + public Auth0.ManagementApi.Organizations.Members.EffectiveRoles.Sources.ISourcesClient Sources { get; } + + /// + /// Lists the roles assigned to an organization member directly or through group membership. + /// + Task> ListAsync( + string id, + string userId, + ListOrganizationMemberEffectiveRolesRequestParameters request, + RequestOptions? options = null, + CancellationToken cancellationToken = default + ); +} diff --git a/src/Auth0.ManagementApi/Organizations/Members/EffectiveRoles/Requests/ListOrganizationMemberEffectiveRolesRequestParameters.cs b/src/Auth0.ManagementApi/Organizations/Members/EffectiveRoles/Requests/ListOrganizationMemberEffectiveRolesRequestParameters.cs new file mode 100644 index 000000000..e6af5d1d7 --- /dev/null +++ b/src/Auth0.ManagementApi/Organizations/Members/EffectiveRoles/Requests/ListOrganizationMemberEffectiveRolesRequestParameters.cs @@ -0,0 +1,26 @@ +using Auth0.ManagementApi.Core; +using global::System.Text.Json.Serialization; + +namespace Auth0.ManagementApi.Organizations.Members; + +[Serializable] +public record ListOrganizationMemberEffectiveRolesRequestParameters +{ + /// + /// Optional Id from which to start selection. + /// + [JsonIgnore] + public Optional From { get; set; } + + /// + /// Number of results per page. Defaults to 50. + /// + [JsonIgnore] + public Optional Take { get; set; } = 50; + + /// + public override string ToString() + { + return JsonUtils.Serialize(this); + } +} diff --git a/src/Auth0.ManagementApi/Organizations/Members/EffectiveRoles/Sources/Groups/GroupsClient.cs b/src/Auth0.ManagementApi/Organizations/Members/EffectiveRoles/Sources/Groups/GroupsClient.cs new file mode 100644 index 000000000..697955113 --- /dev/null +++ b/src/Auth0.ManagementApi/Organizations/Members/EffectiveRoles/Sources/Groups/GroupsClient.cs @@ -0,0 +1,184 @@ +using Auth0.ManagementApi; +using Auth0.ManagementApi.Core; +using global::System.Text.Json; + +namespace Auth0.ManagementApi.Organizations.Members.EffectiveRoles.Sources; + +public partial class GroupsClient : IGroupsClient +{ + private readonly RawClient _client; + + internal GroupsClient(RawClient client) + { + _client = client; + } + + /// + /// Lists the groups which grant the org member a given role. + /// + private WithRawResponseTask ListInternalAsync( + string id, + string userId, + ListOrganizationMemberRoleSourceGroupsRequestParameters request, + RequestOptions? options = null, + CancellationToken cancellationToken = default + ) + { + return new WithRawResponseTask( + ListInternalAsyncCore(id, userId, request, options, cancellationToken) + ); + } + + private async Task< + WithRawResponse + > ListInternalAsyncCore( + string id, + string userId, + ListOrganizationMemberRoleSourceGroupsRequestParameters request, + RequestOptions? options = null, + CancellationToken cancellationToken = default + ) + { + var _queryString = new Auth0.ManagementApi.Core.QueryStringBuilder.Builder(capacity: 3) + .Add("from", request.From.IsDefined ? request.From.Value : null) + .Add("take", request.Take.IsDefined ? request.Take.Value : null) + .Add("role_id", request.RoleId) + .MergeAdditional(options?.AdditionalQueryParameters) + .Build(); + var _headers = await new Auth0.ManagementApi.Core.HeadersBuilder.Builder() + .Add(_client.Options.Headers) + .Add(_client.Options.AdditionalHeaders) + .Add(options?.AdditionalHeaders) + .BuildAsync() + .ConfigureAwait(false); + var response = await _client + .SendRequestAsync( + new JsonRequest + { + Method = HttpMethod.Get, + Path = string.Format( + "organizations/{0}/members/{1}/effective-roles/sources/groups", + ValueConvert.ToPathParameterString(id), + ValueConvert.ToPathParameterString(userId) + ), + QueryString = _queryString, + Headers = _headers, + Options = options, + }, + cancellationToken + ) + .ConfigureAwait(false); + if (response.StatusCode is >= 200 and < 400) + { + var responseBody = await response + .Raw.Content.ReadAsStringAsync(cancellationToken) + .ConfigureAwait(false); + try + { + var responseData = + JsonUtils.Deserialize( + responseBody + )!; + return new WithRawResponse() + { + Data = responseData, + RawResponse = new RawResponse() + { + StatusCode = response.Raw.StatusCode, + Url = response.Raw.RequestMessage?.RequestUri ?? new Uri("about:blank"), + Headers = ResponseHeaders.FromHttpResponseMessage(response.Raw), + }, + }; + } + catch (JsonException e) + { + throw new ManagementApiException( + "Failed to deserialize response", + response.StatusCode, + null, + e + ); + } + } + { + var responseBody = await response + .Raw.Content.ReadAsStringAsync(cancellationToken) + .ConfigureAwait(false); + try + { + switch (response.StatusCode) + { + case 400: + throw new BadRequestError(JsonUtils.Deserialize(responseBody)); + case 401: + throw new UnauthorizedError(JsonUtils.Deserialize(responseBody)); + case 403: + throw new ForbiddenError(JsonUtils.Deserialize(responseBody)); + case 429: + throw new TooManyRequestsError(JsonUtils.Deserialize(responseBody)); + } + } + catch (JsonException) + { + // unable to map error response, throwing generic error + } + throw new ManagementApiException( + $"Error with status code {response.StatusCode}", + response.StatusCode, + responseBody + ); + } + } + + /// + /// Lists the groups which grant the org member a given role. + /// + /// + /// await client.Organizations.Members.EffectiveRoles.Sources.Groups.ListAsync( + /// "id", + /// "user_id", + /// new ListOrganizationMemberRoleSourceGroupsRequestParameters + /// { + /// From = "from", + /// Take = 1, + /// RoleId = "role_id", + /// } + /// ); + /// + public async Task> ListAsync( + string id, + string userId, + ListOrganizationMemberRoleSourceGroupsRequestParameters request, + RequestOptions? options = null, + CancellationToken cancellationToken = default + ) + { + if (request is not null) + { + request = request with { }; + } + var pager = await CursorPager< + ListOrganizationMemberRoleSourceGroupsRequestParameters, + RequestOptions?, + ListOrganizationMemberRoleSourceGroupsResponseContent, + string?, + Group + > + .CreateInstanceAsync( + request, + options, + async (request, options, cancellationToken) => + await ListInternalAsync(id, userId, request, options, cancellationToken) + .WithRawResponse(), + (request, cursor) => + { + request.From = cursor; + }, + response => response.Next, + response => response.Groups?.ToList(), + cancellationToken + ) + .ConfigureAwait(false); + return pager; + } +} diff --git a/src/Auth0.ManagementApi/Organizations/Members/EffectiveRoles/Sources/Groups/IGroupsClient.cs b/src/Auth0.ManagementApi/Organizations/Members/EffectiveRoles/Sources/Groups/IGroupsClient.cs new file mode 100644 index 000000000..9dc743f9c --- /dev/null +++ b/src/Auth0.ManagementApi/Organizations/Members/EffectiveRoles/Sources/Groups/IGroupsClient.cs @@ -0,0 +1,18 @@ +using Auth0.ManagementApi; +using Auth0.ManagementApi.Core; + +namespace Auth0.ManagementApi.Organizations.Members.EffectiveRoles.Sources; + +public partial interface IGroupsClient +{ + /// + /// Lists the groups which grant the org member a given role. + /// + Task> ListAsync( + string id, + string userId, + ListOrganizationMemberRoleSourceGroupsRequestParameters request, + RequestOptions? options = null, + CancellationToken cancellationToken = default + ); +} diff --git a/src/Auth0.ManagementApi/Organizations/Members/EffectiveRoles/Sources/Groups/Requests/ListOrganizationMemberRoleSourceGroupsRequestParameters.cs b/src/Auth0.ManagementApi/Organizations/Members/EffectiveRoles/Sources/Groups/Requests/ListOrganizationMemberRoleSourceGroupsRequestParameters.cs new file mode 100644 index 000000000..24f8bd0a2 --- /dev/null +++ b/src/Auth0.ManagementApi/Organizations/Members/EffectiveRoles/Sources/Groups/Requests/ListOrganizationMemberRoleSourceGroupsRequestParameters.cs @@ -0,0 +1,32 @@ +using Auth0.ManagementApi.Core; +using global::System.Text.Json.Serialization; + +namespace Auth0.ManagementApi.Organizations.Members.EffectiveRoles.Sources; + +[Serializable] +public record ListOrganizationMemberRoleSourceGroupsRequestParameters +{ + /// + /// Optional Id from which to start selection. + /// + [JsonIgnore] + public Optional From { get; set; } + + /// + /// Number of results per page. Defaults to 50. + /// + [JsonIgnore] + public Optional Take { get; set; } = 50; + + /// + /// The role ID to get group sources for. + /// + [JsonIgnore] + public required string RoleId { get; set; } + + /// + public override string ToString() + { + return JsonUtils.Serialize(this); + } +} diff --git a/src/Auth0.ManagementApi/Organizations/Members/EffectiveRoles/Sources/ISourcesClient.cs b/src/Auth0.ManagementApi/Organizations/Members/EffectiveRoles/Sources/ISourcesClient.cs new file mode 100644 index 000000000..430ce8337 --- /dev/null +++ b/src/Auth0.ManagementApi/Organizations/Members/EffectiveRoles/Sources/ISourcesClient.cs @@ -0,0 +1,6 @@ +namespace Auth0.ManagementApi.Organizations.Members.EffectiveRoles.Sources; + +public partial interface ISourcesClient +{ + public IGroupsClient Groups { get; } +} diff --git a/src/Auth0.ManagementApi/Organizations/Members/EffectiveRoles/Sources/SourcesClient.cs b/src/Auth0.ManagementApi/Organizations/Members/EffectiveRoles/Sources/SourcesClient.cs new file mode 100644 index 000000000..60c09c98e --- /dev/null +++ b/src/Auth0.ManagementApi/Organizations/Members/EffectiveRoles/Sources/SourcesClient.cs @@ -0,0 +1,16 @@ +using Auth0.ManagementApi.Core; + +namespace Auth0.ManagementApi.Organizations.Members.EffectiveRoles.Sources; + +public partial class SourcesClient : ISourcesClient +{ + private readonly RawClient _client; + + internal SourcesClient(RawClient client) + { + _client = client; + Groups = new GroupsClient(_client); + } + + public IGroupsClient Groups { get; } +} diff --git a/src/Auth0.ManagementApi/Organizations/Members/IMembersClient.cs b/src/Auth0.ManagementApi/Organizations/Members/IMembersClient.cs index ca11f0215..21b97438b 100644 --- a/src/Auth0.ManagementApi/Organizations/Members/IMembersClient.cs +++ b/src/Auth0.ManagementApi/Organizations/Members/IMembersClient.cs @@ -5,20 +5,15 @@ namespace Auth0.ManagementApi.Organizations; public partial interface IMembersClient { + public Auth0.ManagementApi.Organizations.Members.IEffectiveRolesClient EffectiveRoles { get; } public Auth0.ManagementApi.Organizations.Members.IRolesClient Roles { get; } /// /// List organization members. /// This endpoint is subject to eventual consistency. New users may not be immediately included in the response and deleted users may not be immediately removed from it. /// - /// - /// - /// Use the fields parameter to optionally define the specific member details retrieved. If fields is left blank, all fields (except roles) are returned. - /// - /// - /// Member roles are not sent by default. Use fields=roles to retrieve the roles assigned to each listed member. To use this parameter, you must include the read:organization_member_roles scope in the token. - /// - /// + /// - Use the `fields` parameter to optionally define the specific member details retrieved. If `fields` is left blank, all fields (except roles) are returned. + /// - Member roles are not sent by default. Use `fields=roles` to retrieve the roles assigned to each listed member. To use this parameter, you must include the `read:organization_member_roles` scope in the token. /// /// This endpoint supports two types of pagination: /// @@ -27,9 +22,9 @@ public partial interface IMembersClient /// /// Checkpoint pagination must be used if you need to retrieve more than 1000 organization members. /// - /// Checkpoint Pagination + /// **Checkpoint Pagination** /// - /// To search by checkpoint, use the following parameters: - from: Optional id from which to start selection. - take: The total amount of entries to retrieve when using the from parameter. Defaults to 50. Note: The first time you call this endpoint using Checkpoint Pagination, you should omit the from parameter. If there are more results, a next value will be included in the response. You can use this for subsequent API calls. When next is no longer included in the response, this indicates there are no more pages remaining. + /// To search by checkpoint, use the following parameters: - from: Optional id from which to start selection. - take: The total amount of entries to retrieve when using the from parameter. Defaults to 50. Note: The first time you call this endpoint using Checkpoint Pagination, you should omit the `from` parameter. If there are more results, a `next` value will be included in the response. You can use this for subsequent API calls. When `next` is no longer included in the response, this indicates there are no more pages remaining. /// Task> ListAsync( string id, @@ -39,9 +34,9 @@ Task> ListAsync( ); /// - /// Set one or more existing users as members of a specific Organization. + /// Set one or more existing users as members of a specific [Organization](https://auth0.com/docs/manage-users/organizations). /// - /// To add a user to an Organization through this action, the user must already exist in your tenant. If a user does not yet exist, you can invite them to create an account, manually create them through the Auth0 Dashboard, or use the Management API. + /// To add a user to an Organization through this action, the user must already exist in your tenant. If a user does not yet exist, you can [invite them to create an account](https://auth0.com/docs/manage-users/organizations/configure-organizations/invite-members), manually create them through the Auth0 Dashboard, or use the Management API. /// Task CreateAsync( string id, diff --git a/src/Auth0.ManagementApi/Organizations/Members/MembersClient.cs b/src/Auth0.ManagementApi/Organizations/Members/MembersClient.cs index b459da142..dca69ea6b 100644 --- a/src/Auth0.ManagementApi/Organizations/Members/MembersClient.cs +++ b/src/Auth0.ManagementApi/Organizations/Members/MembersClient.cs @@ -11,23 +11,22 @@ public partial class MembersClient : IMembersClient internal MembersClient(RawClient client) { _client = client; + EffectiveRoles = new Auth0.ManagementApi.Organizations.Members.EffectiveRolesClient( + _client + ); Roles = new Auth0.ManagementApi.Organizations.Members.RolesClient(_client); } + public Auth0.ManagementApi.Organizations.Members.IEffectiveRolesClient EffectiveRoles { get; } + public Auth0.ManagementApi.Organizations.Members.IRolesClient Roles { get; } /// /// List organization members. /// This endpoint is subject to eventual consistency. New users may not be immediately included in the response and deleted users may not be immediately removed from it. /// - /// - /// - /// Use the fields parameter to optionally define the specific member details retrieved. If fields is left blank, all fields (except roles) are returned. - /// - /// - /// Member roles are not sent by default. Use fields=roles to retrieve the roles assigned to each listed member. To use this parameter, you must include the read:organization_member_roles scope in the token. - /// - /// + /// - Use the `fields` parameter to optionally define the specific member details retrieved. If `fields` is left blank, all fields (except roles) are returned. + /// - Member roles are not sent by default. Use `fields=roles` to retrieve the roles assigned to each listed member. To use this parameter, you must include the `read:organization_member_roles` scope in the token. /// /// This endpoint supports two types of pagination: /// @@ -36,9 +35,9 @@ internal MembersClient(RawClient client) /// /// Checkpoint pagination must be used if you need to retrieve more than 1000 organization members. /// - /// Checkpoint Pagination + /// **Checkpoint Pagination** /// - /// To search by checkpoint, use the following parameters: - from: Optional id from which to start selection. - take: The total amount of entries to retrieve when using the from parameter. Defaults to 50. Note: The first time you call this endpoint using Checkpoint Pagination, you should omit the from parameter. If there are more results, a next value will be included in the response. You can use this for subsequent API calls. When next is no longer included in the response, this indicates there are no more pages remaining. + /// To search by checkpoint, use the following parameters: - from: Optional id from which to start selection. - take: The total amount of entries to retrieve when using the from parameter. Defaults to 50. Note: The first time you call this endpoint using Checkpoint Pagination, you should omit the `from` parameter. If there are more results, a `next` value will be included in the response. You can use this for subsequent API calls. When `next` is no longer included in the response, this indicates there are no more pages remaining. /// private WithRawResponseTask ListInternalAsync( string id, @@ -159,14 +158,8 @@ private async Task< /// List organization members. /// This endpoint is subject to eventual consistency. New users may not be immediately included in the response and deleted users may not be immediately removed from it. /// - /// - /// - /// Use the fields parameter to optionally define the specific member details retrieved. If fields is left blank, all fields (except roles) are returned. - /// - /// - /// Member roles are not sent by default. Use fields=roles to retrieve the roles assigned to each listed member. To use this parameter, you must include the read:organization_member_roles scope in the token. - /// - /// + /// - Use the `fields` parameter to optionally define the specific member details retrieved. If `fields` is left blank, all fields (except roles) are returned. + /// - Member roles are not sent by default. Use `fields=roles` to retrieve the roles assigned to each listed member. To use this parameter, you must include the `read:organization_member_roles` scope in the token. /// /// This endpoint supports two types of pagination: /// @@ -175,9 +168,9 @@ private async Task< /// /// Checkpoint pagination must be used if you need to retrieve more than 1000 organization members. /// - /// Checkpoint Pagination + /// **Checkpoint Pagination** /// - /// To search by checkpoint, use the following parameters: - from: Optional id from which to start selection. - take: The total amount of entries to retrieve when using the from parameter. Defaults to 50. Note: The first time you call this endpoint using Checkpoint Pagination, you should omit the from parameter. If there are more results, a next value will be included in the response. You can use this for subsequent API calls. When next is no longer included in the response, this indicates there are no more pages remaining. + /// To search by checkpoint, use the following parameters: - from: Optional id from which to start selection. - take: The total amount of entries to retrieve when using the from parameter. Defaults to 50. Note: The first time you call this endpoint using Checkpoint Pagination, you should omit the `from` parameter. If there are more results, a `next` value will be included in the response. You can use this for subsequent API calls. When `next` is no longer included in the response, this indicates there are no more pages remaining. /// /// /// await client.Organizations.Members.ListAsync( @@ -228,9 +221,9 @@ await ListInternalAsync(id, request, options, cancellationToken) } /// - /// Set one or more existing users as members of a specific Organization. + /// Set one or more existing users as members of a specific [Organization](https://auth0.com/docs/manage-users/organizations). /// - /// To add a user to an Organization through this action, the user must already exist in your tenant. If a user does not yet exist, you can invite them to create an account, manually create them through the Auth0 Dashboard, or use the Management API. + /// To add a user to an Organization through this action, the user must already exist in your tenant. If a user does not yet exist, you can [invite them to create an account](https://auth0.com/docs/manage-users/organizations/configure-organizations/invite-members), manually create them through the Auth0 Dashboard, or use the Management API. /// /// /// await client.Organizations.Members.CreateAsync( diff --git a/src/Auth0.ManagementApi/Organizations/Members/Roles/IRolesClient.cs b/src/Auth0.ManagementApi/Organizations/Members/Roles/IRolesClient.cs index 5b2ace018..de515b06c 100644 --- a/src/Auth0.ManagementApi/Organizations/Members/Roles/IRolesClient.cs +++ b/src/Auth0.ManagementApi/Organizations/Members/Roles/IRolesClient.cs @@ -19,7 +19,7 @@ Task> ListAsync( ); /// - /// Assign one or more roles to a user to determine their access for a specific Organization. + /// Assign one or more [roles](https://auth0.com/docs/manage-users/access-control/rbac) to a user to determine their access for a specific Organization. /// /// Users can be members of multiple Organizations with unique roles assigned for each membership. This action assigns roles to a user only for the specified Organization. Roles cannot be assigned to a user across multiple Organizations in the same call. /// @@ -32,7 +32,7 @@ Task AssignAsync( ); /// - /// Remove one or more Organization-specific roles from a given user. + /// Remove one or more Organization-specific [roles](https://auth0.com/docs/manage-users/access-control/rbac) from a given user. /// /// Users can be members of multiple Organizations with unique roles assigned for each membership. This action removes roles from a user in relation to the specified Organization. Roles assigned to the user within a different Organization cannot be managed in the same call. /// diff --git a/src/Auth0.ManagementApi/Organizations/Members/Roles/RolesClient.cs b/src/Auth0.ManagementApi/Organizations/Members/Roles/RolesClient.cs index b83f2f553..f75d651cd 100644 --- a/src/Auth0.ManagementApi/Organizations/Members/Roles/RolesClient.cs +++ b/src/Auth0.ManagementApi/Organizations/Members/Roles/RolesClient.cs @@ -190,7 +190,7 @@ await ListInternalAsync(id, userId, request, options, cancellationToken) } /// - /// Assign one or more roles to a user to determine their access for a specific Organization. + /// Assign one or more [roles](https://auth0.com/docs/manage-users/access-control/rbac) to a user to determine their access for a specific Organization. /// /// Users can be members of multiple Organizations with unique roles assigned for each membership. This action assigns roles to a user only for the specified Organization. Roles cannot be assigned to a user across multiple Organizations in the same call. /// @@ -270,7 +270,7 @@ public async Task AssignAsync( } /// - /// Remove one or more Organization-specific roles from a given user. + /// Remove one or more Organization-specific [roles](https://auth0.com/docs/manage-users/access-control/rbac) from a given user. /// /// Users can be members of multiple Organizations with unique roles assigned for each membership. This action removes roles from a user in relation to the specified Organization. Roles assigned to the user within a different Organization cannot be managed in the same call. /// diff --git a/src/Auth0.ManagementApi/Organizations/OrganizationsClient.cs b/src/Auth0.ManagementApi/Organizations/OrganizationsClient.cs index 0f5eb6aaf..eda642d55 100644 --- a/src/Auth0.ManagementApi/Organizations/OrganizationsClient.cs +++ b/src/Auth0.ManagementApi/Organizations/OrganizationsClient.cs @@ -17,6 +17,7 @@ internal OrganizationsClient(RawClient client) EnabledConnections = new EnabledConnectionsClient(_client); Invitations = new InvitationsClient(_client); Members = new Auth0.ManagementApi.Organizations.MembersClient(_client); + Groups = new Auth0.ManagementApi.Organizations.GroupsClient(_client); } public Auth0.ManagementApi.Organizations.IClientGrantsClient ClientGrants { get; } @@ -31,26 +32,26 @@ internal OrganizationsClient(RawClient client) public Auth0.ManagementApi.Organizations.IMembersClient Members { get; } + public Auth0.ManagementApi.Organizations.IGroupsClient Groups { get; } + /// /// Retrieve detailed list of all Organizations available in your tenant. For more information, see Auth0 Organizations. /// /// This endpoint supports two types of pagination: - /// - /// Offset pagination - /// Checkpoint pagination - /// + /// + /// - Offset pagination + /// - Checkpoint pagination /// /// Checkpoint pagination must be used if you need to retrieve more than 1000 organizations. /// - /// Checkpoint Pagination + /// **Checkpoint Pagination** /// /// To search by checkpoint, use the following parameters: - /// - /// from: Optional id from which to start selection. - /// take: The total number of entries to retrieve when using the from parameter. Defaults to 50. - /// /// - /// Note: The first time you call this endpoint using checkpoint pagination, omit the from parameter. If there are more results, a next value is included in the response. You can use this for subsequent API calls. When next is no longer included in the response, no pages are remaining. + /// - `from`: Optional id from which to start selection. + /// - `take`: The total number of entries to retrieve when using the `from` parameter. Defaults to 50. + /// + /// **Note**: The first time you call this endpoint using checkpoint pagination, omit the `from` parameter. If there are more results, a `next` value is included in the response. You can use this for subsequent API calls. When `next` is no longer included in the response, no pages are remaining. /// private WithRawResponseTask ListInternalAsync( ListOrganizationsRequestParameters request, @@ -517,22 +518,20 @@ private async Task> UpdateAsy /// Retrieve detailed list of all Organizations available in your tenant. For more information, see Auth0 Organizations. /// /// This endpoint supports two types of pagination: - /// - /// Offset pagination - /// Checkpoint pagination - /// + /// + /// - Offset pagination + /// - Checkpoint pagination /// /// Checkpoint pagination must be used if you need to retrieve more than 1000 organizations. /// - /// Checkpoint Pagination + /// **Checkpoint Pagination** /// /// To search by checkpoint, use the following parameters: - /// - /// from: Optional id from which to start selection. - /// take: The total number of entries to retrieve when using the from parameter. Defaults to 50. - /// /// - /// Note: The first time you call this endpoint using checkpoint pagination, omit the from parameter. If there are more results, a next value is included in the response. You can use this for subsequent API calls. When next is no longer included in the response, no pages are remaining. + /// - `from`: Optional id from which to start selection. + /// - `take`: The total number of entries to retrieve when using the `from` parameter. Defaults to 50. + /// + /// **Note**: The first time you call this endpoint using checkpoint pagination, omit the `from` parameter. If there are more results, a `next` value is included in the response. You can use this for subsequent API calls. When `next` is no longer included in the response, no pages are remaining. /// /// /// await client.Organizations.ListAsync( @@ -579,7 +578,7 @@ await ListInternalAsync(request, options, cancellationToken).WithRawResponse(), } /// - /// Create a new Organization within your tenant. To learn more about Organization settings, behavior, and configuration options, review Create Your First Organization. + /// Create a new Organization within your tenant. To learn more about Organization settings, behavior, and configuration options, review [Create Your First Organization](https://auth0.com/docs/manage-users/organizations/create-first-organization). /// /// /// await client.Organizations.CreateAsync(new CreateOrganizationRequestContent { Name = "name" }); @@ -632,7 +631,7 @@ public WithRawResponseTask GetAsync( /// /// Remove an Organization from your tenant. This action cannot be undone. /// - /// Note: Members are automatically disassociated from an Organization when it is deleted. However, this action does not delete these users from your tenant. + /// **Note**: Members are automatically disassociated from an Organization when it is deleted. However, this action does **not** delete these users from your tenant. /// /// /// await client.Organizations.DeleteAsync("id"); @@ -701,7 +700,7 @@ public async Task DeleteAsync( } /// - /// Update the details of a specific Organization, such as name and display name, branding options, and metadata. + /// Update the details of a specific [Organization](https://auth0.com/docs/manage-users/organizations/configure-organizations/create-organizations), such as name and display name, branding options, and metadata. /// /// /// await client.Organizations.UpdateAsync("id", new UpdateOrganizationRequestContent()); diff --git a/src/Auth0.ManagementApi/Roles/Groups/GroupsClient.cs b/src/Auth0.ManagementApi/Roles/Groups/GroupsClient.cs new file mode 100644 index 000000000..001279432 --- /dev/null +++ b/src/Auth0.ManagementApi/Roles/Groups/GroupsClient.cs @@ -0,0 +1,315 @@ +using Auth0.ManagementApi; +using Auth0.ManagementApi.Core; +using global::System.Text.Json; + +namespace Auth0.ManagementApi.Roles; + +public partial class GroupsClient : IGroupsClient +{ + private readonly RawClient _client; + + internal GroupsClient(RawClient client) + { + _client = client; + } + + /// + /// Lists the groups to which the specified role is assigned. + /// + private WithRawResponseTask GetInternalAsync( + string id, + ListRoleGroupsParameters request, + RequestOptions? options = null, + CancellationToken cancellationToken = default + ) + { + return new WithRawResponseTask( + GetInternalAsyncCore(id, request, options, cancellationToken) + ); + } + + private async Task> GetInternalAsyncCore( + string id, + ListRoleGroupsParameters request, + RequestOptions? options = null, + CancellationToken cancellationToken = default + ) + { + var _queryString = new Auth0.ManagementApi.Core.QueryStringBuilder.Builder(capacity: 2) + .Add("from", request.From.IsDefined ? request.From.Value : null) + .Add("take", request.Take.IsDefined ? request.Take.Value : null) + .MergeAdditional(options?.AdditionalQueryParameters) + .Build(); + var _headers = await new Auth0.ManagementApi.Core.HeadersBuilder.Builder() + .Add(_client.Options.Headers) + .Add(_client.Options.AdditionalHeaders) + .Add(options?.AdditionalHeaders) + .BuildAsync() + .ConfigureAwait(false); + var response = await _client + .SendRequestAsync( + new JsonRequest + { + Method = HttpMethod.Get, + Path = string.Format( + "roles/{0}/groups", + ValueConvert.ToPathParameterString(id) + ), + QueryString = _queryString, + Headers = _headers, + Options = options, + }, + cancellationToken + ) + .ConfigureAwait(false); + if (response.StatusCode is >= 200 and < 400) + { + var responseBody = await response + .Raw.Content.ReadAsStringAsync(cancellationToken) + .ConfigureAwait(false); + try + { + var responseData = JsonUtils.Deserialize( + responseBody + )!; + return new WithRawResponse() + { + Data = responseData, + RawResponse = new RawResponse() + { + StatusCode = response.Raw.StatusCode, + Url = response.Raw.RequestMessage?.RequestUri ?? new Uri("about:blank"), + Headers = ResponseHeaders.FromHttpResponseMessage(response.Raw), + }, + }; + } + catch (JsonException e) + { + throw new ManagementApiException( + "Failed to deserialize response", + response.StatusCode, + null, + e + ); + } + } + { + var responseBody = await response + .Raw.Content.ReadAsStringAsync(cancellationToken) + .ConfigureAwait(false); + try + { + switch (response.StatusCode) + { + case 400: + throw new BadRequestError(JsonUtils.Deserialize(responseBody)); + case 401: + throw new UnauthorizedError(JsonUtils.Deserialize(responseBody)); + case 403: + throw new ForbiddenError(JsonUtils.Deserialize(responseBody)); + case 429: + throw new TooManyRequestsError(JsonUtils.Deserialize(responseBody)); + } + } + catch (JsonException) + { + // unable to map error response, throwing generic error + } + throw new ManagementApiException( + $"Error with status code {response.StatusCode}", + response.StatusCode, + responseBody + ); + } + } + + /// + /// Lists the groups to which the specified role is assigned. + /// + /// + /// await client.Roles.Groups.GetAsync("id", new ListRoleGroupsParameters { From = "from", Take = 1 }); + /// + public async Task> GetAsync( + string id, + ListRoleGroupsParameters request, + RequestOptions? options = null, + CancellationToken cancellationToken = default + ) + { + if (request is not null) + { + request = request with { }; + } + var pager = await CursorPager< + ListRoleGroupsParameters, + RequestOptions?, + ListRoleGroupsResponseContent, + string?, + Group + > + .CreateInstanceAsync( + request, + options, + async (request, options, cancellationToken) => + await GetInternalAsync(id, request, options, cancellationToken) + .WithRawResponse(), + (request, cursor) => + { + request.From = cursor; + }, + response => response.Next, + response => response.Groups?.ToList(), + cancellationToken + ) + .ConfigureAwait(false); + return pager; + } + + /// + /// Assign one or more groups to a specified role. + /// + /// + /// await client.Roles.Groups.CreateAsync( + /// "id", + /// new AssignRoleGroupsRequestContent { Groups = new List<string>() { "groups" } } + /// ); + /// + public async Task CreateAsync( + string id, + AssignRoleGroupsRequestContent request, + RequestOptions? options = null, + CancellationToken cancellationToken = default + ) + { + var _headers = await new Auth0.ManagementApi.Core.HeadersBuilder.Builder() + .Add(_client.Options.Headers) + .Add(_client.Options.AdditionalHeaders) + .Add(options?.AdditionalHeaders) + .BuildAsync() + .ConfigureAwait(false); + var response = await _client + .SendRequestAsync( + new JsonRequest + { + Method = HttpMethod.Post, + Path = string.Format( + "roles/{0}/groups", + ValueConvert.ToPathParameterString(id) + ), + Body = request, + Headers = _headers, + ContentType = "application/json", + Options = options, + }, + cancellationToken + ) + .ConfigureAwait(false); + if (response.StatusCode is >= 200 and < 400) + { + return; + } + { + var responseBody = await response + .Raw.Content.ReadAsStringAsync(cancellationToken) + .ConfigureAwait(false); + try + { + switch (response.StatusCode) + { + case 400: + throw new BadRequestError(JsonUtils.Deserialize(responseBody)); + case 401: + throw new UnauthorizedError(JsonUtils.Deserialize(responseBody)); + case 403: + throw new ForbiddenError(JsonUtils.Deserialize(responseBody)); + case 404: + throw new NotFoundError(JsonUtils.Deserialize(responseBody)); + case 429: + throw new TooManyRequestsError(JsonUtils.Deserialize(responseBody)); + } + } + catch (JsonException) + { + // unable to map error response, throwing generic error + } + throw new ManagementApiException( + $"Error with status code {response.StatusCode}", + response.StatusCode, + responseBody + ); + } + } + + /// + /// Unassign one or more groups from a specified role. + /// + /// + /// await client.Roles.Groups.DeleteAsync( + /// "id", + /// new DeleteRoleGroupsRequestContent { Groups = new List<string>() { "groups" } } + /// ); + /// + public async Task DeleteAsync( + string id, + DeleteRoleGroupsRequestContent request, + RequestOptions? options = null, + CancellationToken cancellationToken = default + ) + { + var _headers = await new Auth0.ManagementApi.Core.HeadersBuilder.Builder() + .Add(_client.Options.Headers) + .Add(_client.Options.AdditionalHeaders) + .Add(options?.AdditionalHeaders) + .BuildAsync() + .ConfigureAwait(false); + var response = await _client + .SendRequestAsync( + new JsonRequest + { + Method = HttpMethod.Delete, + Path = string.Format( + "roles/{0}/groups", + ValueConvert.ToPathParameterString(id) + ), + Body = request, + Headers = _headers, + ContentType = "application/json", + Options = options, + }, + cancellationToken + ) + .ConfigureAwait(false); + if (response.StatusCode is >= 200 and < 400) + { + return; + } + { + var responseBody = await response + .Raw.Content.ReadAsStringAsync(cancellationToken) + .ConfigureAwait(false); + try + { + switch (response.StatusCode) + { + case 400: + throw new BadRequestError(JsonUtils.Deserialize(responseBody)); + case 401: + throw new UnauthorizedError(JsonUtils.Deserialize(responseBody)); + case 403: + throw new ForbiddenError(JsonUtils.Deserialize(responseBody)); + case 429: + throw new TooManyRequestsError(JsonUtils.Deserialize(responseBody)); + } + } + catch (JsonException) + { + // unable to map error response, throwing generic error + } + throw new ManagementApiException( + $"Error with status code {response.StatusCode}", + response.StatusCode, + responseBody + ); + } + } +} diff --git a/src/Auth0.ManagementApi/Roles/Groups/IGroupsClient.cs b/src/Auth0.ManagementApi/Roles/Groups/IGroupsClient.cs new file mode 100644 index 000000000..282cd7af9 --- /dev/null +++ b/src/Auth0.ManagementApi/Roles/Groups/IGroupsClient.cs @@ -0,0 +1,37 @@ +using Auth0.ManagementApi; +using Auth0.ManagementApi.Core; + +namespace Auth0.ManagementApi.Roles; + +public partial interface IGroupsClient +{ + /// + /// Lists the groups to which the specified role is assigned. + /// + Task> GetAsync( + string id, + ListRoleGroupsParameters request, + RequestOptions? options = null, + CancellationToken cancellationToken = default + ); + + /// + /// Assign one or more groups to a specified role. + /// + Task CreateAsync( + string id, + AssignRoleGroupsRequestContent request, + RequestOptions? options = null, + CancellationToken cancellationToken = default + ); + + /// + /// Unassign one or more groups from a specified role. + /// + Task DeleteAsync( + string id, + DeleteRoleGroupsRequestContent request, + RequestOptions? options = null, + CancellationToken cancellationToken = default + ); +} diff --git a/src/Auth0.ManagementApi/Roles/Groups/Requests/AssignRoleGroupsRequestContent.cs b/src/Auth0.ManagementApi/Roles/Groups/Requests/AssignRoleGroupsRequestContent.cs new file mode 100644 index 000000000..7ae9f78f5 --- /dev/null +++ b/src/Auth0.ManagementApi/Roles/Groups/Requests/AssignRoleGroupsRequestContent.cs @@ -0,0 +1,20 @@ +using Auth0.ManagementApi.Core; +using global::System.Text.Json.Serialization; + +namespace Auth0.ManagementApi.Roles; + +[Serializable] +public record AssignRoleGroupsRequestContent +{ + /// + /// Array of group IDs to assign to the role. + /// + [JsonPropertyName("groups")] + public IEnumerable Groups { get; set; } = new List(); + + /// + public override string ToString() + { + return JsonUtils.Serialize(this); + } +} diff --git a/src/Auth0.ManagementApi/Roles/Groups/Requests/DeleteRoleGroupsRequestContent.cs b/src/Auth0.ManagementApi/Roles/Groups/Requests/DeleteRoleGroupsRequestContent.cs new file mode 100644 index 000000000..e8a4393e5 --- /dev/null +++ b/src/Auth0.ManagementApi/Roles/Groups/Requests/DeleteRoleGroupsRequestContent.cs @@ -0,0 +1,20 @@ +using Auth0.ManagementApi.Core; +using global::System.Text.Json.Serialization; + +namespace Auth0.ManagementApi.Roles; + +[Serializable] +public record DeleteRoleGroupsRequestContent +{ + /// + /// Array of group IDs to remove from the role. + /// + [JsonPropertyName("groups")] + public IEnumerable Groups { get; set; } = new List(); + + /// + public override string ToString() + { + return JsonUtils.Serialize(this); + } +} diff --git a/src/Auth0.ManagementApi/Roles/Groups/Requests/ListRoleGroupsParameters.cs b/src/Auth0.ManagementApi/Roles/Groups/Requests/ListRoleGroupsParameters.cs new file mode 100644 index 000000000..68b66721c --- /dev/null +++ b/src/Auth0.ManagementApi/Roles/Groups/Requests/ListRoleGroupsParameters.cs @@ -0,0 +1,26 @@ +using Auth0.ManagementApi.Core; +using global::System.Text.Json.Serialization; + +namespace Auth0.ManagementApi.Roles; + +[Serializable] +public record ListRoleGroupsParameters +{ + /// + /// Optional Id from which to start selection. + /// + [JsonIgnore] + public Optional From { get; set; } + + /// + /// Number of results per page. Defaults to 50. + /// + [JsonIgnore] + public Optional Take { get; set; } = 50; + + /// + public override string ToString() + { + return JsonUtils.Serialize(this); + } +} diff --git a/src/Auth0.ManagementApi/Roles/IRolesClient.cs b/src/Auth0.ManagementApi/Roles/IRolesClient.cs index 483485ee6..205929def 100644 --- a/src/Auth0.ManagementApi/Roles/IRolesClient.cs +++ b/src/Auth0.ManagementApi/Roles/IRolesClient.cs @@ -4,6 +4,7 @@ namespace Auth0.ManagementApi; public partial interface IRolesClient { + public Auth0.ManagementApi.Roles.IGroupsClient Groups { get; } public Auth0.ManagementApi.Roles.IPermissionsClient Permissions { get; } public Auth0.ManagementApi.Roles.IUsersClient Users { get; } diff --git a/src/Auth0.ManagementApi/Roles/RolesClient.cs b/src/Auth0.ManagementApi/Roles/RolesClient.cs index 9ff55eab7..d0d305abc 100644 --- a/src/Auth0.ManagementApi/Roles/RolesClient.cs +++ b/src/Auth0.ManagementApi/Roles/RolesClient.cs @@ -10,10 +10,13 @@ public partial class RolesClient : IRolesClient internal RolesClient(RawClient client) { _client = client; + Groups = new Auth0.ManagementApi.Roles.GroupsClient(_client); Permissions = new Auth0.ManagementApi.Roles.PermissionsClient(_client); Users = new Auth0.ManagementApi.Roles.UsersClient(_client); } + public Auth0.ManagementApi.Roles.IGroupsClient Groups { get; } + public Auth0.ManagementApi.Roles.IPermissionsClient Permissions { get; } public Auth0.ManagementApi.Roles.IUsersClient Users { get; } diff --git a/src/Auth0.ManagementApi/Tenants/Settings/Requests/UpdateTenantSettingsRequestContent.cs b/src/Auth0.ManagementApi/Tenants/Settings/Requests/UpdateTenantSettingsRequestContent.cs index 12b063c74..f3f8b297b 100644 --- a/src/Auth0.ManagementApi/Tenants/Settings/Requests/UpdateTenantSettingsRequestContent.cs +++ b/src/Auth0.ManagementApi/Tenants/Settings/Requests/UpdateTenantSettingsRequestContent.cs @@ -228,6 +228,10 @@ public record UpdateTenantSettingsRequestContent [JsonPropertyName("dynamic_client_registration_security_mode")] public TenantSettingsDynamicClientRegistrationSecurityMode? DynamicClientRegistrationSecurityMode { get; set; } + [Nullable, Optional] + [JsonPropertyName("country_codes")] + public Optional CountryCodes { get; set; } + /// public override string ToString() { diff --git a/src/Auth0.ManagementApi/TokenExchangeProfiles/ITokenExchangeProfilesClient.cs b/src/Auth0.ManagementApi/TokenExchangeProfiles/ITokenExchangeProfilesClient.cs index aa0ad5d80..9ace913fb 100644 --- a/src/Auth0.ManagementApi/TokenExchangeProfiles/ITokenExchangeProfilesClient.cs +++ b/src/Auth0.ManagementApi/TokenExchangeProfiles/ITokenExchangeProfilesClient.cs @@ -7,15 +7,14 @@ public partial interface ITokenExchangeProfilesClient /// /// Retrieve a list of all Token Exchange Profiles available in your tenant. /// - /// By using this feature, you agree to the applicable Free Trial terms in Okta’s Master Subscription Agreement. It is your responsibility to securely validate the user’s subject_token. See User Guide for more details. + /// By using this feature, you agree to the applicable Free Trial terms in [Okta’s Master Subscription Agreement](https://www.okta.com/legal/). It is your responsibility to securely validate the user’s subject_token. See [User Guide](https://auth0.com/docs/authenticate/custom-token-exchange) for more details. /// /// This endpoint supports Checkpoint pagination. To search by checkpoint, use the following parameters: - /// - /// from: Optional id from which to start selection. - /// take: The total amount of entries to retrieve when using the from parameter. Defaults to 50. - /// /// - /// Note: The first time you call this endpoint using checkpoint pagination, omit the from parameter. If there are more results, a next value is included in the response. You can use this for subsequent API calls. When next is no longer included in the response, no pages are remaining. + /// - `from`: Optional id from which to start selection. + /// - `take`: The total amount of entries to retrieve when using the from parameter. Defaults to 50. + /// + /// **Note**: The first time you call this endpoint using checkpoint pagination, omit the `from` parameter. If there are more results, a `next` value is included in the response. You can use this for subsequent API calls. When `next` is no longer included in the response, no pages are remaining. /// Task> ListAsync( TokenExchangeProfilesListRequest request, @@ -26,7 +25,7 @@ Task> ListAsync( /// /// Create a new Token Exchange Profile within your tenant. /// - /// By using this feature, you agree to the applicable Free Trial terms in Okta’s Master Subscription Agreement. It is your responsibility to securely validate the user’s subject_token. See User Guide for more details. + /// By using this feature, you agree to the applicable Free Trial terms in [Okta’s Master Subscription Agreement](https://www.okta.com/legal/). It is your responsibility to securely validate the user’s subject_token. See [User Guide](https://auth0.com/docs/authenticate/custom-token-exchange) for more details. /// WithRawResponseTask CreateAsync( CreateTokenExchangeProfileRequestContent request, @@ -37,7 +36,7 @@ WithRawResponseTask CreateAsync( /// /// Retrieve details about a single Token Exchange Profile specified by ID. /// - /// By using this feature, you agree to the applicable Free Trial terms in Okta’s Master Subscription Agreement. It is your responsibility to securely validate the user’s subject_token. See User Guide for more details. + /// By using this feature, you agree to the applicable Free Trial terms in [Okta’s Master Subscription Agreement](https://www.okta.com/legal/). It is your responsibility to securely validate the user’s subject_token. See [User Guide](https://auth0.com/docs/authenticate/custom-token-exchange) for more details. /// WithRawResponseTask GetAsync( string id, @@ -48,7 +47,7 @@ WithRawResponseTask GetAsync( /// /// Delete a Token Exchange Profile within your tenant. /// - /// By using this feature, you agree to the applicable Free Trial terms in Okta's Master Subscription Agreement. It is your responsibility to securely validate the user's subject_token. See User Guide for more details. + /// By using this feature, you agree to the applicable Free Trial terms in [Okta's Master Subscription Agreement](https://www.okta.com/legal/). It is your responsibility to securely validate the user's subject_token. See [User Guide](https://auth0.com/docs/authenticate/custom-token-exchange) for more details. /// Task DeleteAsync( string id, @@ -59,7 +58,7 @@ Task DeleteAsync( /// /// Update a Token Exchange Profile within your tenant. /// - /// By using this feature, you agree to the applicable Free Trial terms in Okta's Master Subscription Agreement. It is your responsibility to securely validate the user's subject_token. See User Guide for more details. + /// By using this feature, you agree to the applicable Free Trial terms in [Okta's Master Subscription Agreement](https://www.okta.com/legal/). It is your responsibility to securely validate the user's subject_token. See [User Guide](https://auth0.com/docs/authenticate/custom-token-exchange) for more details. /// Task UpdateAsync( string id, diff --git a/src/Auth0.ManagementApi/TokenExchangeProfiles/TokenExchangeProfilesClient.cs b/src/Auth0.ManagementApi/TokenExchangeProfiles/TokenExchangeProfilesClient.cs index 9753e87fa..b8580b1e4 100644 --- a/src/Auth0.ManagementApi/TokenExchangeProfiles/TokenExchangeProfilesClient.cs +++ b/src/Auth0.ManagementApi/TokenExchangeProfiles/TokenExchangeProfilesClient.cs @@ -15,15 +15,14 @@ internal TokenExchangeProfilesClient(RawClient client) /// /// Retrieve a list of all Token Exchange Profiles available in your tenant. /// - /// By using this feature, you agree to the applicable Free Trial terms in Okta’s Master Subscription Agreement. It is your responsibility to securely validate the user’s subject_token. See User Guide for more details. + /// By using this feature, you agree to the applicable Free Trial terms in [Okta’s Master Subscription Agreement](https://www.okta.com/legal/). It is your responsibility to securely validate the user’s subject_token. See [User Guide](https://auth0.com/docs/authenticate/custom-token-exchange) for more details. /// /// This endpoint supports Checkpoint pagination. To search by checkpoint, use the following parameters: - /// - /// from: Optional id from which to start selection. - /// take: The total amount of entries to retrieve when using the from parameter. Defaults to 50. - /// /// - /// Note: The first time you call this endpoint using checkpoint pagination, omit the from parameter. If there are more results, a next value is included in the response. You can use this for subsequent API calls. When next is no longer included in the response, no pages are remaining. + /// - `from`: Optional id from which to start selection. + /// - `take`: The total amount of entries to retrieve when using the from parameter. Defaults to 50. + /// + /// **Note**: The first time you call this endpoint using checkpoint pagination, omit the `from` parameter. If there are more results, a `next` value is included in the response. You can use this for subsequent API calls. When `next` is no longer included in the response, no pages are remaining. /// private WithRawResponseTask ListInternalAsync( TokenExchangeProfilesListRequest request, @@ -311,15 +310,14 @@ private async Task> GetA /// /// Retrieve a list of all Token Exchange Profiles available in your tenant. /// - /// By using this feature, you agree to the applicable Free Trial terms in Okta’s Master Subscription Agreement. It is your responsibility to securely validate the user’s subject_token. See User Guide for more details. + /// By using this feature, you agree to the applicable Free Trial terms in [Okta’s Master Subscription Agreement](https://www.okta.com/legal/). It is your responsibility to securely validate the user’s subject_token. See [User Guide](https://auth0.com/docs/authenticate/custom-token-exchange) for more details. /// /// This endpoint supports Checkpoint pagination. To search by checkpoint, use the following parameters: - /// - /// from: Optional id from which to start selection. - /// take: The total amount of entries to retrieve when using the from parameter. Defaults to 50. - /// /// - /// Note: The first time you call this endpoint using checkpoint pagination, omit the from parameter. If there are more results, a next value is included in the response. You can use this for subsequent API calls. When next is no longer included in the response, no pages are remaining. + /// - `from`: Optional id from which to start selection. + /// - `take`: The total amount of entries to retrieve when using the from parameter. Defaults to 50. + /// + /// **Note**: The first time you call this endpoint using checkpoint pagination, omit the `from` parameter. If there are more results, a `next` value is included in the response. You can use this for subsequent API calls. When `next` is no longer included in the response, no pages are remaining. /// /// /// await client.TokenExchangeProfiles.ListAsync( @@ -363,7 +361,7 @@ await ListInternalAsync(request, options, cancellationToken).WithRawResponse(), /// /// Create a new Token Exchange Profile within your tenant. /// - /// By using this feature, you agree to the applicable Free Trial terms in Okta’s Master Subscription Agreement. It is your responsibility to securely validate the user’s subject_token. See User Guide for more details. + /// By using this feature, you agree to the applicable Free Trial terms in [Okta’s Master Subscription Agreement](https://www.okta.com/legal/). It is your responsibility to securely validate the user’s subject_token. See [User Guide](https://auth0.com/docs/authenticate/custom-token-exchange) for more details. /// /// /// await client.TokenExchangeProfiles.CreateAsync( @@ -390,7 +388,7 @@ public WithRawResponseTask CreateAsyn /// /// Retrieve details about a single Token Exchange Profile specified by ID. /// - /// By using this feature, you agree to the applicable Free Trial terms in Okta’s Master Subscription Agreement. It is your responsibility to securely validate the user’s subject_token. See User Guide for more details. + /// By using this feature, you agree to the applicable Free Trial terms in [Okta’s Master Subscription Agreement](https://www.okta.com/legal/). It is your responsibility to securely validate the user’s subject_token. See [User Guide](https://auth0.com/docs/authenticate/custom-token-exchange) for more details. /// /// /// await client.TokenExchangeProfiles.GetAsync("id"); @@ -409,7 +407,7 @@ public WithRawResponseTask GetAsync( /// /// Delete a Token Exchange Profile within your tenant. /// - /// By using this feature, you agree to the applicable Free Trial terms in Okta's Master Subscription Agreement. It is your responsibility to securely validate the user's subject_token. See User Guide for more details. + /// By using this feature, you agree to the applicable Free Trial terms in [Okta's Master Subscription Agreement](https://www.okta.com/legal/). It is your responsibility to securely validate the user's subject_token. See [User Guide](https://auth0.com/docs/authenticate/custom-token-exchange) for more details. /// /// /// await client.TokenExchangeProfiles.DeleteAsync("id"); @@ -476,7 +474,7 @@ public async Task DeleteAsync( /// /// Update a Token Exchange Profile within your tenant. /// - /// By using this feature, you agree to the applicable Free Trial terms in Okta's Master Subscription Agreement. It is your responsibility to securely validate the user's subject_token. See User Guide for more details. + /// By using this feature, you agree to the applicable Free Trial terms in [Okta's Master Subscription Agreement](https://www.okta.com/legal/). It is your responsibility to securely validate the user's subject_token. See [User Guide](https://auth0.com/docs/authenticate/custom-token-exchange) for more details. /// /// /// await client.TokenExchangeProfiles.UpdateAsync( diff --git a/src/Auth0.ManagementApi/Types/GetTenantSettingsResponseContent.cs b/src/Auth0.ManagementApi/Types/GetTenantSettingsResponseContent.cs index d3392dc32..d9e862dfc 100644 --- a/src/Auth0.ManagementApi/Types/GetTenantSettingsResponseContent.cs +++ b/src/Auth0.ManagementApi/Types/GetTenantSettingsResponseContent.cs @@ -236,6 +236,10 @@ public record GetTenantSettingsResponseContent : IJsonOnDeserialized [JsonPropertyName("dynamic_client_registration_security_mode")] public TenantSettingsDynamicClientRegistrationSecurityMode? DynamicClientRegistrationSecurityMode { get; set; } + [Optional] + [JsonPropertyName("country_codes")] + public TenantSettingsCountryCodesResponse? CountryCodes { get; set; } + [JsonIgnore] public ReadOnlyAdditionalProperties AdditionalProperties { get; private set; } = new(); diff --git a/src/Auth0.ManagementApi/Types/ListOrganizationGroupRolesResponseContent.cs b/src/Auth0.ManagementApi/Types/ListOrganizationGroupRolesResponseContent.cs new file mode 100644 index 000000000..0ebc4ba5a --- /dev/null +++ b/src/Auth0.ManagementApi/Types/ListOrganizationGroupRolesResponseContent.cs @@ -0,0 +1,35 @@ +using Auth0.ManagementApi.Core; +using global::System.Text.Json; +using global::System.Text.Json.Serialization; + +namespace Auth0.ManagementApi; + +[Serializable] +public record ListOrganizationGroupRolesResponseContent : IJsonOnDeserialized +{ + [JsonExtensionData] + private readonly IDictionary _extensionData = + new Dictionary(); + + [JsonPropertyName("roles")] + public IEnumerable Roles { get; set; } = new List(); + + /// + /// A cursor to be used as the "from" query parameter for the next page of results. + /// + [Optional] + [JsonPropertyName("next")] + public string? Next { get; set; } + + [JsonIgnore] + public ReadOnlyAdditionalProperties AdditionalProperties { get; private set; } = new(); + + void IJsonOnDeserialized.OnDeserialized() => + AdditionalProperties.CopyFromExtensionData(_extensionData); + + /// + public override string ToString() + { + return JsonUtils.Serialize(this); + } +} diff --git a/src/Auth0.ManagementApi/Types/ListOrganizationGroupsResponseContent.cs b/src/Auth0.ManagementApi/Types/ListOrganizationGroupsResponseContent.cs new file mode 100644 index 000000000..6643b284a --- /dev/null +++ b/src/Auth0.ManagementApi/Types/ListOrganizationGroupsResponseContent.cs @@ -0,0 +1,35 @@ +using Auth0.ManagementApi.Core; +using global::System.Text.Json; +using global::System.Text.Json.Serialization; + +namespace Auth0.ManagementApi; + +[Serializable] +public record ListOrganizationGroupsResponseContent : IJsonOnDeserialized +{ + [JsonExtensionData] + private readonly IDictionary _extensionData = + new Dictionary(); + + [JsonPropertyName("groups")] + public IEnumerable Groups { get; set; } = new List(); + + /// + /// A cursor to be used as the "from" query parameter for the next page of results. + /// + [Optional] + [JsonPropertyName("next")] + public string? Next { get; set; } + + [JsonIgnore] + public ReadOnlyAdditionalProperties AdditionalProperties { get; private set; } = new(); + + void IJsonOnDeserialized.OnDeserialized() => + AdditionalProperties.CopyFromExtensionData(_extensionData); + + /// + public override string ToString() + { + return JsonUtils.Serialize(this); + } +} diff --git a/src/Auth0.ManagementApi/Types/ListOrganizationMemberEffectiveRolesResponseContent.cs b/src/Auth0.ManagementApi/Types/ListOrganizationMemberEffectiveRolesResponseContent.cs new file mode 100644 index 000000000..c908caf5b --- /dev/null +++ b/src/Auth0.ManagementApi/Types/ListOrganizationMemberEffectiveRolesResponseContent.cs @@ -0,0 +1,36 @@ +using Auth0.ManagementApi.Core; +using global::System.Text.Json; +using global::System.Text.Json.Serialization; + +namespace Auth0.ManagementApi; + +[Serializable] +public record ListOrganizationMemberEffectiveRolesResponseContent : IJsonOnDeserialized +{ + [JsonExtensionData] + private readonly IDictionary _extensionData = + new Dictionary(); + + [JsonPropertyName("roles")] + public IEnumerable Roles { get; set; } = + new List(); + + /// + /// Cursor for the next page of results + /// + [Optional] + [JsonPropertyName("next")] + public string? Next { get; set; } + + [JsonIgnore] + public ReadOnlyAdditionalProperties AdditionalProperties { get; private set; } = new(); + + void IJsonOnDeserialized.OnDeserialized() => + AdditionalProperties.CopyFromExtensionData(_extensionData); + + /// + public override string ToString() + { + return JsonUtils.Serialize(this); + } +} diff --git a/src/Auth0.ManagementApi/Types/ListOrganizationMemberRoleSourceGroupsResponseContent.cs b/src/Auth0.ManagementApi/Types/ListOrganizationMemberRoleSourceGroupsResponseContent.cs new file mode 100644 index 000000000..dda045176 --- /dev/null +++ b/src/Auth0.ManagementApi/Types/ListOrganizationMemberRoleSourceGroupsResponseContent.cs @@ -0,0 +1,35 @@ +using Auth0.ManagementApi.Core; +using global::System.Text.Json; +using global::System.Text.Json.Serialization; + +namespace Auth0.ManagementApi; + +[Serializable] +public record ListOrganizationMemberRoleSourceGroupsResponseContent : IJsonOnDeserialized +{ + [JsonExtensionData] + private readonly IDictionary _extensionData = + new Dictionary(); + + [JsonPropertyName("groups")] + public IEnumerable Groups { get; set; } = new List(); + + /// + /// A cursor to be used as the "from" query parameter for the next page of results. + /// + [Optional] + [JsonPropertyName("next")] + public string? Next { get; set; } + + [JsonIgnore] + public ReadOnlyAdditionalProperties AdditionalProperties { get; private set; } = new(); + + void IJsonOnDeserialized.OnDeserialized() => + AdditionalProperties.CopyFromExtensionData(_extensionData); + + /// + public override string ToString() + { + return JsonUtils.Serialize(this); + } +} diff --git a/src/Auth0.ManagementApi/Types/ListRoleGroupsResponseContent.cs b/src/Auth0.ManagementApi/Types/ListRoleGroupsResponseContent.cs new file mode 100644 index 000000000..db9959466 --- /dev/null +++ b/src/Auth0.ManagementApi/Types/ListRoleGroupsResponseContent.cs @@ -0,0 +1,35 @@ +using Auth0.ManagementApi.Core; +using global::System.Text.Json; +using global::System.Text.Json.Serialization; + +namespace Auth0.ManagementApi; + +[Serializable] +public record ListRoleGroupsResponseContent : IJsonOnDeserialized +{ + [JsonExtensionData] + private readonly IDictionary _extensionData = + new Dictionary(); + + [JsonPropertyName("groups")] + public IEnumerable Groups { get; set; } = new List(); + + /// + /// A cursor to be used as the "from" query parameter for the next page of results. + /// + [Optional] + [JsonPropertyName("next")] + public string? Next { get; set; } + + [JsonIgnore] + public ReadOnlyAdditionalProperties AdditionalProperties { get; private set; } = new(); + + void IJsonOnDeserialized.OnDeserialized() => + AdditionalProperties.CopyFromExtensionData(_extensionData); + + /// + public override string ToString() + { + return JsonUtils.Serialize(this); + } +} diff --git a/src/Auth0.ManagementApi/Types/ListUserEffectivePermissionRoleSourcesResponseContent.cs b/src/Auth0.ManagementApi/Types/ListUserEffectivePermissionRoleSourcesResponseContent.cs new file mode 100644 index 000000000..3fc5edd19 --- /dev/null +++ b/src/Auth0.ManagementApi/Types/ListUserEffectivePermissionRoleSourcesResponseContent.cs @@ -0,0 +1,39 @@ +using Auth0.ManagementApi.Core; +using global::System.Text.Json; +using global::System.Text.Json.Serialization; + +namespace Auth0.ManagementApi; + +[Serializable] +public record ListUserEffectivePermissionRoleSourcesResponseContent : IJsonOnDeserialized +{ + [JsonExtensionData] + private readonly IDictionary _extensionData = + new Dictionary(); + + /// + /// Roles with the specified permission assigned to the user, both directly and via groups. + /// + [JsonPropertyName("roles")] + public IEnumerable Roles { get; set; } = + new List(); + + /// + /// A cursor to be used as the "from" query parameter for the next page of results. + /// + [Optional] + [JsonPropertyName("next")] + public string? Next { get; set; } + + [JsonIgnore] + public ReadOnlyAdditionalProperties AdditionalProperties { get; private set; } = new(); + + void IJsonOnDeserialized.OnDeserialized() => + AdditionalProperties.CopyFromExtensionData(_extensionData); + + /// + public override string ToString() + { + return JsonUtils.Serialize(this); + } +} diff --git a/src/Auth0.ManagementApi/Types/ListUserEffectivePermissionsResponseContent.cs b/src/Auth0.ManagementApi/Types/ListUserEffectivePermissionsResponseContent.cs new file mode 100644 index 000000000..eb238d7cf --- /dev/null +++ b/src/Auth0.ManagementApi/Types/ListUserEffectivePermissionsResponseContent.cs @@ -0,0 +1,39 @@ +using Auth0.ManagementApi.Core; +using global::System.Text.Json; +using global::System.Text.Json.Serialization; + +namespace Auth0.ManagementApi; + +[Serializable] +public record ListUserEffectivePermissionsResponseContent : IJsonOnDeserialized +{ + [JsonExtensionData] + private readonly IDictionary _extensionData = + new Dictionary(); + + /// + /// List of permissions assigned to the user. + /// + [JsonPropertyName("permissions")] + public IEnumerable Permissions { get; set; } = + new List(); + + /// + /// A cursor to be used as the "from" query parameter for the next page of results. + /// + [Optional] + [JsonPropertyName("next")] + public string? Next { get; set; } + + [JsonIgnore] + public ReadOnlyAdditionalProperties AdditionalProperties { get; private set; } = new(); + + void IJsonOnDeserialized.OnDeserialized() => + AdditionalProperties.CopyFromExtensionData(_extensionData); + + /// + public override string ToString() + { + return JsonUtils.Serialize(this); + } +} diff --git a/src/Auth0.ManagementApi/Types/ListUserEffectiveRolesResponseContent.cs b/src/Auth0.ManagementApi/Types/ListUserEffectiveRolesResponseContent.cs new file mode 100644 index 000000000..0aab72fe0 --- /dev/null +++ b/src/Auth0.ManagementApi/Types/ListUserEffectiveRolesResponseContent.cs @@ -0,0 +1,35 @@ +using Auth0.ManagementApi.Core; +using global::System.Text.Json; +using global::System.Text.Json.Serialization; + +namespace Auth0.ManagementApi; + +[Serializable] +public record ListUserEffectiveRolesResponseContent : IJsonOnDeserialized +{ + [JsonExtensionData] + private readonly IDictionary _extensionData = + new Dictionary(); + + [JsonPropertyName("roles")] + public IEnumerable Roles { get; set; } = new List(); + + /// + /// Cursor for the next page of results + /// + [Optional] + [JsonPropertyName("next")] + public string? Next { get; set; } + + [JsonIgnore] + public ReadOnlyAdditionalProperties AdditionalProperties { get; private set; } = new(); + + void IJsonOnDeserialized.OnDeserialized() => + AdditionalProperties.CopyFromExtensionData(_extensionData); + + /// + public override string ToString() + { + return JsonUtils.Serialize(this); + } +} diff --git a/src/Auth0.ManagementApi/Types/ListUserRoleSourceGroupsResponseContent.cs b/src/Auth0.ManagementApi/Types/ListUserRoleSourceGroupsResponseContent.cs new file mode 100644 index 000000000..c80a2a682 --- /dev/null +++ b/src/Auth0.ManagementApi/Types/ListUserRoleSourceGroupsResponseContent.cs @@ -0,0 +1,35 @@ +using Auth0.ManagementApi.Core; +using global::System.Text.Json; +using global::System.Text.Json.Serialization; + +namespace Auth0.ManagementApi; + +[Serializable] +public record ListUserRoleSourceGroupsResponseContent : IJsonOnDeserialized +{ + [JsonExtensionData] + private readonly IDictionary _extensionData = + new Dictionary(); + + [JsonPropertyName("groups")] + public IEnumerable Groups { get; set; } = new List(); + + /// + /// A cursor to be used as the "from" query parameter for the next page of results. + /// + [Optional] + [JsonPropertyName("next")] + public string? Next { get; set; } + + [JsonIgnore] + public ReadOnlyAdditionalProperties AdditionalProperties { get; private set; } = new(); + + void IJsonOnDeserialized.OnDeserialized() => + AdditionalProperties.CopyFromExtensionData(_extensionData); + + /// + public override string ToString() + { + return JsonUtils.Serialize(this); + } +} diff --git a/src/Auth0.ManagementApi/Types/OauthScope.cs b/src/Auth0.ManagementApi/Types/OauthScope.cs index a88a3ecc6..15d954be3 100644 --- a/src/Auth0.ManagementApi/Types/OauthScope.cs +++ b/src/Auth0.ManagementApi/Types/OauthScope.cs @@ -758,6 +758,32 @@ namespace Auth0.ManagementApi; Values.DeleteOrganizationDiscoveryDomains ); + /// + /// Create Organization Group Roles + /// + public static readonly OauthScope CreateOrganizationGroupRoles = new( + Values.CreateOrganizationGroupRoles + ); + + /// + /// Read Organization Group Roles + /// + public static readonly OauthScope ReadOrganizationGroupRoles = new( + Values.ReadOrganizationGroupRoles + ); + + /// + /// Delete Organization Group Roles + /// + public static readonly OauthScope DeleteOrganizationGroupRoles = new( + Values.DeleteOrganizationGroupRoles + ); + + /// + /// Read Organization Groups + /// + public static readonly OauthScope ReadOrganizationGroups = new(Values.ReadOrganizationGroups); + /// /// Create Organization Invitations /// @@ -779,6 +805,20 @@ namespace Auth0.ManagementApi; Values.DeleteOrganizationInvitations ); + /// + /// Read Organization Member Effective Roles + /// + public static readonly OauthScope ReadOrganizationMemberEffectiveRoles = new( + Values.ReadOrganizationMemberEffectiveRoles + ); + + /// + /// Read Organization Member Role Source Groups + /// + public static readonly OauthScope ReadOrganizationMemberRoleSourceGroups = new( + Values.ReadOrganizationMemberRoleSourceGroups + ); + /// /// Create Organization Member Roles /// @@ -1207,11 +1247,37 @@ namespace Auth0.ManagementApi; Values.DeleteUserAttributeProfiles ); + /// + /// Read User Effective Permissions + /// + public static readonly OauthScope ReadUserEffectivePermissions = new( + Values.ReadUserEffectivePermissions + ); + + /// + /// Read User Effective Roles + /// + public static readonly OauthScope ReadUserEffectiveRoles = new(Values.ReadUserEffectiveRoles); + /// /// Read User Idp Tokens /// public static readonly OauthScope ReadUserIdpTokens = new(Values.ReadUserIdpTokens); + /// + /// Read User Permission Source Roles + /// + public static readonly OauthScope ReadUserPermissionSourceRoles = new( + Values.ReadUserPermissionSourceRoles + ); + + /// + /// Read User Role Source Groups + /// + public static readonly OauthScope ReadUserRoleSourceGroups = new( + Values.ReadUserRoleSourceGroups + ); + /// /// Create User Tickets /// @@ -2045,6 +2111,26 @@ public static class Values public const string DeleteOrganizationDiscoveryDomains = "delete:organization_discovery_domains"; + /// + /// Create Organization Group Roles + /// + public const string CreateOrganizationGroupRoles = "create:organization_group_roles"; + + /// + /// Read Organization Group Roles + /// + public const string ReadOrganizationGroupRoles = "read:organization_group_roles"; + + /// + /// Delete Organization Group Roles + /// + public const string DeleteOrganizationGroupRoles = "delete:organization_group_roles"; + + /// + /// Read Organization Groups + /// + public const string ReadOrganizationGroups = "read:organization_groups"; + /// /// Create Organization Invitations /// @@ -2060,6 +2146,18 @@ public static class Values /// public const string DeleteOrganizationInvitations = "delete:organization_invitations"; + /// + /// Read Organization Member Effective Roles + /// + public const string ReadOrganizationMemberEffectiveRoles = + "read:organization_member_effective_roles"; + + /// + /// Read Organization Member Role Source Groups + /// + public const string ReadOrganizationMemberRoleSourceGroups = + "read:organization_member_role_source_groups"; + /// /// Create Organization Member Roles /// @@ -2452,11 +2550,31 @@ public static class Values /// public const string DeleteUserAttributeProfiles = "delete:user_attribute_profiles"; + /// + /// Read User Effective Permissions + /// + public const string ReadUserEffectivePermissions = "read:user_effective_permissions"; + + /// + /// Read User Effective Roles + /// + public const string ReadUserEffectiveRoles = "read:user_effective_roles"; + /// /// Read User Idp Tokens /// public const string ReadUserIdpTokens = "read:user_idp_tokens"; + /// + /// Read User Permission Source Roles + /// + public const string ReadUserPermissionSourceRoles = "read:user_permission_source_roles"; + + /// + /// Read User Role Source Groups + /// + public const string ReadUserRoleSourceGroups = "read:user_role_source_groups"; + /// /// Create User Tickets /// diff --git a/src/Auth0.ManagementApi/Types/OrganizationMemberEffectiveRole.cs b/src/Auth0.ManagementApi/Types/OrganizationMemberEffectiveRole.cs new file mode 100644 index 000000000..d13479c55 --- /dev/null +++ b/src/Auth0.ManagementApi/Types/OrganizationMemberEffectiveRole.cs @@ -0,0 +1,50 @@ +using Auth0.ManagementApi.Core; +using global::System.Text.Json; +using global::System.Text.Json.Serialization; + +namespace Auth0.ManagementApi; + +[Serializable] +public record OrganizationMemberEffectiveRole : IJsonOnDeserialized +{ + [JsonExtensionData] + private readonly IDictionary _extensionData = + new Dictionary(); + + /// + /// Role ID + /// + [JsonPropertyName("id")] + public required string Id { get; set; } + + /// + /// Role name + /// + [JsonPropertyName("name")] + public required string Name { get; set; } + + /// + /// Role description + /// + [JsonPropertyName("description")] + public required string Description { get; set; } + + /// + /// Sources of the role assignment (direct or through group membership) + /// + [JsonPropertyName("sources")] + public IEnumerable Sources { get; set; } = + new List(); + + [JsonIgnore] + public ReadOnlyAdditionalProperties AdditionalProperties { get; private set; } = new(); + + void IJsonOnDeserialized.OnDeserialized() => + AdditionalProperties.CopyFromExtensionData(_extensionData); + + /// + public override string ToString() + { + return JsonUtils.Serialize(this); + } +} diff --git a/src/Auth0.ManagementApi/Types/OrganizationMemberEffectiveRoleSource.cs b/src/Auth0.ManagementApi/Types/OrganizationMemberEffectiveRoleSource.cs new file mode 100644 index 000000000..af8dbd8cd --- /dev/null +++ b/src/Auth0.ManagementApi/Types/OrganizationMemberEffectiveRoleSource.cs @@ -0,0 +1,120 @@ +using Auth0.ManagementApi.Core; +using global::System.Text.Json; +using global::System.Text.Json.Serialization; + +namespace Auth0.ManagementApi; + +[JsonConverter( + typeof(OrganizationMemberEffectiveRoleSource.OrganizationMemberEffectiveRoleSourceSerializer) +)] +[Serializable] +public readonly record struct OrganizationMemberEffectiveRoleSource : IStringEnum +{ + public static readonly OrganizationMemberEffectiveRoleSource Direct = new(Values.Direct); + + public static readonly OrganizationMemberEffectiveRoleSource Groups = new(Values.Groups); + + public OrganizationMemberEffectiveRoleSource(string value) + { + Value = value; + } + + /// + /// The string value of the enum. + /// + public string Value { get; } + + /// + /// Create a string enum with the given value. + /// + public static OrganizationMemberEffectiveRoleSource FromCustom(string value) + { + return new OrganizationMemberEffectiveRoleSource(value); + } + + public bool Equals(string? other) + { + return Value.Equals(other); + } + + /// + /// Returns the string value of the enum. + /// + public override string ToString() + { + return Value; + } + + public static bool operator ==(OrganizationMemberEffectiveRoleSource value1, string value2) => + value1.Value.Equals(value2); + + public static bool operator !=(OrganizationMemberEffectiveRoleSource value1, string value2) => + !value1.Value.Equals(value2); + + public static explicit operator string(OrganizationMemberEffectiveRoleSource value) => + value.Value; + + public static explicit operator OrganizationMemberEffectiveRoleSource(string value) => + new(value); + + internal class OrganizationMemberEffectiveRoleSourceSerializer + : JsonConverter + { + public override OrganizationMemberEffectiveRoleSource Read( + ref Utf8JsonReader reader, + Type typeToConvert, + JsonSerializerOptions options + ) + { + var stringValue = + reader.GetString() + ?? throw new global::System.Exception( + "The JSON value could not be read as a string." + ); + return new OrganizationMemberEffectiveRoleSource(stringValue); + } + + public override void Write( + Utf8JsonWriter writer, + OrganizationMemberEffectiveRoleSource value, + JsonSerializerOptions options + ) + { + writer.WriteStringValue(value.Value); + } + + public override OrganizationMemberEffectiveRoleSource ReadAsPropertyName( + ref Utf8JsonReader reader, + Type typeToConvert, + JsonSerializerOptions options + ) + { + var stringValue = + reader.GetString() + ?? throw new global::System.Exception( + "The JSON property name could not be read as a string." + ); + return new OrganizationMemberEffectiveRoleSource(stringValue); + } + + public override void WriteAsPropertyName( + Utf8JsonWriter writer, + OrganizationMemberEffectiveRoleSource value, + JsonSerializerOptions options + ) + { + writer.WritePropertyName(value.Value); + } + } + + /// + /// Constant strings for enum values + /// + [Serializable] + public static class Values + { + public const string Direct = "direct"; + + public const string Groups = "groups"; + } +} diff --git a/src/Auth0.ManagementApi/Types/TenantSettingsCountryCodes.cs b/src/Auth0.ManagementApi/Types/TenantSettingsCountryCodes.cs new file mode 100644 index 000000000..4f0e9f3e1 --- /dev/null +++ b/src/Auth0.ManagementApi/Types/TenantSettingsCountryCodes.cs @@ -0,0 +1,39 @@ +using Auth0.ManagementApi.Core; +using global::System.Text.Json; +using global::System.Text.Json.Serialization; + +namespace Auth0.ManagementApi; + +/// +/// Phone country code configuration for identifier input. +/// +[Serializable] +public record TenantSettingsCountryCodes : IJsonOnDeserialized +{ + [JsonExtensionData] + private readonly IDictionary _extensionData = + new Dictionary(); + + /// + /// Array of ISO 3166-1 alpha-2 country codes. + /// + [Optional] + [JsonPropertyName("list")] + public IEnumerable? List { get; set; } + + [Optional] + [JsonPropertyName("mode")] + public TenantSettingsCountryCodesMode? Mode { get; set; } + + [JsonIgnore] + public ReadOnlyAdditionalProperties AdditionalProperties { get; private set; } = new(); + + void IJsonOnDeserialized.OnDeserialized() => + AdditionalProperties.CopyFromExtensionData(_extensionData); + + /// + public override string ToString() + { + return JsonUtils.Serialize(this); + } +} diff --git a/src/Auth0.ManagementApi/Types/TenantSettingsCountryCodesMode.cs b/src/Auth0.ManagementApi/Types/TenantSettingsCountryCodesMode.cs new file mode 100644 index 000000000..99b82d8d6 --- /dev/null +++ b/src/Auth0.ManagementApi/Types/TenantSettingsCountryCodesMode.cs @@ -0,0 +1,116 @@ +using Auth0.ManagementApi.Core; +using global::System.Text.Json; +using global::System.Text.Json.Serialization; + +namespace Auth0.ManagementApi; + +[JsonConverter(typeof(TenantSettingsCountryCodesMode.TenantSettingsCountryCodesModeSerializer))] +[Serializable] +public readonly record struct TenantSettingsCountryCodesMode : IStringEnum +{ + public static readonly TenantSettingsCountryCodesMode Allow = new(Values.Allow); + + public static readonly TenantSettingsCountryCodesMode Deny = new(Values.Deny); + + public TenantSettingsCountryCodesMode(string value) + { + Value = value; + } + + /// + /// The string value of the enum. + /// + public string Value { get; } + + /// + /// Create a string enum with the given value. + /// + public static TenantSettingsCountryCodesMode FromCustom(string value) + { + return new TenantSettingsCountryCodesMode(value); + } + + public bool Equals(string? other) + { + return Value.Equals(other); + } + + /// + /// Returns the string value of the enum. + /// + public override string ToString() + { + return Value; + } + + public static bool operator ==(TenantSettingsCountryCodesMode value1, string value2) => + value1.Value.Equals(value2); + + public static bool operator !=(TenantSettingsCountryCodesMode value1, string value2) => + !value1.Value.Equals(value2); + + public static explicit operator string(TenantSettingsCountryCodesMode value) => value.Value; + + public static explicit operator TenantSettingsCountryCodesMode(string value) => new(value); + + internal class TenantSettingsCountryCodesModeSerializer + : JsonConverter + { + public override TenantSettingsCountryCodesMode Read( + ref Utf8JsonReader reader, + Type typeToConvert, + JsonSerializerOptions options + ) + { + var stringValue = + reader.GetString() + ?? throw new global::System.Exception( + "The JSON value could not be read as a string." + ); + return new TenantSettingsCountryCodesMode(stringValue); + } + + public override void Write( + Utf8JsonWriter writer, + TenantSettingsCountryCodesMode value, + JsonSerializerOptions options + ) + { + writer.WriteStringValue(value.Value); + } + + public override TenantSettingsCountryCodesMode ReadAsPropertyName( + ref Utf8JsonReader reader, + Type typeToConvert, + JsonSerializerOptions options + ) + { + var stringValue = + reader.GetString() + ?? throw new global::System.Exception( + "The JSON property name could not be read as a string." + ); + return new TenantSettingsCountryCodesMode(stringValue); + } + + public override void WriteAsPropertyName( + Utf8JsonWriter writer, + TenantSettingsCountryCodesMode value, + JsonSerializerOptions options + ) + { + writer.WritePropertyName(value.Value); + } + } + + /// + /// Constant strings for enum values + /// + [Serializable] + public static class Values + { + public const string Allow = "allow"; + + public const string Deny = "deny"; + } +} diff --git a/src/Auth0.ManagementApi/Types/TenantSettingsCountryCodesModeResponse.cs b/src/Auth0.ManagementApi/Types/TenantSettingsCountryCodesModeResponse.cs new file mode 100644 index 000000000..c8b7f8fa1 --- /dev/null +++ b/src/Auth0.ManagementApi/Types/TenantSettingsCountryCodesModeResponse.cs @@ -0,0 +1,120 @@ +using Auth0.ManagementApi.Core; +using global::System.Text.Json; +using global::System.Text.Json.Serialization; + +namespace Auth0.ManagementApi; + +[JsonConverter( + typeof(TenantSettingsCountryCodesModeResponse.TenantSettingsCountryCodesModeResponseSerializer) +)] +[Serializable] +public readonly record struct TenantSettingsCountryCodesModeResponse : IStringEnum +{ + public static readonly TenantSettingsCountryCodesModeResponse Allow = new(Values.Allow); + + public static readonly TenantSettingsCountryCodesModeResponse Deny = new(Values.Deny); + + public TenantSettingsCountryCodesModeResponse(string value) + { + Value = value; + } + + /// + /// The string value of the enum. + /// + public string Value { get; } + + /// + /// Create a string enum with the given value. + /// + public static TenantSettingsCountryCodesModeResponse FromCustom(string value) + { + return new TenantSettingsCountryCodesModeResponse(value); + } + + public bool Equals(string? other) + { + return Value.Equals(other); + } + + /// + /// Returns the string value of the enum. + /// + public override string ToString() + { + return Value; + } + + public static bool operator ==(TenantSettingsCountryCodesModeResponse value1, string value2) => + value1.Value.Equals(value2); + + public static bool operator !=(TenantSettingsCountryCodesModeResponse value1, string value2) => + !value1.Value.Equals(value2); + + public static explicit operator string(TenantSettingsCountryCodesModeResponse value) => + value.Value; + + public static explicit operator TenantSettingsCountryCodesModeResponse(string value) => + new(value); + + internal class TenantSettingsCountryCodesModeResponseSerializer + : JsonConverter + { + public override TenantSettingsCountryCodesModeResponse Read( + ref Utf8JsonReader reader, + Type typeToConvert, + JsonSerializerOptions options + ) + { + var stringValue = + reader.GetString() + ?? throw new global::System.Exception( + "The JSON value could not be read as a string." + ); + return new TenantSettingsCountryCodesModeResponse(stringValue); + } + + public override void Write( + Utf8JsonWriter writer, + TenantSettingsCountryCodesModeResponse value, + JsonSerializerOptions options + ) + { + writer.WriteStringValue(value.Value); + } + + public override TenantSettingsCountryCodesModeResponse ReadAsPropertyName( + ref Utf8JsonReader reader, + Type typeToConvert, + JsonSerializerOptions options + ) + { + var stringValue = + reader.GetString() + ?? throw new global::System.Exception( + "The JSON property name could not be read as a string." + ); + return new TenantSettingsCountryCodesModeResponse(stringValue); + } + + public override void WriteAsPropertyName( + Utf8JsonWriter writer, + TenantSettingsCountryCodesModeResponse value, + JsonSerializerOptions options + ) + { + writer.WritePropertyName(value.Value); + } + } + + /// + /// Constant strings for enum values + /// + [Serializable] + public static class Values + { + public const string Allow = "allow"; + + public const string Deny = "deny"; + } +} diff --git a/src/Auth0.ManagementApi/Types/TenantSettingsCountryCodesResponse.cs b/src/Auth0.ManagementApi/Types/TenantSettingsCountryCodesResponse.cs new file mode 100644 index 000000000..c80352671 --- /dev/null +++ b/src/Auth0.ManagementApi/Types/TenantSettingsCountryCodesResponse.cs @@ -0,0 +1,39 @@ +using Auth0.ManagementApi.Core; +using global::System.Text.Json; +using global::System.Text.Json.Serialization; + +namespace Auth0.ManagementApi; + +/// +/// Phone country code configuration for identifier input. +/// +[Serializable] +public record TenantSettingsCountryCodesResponse : IJsonOnDeserialized +{ + [JsonExtensionData] + private readonly IDictionary _extensionData = + new Dictionary(); + + /// + /// Array of ISO 3166-1 alpha-2 country codes. + /// + [Optional] + [JsonPropertyName("list")] + public IEnumerable? List { get; set; } + + [Optional] + [JsonPropertyName("mode")] + public TenantSettingsCountryCodesModeResponse? Mode { get; set; } + + [JsonIgnore] + public ReadOnlyAdditionalProperties AdditionalProperties { get; private set; } = new(); + + void IJsonOnDeserialized.OnDeserialized() => + AdditionalProperties.CopyFromExtensionData(_extensionData); + + /// + public override string ToString() + { + return JsonUtils.Serialize(this); + } +} diff --git a/src/Auth0.ManagementApi/Types/UpdateTenantSettingsResponseContent.cs b/src/Auth0.ManagementApi/Types/UpdateTenantSettingsResponseContent.cs index a5125a533..85af7aa5a 100644 --- a/src/Auth0.ManagementApi/Types/UpdateTenantSettingsResponseContent.cs +++ b/src/Auth0.ManagementApi/Types/UpdateTenantSettingsResponseContent.cs @@ -236,6 +236,10 @@ public record UpdateTenantSettingsResponseContent : IJsonOnDeserialized [JsonPropertyName("dynamic_client_registration_security_mode")] public TenantSettingsDynamicClientRegistrationSecurityMode? DynamicClientRegistrationSecurityMode { get; set; } + [Optional] + [JsonPropertyName("country_codes")] + public TenantSettingsCountryCodesResponse? CountryCodes { get; set; } + [JsonIgnore] public ReadOnlyAdditionalProperties AdditionalProperties { get; private set; } = new(); diff --git a/src/Auth0.ManagementApi/Types/UserEffectivePermissionResponseContent.cs b/src/Auth0.ManagementApi/Types/UserEffectivePermissionResponseContent.cs new file mode 100644 index 000000000..d47675acf --- /dev/null +++ b/src/Auth0.ManagementApi/Types/UserEffectivePermissionResponseContent.cs @@ -0,0 +1,60 @@ +using Auth0.ManagementApi.Core; +using global::System.Text.Json; +using global::System.Text.Json.Serialization; + +namespace Auth0.ManagementApi; + +[Serializable] +public record UserEffectivePermissionResponseContent : IJsonOnDeserialized +{ + [JsonExtensionData] + private readonly IDictionary _extensionData = + new Dictionary(); + + /// + /// Resource server (API) identifier that this permission is for. + /// + [Optional] + [JsonPropertyName("resource_server_identifier")] + public string? ResourceServerIdentifier { get; set; } + + /// + /// Name of this permission. + /// + [Optional] + [JsonPropertyName("permission_name")] + public string? PermissionName { get; set; } + + /// + /// Resource server (API) name this permission is for. + /// + [Optional] + [JsonPropertyName("resource_server_name")] + public string? ResourceServerName { get; set; } + + /// + /// Description of this permission. + /// + [Optional] + [JsonPropertyName("description")] + public string? Description { get; set; } + + /// + /// List of sources where this permission is coming from. + /// + [Optional] + [JsonPropertyName("sources")] + public IEnumerable? Sources { get; set; } + + [JsonIgnore] + public ReadOnlyAdditionalProperties AdditionalProperties { get; private set; } = new(); + + void IJsonOnDeserialized.OnDeserialized() => + AdditionalProperties.CopyFromExtensionData(_extensionData); + + /// + public override string ToString() + { + return JsonUtils.Serialize(this); + } +} diff --git a/src/Auth0.ManagementApi/Types/UserEffectivePermissionRoleSourceEnum.cs b/src/Auth0.ManagementApi/Types/UserEffectivePermissionRoleSourceEnum.cs new file mode 100644 index 000000000..82262db77 --- /dev/null +++ b/src/Auth0.ManagementApi/Types/UserEffectivePermissionRoleSourceEnum.cs @@ -0,0 +1,120 @@ +using Auth0.ManagementApi.Core; +using global::System.Text.Json; +using global::System.Text.Json.Serialization; + +namespace Auth0.ManagementApi; + +[JsonConverter( + typeof(UserEffectivePermissionRoleSourceEnum.UserEffectivePermissionRoleSourceEnumSerializer) +)] +[Serializable] +public readonly record struct UserEffectivePermissionRoleSourceEnum : IStringEnum +{ + public static readonly UserEffectivePermissionRoleSourceEnum Direct = new(Values.Direct); + + public static readonly UserEffectivePermissionRoleSourceEnum Groups = new(Values.Groups); + + public UserEffectivePermissionRoleSourceEnum(string value) + { + Value = value; + } + + /// + /// The string value of the enum. + /// + public string Value { get; } + + /// + /// Create a string enum with the given value. + /// + public static UserEffectivePermissionRoleSourceEnum FromCustom(string value) + { + return new UserEffectivePermissionRoleSourceEnum(value); + } + + public bool Equals(string? other) + { + return Value.Equals(other); + } + + /// + /// Returns the string value of the enum. + /// + public override string ToString() + { + return Value; + } + + public static bool operator ==(UserEffectivePermissionRoleSourceEnum value1, string value2) => + value1.Value.Equals(value2); + + public static bool operator !=(UserEffectivePermissionRoleSourceEnum value1, string value2) => + !value1.Value.Equals(value2); + + public static explicit operator string(UserEffectivePermissionRoleSourceEnum value) => + value.Value; + + public static explicit operator UserEffectivePermissionRoleSourceEnum(string value) => + new(value); + + internal class UserEffectivePermissionRoleSourceEnumSerializer + : JsonConverter + { + public override UserEffectivePermissionRoleSourceEnum Read( + ref Utf8JsonReader reader, + Type typeToConvert, + JsonSerializerOptions options + ) + { + var stringValue = + reader.GetString() + ?? throw new global::System.Exception( + "The JSON value could not be read as a string." + ); + return new UserEffectivePermissionRoleSourceEnum(stringValue); + } + + public override void Write( + Utf8JsonWriter writer, + UserEffectivePermissionRoleSourceEnum value, + JsonSerializerOptions options + ) + { + writer.WriteStringValue(value.Value); + } + + public override UserEffectivePermissionRoleSourceEnum ReadAsPropertyName( + ref Utf8JsonReader reader, + Type typeToConvert, + JsonSerializerOptions options + ) + { + var stringValue = + reader.GetString() + ?? throw new global::System.Exception( + "The JSON property name could not be read as a string." + ); + return new UserEffectivePermissionRoleSourceEnum(stringValue); + } + + public override void WriteAsPropertyName( + Utf8JsonWriter writer, + UserEffectivePermissionRoleSourceEnum value, + JsonSerializerOptions options + ) + { + writer.WritePropertyName(value.Value); + } + } + + /// + /// Constant strings for enum values + /// + [Serializable] + public static class Values + { + public const string Direct = "direct"; + + public const string Groups = "groups"; + } +} diff --git a/src/Auth0.ManagementApi/Types/UserEffectivePermissionRoleSourceResponseContent.cs b/src/Auth0.ManagementApi/Types/UserEffectivePermissionRoleSourceResponseContent.cs new file mode 100644 index 000000000..abb80afea --- /dev/null +++ b/src/Auth0.ManagementApi/Types/UserEffectivePermissionRoleSourceResponseContent.cs @@ -0,0 +1,53 @@ +using Auth0.ManagementApi.Core; +using global::System.Text.Json; +using global::System.Text.Json.Serialization; + +namespace Auth0.ManagementApi; + +[Serializable] +public record UserEffectivePermissionRoleSourceResponseContent : IJsonOnDeserialized +{ + [JsonExtensionData] + private readonly IDictionary _extensionData = + new Dictionary(); + + /// + /// ID for this role. + /// + [Optional] + [JsonPropertyName("id")] + public string? Id { get; set; } + + /// + /// Name of this role. + /// + [Optional] + [JsonPropertyName("name")] + public string? Name { get; set; } + + /// + /// Description of this role. + /// + [Optional] + [JsonPropertyName("description")] + public string? Description { get; set; } + + /// + /// List of sources where this role is coming from. + /// + [Optional] + [JsonPropertyName("sources")] + public IEnumerable? Sources { get; set; } + + [JsonIgnore] + public ReadOnlyAdditionalProperties AdditionalProperties { get; private set; } = new(); + + void IJsonOnDeserialized.OnDeserialized() => + AdditionalProperties.CopyFromExtensionData(_extensionData); + + /// + public override string ToString() + { + return JsonUtils.Serialize(this); + } +} diff --git a/src/Auth0.ManagementApi/Types/UserEffectivePermissionSourceEnum.cs b/src/Auth0.ManagementApi/Types/UserEffectivePermissionSourceEnum.cs new file mode 100644 index 000000000..4ae50f9b5 --- /dev/null +++ b/src/Auth0.ManagementApi/Types/UserEffectivePermissionSourceEnum.cs @@ -0,0 +1,118 @@ +using Auth0.ManagementApi.Core; +using global::System.Text.Json; +using global::System.Text.Json.Serialization; + +namespace Auth0.ManagementApi; + +[JsonConverter( + typeof(UserEffectivePermissionSourceEnum.UserEffectivePermissionSourceEnumSerializer) +)] +[Serializable] +public readonly record struct UserEffectivePermissionSourceEnum : IStringEnum +{ + public static readonly UserEffectivePermissionSourceEnum Direct = new(Values.Direct); + + public static readonly UserEffectivePermissionSourceEnum Roles = new(Values.Roles); + + public UserEffectivePermissionSourceEnum(string value) + { + Value = value; + } + + /// + /// The string value of the enum. + /// + public string Value { get; } + + /// + /// Create a string enum with the given value. + /// + public static UserEffectivePermissionSourceEnum FromCustom(string value) + { + return new UserEffectivePermissionSourceEnum(value); + } + + public bool Equals(string? other) + { + return Value.Equals(other); + } + + /// + /// Returns the string value of the enum. + /// + public override string ToString() + { + return Value; + } + + public static bool operator ==(UserEffectivePermissionSourceEnum value1, string value2) => + value1.Value.Equals(value2); + + public static bool operator !=(UserEffectivePermissionSourceEnum value1, string value2) => + !value1.Value.Equals(value2); + + public static explicit operator string(UserEffectivePermissionSourceEnum value) => value.Value; + + public static explicit operator UserEffectivePermissionSourceEnum(string value) => new(value); + + internal class UserEffectivePermissionSourceEnumSerializer + : JsonConverter + { + public override UserEffectivePermissionSourceEnum Read( + ref Utf8JsonReader reader, + Type typeToConvert, + JsonSerializerOptions options + ) + { + var stringValue = + reader.GetString() + ?? throw new global::System.Exception( + "The JSON value could not be read as a string." + ); + return new UserEffectivePermissionSourceEnum(stringValue); + } + + public override void Write( + Utf8JsonWriter writer, + UserEffectivePermissionSourceEnum value, + JsonSerializerOptions options + ) + { + writer.WriteStringValue(value.Value); + } + + public override UserEffectivePermissionSourceEnum ReadAsPropertyName( + ref Utf8JsonReader reader, + Type typeToConvert, + JsonSerializerOptions options + ) + { + var stringValue = + reader.GetString() + ?? throw new global::System.Exception( + "The JSON property name could not be read as a string." + ); + return new UserEffectivePermissionSourceEnum(stringValue); + } + + public override void WriteAsPropertyName( + Utf8JsonWriter writer, + UserEffectivePermissionSourceEnum value, + JsonSerializerOptions options + ) + { + writer.WritePropertyName(value.Value); + } + } + + /// + /// Constant strings for enum values + /// + [Serializable] + public static class Values + { + public const string Direct = "direct"; + + public const string Roles = "roles"; + } +} diff --git a/src/Auth0.ManagementApi/Types/UserEffectiveRole.cs b/src/Auth0.ManagementApi/Types/UserEffectiveRole.cs new file mode 100644 index 000000000..3215a3b2e --- /dev/null +++ b/src/Auth0.ManagementApi/Types/UserEffectiveRole.cs @@ -0,0 +1,50 @@ +using Auth0.ManagementApi.Core; +using global::System.Text.Json; +using global::System.Text.Json.Serialization; + +namespace Auth0.ManagementApi; + +[Serializable] +public record UserEffectiveRole : IJsonOnDeserialized +{ + [JsonExtensionData] + private readonly IDictionary _extensionData = + new Dictionary(); + + /// + /// Role ID + /// + [JsonPropertyName("id")] + public required string Id { get; set; } + + /// + /// Role name + /// + [JsonPropertyName("name")] + public required string Name { get; set; } + + /// + /// Role description + /// + [JsonPropertyName("description")] + public required string Description { get; set; } + + /// + /// Sources of the role assignment (direct or through group membership) + /// + [JsonPropertyName("sources")] + public IEnumerable Sources { get; set; } = + new List(); + + [JsonIgnore] + public ReadOnlyAdditionalProperties AdditionalProperties { get; private set; } = new(); + + void IJsonOnDeserialized.OnDeserialized() => + AdditionalProperties.CopyFromExtensionData(_extensionData); + + /// + public override string ToString() + { + return JsonUtils.Serialize(this); + } +} diff --git a/src/Auth0.ManagementApi/Types/UserEffectiveRoleSource.cs b/src/Auth0.ManagementApi/Types/UserEffectiveRoleSource.cs new file mode 100644 index 000000000..0e077680a --- /dev/null +++ b/src/Auth0.ManagementApi/Types/UserEffectiveRoleSource.cs @@ -0,0 +1,115 @@ +using Auth0.ManagementApi.Core; +using global::System.Text.Json; +using global::System.Text.Json.Serialization; + +namespace Auth0.ManagementApi; + +[JsonConverter(typeof(UserEffectiveRoleSource.UserEffectiveRoleSourceSerializer))] +[Serializable] +public readonly record struct UserEffectiveRoleSource : IStringEnum +{ + public static readonly UserEffectiveRoleSource Direct = new(Values.Direct); + + public static readonly UserEffectiveRoleSource Groups = new(Values.Groups); + + public UserEffectiveRoleSource(string value) + { + Value = value; + } + + /// + /// The string value of the enum. + /// + public string Value { get; } + + /// + /// Create a string enum with the given value. + /// + public static UserEffectiveRoleSource FromCustom(string value) + { + return new UserEffectiveRoleSource(value); + } + + public bool Equals(string? other) + { + return Value.Equals(other); + } + + /// + /// Returns the string value of the enum. + /// + public override string ToString() + { + return Value; + } + + public static bool operator ==(UserEffectiveRoleSource value1, string value2) => + value1.Value.Equals(value2); + + public static bool operator !=(UserEffectiveRoleSource value1, string value2) => + !value1.Value.Equals(value2); + + public static explicit operator string(UserEffectiveRoleSource value) => value.Value; + + public static explicit operator UserEffectiveRoleSource(string value) => new(value); + + internal class UserEffectiveRoleSourceSerializer : JsonConverter + { + public override UserEffectiveRoleSource Read( + ref Utf8JsonReader reader, + Type typeToConvert, + JsonSerializerOptions options + ) + { + var stringValue = + reader.GetString() + ?? throw new global::System.Exception( + "The JSON value could not be read as a string." + ); + return new UserEffectiveRoleSource(stringValue); + } + + public override void Write( + Utf8JsonWriter writer, + UserEffectiveRoleSource value, + JsonSerializerOptions options + ) + { + writer.WriteStringValue(value.Value); + } + + public override UserEffectiveRoleSource ReadAsPropertyName( + ref Utf8JsonReader reader, + Type typeToConvert, + JsonSerializerOptions options + ) + { + var stringValue = + reader.GetString() + ?? throw new global::System.Exception( + "The JSON property name could not be read as a string." + ); + return new UserEffectiveRoleSource(stringValue); + } + + public override void WriteAsPropertyName( + Utf8JsonWriter writer, + UserEffectiveRoleSource value, + JsonSerializerOptions options + ) + { + writer.WritePropertyName(value.Value); + } + } + + /// + /// Constant strings for enum values + /// + [Serializable] + public static class Values + { + public const string Direct = "direct"; + + public const string Groups = "groups"; + } +} diff --git a/src/Auth0.ManagementApi/UserBlocks/IUserBlocksClient.cs b/src/Auth0.ManagementApi/UserBlocks/IUserBlocksClient.cs index 654106c2e..2bcb64f62 100644 --- a/src/Auth0.ManagementApi/UserBlocks/IUserBlocksClient.cs +++ b/src/Auth0.ManagementApi/UserBlocks/IUserBlocksClient.cs @@ -3,7 +3,7 @@ namespace Auth0.ManagementApi; public partial interface IUserBlocksClient { /// - /// Retrieve details of all Brute-force Protection blocks for a user with the given identifier (username, phone number, or email). + /// Retrieve details of all [Brute-force Protection](https://auth0.com/docs/secure/attack-protection/brute-force-protection) blocks for a user with the given identifier (username, phone number, or email). /// WithRawResponseTask ListByIdentifierAsync( ListUserBlocksByIdentifierRequestParameters request, @@ -12,9 +12,9 @@ WithRawResponseTask ListByIdentifierA ); /// - /// Remove all Brute-force Protection blocks for the user with the given identifier (username, phone number, or email). + /// Remove all [Brute-force Protection](https://auth0.com/docs/secure/attack-protection/brute-force-protection) blocks for the user with the given identifier (username, phone number, or email). /// - /// Note: This endpoint does not unblock users that were blocked by a tenant administrator. + /// Note: This endpoint does not unblock users that were [blocked by a tenant administrator](https://auth0.com/docs/user-profile#block-and-unblock-a-user). /// Task DeleteByIdentifierAsync( DeleteUserBlocksByIdentifierRequestParameters request, @@ -23,7 +23,7 @@ Task DeleteByIdentifierAsync( ); /// - /// Retrieve details of all Brute-force Protection blocks for the user with the given ID. + /// Retrieve details of all [Brute-force Protection](https://auth0.com/docs/secure/attack-protection/brute-force-protection) blocks for the user with the given ID. /// WithRawResponseTask ListAsync( string id, @@ -33,9 +33,9 @@ WithRawResponseTask ListAsync( ); /// - /// Remove all Brute-force Protection blocks for the user with the given ID. + /// Remove all [Brute-force Protection](https://auth0.com/docs/secure/attack-protection/brute-force-protection) blocks for the user with the given ID. /// - /// Note: This endpoint does not unblock users that were blocked by a tenant administrator. + /// Note: This endpoint does not unblock users that were [blocked by a tenant administrator](https://auth0.com/docs/user-profile#block-and-unblock-a-user). /// Task DeleteAsync( string id, diff --git a/src/Auth0.ManagementApi/UserBlocks/UserBlocksClient.cs b/src/Auth0.ManagementApi/UserBlocks/UserBlocksClient.cs index cd0280d54..9c4d5f396 100644 --- a/src/Auth0.ManagementApi/UserBlocks/UserBlocksClient.cs +++ b/src/Auth0.ManagementApi/UserBlocks/UserBlocksClient.cs @@ -209,7 +209,7 @@ private async Task> ListAsyncCore } /// - /// Retrieve details of all Brute-force Protection blocks for a user with the given identifier (username, phone number, or email). + /// Retrieve details of all [Brute-force Protection](https://auth0.com/docs/secure/attack-protection/brute-force-protection) blocks for a user with the given identifier (username, phone number, or email). /// /// /// await client.UserBlocks.ListByIdentifierAsync( @@ -232,9 +232,9 @@ public WithRawResponseTask ListByIden } /// - /// Remove all Brute-force Protection blocks for the user with the given identifier (username, phone number, or email). + /// Remove all [Brute-force Protection](https://auth0.com/docs/secure/attack-protection/brute-force-protection) blocks for the user with the given identifier (username, phone number, or email). /// - /// Note: This endpoint does not unblock users that were blocked by a tenant administrator. + /// Note: This endpoint does not unblock users that were [blocked by a tenant administrator](https://auth0.com/docs/user-profile#block-and-unblock-a-user). /// /// /// await client.UserBlocks.DeleteByIdentifierAsync( @@ -305,7 +305,7 @@ public async Task DeleteByIdentifierAsync( } /// - /// Retrieve details of all Brute-force Protection blocks for the user with the given ID. + /// Retrieve details of all [Brute-force Protection](https://auth0.com/docs/secure/attack-protection/brute-force-protection) blocks for the user with the given ID. /// /// /// await client.UserBlocks.ListAsync( @@ -326,9 +326,9 @@ public WithRawResponseTask ListAsync( } /// - /// Remove all Brute-force Protection blocks for the user with the given ID. + /// Remove all [Brute-force Protection](https://auth0.com/docs/secure/attack-protection/brute-force-protection) blocks for the user with the given ID. /// - /// Note: This endpoint does not unblock users that were blocked by a tenant administrator. + /// Note: This endpoint does not unblock users that were [blocked by a tenant administrator](https://auth0.com/docs/user-profile#block-and-unblock-a-user). /// /// /// await client.UserBlocks.DeleteAsync("id"); diff --git a/src/Auth0.ManagementApi/UserGrants/IUserGrantsClient.cs b/src/Auth0.ManagementApi/UserGrants/IUserGrantsClient.cs index 342207221..0bd1ebe7d 100644 --- a/src/Auth0.ManagementApi/UserGrants/IUserGrantsClient.cs +++ b/src/Auth0.ManagementApi/UserGrants/IUserGrantsClient.cs @@ -5,7 +5,7 @@ namespace Auth0.ManagementApi; public partial interface IUserGrantsClient { /// - /// Retrieve the grants associated with your account. + /// Retrieve the [grants](https://auth0.com/docs/api-auth/which-oauth-flow-to-use) associated with your account. /// Task> ListAsync( ListUserGrantsRequestParameters request, diff --git a/src/Auth0.ManagementApi/UserGrants/UserGrantsClient.cs b/src/Auth0.ManagementApi/UserGrants/UserGrantsClient.cs index 97879b6ad..ece6d9788 100644 --- a/src/Auth0.ManagementApi/UserGrants/UserGrantsClient.cs +++ b/src/Auth0.ManagementApi/UserGrants/UserGrantsClient.cs @@ -13,7 +13,7 @@ internal UserGrantsClient(RawClient client) } /// - /// Retrieve the grants associated with your account. + /// Retrieve the [grants](https://auth0.com/docs/api-auth/which-oauth-flow-to-use) associated with your account. /// private WithRawResponseTask ListInternalAsync( ListUserGrantsRequestParameters request, @@ -126,7 +126,7 @@ private async Task< } /// - /// Retrieve the grants associated with your account. + /// Retrieve the [grants](https://auth0.com/docs/api-auth/which-oauth-flow-to-use) associated with your account. /// /// /// await client.UserGrants.ListAsync( diff --git a/src/Auth0.ManagementApi/Users/EffectivePermissions/EffectivePermissionsClient.cs b/src/Auth0.ManagementApi/Users/EffectivePermissions/EffectivePermissionsClient.cs new file mode 100644 index 000000000..522c611ff --- /dev/null +++ b/src/Auth0.ManagementApi/Users/EffectivePermissions/EffectivePermissionsClient.cs @@ -0,0 +1,184 @@ +using Auth0.ManagementApi; +using Auth0.ManagementApi.Core; +using global::System.Text.Json; + +namespace Auth0.ManagementApi.Users; + +public partial class EffectivePermissionsClient : IEffectivePermissionsClient +{ + private readonly RawClient _client; + + internal EffectivePermissionsClient(RawClient client) + { + _client = client; + Sources = new Auth0.ManagementApi.Users.EffectivePermissions.Sources.SourcesClient(_client); + } + + public Auth0.ManagementApi.Users.EffectivePermissions.Sources.ISourcesClient Sources { get; } + + /// + /// Returns the list of effective permissions for a user, taking into account permissions granted directly to the user, as well as those inherited through roles and group memberships. + /// + private WithRawResponseTask ListInternalAsync( + string id, + ListUserEffectivePermissionsRequestParameters request, + RequestOptions? options = null, + CancellationToken cancellationToken = default + ) + { + return new WithRawResponseTask( + ListInternalAsyncCore(id, request, options, cancellationToken) + ); + } + + private async Task< + WithRawResponse + > ListInternalAsyncCore( + string id, + ListUserEffectivePermissionsRequestParameters request, + RequestOptions? options = null, + CancellationToken cancellationToken = default + ) + { + var _queryString = new Auth0.ManagementApi.Core.QueryStringBuilder.Builder(capacity: 3) + .Add("from", request.From.IsDefined ? request.From.Value : null) + .Add("take", request.Take.IsDefined ? request.Take.Value : null) + .Add("resource_server_identifier", request.ResourceServerIdentifier) + .MergeAdditional(options?.AdditionalQueryParameters) + .Build(); + var _headers = await new Auth0.ManagementApi.Core.HeadersBuilder.Builder() + .Add(_client.Options.Headers) + .Add(_client.Options.AdditionalHeaders) + .Add(options?.AdditionalHeaders) + .BuildAsync() + .ConfigureAwait(false); + var response = await _client + .SendRequestAsync( + new JsonRequest + { + Method = HttpMethod.Get, + Path = string.Format( + "users/{0}/effective-permissions", + ValueConvert.ToPathParameterString(id) + ), + QueryString = _queryString, + Headers = _headers, + Options = options, + }, + cancellationToken + ) + .ConfigureAwait(false); + if (response.StatusCode is >= 200 and < 400) + { + var responseBody = await response + .Raw.Content.ReadAsStringAsync(cancellationToken) + .ConfigureAwait(false); + try + { + var responseData = + JsonUtils.Deserialize( + responseBody + )!; + return new WithRawResponse() + { + Data = responseData, + RawResponse = new RawResponse() + { + StatusCode = response.Raw.StatusCode, + Url = response.Raw.RequestMessage?.RequestUri ?? new Uri("about:blank"), + Headers = ResponseHeaders.FromHttpResponseMessage(response.Raw), + }, + }; + } + catch (JsonException e) + { + throw new ManagementApiException( + "Failed to deserialize response", + response.StatusCode, + null, + e + ); + } + } + { + var responseBody = await response + .Raw.Content.ReadAsStringAsync(cancellationToken) + .ConfigureAwait(false); + try + { + switch (response.StatusCode) + { + case 400: + throw new BadRequestError(JsonUtils.Deserialize(responseBody)); + case 401: + throw new UnauthorizedError(JsonUtils.Deserialize(responseBody)); + case 403: + throw new ForbiddenError(JsonUtils.Deserialize(responseBody)); + case 404: + throw new NotFoundError(JsonUtils.Deserialize(responseBody)); + case 429: + throw new TooManyRequestsError(JsonUtils.Deserialize(responseBody)); + } + } + catch (JsonException) + { + // unable to map error response, throwing generic error + } + throw new ManagementApiException( + $"Error with status code {response.StatusCode}", + response.StatusCode, + responseBody + ); + } + } + + /// + /// Returns the list of effective permissions for a user, taking into account permissions granted directly to the user, as well as those inherited through roles and group memberships. + /// + /// + /// await client.Users.EffectivePermissions.ListAsync( + /// "id", + /// new ListUserEffectivePermissionsRequestParameters + /// { + /// From = "from", + /// Take = 1, + /// ResourceServerIdentifier = "resource_server_identifier", + /// } + /// ); + /// + public async Task> ListAsync( + string id, + ListUserEffectivePermissionsRequestParameters request, + RequestOptions? options = null, + CancellationToken cancellationToken = default + ) + { + if (request is not null) + { + request = request with { }; + } + var pager = await CursorPager< + ListUserEffectivePermissionsRequestParameters, + RequestOptions?, + ListUserEffectivePermissionsResponseContent, + string?, + UserEffectivePermissionResponseContent + > + .CreateInstanceAsync( + request, + options, + async (request, options, cancellationToken) => + await ListInternalAsync(id, request, options, cancellationToken) + .WithRawResponse(), + (request, cursor) => + { + request.From = cursor; + }, + response => response.Next, + response => response.Permissions?.ToList(), + cancellationToken + ) + .ConfigureAwait(false); + return pager; + } +} diff --git a/src/Auth0.ManagementApi/Users/EffectivePermissions/IEffectivePermissionsClient.cs b/src/Auth0.ManagementApi/Users/EffectivePermissions/IEffectivePermissionsClient.cs new file mode 100644 index 000000000..acd556363 --- /dev/null +++ b/src/Auth0.ManagementApi/Users/EffectivePermissions/IEffectivePermissionsClient.cs @@ -0,0 +1,19 @@ +using Auth0.ManagementApi; +using Auth0.ManagementApi.Core; + +namespace Auth0.ManagementApi.Users; + +public partial interface IEffectivePermissionsClient +{ + public Auth0.ManagementApi.Users.EffectivePermissions.Sources.ISourcesClient Sources { get; } + + /// + /// Returns the list of effective permissions for a user, taking into account permissions granted directly to the user, as well as those inherited through roles and group memberships. + /// + Task> ListAsync( + string id, + ListUserEffectivePermissionsRequestParameters request, + RequestOptions? options = null, + CancellationToken cancellationToken = default + ); +} diff --git a/src/Auth0.ManagementApi/Users/EffectivePermissions/Requests/ListUserEffectivePermissionsRequestParameters.cs b/src/Auth0.ManagementApi/Users/EffectivePermissions/Requests/ListUserEffectivePermissionsRequestParameters.cs new file mode 100644 index 000000000..2ed68df56 --- /dev/null +++ b/src/Auth0.ManagementApi/Users/EffectivePermissions/Requests/ListUserEffectivePermissionsRequestParameters.cs @@ -0,0 +1,32 @@ +using Auth0.ManagementApi.Core; +using global::System.Text.Json.Serialization; + +namespace Auth0.ManagementApi.Users; + +[Serializable] +public record ListUserEffectivePermissionsRequestParameters +{ + /// + /// Optional Id from which to start selection. + /// + [JsonIgnore] + public Optional From { get; set; } + + /// + /// Number of results per page. Defaults to 50. + /// + [JsonIgnore] + public Optional Take { get; set; } = 50; + + /// + /// The identifier of the resource server for which to calculate user permissions. + /// + [JsonIgnore] + public required string ResourceServerIdentifier { get; set; } + + /// + public override string ToString() + { + return JsonUtils.Serialize(this); + } +} diff --git a/src/Auth0.ManagementApi/Users/EffectivePermissions/Sources/ISourcesClient.cs b/src/Auth0.ManagementApi/Users/EffectivePermissions/Sources/ISourcesClient.cs new file mode 100644 index 000000000..d037998be --- /dev/null +++ b/src/Auth0.ManagementApi/Users/EffectivePermissions/Sources/ISourcesClient.cs @@ -0,0 +1,6 @@ +namespace Auth0.ManagementApi.Users.EffectivePermissions.Sources; + +public partial interface ISourcesClient +{ + public IRolesClient Roles { get; } +} diff --git a/src/Auth0.ManagementApi/Users/EffectivePermissions/Sources/Roles/IRolesClient.cs b/src/Auth0.ManagementApi/Users/EffectivePermissions/Sources/Roles/IRolesClient.cs new file mode 100644 index 000000000..64641a1bc --- /dev/null +++ b/src/Auth0.ManagementApi/Users/EffectivePermissions/Sources/Roles/IRolesClient.cs @@ -0,0 +1,17 @@ +using Auth0.ManagementApi; +using Auth0.ManagementApi.Core; + +namespace Auth0.ManagementApi.Users.EffectivePermissions.Sources; + +public partial interface IRolesClient +{ + /// + /// Lists the roles which grant the user a given permission, including roles assigned directly to the user and those inherited through group memberships. + /// + Task> ListAsync( + string id, + ListUserEffectivePermissionRoleSourceRequestParameters request, + RequestOptions? options = null, + CancellationToken cancellationToken = default + ); +} diff --git a/src/Auth0.ManagementApi/Users/EffectivePermissions/Sources/Roles/Requests/ListUserEffectivePermissionRoleSourceRequestParameters.cs b/src/Auth0.ManagementApi/Users/EffectivePermissions/Sources/Roles/Requests/ListUserEffectivePermissionRoleSourceRequestParameters.cs new file mode 100644 index 000000000..e8e9325b6 --- /dev/null +++ b/src/Auth0.ManagementApi/Users/EffectivePermissions/Sources/Roles/Requests/ListUserEffectivePermissionRoleSourceRequestParameters.cs @@ -0,0 +1,38 @@ +using Auth0.ManagementApi.Core; +using global::System.Text.Json.Serialization; + +namespace Auth0.ManagementApi.Users.EffectivePermissions.Sources; + +[Serializable] +public record ListUserEffectivePermissionRoleSourceRequestParameters +{ + /// + /// Optional Id from which to start selection. + /// + [JsonIgnore] + public Optional From { get; set; } + + /// + /// Number of results per page. Defaults to 50. + /// + [JsonIgnore] + public Optional Take { get; set; } = 50; + + /// + /// The identifier of the resource server for which to calculate user permissions. + /// + [JsonIgnore] + public required string ResourceServerIdentifier { get; set; } + + /// + /// Name of this permission + /// + [JsonIgnore] + public required string PermissionName { get; set; } + + /// + public override string ToString() + { + return JsonUtils.Serialize(this); + } +} diff --git a/src/Auth0.ManagementApi/Users/EffectivePermissions/Sources/Roles/RolesClient.cs b/src/Auth0.ManagementApi/Users/EffectivePermissions/Sources/Roles/RolesClient.cs new file mode 100644 index 000000000..15d7e9ab1 --- /dev/null +++ b/src/Auth0.ManagementApi/Users/EffectivePermissions/Sources/Roles/RolesClient.cs @@ -0,0 +1,183 @@ +using Auth0.ManagementApi; +using Auth0.ManagementApi.Core; +using global::System.Text.Json; + +namespace Auth0.ManagementApi.Users.EffectivePermissions.Sources; + +public partial class RolesClient : IRolesClient +{ + private readonly RawClient _client; + + internal RolesClient(RawClient client) + { + _client = client; + } + + /// + /// Lists the roles which grant the user a given permission, including roles assigned directly to the user and those inherited through group memberships. + /// + private WithRawResponseTask ListInternalAsync( + string id, + ListUserEffectivePermissionRoleSourceRequestParameters request, + RequestOptions? options = null, + CancellationToken cancellationToken = default + ) + { + return new WithRawResponseTask( + ListInternalAsyncCore(id, request, options, cancellationToken) + ); + } + + private async Task< + WithRawResponse + > ListInternalAsyncCore( + string id, + ListUserEffectivePermissionRoleSourceRequestParameters request, + RequestOptions? options = null, + CancellationToken cancellationToken = default + ) + { + var _queryString = new Auth0.ManagementApi.Core.QueryStringBuilder.Builder(capacity: 4) + .Add("from", request.From.IsDefined ? request.From.Value : null) + .Add("take", request.Take.IsDefined ? request.Take.Value : null) + .Add("resource_server_identifier", request.ResourceServerIdentifier) + .Add("permission_name", request.PermissionName) + .MergeAdditional(options?.AdditionalQueryParameters) + .Build(); + var _headers = await new Auth0.ManagementApi.Core.HeadersBuilder.Builder() + .Add(_client.Options.Headers) + .Add(_client.Options.AdditionalHeaders) + .Add(options?.AdditionalHeaders) + .BuildAsync() + .ConfigureAwait(false); + var response = await _client + .SendRequestAsync( + new JsonRequest + { + Method = HttpMethod.Get, + Path = string.Format( + "users/{0}/effective-permissions/sources/effective-roles", + ValueConvert.ToPathParameterString(id) + ), + QueryString = _queryString, + Headers = _headers, + Options = options, + }, + cancellationToken + ) + .ConfigureAwait(false); + if (response.StatusCode is >= 200 and < 400) + { + var responseBody = await response + .Raw.Content.ReadAsStringAsync(cancellationToken) + .ConfigureAwait(false); + try + { + var responseData = + JsonUtils.Deserialize( + responseBody + )!; + return new WithRawResponse() + { + Data = responseData, + RawResponse = new RawResponse() + { + StatusCode = response.Raw.StatusCode, + Url = response.Raw.RequestMessage?.RequestUri ?? new Uri("about:blank"), + Headers = ResponseHeaders.FromHttpResponseMessage(response.Raw), + }, + }; + } + catch (JsonException e) + { + throw new ManagementApiException( + "Failed to deserialize response", + response.StatusCode, + null, + e + ); + } + } + { + var responseBody = await response + .Raw.Content.ReadAsStringAsync(cancellationToken) + .ConfigureAwait(false); + try + { + switch (response.StatusCode) + { + case 400: + throw new BadRequestError(JsonUtils.Deserialize(responseBody)); + case 401: + throw new UnauthorizedError(JsonUtils.Deserialize(responseBody)); + case 403: + throw new ForbiddenError(JsonUtils.Deserialize(responseBody)); + case 404: + throw new NotFoundError(JsonUtils.Deserialize(responseBody)); + case 429: + throw new TooManyRequestsError(JsonUtils.Deserialize(responseBody)); + } + } + catch (JsonException) + { + // unable to map error response, throwing generic error + } + throw new ManagementApiException( + $"Error with status code {response.StatusCode}", + response.StatusCode, + responseBody + ); + } + } + + /// + /// Lists the roles which grant the user a given permission, including roles assigned directly to the user and those inherited through group memberships. + /// + /// + /// await client.Users.EffectivePermissions.Sources.Roles.ListAsync( + /// "id", + /// new ListUserEffectivePermissionRoleSourceRequestParameters + /// { + /// From = "from", + /// Take = 1, + /// ResourceServerIdentifier = "resource_server_identifier", + /// PermissionName = "permission_name", + /// } + /// ); + /// + public async Task> ListAsync( + string id, + ListUserEffectivePermissionRoleSourceRequestParameters request, + RequestOptions? options = null, + CancellationToken cancellationToken = default + ) + { + if (request is not null) + { + request = request with { }; + } + var pager = await CursorPager< + ListUserEffectivePermissionRoleSourceRequestParameters, + RequestOptions?, + ListUserEffectivePermissionRoleSourcesResponseContent, + string?, + UserEffectivePermissionRoleSourceResponseContent + > + .CreateInstanceAsync( + request, + options, + async (request, options, cancellationToken) => + await ListInternalAsync(id, request, options, cancellationToken) + .WithRawResponse(), + (request, cursor) => + { + request.From = cursor; + }, + response => response.Next, + response => response.Roles?.ToList(), + cancellationToken + ) + .ConfigureAwait(false); + return pager; + } +} diff --git a/src/Auth0.ManagementApi/Users/EffectivePermissions/Sources/SourcesClient.cs b/src/Auth0.ManagementApi/Users/EffectivePermissions/Sources/SourcesClient.cs new file mode 100644 index 000000000..f3fe6daed --- /dev/null +++ b/src/Auth0.ManagementApi/Users/EffectivePermissions/Sources/SourcesClient.cs @@ -0,0 +1,16 @@ +using Auth0.ManagementApi.Core; + +namespace Auth0.ManagementApi.Users.EffectivePermissions.Sources; + +public partial class SourcesClient : ISourcesClient +{ + private readonly RawClient _client; + + internal SourcesClient(RawClient client) + { + _client = client; + Roles = new RolesClient(_client); + } + + public IRolesClient Roles { get; } +} diff --git a/src/Auth0.ManagementApi/Users/EffectiveRoles/EffectiveRolesClient.cs b/src/Auth0.ManagementApi/Users/EffectiveRoles/EffectiveRolesClient.cs new file mode 100644 index 000000000..14c0e1731 --- /dev/null +++ b/src/Auth0.ManagementApi/Users/EffectiveRoles/EffectiveRolesClient.cs @@ -0,0 +1,175 @@ +using Auth0.ManagementApi; +using Auth0.ManagementApi.Core; +using global::System.Text.Json; + +namespace Auth0.ManagementApi.Users; + +public partial class EffectiveRolesClient : IEffectiveRolesClient +{ + private readonly RawClient _client; + + internal EffectiveRolesClient(RawClient client) + { + _client = client; + Sources = new Auth0.ManagementApi.Users.EffectiveRoles.Sources.SourcesClient(_client); + } + + public Auth0.ManagementApi.Users.EffectiveRoles.Sources.ISourcesClient Sources { get; } + + /// + /// Retrieve detailed list of effective roles for a user, including roles assigned directly and through group memberships. + /// + private WithRawResponseTask ListInternalAsync( + string id, + ListUserEffectiveRolesRequestParameters request, + RequestOptions? options = null, + CancellationToken cancellationToken = default + ) + { + return new WithRawResponseTask( + ListInternalAsyncCore(id, request, options, cancellationToken) + ); + } + + private async Task< + WithRawResponse + > ListInternalAsyncCore( + string id, + ListUserEffectiveRolesRequestParameters request, + RequestOptions? options = null, + CancellationToken cancellationToken = default + ) + { + var _queryString = new Auth0.ManagementApi.Core.QueryStringBuilder.Builder(capacity: 2) + .Add("from", request.From.IsDefined ? request.From.Value : null) + .Add("take", request.Take.IsDefined ? request.Take.Value : null) + .MergeAdditional(options?.AdditionalQueryParameters) + .Build(); + var _headers = await new Auth0.ManagementApi.Core.HeadersBuilder.Builder() + .Add(_client.Options.Headers) + .Add(_client.Options.AdditionalHeaders) + .Add(options?.AdditionalHeaders) + .BuildAsync() + .ConfigureAwait(false); + var response = await _client + .SendRequestAsync( + new JsonRequest + { + Method = HttpMethod.Get, + Path = string.Format( + "users/{0}/effective-roles", + ValueConvert.ToPathParameterString(id) + ), + QueryString = _queryString, + Headers = _headers, + Options = options, + }, + cancellationToken + ) + .ConfigureAwait(false); + if (response.StatusCode is >= 200 and < 400) + { + var responseBody = await response + .Raw.Content.ReadAsStringAsync(cancellationToken) + .ConfigureAwait(false); + try + { + var responseData = JsonUtils.Deserialize( + responseBody + )!; + return new WithRawResponse() + { + Data = responseData, + RawResponse = new RawResponse() + { + StatusCode = response.Raw.StatusCode, + Url = response.Raw.RequestMessage?.RequestUri ?? new Uri("about:blank"), + Headers = ResponseHeaders.FromHttpResponseMessage(response.Raw), + }, + }; + } + catch (JsonException e) + { + throw new ManagementApiException( + "Failed to deserialize response", + response.StatusCode, + null, + e + ); + } + } + { + var responseBody = await response + .Raw.Content.ReadAsStringAsync(cancellationToken) + .ConfigureAwait(false); + try + { + switch (response.StatusCode) + { + case 400: + throw new BadRequestError(JsonUtils.Deserialize(responseBody)); + case 401: + throw new UnauthorizedError(JsonUtils.Deserialize(responseBody)); + case 403: + throw new ForbiddenError(JsonUtils.Deserialize(responseBody)); + case 429: + throw new TooManyRequestsError(JsonUtils.Deserialize(responseBody)); + } + } + catch (JsonException) + { + // unable to map error response, throwing generic error + } + throw new ManagementApiException( + $"Error with status code {response.StatusCode}", + response.StatusCode, + responseBody + ); + } + } + + /// + /// Retrieve detailed list of effective roles for a user, including roles assigned directly and through group memberships. + /// + /// + /// await client.Users.EffectiveRoles.ListAsync( + /// "id", + /// new ListUserEffectiveRolesRequestParameters { From = "from", Take = 1 } + /// ); + /// + public async Task> ListAsync( + string id, + ListUserEffectiveRolesRequestParameters request, + RequestOptions? options = null, + CancellationToken cancellationToken = default + ) + { + if (request is not null) + { + request = request with { }; + } + var pager = await CursorPager< + ListUserEffectiveRolesRequestParameters, + RequestOptions?, + ListUserEffectiveRolesResponseContent, + string?, + UserEffectiveRole + > + .CreateInstanceAsync( + request, + options, + async (request, options, cancellationToken) => + await ListInternalAsync(id, request, options, cancellationToken) + .WithRawResponse(), + (request, cursor) => + { + request.From = cursor; + }, + response => response.Next, + response => response.Roles?.ToList(), + cancellationToken + ) + .ConfigureAwait(false); + return pager; + } +} diff --git a/src/Auth0.ManagementApi/Users/EffectiveRoles/IEffectiveRolesClient.cs b/src/Auth0.ManagementApi/Users/EffectiveRoles/IEffectiveRolesClient.cs new file mode 100644 index 000000000..7de436b58 --- /dev/null +++ b/src/Auth0.ManagementApi/Users/EffectiveRoles/IEffectiveRolesClient.cs @@ -0,0 +1,19 @@ +using Auth0.ManagementApi; +using Auth0.ManagementApi.Core; + +namespace Auth0.ManagementApi.Users; + +public partial interface IEffectiveRolesClient +{ + public Auth0.ManagementApi.Users.EffectiveRoles.Sources.ISourcesClient Sources { get; } + + /// + /// Retrieve detailed list of effective roles for a user, including roles assigned directly and through group memberships. + /// + Task> ListAsync( + string id, + ListUserEffectiveRolesRequestParameters request, + RequestOptions? options = null, + CancellationToken cancellationToken = default + ); +} diff --git a/src/Auth0.ManagementApi/Users/EffectiveRoles/Requests/ListUserEffectiveRolesRequestParameters.cs b/src/Auth0.ManagementApi/Users/EffectiveRoles/Requests/ListUserEffectiveRolesRequestParameters.cs new file mode 100644 index 000000000..30fc00165 --- /dev/null +++ b/src/Auth0.ManagementApi/Users/EffectiveRoles/Requests/ListUserEffectiveRolesRequestParameters.cs @@ -0,0 +1,26 @@ +using Auth0.ManagementApi.Core; +using global::System.Text.Json.Serialization; + +namespace Auth0.ManagementApi.Users; + +[Serializable] +public record ListUserEffectiveRolesRequestParameters +{ + /// + /// Optional Id from which to start selection. + /// + [JsonIgnore] + public Optional From { get; set; } + + /// + /// Number of results per page. Defaults to 50. + /// + [JsonIgnore] + public Optional Take { get; set; } = 50; + + /// + public override string ToString() + { + return JsonUtils.Serialize(this); + } +} diff --git a/src/Auth0.ManagementApi/Users/EffectiveRoles/Sources/Groups/GroupsClient.cs b/src/Auth0.ManagementApi/Users/EffectiveRoles/Sources/Groups/GroupsClient.cs new file mode 100644 index 000000000..ccb6d3f7e --- /dev/null +++ b/src/Auth0.ManagementApi/Users/EffectiveRoles/Sources/Groups/GroupsClient.cs @@ -0,0 +1,178 @@ +using Auth0.ManagementApi; +using Auth0.ManagementApi.Core; +using global::System.Text.Json; + +namespace Auth0.ManagementApi.Users.EffectiveRoles.Sources; + +public partial class GroupsClient : IGroupsClient +{ + private readonly RawClient _client; + + internal GroupsClient(RawClient client) + { + _client = client; + } + + /// + /// Lists the groups that grant a user a specific role. + /// + private WithRawResponseTask ListInternalAsync( + string id, + ListUserRoleSourceGroupsRequestParameters request, + RequestOptions? options = null, + CancellationToken cancellationToken = default + ) + { + return new WithRawResponseTask( + ListInternalAsyncCore(id, request, options, cancellationToken) + ); + } + + private async Task< + WithRawResponse + > ListInternalAsyncCore( + string id, + ListUserRoleSourceGroupsRequestParameters request, + RequestOptions? options = null, + CancellationToken cancellationToken = default + ) + { + var _queryString = new Auth0.ManagementApi.Core.QueryStringBuilder.Builder(capacity: 3) + .Add("role_id", request.RoleId) + .Add("from", request.From.IsDefined ? request.From.Value : null) + .Add("take", request.Take.IsDefined ? request.Take.Value : null) + .MergeAdditional(options?.AdditionalQueryParameters) + .Build(); + var _headers = await new Auth0.ManagementApi.Core.HeadersBuilder.Builder() + .Add(_client.Options.Headers) + .Add(_client.Options.AdditionalHeaders) + .Add(options?.AdditionalHeaders) + .BuildAsync() + .ConfigureAwait(false); + var response = await _client + .SendRequestAsync( + new JsonRequest + { + Method = HttpMethod.Get, + Path = string.Format( + "users/{0}/effective-roles/sources/groups", + ValueConvert.ToPathParameterString(id) + ), + QueryString = _queryString, + Headers = _headers, + Options = options, + }, + cancellationToken + ) + .ConfigureAwait(false); + if (response.StatusCode is >= 200 and < 400) + { + var responseBody = await response + .Raw.Content.ReadAsStringAsync(cancellationToken) + .ConfigureAwait(false); + try + { + var responseData = JsonUtils.Deserialize( + responseBody + )!; + return new WithRawResponse() + { + Data = responseData, + RawResponse = new RawResponse() + { + StatusCode = response.Raw.StatusCode, + Url = response.Raw.RequestMessage?.RequestUri ?? new Uri("about:blank"), + Headers = ResponseHeaders.FromHttpResponseMessage(response.Raw), + }, + }; + } + catch (JsonException e) + { + throw new ManagementApiException( + "Failed to deserialize response", + response.StatusCode, + null, + e + ); + } + } + { + var responseBody = await response + .Raw.Content.ReadAsStringAsync(cancellationToken) + .ConfigureAwait(false); + try + { + switch (response.StatusCode) + { + case 400: + throw new BadRequestError(JsonUtils.Deserialize(responseBody)); + case 401: + throw new UnauthorizedError(JsonUtils.Deserialize(responseBody)); + case 403: + throw new ForbiddenError(JsonUtils.Deserialize(responseBody)); + case 429: + throw new TooManyRequestsError(JsonUtils.Deserialize(responseBody)); + } + } + catch (JsonException) + { + // unable to map error response, throwing generic error + } + throw new ManagementApiException( + $"Error with status code {response.StatusCode}", + response.StatusCode, + responseBody + ); + } + } + + /// + /// Lists the groups that grant a user a specific role. + /// + /// + /// await client.Users.EffectiveRoles.Sources.Groups.ListAsync( + /// "id", + /// new ListUserRoleSourceGroupsRequestParameters + /// { + /// RoleId = "role_id", + /// From = "from", + /// Take = 1, + /// } + /// ); + /// + public async Task> ListAsync( + string id, + ListUserRoleSourceGroupsRequestParameters request, + RequestOptions? options = null, + CancellationToken cancellationToken = default + ) + { + if (request is not null) + { + request = request with { }; + } + var pager = await CursorPager< + ListUserRoleSourceGroupsRequestParameters, + RequestOptions?, + ListUserRoleSourceGroupsResponseContent, + string?, + Group + > + .CreateInstanceAsync( + request, + options, + async (request, options, cancellationToken) => + await ListInternalAsync(id, request, options, cancellationToken) + .WithRawResponse(), + (request, cursor) => + { + request.From = cursor; + }, + response => response.Next, + response => response.Groups?.ToList(), + cancellationToken + ) + .ConfigureAwait(false); + return pager; + } +} diff --git a/src/Auth0.ManagementApi/Users/EffectiveRoles/Sources/Groups/IGroupsClient.cs b/src/Auth0.ManagementApi/Users/EffectiveRoles/Sources/Groups/IGroupsClient.cs new file mode 100644 index 000000000..83e8bc8a6 --- /dev/null +++ b/src/Auth0.ManagementApi/Users/EffectiveRoles/Sources/Groups/IGroupsClient.cs @@ -0,0 +1,17 @@ +using Auth0.ManagementApi; +using Auth0.ManagementApi.Core; + +namespace Auth0.ManagementApi.Users.EffectiveRoles.Sources; + +public partial interface IGroupsClient +{ + /// + /// Lists the groups that grant a user a specific role. + /// + Task> ListAsync( + string id, + ListUserRoleSourceGroupsRequestParameters request, + RequestOptions? options = null, + CancellationToken cancellationToken = default + ); +} diff --git a/src/Auth0.ManagementApi/Users/EffectiveRoles/Sources/Groups/Requests/ListUserRoleSourceGroupsRequestParameters.cs b/src/Auth0.ManagementApi/Users/EffectiveRoles/Sources/Groups/Requests/ListUserRoleSourceGroupsRequestParameters.cs new file mode 100644 index 000000000..bc1e03f06 --- /dev/null +++ b/src/Auth0.ManagementApi/Users/EffectiveRoles/Sources/Groups/Requests/ListUserRoleSourceGroupsRequestParameters.cs @@ -0,0 +1,32 @@ +using Auth0.ManagementApi.Core; +using global::System.Text.Json.Serialization; + +namespace Auth0.ManagementApi.Users.EffectiveRoles.Sources; + +[Serializable] +public record ListUserRoleSourceGroupsRequestParameters +{ + /// + /// ID of the role to get source groups for. + /// + [JsonIgnore] + public required string RoleId { get; set; } + + /// + /// Optional Id from which to start selection. + /// + [JsonIgnore] + public Optional From { get; set; } + + /// + /// Number of results per page. Defaults to 50. + /// + [JsonIgnore] + public Optional Take { get; set; } = 50; + + /// + public override string ToString() + { + return JsonUtils.Serialize(this); + } +} diff --git a/src/Auth0.ManagementApi/Users/EffectiveRoles/Sources/ISourcesClient.cs b/src/Auth0.ManagementApi/Users/EffectiveRoles/Sources/ISourcesClient.cs new file mode 100644 index 000000000..2de0a981e --- /dev/null +++ b/src/Auth0.ManagementApi/Users/EffectiveRoles/Sources/ISourcesClient.cs @@ -0,0 +1,6 @@ +namespace Auth0.ManagementApi.Users.EffectiveRoles.Sources; + +public partial interface ISourcesClient +{ + public IGroupsClient Groups { get; } +} diff --git a/src/Auth0.ManagementApi/Users/EffectiveRoles/Sources/SourcesClient.cs b/src/Auth0.ManagementApi/Users/EffectiveRoles/Sources/SourcesClient.cs new file mode 100644 index 000000000..378270383 --- /dev/null +++ b/src/Auth0.ManagementApi/Users/EffectiveRoles/Sources/SourcesClient.cs @@ -0,0 +1,16 @@ +using Auth0.ManagementApi.Core; + +namespace Auth0.ManagementApi.Users.EffectiveRoles.Sources; + +public partial class SourcesClient : ISourcesClient +{ + private readonly RawClient _client; + + internal SourcesClient(RawClient client) + { + _client = client; + Groups = new GroupsClient(_client); + } + + public IGroupsClient Groups { get; } +} diff --git a/src/Auth0.ManagementApi/Users/IUsersClient.cs b/src/Auth0.ManagementApi/Users/IUsersClient.cs index 38e244612..799f9d4d4 100644 --- a/src/Auth0.ManagementApi/Users/IUsersClient.cs +++ b/src/Auth0.ManagementApi/Users/IUsersClient.cs @@ -8,6 +8,8 @@ public partial interface IUsersClient public IAuthenticationMethodsClient AuthenticationMethods { get; } public IAuthenticatorsClient Authenticators { get; } public IConnectedAccountsClient ConnectedAccounts { get; } + public IEffectivePermissionsClient EffectivePermissions { get; } + public Auth0.ManagementApi.Users.IEffectiveRolesClient EffectiveRoles { get; } public Auth0.ManagementApi.Users.IEnrollmentsClient Enrollments { get; } public IFederatedConnectionsTokensetsClient FederatedConnectionsTokensets { get; } public Auth0.ManagementApi.Users.IGroupsClient Groups { get; } diff --git a/src/Auth0.ManagementApi/Users/UsersClient.cs b/src/Auth0.ManagementApi/Users/UsersClient.cs index 9afaee40b..a4cd97554 100644 --- a/src/Auth0.ManagementApi/Users/UsersClient.cs +++ b/src/Auth0.ManagementApi/Users/UsersClient.cs @@ -14,6 +14,8 @@ internal UsersClient(RawClient client) AuthenticationMethods = new AuthenticationMethodsClient(_client); Authenticators = new AuthenticatorsClient(_client); ConnectedAccounts = new ConnectedAccountsClient(_client); + EffectivePermissions = new EffectivePermissionsClient(_client); + EffectiveRoles = new Auth0.ManagementApi.Users.EffectiveRolesClient(_client); Enrollments = new Auth0.ManagementApi.Users.EnrollmentsClient(_client); FederatedConnectionsTokensets = new FederatedConnectionsTokensetsClient(_client); Groups = new Auth0.ManagementApi.Users.GroupsClient(_client); @@ -34,6 +36,10 @@ internal UsersClient(RawClient client) public IConnectedAccountsClient ConnectedAccounts { get; } + public IEffectivePermissionsClient EffectivePermissions { get; } + + public Auth0.ManagementApi.Users.IEffectiveRolesClient EffectiveRoles { get; } + public Auth0.ManagementApi.Users.IEnrollmentsClient Enrollments { get; } public IFederatedConnectionsTokensetsClient FederatedConnectionsTokensets { get; } diff --git a/tests/Auth0.ManagementApi.Test/Unit/MockServer/Organizations/Groups/ListTest.cs b/tests/Auth0.ManagementApi.Test/Unit/MockServer/Organizations/Groups/ListTest.cs new file mode 100644 index 000000000..cb64616d2 --- /dev/null +++ b/tests/Auth0.ManagementApi.Test/Unit/MockServer/Organizations/Groups/ListTest.cs @@ -0,0 +1,57 @@ +using Auth0.ManagementApi.Organizations; +using Auth0.ManagementApi.Test.Unit.MockServer; +using NUnit.Framework; + +namespace Auth0.ManagementApi.Test.Unit.MockServer.Organizations.Groups; + +[TestFixture] +[Parallelizable(ParallelScope.Self)] +public class ListTest : BaseMockServerTest +{ + [NUnit.Framework.Test] + public async Task MockServerTest() + { + const string mockResponse = """ + { + "groups": [ + { + "id": "id", + "name": "name", + "external_id": "external_id", + "connection_id": "connection_id", + "tenant_name": "tenant_name", + "created_at": "2024-01-15T09:30:00.000Z", + "updated_at": "2024-01-15T09:30:00.000Z" + } + ], + "next": "next" + } + """; + + Server + .Given( + WireMock + .RequestBuilders.Request.Create() + .WithPath("/organizations/organization_id/groups") + .WithParam("from", "from") + .WithParam("take", "1") + .UsingGet() + ) + .RespondWith( + WireMock + .ResponseBuilders.Response.Create() + .WithStatusCode(200) + .WithBody(mockResponse) + ); + + var items = await Client.Organizations.Groups.ListAsync( + "organization_id", + new ListOrganizationGroupsRequestParameters { From = "from", Take = 1 } + ); + await foreach (var item in items) + { + Assert.That(item, Is.Not.Null); + break; // Only check the first item + } + } +} diff --git a/tests/Auth0.ManagementApi.Test/Unit/MockServer/Organizations/Groups/Roles/CreateTest.cs b/tests/Auth0.ManagementApi.Test/Unit/MockServer/Organizations/Groups/Roles/CreateTest.cs new file mode 100644 index 000000000..8c9b98a63 --- /dev/null +++ b/tests/Auth0.ManagementApi.Test/Unit/MockServer/Organizations/Groups/Roles/CreateTest.cs @@ -0,0 +1,44 @@ +using Auth0.ManagementApi.Organizations.Groups; +using Auth0.ManagementApi.Test.Unit.MockServer; +using NUnit.Framework; + +namespace Auth0.ManagementApi.Test.Unit.MockServer.Organizations.Groups.Roles; + +[TestFixture] +[Parallelizable(ParallelScope.Self)] +public class CreateTest : BaseMockServerTest +{ + [NUnit.Framework.Test] + public void MockServerTest() + { + const string requestJson = """ + { + "roles": [ + "roles" + ] + } + """; + + Server + .Given( + WireMock + .RequestBuilders.Request.Create() + .WithPath("/organizations/organization_id/groups/group_id/roles") + .WithHeader("Content-Type", "application/json") + .UsingPost() + .WithBodyAsJson(requestJson) + ) + .RespondWith(WireMock.ResponseBuilders.Response.Create().WithStatusCode(200)); + + Assert.DoesNotThrowAsync(async () => + await Client.Organizations.Groups.Roles.CreateAsync( + "organization_id", + "group_id", + new CreateOrganizationGroupRolesRequestContent + { + Roles = new List() { "roles" }, + } + ) + ); + } +} diff --git a/tests/Auth0.ManagementApi.Test/Unit/MockServer/Organizations/Groups/Roles/DeleteTest.cs b/tests/Auth0.ManagementApi.Test/Unit/MockServer/Organizations/Groups/Roles/DeleteTest.cs new file mode 100644 index 000000000..2a9b99090 --- /dev/null +++ b/tests/Auth0.ManagementApi.Test/Unit/MockServer/Organizations/Groups/Roles/DeleteTest.cs @@ -0,0 +1,44 @@ +using Auth0.ManagementApi.Organizations.Groups; +using Auth0.ManagementApi.Test.Unit.MockServer; +using NUnit.Framework; + +namespace Auth0.ManagementApi.Test.Unit.MockServer.Organizations.Groups.Roles; + +[TestFixture] +[Parallelizable(ParallelScope.Self)] +public class DeleteTest : BaseMockServerTest +{ + [NUnit.Framework.Test] + public void MockServerTest() + { + const string requestJson = """ + { + "roles": [ + "roles" + ] + } + """; + + Server + .Given( + WireMock + .RequestBuilders.Request.Create() + .WithPath("/organizations/organization_id/groups/group_id/roles") + .WithHeader("Content-Type", "application/json") + .UsingDelete() + .WithBodyAsJson(requestJson) + ) + .RespondWith(WireMock.ResponseBuilders.Response.Create().WithStatusCode(200)); + + Assert.DoesNotThrowAsync(async () => + await Client.Organizations.Groups.Roles.DeleteAsync( + "organization_id", + "group_id", + new DeleteOrganizationGroupRolesRequestContent + { + Roles = new List() { "roles" }, + } + ) + ); + } +} diff --git a/tests/Auth0.ManagementApi.Test/Unit/MockServer/Organizations/Groups/Roles/ListTest.cs b/tests/Auth0.ManagementApi.Test/Unit/MockServer/Organizations/Groups/Roles/ListTest.cs new file mode 100644 index 000000000..e05e74ac7 --- /dev/null +++ b/tests/Auth0.ManagementApi.Test/Unit/MockServer/Organizations/Groups/Roles/ListTest.cs @@ -0,0 +1,54 @@ +using Auth0.ManagementApi.Organizations.Groups; +using Auth0.ManagementApi.Test.Unit.MockServer; +using NUnit.Framework; + +namespace Auth0.ManagementApi.Test.Unit.MockServer.Organizations.Groups.Roles; + +[TestFixture] +[Parallelizable(ParallelScope.Self)] +public class ListTest : BaseMockServerTest +{ + [NUnit.Framework.Test] + public async Task MockServerTest() + { + const string mockResponse = """ + { + "roles": [ + { + "id": "id", + "name": "name", + "description": "description" + } + ], + "next": "next" + } + """; + + Server + .Given( + WireMock + .RequestBuilders.Request.Create() + .WithPath("/organizations/organization_id/groups/group_id/roles") + .WithParam("from", "from") + .WithParam("take", "1") + .UsingGet() + ) + .RespondWith( + WireMock + .ResponseBuilders.Response.Create() + .WithStatusCode(200) + .WithBody(mockResponse) + ); + + var items = await Client.Organizations.Groups.Roles.ListAsync( + "organization_id", + "group_id", + new ListOrganizationGroupRolesRequestParameters { From = "from", Take = 1 } + ); + await foreach (var item in items) + { + Assert.That(item, Is.Not.Null); + break; // Only check the first item + } + } +} diff --git a/tests/Auth0.ManagementApi.Test/Unit/MockServer/Organizations/Members/EffectiveRoles/ListTest.cs b/tests/Auth0.ManagementApi.Test/Unit/MockServer/Organizations/Members/EffectiveRoles/ListTest.cs new file mode 100644 index 000000000..9f6b9f0ac --- /dev/null +++ b/tests/Auth0.ManagementApi.Test/Unit/MockServer/Organizations/Members/EffectiveRoles/ListTest.cs @@ -0,0 +1,57 @@ +using Auth0.ManagementApi.Organizations.Members; +using Auth0.ManagementApi.Test.Unit.MockServer; +using NUnit.Framework; + +namespace Auth0.ManagementApi.Test.Unit.MockServer.Organizations.Members.EffectiveRoles; + +[TestFixture] +[Parallelizable(ParallelScope.Self)] +public class ListTest : BaseMockServerTest +{ + [NUnit.Framework.Test] + public async Task MockServerTest() + { + const string mockResponse = """ + { + "roles": [ + { + "id": "id", + "name": "name", + "description": "description", + "sources": [ + "direct" + ] + } + ], + "next": "next" + } + """; + + Server + .Given( + WireMock + .RequestBuilders.Request.Create() + .WithPath("/organizations/id/members/user_id/effective-roles") + .WithParam("from", "from") + .WithParam("take", "1") + .UsingGet() + ) + .RespondWith( + WireMock + .ResponseBuilders.Response.Create() + .WithStatusCode(200) + .WithBody(mockResponse) + ); + + var items = await Client.Organizations.Members.EffectiveRoles.ListAsync( + "id", + "user_id", + new ListOrganizationMemberEffectiveRolesRequestParameters { From = "from", Take = 1 } + ); + await foreach (var item in items) + { + Assert.That(item, Is.Not.Null); + break; // Only check the first item + } + } +} diff --git a/tests/Auth0.ManagementApi.Test/Unit/MockServer/Organizations/Members/EffectiveRoles/Sources/Groups/ListTest.cs b/tests/Auth0.ManagementApi.Test/Unit/MockServer/Organizations/Members/EffectiveRoles/Sources/Groups/ListTest.cs new file mode 100644 index 000000000..5b4d5783a --- /dev/null +++ b/tests/Auth0.ManagementApi.Test/Unit/MockServer/Organizations/Members/EffectiveRoles/Sources/Groups/ListTest.cs @@ -0,0 +1,64 @@ +using Auth0.ManagementApi.Organizations.Members.EffectiveRoles.Sources; +using Auth0.ManagementApi.Test.Unit.MockServer; +using NUnit.Framework; + +namespace Auth0.ManagementApi.Test.Unit.MockServer.Organizations.Members.EffectiveRoles.Sources.Groups; + +[TestFixture] +[Parallelizable(ParallelScope.Self)] +public class ListTest : BaseMockServerTest +{ + [NUnit.Framework.Test] + public async Task MockServerTest() + { + const string mockResponse = """ + { + "groups": [ + { + "id": "id", + "name": "name", + "external_id": "external_id", + "connection_id": "connection_id", + "tenant_name": "tenant_name", + "created_at": "2024-01-15T09:30:00.000Z", + "updated_at": "2024-01-15T09:30:00.000Z" + } + ], + "next": "next" + } + """; + + Server + .Given( + WireMock + .RequestBuilders.Request.Create() + .WithPath("/organizations/id/members/user_id/effective-roles/sources/groups") + .WithParam("from", "from") + .WithParam("take", "1") + .WithParam("role_id", "role_id") + .UsingGet() + ) + .RespondWith( + WireMock + .ResponseBuilders.Response.Create() + .WithStatusCode(200) + .WithBody(mockResponse) + ); + + var items = await Client.Organizations.Members.EffectiveRoles.Sources.Groups.ListAsync( + "id", + "user_id", + new ListOrganizationMemberRoleSourceGroupsRequestParameters + { + From = "from", + Take = 1, + RoleId = "role_id", + } + ); + await foreach (var item in items) + { + Assert.That(item, Is.Not.Null); + break; // Only check the first item + } + } +} diff --git a/tests/Auth0.ManagementApi.Test/Unit/MockServer/Roles/Groups/CreateTest.cs b/tests/Auth0.ManagementApi.Test/Unit/MockServer/Roles/Groups/CreateTest.cs new file mode 100644 index 000000000..cf04d45c0 --- /dev/null +++ b/tests/Auth0.ManagementApi.Test/Unit/MockServer/Roles/Groups/CreateTest.cs @@ -0,0 +1,40 @@ +using Auth0.ManagementApi.Roles; +using Auth0.ManagementApi.Test.Unit.MockServer; +using NUnit.Framework; + +namespace Auth0.ManagementApi.Test.Unit.MockServer.Roles.Groups; + +[TestFixture] +[Parallelizable(ParallelScope.Self)] +public class CreateTest : BaseMockServerTest +{ + [NUnit.Framework.Test] + public void MockServerTest() + { + const string requestJson = """ + { + "groups": [ + "groups" + ] + } + """; + + Server + .Given( + WireMock + .RequestBuilders.Request.Create() + .WithPath("/roles/id/groups") + .WithHeader("Content-Type", "application/json") + .UsingPost() + .WithBodyAsJson(requestJson) + ) + .RespondWith(WireMock.ResponseBuilders.Response.Create().WithStatusCode(200)); + + Assert.DoesNotThrowAsync(async () => + await Client.Roles.Groups.CreateAsync( + "id", + new AssignRoleGroupsRequestContent { Groups = new List() { "groups" } } + ) + ); + } +} diff --git a/tests/Auth0.ManagementApi.Test/Unit/MockServer/Roles/Groups/DeleteTest.cs b/tests/Auth0.ManagementApi.Test/Unit/MockServer/Roles/Groups/DeleteTest.cs new file mode 100644 index 000000000..adf759cd8 --- /dev/null +++ b/tests/Auth0.ManagementApi.Test/Unit/MockServer/Roles/Groups/DeleteTest.cs @@ -0,0 +1,40 @@ +using Auth0.ManagementApi.Roles; +using Auth0.ManagementApi.Test.Unit.MockServer; +using NUnit.Framework; + +namespace Auth0.ManagementApi.Test.Unit.MockServer.Roles.Groups; + +[TestFixture] +[Parallelizable(ParallelScope.Self)] +public class DeleteTest : BaseMockServerTest +{ + [NUnit.Framework.Test] + public void MockServerTest() + { + const string requestJson = """ + { + "groups": [ + "groups" + ] + } + """; + + Server + .Given( + WireMock + .RequestBuilders.Request.Create() + .WithPath("/roles/id/groups") + .WithHeader("Content-Type", "application/json") + .UsingDelete() + .WithBodyAsJson(requestJson) + ) + .RespondWith(WireMock.ResponseBuilders.Response.Create().WithStatusCode(200)); + + Assert.DoesNotThrowAsync(async () => + await Client.Roles.Groups.DeleteAsync( + "id", + new DeleteRoleGroupsRequestContent { Groups = new List() { "groups" } } + ) + ); + } +} diff --git a/tests/Auth0.ManagementApi.Test/Unit/MockServer/Roles/Groups/GetTest.cs b/tests/Auth0.ManagementApi.Test/Unit/MockServer/Roles/Groups/GetTest.cs new file mode 100644 index 000000000..ee027088f --- /dev/null +++ b/tests/Auth0.ManagementApi.Test/Unit/MockServer/Roles/Groups/GetTest.cs @@ -0,0 +1,57 @@ +using Auth0.ManagementApi.Roles; +using Auth0.ManagementApi.Test.Unit.MockServer; +using NUnit.Framework; + +namespace Auth0.ManagementApi.Test.Unit.MockServer.Roles.Groups; + +[TestFixture] +[Parallelizable(ParallelScope.Self)] +public class GetTest : BaseMockServerTest +{ + [NUnit.Framework.Test] + public async Task MockServerTest() + { + const string mockResponse = """ + { + "groups": [ + { + "id": "id", + "name": "name", + "external_id": "external_id", + "connection_id": "connection_id", + "tenant_name": "tenant_name", + "created_at": "2024-01-15T09:30:00.000Z", + "updated_at": "2024-01-15T09:30:00.000Z" + } + ], + "next": "next" + } + """; + + Server + .Given( + WireMock + .RequestBuilders.Request.Create() + .WithPath("/roles/id/groups") + .WithParam("from", "from") + .WithParam("take", "1") + .UsingGet() + ) + .RespondWith( + WireMock + .ResponseBuilders.Response.Create() + .WithStatusCode(200) + .WithBody(mockResponse) + ); + + var items = await Client.Roles.Groups.GetAsync( + "id", + new ListRoleGroupsParameters { From = "from", Take = 1 } + ); + await foreach (var item in items) + { + Assert.That(item, Is.Not.Null); + break; // Only check the first item + } + } +} diff --git a/tests/Auth0.ManagementApi.Test/Unit/MockServer/Tenants/Settings/GetTest.cs b/tests/Auth0.ManagementApi.Test/Unit/MockServer/Tenants/Settings/GetTest.cs index d5c49e9dc..e785ae59b 100644 --- a/tests/Auth0.ManagementApi.Test/Unit/MockServer/Tenants/Settings/GetTest.cs +++ b/tests/Auth0.ManagementApi.Test/Unit/MockServer/Tenants/Settings/GetTest.cs @@ -116,7 +116,13 @@ public async Task MockServerTest() "client_id_metadata_document_supported": true, "phone_consolidated_experience": true, "enable_ai_guide": true, - "dynamic_client_registration_security_mode": "strict" + "dynamic_client_registration_security_mode": "strict", + "country_codes": { + "list": [ + "list" + ], + "mode": "allow" + } } """; diff --git a/tests/Auth0.ManagementApi.Test/Unit/MockServer/Tenants/Settings/UpdateTest.cs b/tests/Auth0.ManagementApi.Test/Unit/MockServer/Tenants/Settings/UpdateTest.cs index b426c9f26..fa38ed8a8 100644 --- a/tests/Auth0.ManagementApi.Test/Unit/MockServer/Tenants/Settings/UpdateTest.cs +++ b/tests/Auth0.ManagementApi.Test/Unit/MockServer/Tenants/Settings/UpdateTest.cs @@ -120,7 +120,13 @@ public async Task MockServerTest() "client_id_metadata_document_supported": true, "phone_consolidated_experience": true, "enable_ai_guide": true, - "dynamic_client_registration_security_mode": "strict" + "dynamic_client_registration_security_mode": "strict", + "country_codes": { + "list": [ + "list" + ], + "mode": "allow" + } } """; diff --git a/tests/Auth0.ManagementApi.Test/Unit/MockServer/Users/EffectivePermissions/ListTest.cs b/tests/Auth0.ManagementApi.Test/Unit/MockServer/Users/EffectivePermissions/ListTest.cs new file mode 100644 index 000000000..f66f5b7f7 --- /dev/null +++ b/tests/Auth0.ManagementApi.Test/Unit/MockServer/Users/EffectivePermissions/ListTest.cs @@ -0,0 +1,63 @@ +using Auth0.ManagementApi.Test.Unit.MockServer; +using Auth0.ManagementApi.Users; +using NUnit.Framework; + +namespace Auth0.ManagementApi.Test.Unit.MockServer.Users.EffectivePermissions; + +[TestFixture] +[Parallelizable(ParallelScope.Self)] +public class ListTest : BaseMockServerTest +{ + [NUnit.Framework.Test] + public async Task MockServerTest() + { + const string mockResponse = """ + { + "permissions": [ + { + "resource_server_identifier": "resource_server_identifier", + "permission_name": "permission_name", + "resource_server_name": "resource_server_name", + "description": "description", + "sources": [ + "direct" + ] + } + ], + "next": "next" + } + """; + + Server + .Given( + WireMock + .RequestBuilders.Request.Create() + .WithPath("/users/id/effective-permissions") + .WithParam("from", "from") + .WithParam("take", "1") + .WithParam("resource_server_identifier", "resource_server_identifier") + .UsingGet() + ) + .RespondWith( + WireMock + .ResponseBuilders.Response.Create() + .WithStatusCode(200) + .WithBody(mockResponse) + ); + + var items = await Client.Users.EffectivePermissions.ListAsync( + "id", + new ListUserEffectivePermissionsRequestParameters + { + From = "from", + Take = 1, + ResourceServerIdentifier = "resource_server_identifier", + } + ); + await foreach (var item in items) + { + Assert.That(item, Is.Not.Null); + break; // Only check the first item + } + } +} diff --git a/tests/Auth0.ManagementApi.Test/Unit/MockServer/Users/EffectivePermissions/Sources/Roles/ListTest.cs b/tests/Auth0.ManagementApi.Test/Unit/MockServer/Users/EffectivePermissions/Sources/Roles/ListTest.cs new file mode 100644 index 000000000..e976feb90 --- /dev/null +++ b/tests/Auth0.ManagementApi.Test/Unit/MockServer/Users/EffectivePermissions/Sources/Roles/ListTest.cs @@ -0,0 +1,64 @@ +using Auth0.ManagementApi.Test.Unit.MockServer; +using Auth0.ManagementApi.Users.EffectivePermissions.Sources; +using NUnit.Framework; + +namespace Auth0.ManagementApi.Test.Unit.MockServer.Users.EffectivePermissions.Sources.Roles; + +[TestFixture] +[Parallelizable(ParallelScope.Self)] +public class ListTest : BaseMockServerTest +{ + [NUnit.Framework.Test] + public async Task MockServerTest() + { + const string mockResponse = """ + { + "roles": [ + { + "id": "id", + "name": "name", + "description": "description", + "sources": [ + "direct" + ] + } + ], + "next": "next" + } + """; + + Server + .Given( + WireMock + .RequestBuilders.Request.Create() + .WithPath("/users/id/effective-permissions/sources/effective-roles") + .WithParam("from", "from") + .WithParam("take", "1") + .WithParam("resource_server_identifier", "resource_server_identifier") + .WithParam("permission_name", "permission_name") + .UsingGet() + ) + .RespondWith( + WireMock + .ResponseBuilders.Response.Create() + .WithStatusCode(200) + .WithBody(mockResponse) + ); + + var items = await Client.Users.EffectivePermissions.Sources.Roles.ListAsync( + "id", + new ListUserEffectivePermissionRoleSourceRequestParameters + { + From = "from", + Take = 1, + ResourceServerIdentifier = "resource_server_identifier", + PermissionName = "permission_name", + } + ); + await foreach (var item in items) + { + Assert.That(item, Is.Not.Null); + break; // Only check the first item + } + } +} diff --git a/tests/Auth0.ManagementApi.Test/Unit/MockServer/Users/EffectiveRoles/ListTest.cs b/tests/Auth0.ManagementApi.Test/Unit/MockServer/Users/EffectiveRoles/ListTest.cs new file mode 100644 index 000000000..b15014902 --- /dev/null +++ b/tests/Auth0.ManagementApi.Test/Unit/MockServer/Users/EffectiveRoles/ListTest.cs @@ -0,0 +1,56 @@ +using Auth0.ManagementApi.Test.Unit.MockServer; +using Auth0.ManagementApi.Users; +using NUnit.Framework; + +namespace Auth0.ManagementApi.Test.Unit.MockServer.Users.EffectiveRoles; + +[TestFixture] +[Parallelizable(ParallelScope.Self)] +public class ListTest : BaseMockServerTest +{ + [NUnit.Framework.Test] + public async Task MockServerTest() + { + const string mockResponse = """ + { + "roles": [ + { + "id": "id", + "name": "name", + "description": "description", + "sources": [ + "direct" + ] + } + ], + "next": "next" + } + """; + + Server + .Given( + WireMock + .RequestBuilders.Request.Create() + .WithPath("/users/id/effective-roles") + .WithParam("from", "from") + .WithParam("take", "1") + .UsingGet() + ) + .RespondWith( + WireMock + .ResponseBuilders.Response.Create() + .WithStatusCode(200) + .WithBody(mockResponse) + ); + + var items = await Client.Users.EffectiveRoles.ListAsync( + "id", + new ListUserEffectiveRolesRequestParameters { From = "from", Take = 1 } + ); + await foreach (var item in items) + { + Assert.That(item, Is.Not.Null); + break; // Only check the first item + } + } +} diff --git a/tests/Auth0.ManagementApi.Test/Unit/MockServer/Users/EffectiveRoles/Sources/Groups/ListTest.cs b/tests/Auth0.ManagementApi.Test/Unit/MockServer/Users/EffectiveRoles/Sources/Groups/ListTest.cs new file mode 100644 index 000000000..a50d83128 --- /dev/null +++ b/tests/Auth0.ManagementApi.Test/Unit/MockServer/Users/EffectiveRoles/Sources/Groups/ListTest.cs @@ -0,0 +1,63 @@ +using Auth0.ManagementApi.Test.Unit.MockServer; +using Auth0.ManagementApi.Users.EffectiveRoles.Sources; +using NUnit.Framework; + +namespace Auth0.ManagementApi.Test.Unit.MockServer.Users.EffectiveRoles.Sources.Groups; + +[TestFixture] +[Parallelizable(ParallelScope.Self)] +public class ListTest : BaseMockServerTest +{ + [NUnit.Framework.Test] + public async Task MockServerTest() + { + const string mockResponse = """ + { + "groups": [ + { + "id": "id", + "name": "name", + "external_id": "external_id", + "connection_id": "connection_id", + "tenant_name": "tenant_name", + "created_at": "2024-01-15T09:30:00.000Z", + "updated_at": "2024-01-15T09:30:00.000Z" + } + ], + "next": "next" + } + """; + + Server + .Given( + WireMock + .RequestBuilders.Request.Create() + .WithPath("/users/id/effective-roles/sources/groups") + .WithParam("role_id", "role_id") + .WithParam("from", "from") + .WithParam("take", "1") + .UsingGet() + ) + .RespondWith( + WireMock + .ResponseBuilders.Response.Create() + .WithStatusCode(200) + .WithBody(mockResponse) + ); + + var items = await Client.Users.EffectiveRoles.Sources.Groups.ListAsync( + "id", + new ListUserRoleSourceGroupsRequestParameters + { + RoleId = "role_id", + From = "from", + Take = 1, + } + ); + await foreach (var item in items) + { + Assert.That(item, Is.Not.Null); + break; // Only check the first item + } + } +}