Skip to content

feat(identity): authenticate principals with Basic Auth#5451

Open
juliamrch wants to merge 16 commits into
release/kong-identity-m0from
iss5037
Open

feat(identity): authenticate principals with Basic Auth#5451
juliamrch wants to merge 16 commits into
release/kong-identity-m0from
iss5037

Conversation

@juliamrch
Copy link
Copy Markdown
Contributor

@juliamrch juliamrch commented Jun 3, 2026

Description

closes #5037

This PR contains a new guide for Kong Identity, using Principals and Basic Auth.

Preview Links

https://deploy-preview-5451--kongdeveloper.netlify.app/how-to/authenticate-principals-with-basic-authentication/

Checklist

  • Tested how-to docs. If not, note why here.
  • All pages contain metadata.
  • Any new docs link to existing docs.
  • All autogenerated instructions render correctly (API, decK, Konnect, Kong Manager).
  • Style guide (capitalized gateway entities, placeholder URLs) implemented correctly.
  • Every page has a description entry in frontmatter.
  • Add new pages to the product documentation index (if applicable).

@juliamrch juliamrch self-assigned this Jun 3, 2026
@netlify
Copy link
Copy Markdown

netlify Bot commented Jun 3, 2026

Deploy Preview for kongdeveloper ready!

Name Link
🔨 Latest commit b395792
🔍 Latest deploy log https://app.netlify.com/projects/kongdeveloper/deploys/6a22d6ceaa20120008a28cef
😎 Deploy Preview https://deploy-preview-5451--kongdeveloper.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

To edit notification comments on pull requests, go to your Netlify project configuration.

@juliamrch juliamrch added this to the Kong Identity M0 and M1.1 milestone Jun 3, 2026
@juliamrch juliamrch changed the base branch from main to release/kong-identity-m0 June 3, 2026 18:18
cloudjumpercat and others added 6 commits June 3, 2026 20:24
Signed-off-by: Diana <75819066+cloudjumpercat@users.noreply.github.com>
Signed-off-by: Diana <75819066+cloudjumpercat@users.noreply.github.com>
Co-authored-by: Diana <75819066+cloudjumpercat@users.noreply.github.com>
Signed-off-by: Diana <75819066+cloudjumpercat@users.noreply.github.com>
Signed-off-by: Diana <75819066+cloudjumpercat@users.noreply.github.com>
@juliamrch juliamrch marked this pull request as ready for review June 3, 2026 18:25
@juliamrch juliamrch requested a review from a team as a code owner June 3, 2026 18:25
Copilot AI review requested due to automatic review settings June 3, 2026 18:25
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds new Kong Identity documentation covering the core concepts of Directories/Principals and a Gateway how-to showing how to authenticate Principals using the Basic Authentication plugin.

Changes:

  • Introduces a new Kong Identity reference page explaining Principals, Directories, identities, credentials, metadata, and limits.
  • Adds a new Gateway how-to that creates a Directory + Principal and configures the Basic Auth plugin to authenticate Principals.
  • Includes validation steps demonstrating unauthorized vs authorized requests.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 8 comments.

File Description
app/kong-identity/principals-and-directories.md New reference page defining Kong Identity Principals/Directories and how they map to Gateway concepts.
app/_how-tos/gateway/authenticate-principals-with-basic-authentication.md New how-to for configuring Basic Auth to authenticate Kong Identity Principals and validating requests.

Comment thread app/kong-identity/principals-and-directories.md
Comment thread app/_how-tos/gateway/authenticate-principals-with-basic-authentication.md Outdated
Comment thread app/_how-tos/gateway/authenticate-principals-with-basic-authentication.md Outdated
Comment thread app/_how-tos/gateway/authenticate-principals-with-basic-authentication.md Outdated
Comment thread app/_how-tos/gateway/authenticate-principals-with-basic-authentication.md Outdated
Comment thread app/_how-tos/gateway/authenticate-principals-with-basic-authentication.md Outdated
juliamrch and others added 6 commits June 3, 2026 20:37
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Comment on lines +170 to +274
## Create a directory

{% navtabs "create-directory" %}
{% navtab "UI" %}

UI steps will be added once the feature is available for testing.

{% endnavtab %}
{% navtab "API" %}

Send a `POST` request to the [`/v2/directories` endpoint](/api/konnect/kong-identity/v2/#/operations/createDirectory):

<!--vale off-->
{% konnect_api_request %}
url: /v2/directories
status_code: 201
method: POST
body:
name: example-directory
description: Example directory for principals
allow_all_control_planes: true
{% endkonnect_api_request %}
<!--vale on-->

{% endnavtab %}
{% navtab "Terraform" %}

Terraform steps will be added once the feature is available for testing.

{% endnavtab %}
{% endnavtabs %}

## Configure a principal

Configuring a principal is a multi-step process. You always create the principal first, then attach identities. Metadata is optional.

{% navtabs "configure-principal" %}
{% navtab "UI" %}

UI steps will be added once the feature is available for testing.

{% endnavtab %}
{% navtab "API" %}

1. Create the principal by sending a `POST` request to the [`/v2/directories/{directoryId}/principals` endpoint](/api/konnect/kong-identity/v2/#/operations/createPrincipal):
{% capture create_principal %}
<!--vale off-->
{% konnect_api_request %}
url: /v2/directories/$DIRECTORY_ID/principals
status_code: 201
method: POST
body:
display_name: example-principal
description: Example principal
{% endkonnect_api_request %}
<!--vale on-->
{% endcapture %}
{{ create_principal | indent: 3}}

1. Link an identity to a principal by sending a `POST` request to the [`/v2/directories/{directoryId}/principals/{principalId}/identities` endpoint](/api/konnect/kong-identity/v2/#/operations/createIdentity). In this example, you'll be attaching a `control_plane_consumer` identity to map the principal to a Consumer in a {{site.base_gateway}} control plane:
{% capture link_identity %}
<!--vale off-->
{% konnect_api_request %}
url: /v2/directories/$DIRECTORY_ID/principals/$PRINCIPAL_ID/identities
status_code: 201
method: POST
body:
type: control_plane_consumer
control_plane_id: $CONTROL_PLANE_ID
consumer_id: $CONSUMER_ID
{% endkonnect_api_request %}
<!--vale on-->
{% endcapture %}
{{ link_identity | indent: 3}}

For other identity types and the fields each one accepts, see [Identities](#identities).

{:.info}
> If you want to authenticate clients against this principal using basic auth or an API key, you also need to add the credentials in separate API calls:
> * **Basic auth:** `POST` to [`/v2/directories/{directoryId}/principals/{principalId}/basic-auths`](/api/konnect/kong-identity/v2/#/operations/createBasicAuth) to create the basic auth entry, then `POST` to [`/v2/directories/{directoryId}/principals/{principalId}/basic-auths/{basicAuthId}/passwords`](/api/konnect/kong-identity/v2/#/operations/createPassword) to set a password.
> * **API key:** `POST` to [`/v2/directories/{directoryId}/principals/{principalId}/api-keys`](/api/konnect/kong-identity/v2/#/operations/createKey).

1. (Optional) Add or update metadata on the principal by sending a `PATCH` request to the [`/v2/directories/{directoryId}/principals/{principalId}` endpoint](/api/konnect/kong-identity/v2/#/operations/updatePrincipal):
{% capture update_metadata %}
<!--vale off-->
{% konnect_api_request %}
url: /v2/directories/$DIRECTORY_ID/principals/$PRINCIPAL_ID
status_code: 200
method: PATCH
body:
metadata:
business_unit: payments
tier: gold
{% endkonnect_api_request %}
<!--vale on-->
{% endcapture %}
{{ update_metadata | indent: 3}}

{% endnavtab %}
{% navtab "Terraform" %}

Terraform steps will be added once the feature is available for testing.

{% endnavtab %}
{% endnavtabs %}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this go in a how-to?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure, it's more a tutorial that @cloudjumpercat included in a reference page (this page comes from a cherry-pick from her branch) than a how-to .

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this a core workflow for identity? If so why not have it as a how to?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Guaris This content will be in the various how tos since creating a principal and directory are required for those flows. It also exists on the Principals reference page (work in progress, PR is here if you want to check it out) similar to what we have for Gateway entities, like Set up a Consumer. That way information about the entity + general steps of how to configure it using various tools are in one space. We'll have links to the how tos on the reference page as well for users who want the more opinionated how to flows.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Kong Identity: Basic auth support

4 participants