Skip to content
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

feat: add support for externalized consumers #7657

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Changes from 2 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
74 changes: 71 additions & 3 deletions app/_hub/kong-inc/key-auth/overview/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,9 +77,9 @@ For more information about how to configure anonymous access, see [Anonymous Acc
### Create a Key

{:.important}
> **Note**: We recommend letting the API gateway autogenerate the key. Only specify it
yourself if you are migrating an existing system to {{site.base_gateway}}.
You must reuse your keys to make the migration to {{site.base_gateway}} transparent
> **Note**: We recommend letting the API gateway autogenerate the key. Only specify it
yourself if you are migrating an existing system to {{site.base_gateway}}.
You must reuse your keys to make the migration to {{site.base_gateway}} transparent
to your consumers.

{% navtabs %}
Expand Down Expand Up @@ -303,3 +303,71 @@ No API key is provided. | No | 401
The API key is not known to {{site.base_gateway}} | No | 401
A runtime error occurred. | No | 500


### Externalized Consumers

-- Dummy/Link that points to Konnect Docs when ready.

With the `pool_id` you obtained from the previous step, you can configure the key-auth plugin to validate API keys against the Identity Service.
Copy link
Contributor

Choose a reason for hiding this comment

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

@jschmid1 where does the pool_id come from? Konnect?


#### Configuring Multiple Pools

In the key-auth plugin configuration, add the `pools` option as shown below:

```yaml
pools:
- geo: us
id: <the_pool_id_you_got_in_step_1>
type: remote
- geo: null
id: null
type: local
```

The order in which you configure the pools dictates the priority in which the dataplane attempts to authenticate the provided API keys.

In the example above, if the remote pool is listed first, the dataplane will first reach out to the identity service and, if necessary, subsequently to the local pool.

Alternatively, you can configure the local pool first:

```yaml
pools:
- geo: null
id: null
type: local
- geo: us
id: <the_pool_id_you_got_in_step_1>
type: remote
```

In this configuration, the dataplane will initially check the local pool (LMDB) before querying the remote Identity Service.

If a matching key is found in any of these pools, the request will be authenticated. If the key is not found in any of the configured pools, the request will be blocked.

#### Configuring Single Pools

It is also possible to configure only a single pool, either local or remote. However, only one of each type can be configured.

To configure only a remote pool:

```yaml
pools:
- geo: us
id: <the_pool_id_you_got_in_step_1>
type: remote
```

In this case, the dataplane will only attempt to authenticate API keys against the remote Identity Service.

To configure only a local pool:

```yaml
pools:
- geo: null
id: null
Copy link
Member

Choose a reason for hiding this comment

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

geo and id should be optional (default null) imo

type: local
```

In this scenario, the dataplane will only check the local pool (LMDB) for API key authentication.

In both cases, if the API key is not found in the configured pool, the request will be blocked.
Loading