Skip to content

Commit ad90e9b

Browse files
authored
Implementation of OAUTHBEARER/OIDC metadata based authentication (#5155)
* Implementation of OAUTHBEARER/OIDC metadata based authentication, initially supporting the Azure UAMI method. * Tests with trivup 0.14.0 supporting metadata based authentications * Add documentation and changelog entry * Rename `azure` value to `azure_imds` and replace UAMI that is the identity with IMDS that is the authentication service * Extract authentication URL and rename internal function and enums * Changes to name the configuration property "query" instead of "params" as in other implementations and to make it optional if the default endpoint is overridden.
1 parent d1b2dc6 commit ad90e9b

16 files changed

+805
-294
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ SOURCES
2020
gmon.out
2121
*.gz
2222
*.tgz
23+
!tests/trivup/trivup*.tar.gz
2324
*.bz2
2425
*.deb
2526
*.rpm

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
librdkafka v2.12.0 is a feature release:
44

5+
* Support for OAUTHBEARER metadata based authentication types,
6+
starting with Azure IMDS. [Introduction available](INTRODUCTION.md#oauthbearer-oidc-metadata-authentication) (#5155).
57
* Fix compression types read issue in GetTelemetrySubscriptions response
68
for big-endian architectures (#5183, @paravoid).
79
* Fix for KIP-1102 time based re-bootstrap condition (#5177).

CONFIGURATION.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,7 @@ sasl.oauthbearer.assertion.claim.jti.include | * | true, false | f
121121
sasl.oauthbearer.assertion.claim.nbf.seconds | * | 0 .. 2147483647 | 60 | low | Assertion not before time in seconds. Only used when `sasl.oauthbearer.method` is set to "oidc" and JWT assertion is needed. <br>*Type: integer*
122122
sasl.oauthbearer.assertion.claim.sub | * | | | low | JWT subject claim. Only used when `sasl.oauthbearer.method` is set to "oidc" and JWT assertion is needed. <br>*Type: string*
123123
sasl.oauthbearer.assertion.jwt.template.file | * | | | low | Path to the JWT template file. Only used when `sasl.oauthbearer.method` is set to "oidc" and JWT assertion is needed. <br>*Type: string*
124+
sasl.oauthbearer.metadata.authentication.type | * | none, azure_imds | none | low | Type of metadata-based authentication to use for OAUTHBEARER/OIDC `azure_imds` authenticates using the Azure IMDS endpoint. Sets a default value for `sasl.oauthbearer.token.endpoint.url` if missing. Configuration values specific of chosen authentication type can be passed through `sasl.oauthbearer.config`. <br>*Type: enum value*
124125
plugin.library.paths | * | | | low | List of plugin libraries to load (; separated). The library search path is platform dependent (see dlopen(3) for Unix and LoadLibrary() for Windows). If no filename extension is specified the platform-specific extension (such as .dll or .so) will be appended automatically. <br>*Type: string*
125126
interceptors | * | | | low | Interceptors added through rd_kafka_conf_interceptor_add_..() and any configuration handled by interceptors. <br>*Type: see dedicated API*
126127
group.id | C | | | high | Client group id string. All clients sharing the same group.id belong to the same group. <br>*Type: string*

INTRODUCTION.md

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1232,6 +1232,44 @@ either through the template or with the `claim` properties.
12321232
it's possible to dynamically customize the JWT claims with these or to
12331233
skip the template file and use only these properties.
12341234

1235+
<a name="oauthbearer-oidc-metadata-authentication"></a>
1236+
##### Metadata based authentication
1237+
1238+
Some cloud providers added the ability to authenticate clients based on
1239+
OAUTHBEARER/OIDC tokens returned from endpoints that can only be called from
1240+
a given instance. Such endpoints are served on a specific IP address (169.254.169.254)
1241+
that is a link-local metadata endpoint.
1242+
1243+
1244+
While there is no standard for that still, librdkafka has support for
1245+
some metadata based OAUTHBEARER authentication types.
1246+
1247+
1248+
Currently these authentication types are supported:
1249+
1250+
###### Azure IMDS
1251+
1252+
To use this method you set:
1253+
1254+
* `sasl.oauthbearer.metadata.authentication.type=azure_imds` this makes it so
1255+
that ` sasl.oauthbearer.client.id` and `sasl.oauthbearer.client.secret`
1256+
aren't required.
1257+
* `sasl.oauthbearer.config` is a general purpose configuration property
1258+
In this case it accepts comma-separated `key=value` pairs.
1259+
The `query` key is required in case `sasl.oauthbearer.token.endpoint.url` isn't
1260+
specified and its value is the GET query string to append
1261+
to the token endpoint URL. Such query string contains params required by
1262+
Azure IMDS such as `client_id` (the UAMI), `resource` for determining the
1263+
target audience and `api-version` for the API version to be used by the endpoint
1264+
* `sasl.oauthbearer.token.endpoint.url` (optional) is set automatically.
1265+
when choosing `sasl.oauthbearer.metadata.authentication.type=azure_imds` but can
1266+
be customized.
1267+
1268+
1269+
_Example:_ `sasl.oauthbearer.metadata.authentication.type=azure_imds` and
1270+
`sasl.oauthbearer.config=params=api-version=2025-04-07&resource=api://<App registration client id>&client_id=<UAMI client id>`
1271+
1272+
12351273
<a name="sparse-connections"></a>
12361274
#### Sparse connections
12371275

0 commit comments

Comments
 (0)