Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
aced943
feat(auth0): wrap the calls portals needs
jacobovidal Nov 5, 2026
08112d4
feat(portals): add the stores and a fake tenant
jacobovidal Nov 5, 2026
ba3e9dd
feat(cli): implement the portals stores on the SDK
jacobovidal Nov 6, 2026
fe93fd1
feat(portals): check the permissions before setup
jacobovidal Nov 6, 2026
6992424
feat(portals): add the terminal output
jacobovidal Nov 6, 2026
03563ba
feat(portals): set up a consumer portal
jacobovidal Nov 6, 2026
371dc42
feat(portals): set up a business portal
jacobovidal Nov 6, 2026
eeed332
feat(cli): replace universal-portals setup
jacobovidal Nov 6, 2026
d857ab1
feat(cli): add --dry-run to universal-portals setup
jacobovidal Nov 6, 2026
16a8c53
feat(portals): audit a portal and fix its errors
jacobovidal Nov 6, 2026
795c571
feat(cli): add universal-portals audit
jacobovidal Nov 6, 2026
5268dc5
test(portals): check the scopes cover every request
jacobovidal Nov 6, 2026
3821125
fix(cli): draw a blank line as the bare rail
jacobovidal Nov 6, 2026
314716e
fix(portals): report a taken slug as slug_taken
jacobovidal Nov 6, 2026
a717bbd
fix(cli): keep a portal or form id as one path segment
jacobovidal Nov 6, 2026
f3796c6
fix(portals): report every failed audit read
jacobovidal Nov 6, 2026
7cde049
fix(portalstest): leave a setting alone when it is empty
jacobovidal Nov 6, 2026
35aad50
fix(portals): fix a sole client_credentials grant by hand
jacobovidal Nov 6, 2026
fb4ce67
test(cli): pin the reason of every portals error
jacobovidal Nov 6, 2026
c00d978
fix(cli): read an empty answer as an empty list
jacobovidal Nov 6, 2026
8458b33
test(cli): dry-run a business portal end to end
jacobovidal Nov 6, 2026
3d04a79
fix(portals): probe the writes a rerun and a role make
jacobovidal Nov 6, 2026
91dd4a9
perf(portals): read the permissions of the roles together
jacobovidal Nov 6, 2026
db21325
refactor(portals): check the setup options in one place
jacobovidal Nov 6, 2026
dde896c
refactor(portals): decide in one place if a domain is ready
jacobovidal Nov 6, 2026
8835fd0
fix(portals): name the field a portal cannot be read from
jacobovidal Nov 6, 2026
2c8818e
refactor(portals): use what the standard library has
jacobovidal Nov 6, 2026
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
5 changes: 3 additions & 2 deletions docs/auth0_universal-portals.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,10 @@ has_children: true
---
# auth0 universal-portals

Manage Auth0 Universal Portals resources.
Set up and audit Auth0 Universal Portals.

## Commands

- [auth0 universal-portals setup](auth0_universal-portals_setup.md) - Set up Auth0 resources for a Universal Portals application
- [auth0 universal-portals audit](auth0_universal-portals_audit.md) - Check a Universal Portal
- [auth0 universal-portals setup](auth0_universal-portals_setup.md) - Set up a Universal Portal

54 changes: 54 additions & 0 deletions docs/auth0_universal-portals_audit.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
---
layout: default
parent: auth0 universal-portals
has_toc: false
---
# auth0 universal-portals audit

Checks a Universal Portal and its application against what setup makes, and tells what is wrong and how to fix it.

An error breaks the portal or one of its components, and a warning is something degraded or different from the setup guide. The command fails when there is an error, and with --strict when there is a warning too.

With a terminal it offers to fix the errors the CLI can fix, and with --fix it fixes them without asking. Warnings are never changed, because they may be intentional.

## Usage
```
auth0 universal-portals audit <portal-id> [flags]
```

## Examples

```
auth0 universal-portals audit up_123
auth0 universal-portals audit up_123 --fix
auth0 up audit up_123 --organization org_123 --strict --json
```


## Flags

```
--fix Apply the errors the CLI can fix, without asking. Warnings are never changed.
--json Output in json format.
-o, --organization string Business only: the ID of the organization the portal opens in, to check that it shares a connection with the application.
--strict Also fail when there are warnings.
```


## Inherited Flags

```
--agent-mode Output JSON, disable prompts and colors. Auto-enabled for AI agents; set AUTH0_AGENT_MODE=false to disable.
--debug Enable debug mode.
--no-color Disable colors.
--no-input Disable interactivity.
--tenant string Specific tenant to use.
```


## Related Commands

- [auth0 universal-portals audit](auth0_universal-portals_audit.md) - Check a Universal Portal
- [auth0 universal-portals setup](auth0_universal-portals_setup.md) - Set up a Universal Portal


23 changes: 14 additions & 9 deletions docs/auth0_universal-portals_setup.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,9 @@ has_toc: false
---
# auth0 universal-portals setup

Provisions the Auth0 resources required by a Universal Portals application:
Creates a Universal Portal with its application, forms and pages, and checks that the logged-in session has the permissions it needs before it creates anything.

- Auth0 My Account API and My Organization API (resource servers)
- A Regular Web App client with the required configuration
- Client grants for My Account API, My Organization API, and the Management API
Running the command again after a failure resumes: what exists is reused.

## Usage
```
Expand All @@ -20,16 +18,22 @@ auth0 universal-portals setup [flags]

```
auth0 universal-portals setup
auth0 universal-portals setup --name "Acme" --slug "acme"
auth0 up setup -n "Acme" -s "acme"
auth0 universal-portals setup --template business --name "Acme Admin" --user jane@acme.com
auth0 universal-portals setup --template consumer --name "Acme Account" --dry-run
auth0 up setup --no-input --template consumer --name "Acme Account" --json
```


## Flags

```
-n, --name string Display name of the portal.
-s, --slug string URL-friendly identifier for the portal (e.g. my-portal).
--dry-run Show what setup would create, without changing the tenant.
--json Output in json format.
-n, --name string Name of the portal. Asked when omitted.
-o, --organization string Business only: the ID or name of the organization, when the user has several.
-s, --slug string URL slug of the portal, for example acme-account. Defaults to a slug made from the name.
--template string Kind of portal: consumer, for end-users to manage their account, or business, for organization administrators to manage their organization. Asked when omitted.
-u, --user string Business only: the email or user ID of the user who will test the portal.
```


Expand All @@ -46,6 +50,7 @@ auth0 universal-portals setup [flags]

## Related Commands

- [auth0 universal-portals setup](auth0_universal-portals_setup.md) - Set up Auth0 resources for a Universal Portals application
- [auth0 universal-portals audit](auth0_universal-portals_audit.md) - Check a Universal Portal
- [auth0 universal-portals setup](auth0_universal-portals_setup.md) - Set up a Universal Portal


2 changes: 1 addition & 1 deletion docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,6 @@ The help for any command can also be emitted as JSON by combining `--help` with
- [auth0 test](auth0_test.md) - Try your Universal Login box or get a token
- [auth0 token-exchange](auth0_token-exchange.md) - Manage token exchange profiles
- [auth0 universal-login](auth0_universal-login.md) - Manage the Universal Login experience
- [auth0 universal-portals](auth0_universal-portals.md) - Manage Universal Portals resources
- [auth0 universal-portals](auth0_universal-portals.md) - Set up and audit Universal Portals
- [auth0 users](auth0_users.md) - Manage resources for users

2 changes: 2 additions & 0 deletions internal/auth0/auth0.go
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ type APIV3 struct {
NetworkACLKey NetworkACLKeyAPIV3
Connection ConnectionAPIV3
ConnectionEnabledClient ConnectionEnabledClientAPIV3
ClientConnection ClientConnectionAPIV3
Experiments ExperimentsAPI
FeatureFlags FeatureFlagsAPI
Variations VariationsAPI
Expand Down Expand Up @@ -133,6 +134,7 @@ func NewAPIV3(m *managementv3.Management) *APIV3 {
NetworkACLKey: m.Keys.NetworkACLs,
Connection: m.Connections,
ConnectionEnabledClient: m.Connections.Clients,
ClientConnection: m.Clients.Connections,
Experiments: m.Experimentation.Experiments,
FeatureFlags: m.Experimentation.FeatureFlags,
Variations: m.Experimentation.FeatureFlags.Variations,
Expand Down
30 changes: 30 additions & 0 deletions internal/auth0/client_connection_v3.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
//go:generate go tool mockgen -source=client_connection_v3.go -destination=mock/client_connection_v3_mock.go -package=mock

package auth0

import (
"context"

managementv3 "github.com/auth0/go-auth0/v3/management"
"github.com/auth0/go-auth0/v3/management/core"
"github.com/auth0/go-auth0/v3/management/option"
)

// ClientConnectionPage aliases the checkpoint-paginated list of the connections
// enabled for a client. The alias keeps the interface return type a single
// identifier so mockgen's source parser can handle it.
type ClientConnectionPage = core.Page[*string, *managementv3.ConnectionForList, *managementv3.ListClientConnectionsResponseContent]

// ClientConnectionAPIV3 is the V3 SDK interface for the /clients/{id}/connections
// endpoint, used to read which connections are enabled for a client.
type ClientConnectionAPIV3 interface {
// Get the connections enabled for a client. The request must not be nil.
//
// Required scope: `read:connections`.
Get(
ctx context.Context,
id string,
request *managementv3.ConnectionsGetRequest,
opts ...option.RequestOption,
) (*ClientConnectionPage, error)
}
64 changes: 64 additions & 0 deletions internal/auth0/mock/client_connection_v3_mock.go

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

57 changes: 57 additions & 0 deletions internal/auth0/mock/organization_mock.go

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

20 changes: 20 additions & 0 deletions internal/auth0/mock/user_mock.go

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

15 changes: 15 additions & 0 deletions internal/auth0/organization.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,21 @@ type OrganizationAPI interface {
// See: https://auth0.com/docs/api/management/v2/#!/Organizations/get_enabled_connections
Connections(ctx context.Context, id string, opts ...management.RequestOption) (c *management.OrganizationConnectionList, err error)

// AddConnection enables a connection for an organization.
//
// See: https://auth0.com/docs/api/management/v2#!/Organizations/post_enabled_connections
AddConnection(ctx context.Context, id string, c *management.OrganizationConnection, opts ...management.RequestOption) (err error)

// AddMembers adds users to an organization as members.
//
// See: https://auth0.com/docs/api/management/v2#!/Organizations/post_members
AddMembers(ctx context.Context, id string, memberIDs []string, opts ...management.RequestOption) (err error)

// AssignMemberRoles assigns roles to a member of an organization.
//
// See: https://auth0.com/docs/api/management/v2#!/Organizations/post_organization_member_roles
AssignMemberRoles(ctx context.Context, id string, memberID string, roles []string, opts ...management.RequestOption) (err error)

// DiscoveryDomains retrieves the discovery domains for an organization.
DiscoveryDomains(ctx context.Context, id string, opts ...management.RequestOption) (d *management.DiscoveryDomainList, err error)

Expand Down
3 changes: 3 additions & 0 deletions internal/auth0/user.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,9 @@ type UserAPI interface {
// Roles lists all roles associated with a user.
Roles(ctx context.Context, id string, opts ...management.RequestOption) (r *management.RoleList, err error)

// Organizations lists the organizations a user is a member of.
Organizations(ctx context.Context, id string, opts ...management.RequestOption) (p *management.OrganizationList, err error)

// AssignRoles assigns roles to a user.
AssignRoles(ctx context.Context, id string, roles []*management.Role, opts ...management.RequestOption) error

Expand Down
1 change: 1 addition & 0 deletions internal/cli/auth_env.go
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,7 @@ func (c *cli) setupWithEnvAuthentication(ctx context.Context) error {

c.api = auth0.NewAPI(api)
c.apiv3 = auth0.NewAPIV3(apiv3)
c.apiAccess = apiAccess{domain: domain, accessToken: accessToken, invokerMetadata: invokerMetadata}

return nil
}
Expand Down
12 changes: 12 additions & 0 deletions internal/cli/cli.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,20 @@ type cli struct {
detectedAgent string
executedCommandPath string

// What the Management API clients were built with, for a command that builds a client of its own.
apiAccess apiAccess

Config config.Config
}

// apiAccess is the tenant and the token the Management API clients were built with, and the metadata
// they send with each request.
type apiAccess struct {
domain string
accessToken string
invokerMetadata string
}

// setupWithAuthentication will fetch the tenant from the config.json
// and regenerate its access token if needed. The access token will
// then be used to configure an instance of the Auth0 Management SDK.
Expand Down Expand Up @@ -221,6 +232,7 @@ func (c *cli) setupWithAuthentication(ctx context.Context) error {

c.api = auth0.NewAPI(api)
c.apiv3 = auth0.NewAPIV3(apiv3)
c.apiAccess = apiAccess{domain: tenant.Domain, accessToken: accessToken, invokerMetadata: invokerMetadata}
return nil
}

Expand Down
Loading
Loading