Skip to content

Add Support for Limiting M2M Usage via Tenant-Wide Defaults and Client/Organization Overrides #537

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions management/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,20 @@ type Client struct {
DefaultOrganization *ClientDefaultOrganization `json:"default_organization,omitempty"`

TokenExchange *ClientTokenExchange `json:"token_exchange,omitempty"`

// TokenQuota Token Quota configuration, to configure quotas for token issuance for clients.
//
// To unset values (set to null), use a PATCH request like this:
//
// PATCH /api/v2/clients/{id}
//
// {
// "token_quota": null
// }
//
// For more details on making custom requests, refer to the Auth0 Go SDK examples:
// https://github.com/auth0/go-auth0/blob/main/EXAMPLES.md#providing-a-custom-user-struct
TokenQuota *TokenQuota `json:"token_quota,omitempty"`
}

// ClientTokenExchange allows configuration for token exchange.
Expand Down
87 changes: 87 additions & 0 deletions management/management.gen.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

96 changes: 96 additions & 0 deletions management/management.gen_test.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 14 additions & 0 deletions management/organization.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,20 @@ type Organization struct {
// See POST enabled_connections endpoint for the object format.
// (Max of 10 connections allowed)
EnabledConnections []*OrganizationConnection `json:"enabled_connections,omitempty"`

// TokenQuota configuration, to configure quotas for token issuance for organizations.
// To unset values (set to null), use a PATCH request like this:
//
//
// PATCH /api/v2/organizations/{id}
//
// {
// "token_quota": null
// }
//
// For more details on making custom requests, refer to the Auth0 Go SDK examples:
// https://github.com/auth0/go-auth0/blob/main/EXAMPLES.md#providing-a-custom-user-struct
TokenQuota *TokenQuota `json:"token_quota,omitempty"`
}

// OrganizationBranding holds branding information for an Organization.
Expand Down
40 changes: 40 additions & 0 deletions management/tenant.go
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,46 @@ type Tenant struct {

// Enables the use of Pushed Authorization Requests
PushedAuthorizationRequestsSupported *bool `json:"pushed_authorization_requests_supported,omitempty"`

// Token Quota configuration, to configure quotas for token issuance for clients and organizations.
// Applied to all clients and organizations unless overridden in individual client or organization settings.
//
// To unset values (set to null), use a PATCH request like this:
//
// PATCH /api/v2/tenants/settings
// {
// "default_token_quota": null
// }
//
// For more details on making custom requests, refer to the Auth0 Go SDK examples:
// https://github.com/auth0/go-auth0/blob/main/EXAMPLES.md#providing-a-custom-user-struct
DefaultTokenQuota *TenantDefaultTokenQuota `json:"default_token_quota,omitempty"`
}

// TenantDefaultTokenQuota holds settings for the default token quota.
type TenantDefaultTokenQuota struct {
// Token quota configuration for clients.
Clients *TokenQuota `json:"clients,omitempty"`
// Token quota configuration for organizations.
Organizations *TokenQuota `json:"organizations,omitempty"`
}

// TokenQuota holds settings for the token quota configuration.
type TokenQuota struct {
ClientCredentials *TokenQuotaClientCredentials `json:"client_credentials,omitempty"`
}

// TokenQuotaClientCredentials holds settings for the token quota configuration client credentials.
type TokenQuotaClientCredentials struct {
// If enabled, the quota will be enforced and requests in excess of the quota will fail.
// If disabled, the quota will not be enforced, but notifications for requests exceeding the quota will be available in logs.
Enforce *bool `json:"enforce,omitempty"`

// Maximum number of issued tokens per day
PerDay *int `json:"per_day,omitempty"`

// Maximum number of issued tokens per hour
PerHour *int `json:"per_hour,omitempty"`
}

// TenantMTLSConfiguration hold settings for mTLS. If true, enables mTLS endpoint aliases.
Expand Down
Loading
Loading