diff --git a/docs/management/index.md b/docs/management/index.md index e2d7a8da8f..8ce23cf6b4 100644 --- a/docs/management/index.md +++ b/docs/management/index.md @@ -410,8 +410,13 @@ Given above configuration, when a user visits the management UI, the following t If RabbitMQ cannot download the OpenID provider configuration, it shows an error message and the OAuth 2.0 authentication option will be disabled in the management UI ::: + :::warning + `management.oauth_metadata_url` and `management.oauth_resource_servers.$id.oauth_metadata_url` are deprecated. You should configure the OpenId Discovery endpoint's path as it is explained [here](./oauth2#discovery-endpoint-params). + These two settings will no longer exist in RabbitMQ 4.2.0. In the meantime, RabbitMQ will support them until you update your configuration. + ::: + :::tip - If you used to configure `management.oauth_metadata_url` because your provider did not use the standard OpenId Discovery endpoint's path, since RabbitMQ 4.1 you should instead configure the correct path as it is explained [here](./oauth2#discovery-endpoint-params). + If you used to configure `auth_oauth2.metadata_url` because your provider used a slightly different OpenId Discovery endpoint url, since RabbitMQ 4.1 you should instead configure the correct path and/or include any additional parameters. Please read [this section of the documentation](./oauth2#discovery-endpoint-params) where it is explained how to do it. `auth_oauth2.metadata_url` may be deprecated in future versions. ::: 2. RabbitMQ displays a button with the label "Click here to login". When the user clicks on the button, the management UI initiates the OAuth 2.0 Authorization Code Flow, which redirects the user to the identity provider to authenticate and get a token. @@ -510,29 +515,18 @@ RabbitMQ 3.13.1 and earlier versions require the [OpenId Connect Discovery endpo There are other two additional scenarios which can trigger a logout. One scenario occurs when the OAuth Token expires. Although RabbitMQ renews the token in the background before it expires, if the token expires, the user is logged out. The second scenario is when the management UI session exceeds the maximum allowed time configured on the [Login Session Timeout](#login-session-timeout). -### Configure Extra URI Parameters for Authorization and Token Endpoints {#extra-endpoint-params} +### Configure extra parameters for authorization and token endpoints {#extra-endpoint-params} -Some OAuth 2.0 providers require additional URI parameters to be included into the request sent to the **authorization endpoint** and/or to the **token endpoint**. -These parameters are vendor- or IDP installation-specific. The Management UI already sends all the parameters required by the OAuth 2.0 Authorization Code flow. +There are some OAuth 2.0 providers which require extra parameters in the request sent to the **authorization endpoint** and/or to the **token endpoint**. These parameters are custom parameters. The Management UI already sends all the parameters required by the OAuth 2.0 Authorization Code flow. -In the followingexample an extra URI parameter called `audience` is added for both the **authorization** and **token** endpoints: +Here is an example of setting an extra parameter called `audience` for both endpoints, the **authorization** and **token** endpoint: ```ini management.oauth_authorization_endpoint_params.audience = some-audience-id - -management.oauth_token_endpoint_params.audience = some-audience-id -``` - -Multiple parameters can be configured like so: - -```ini -management.oauth_authorization_endpoint_params.audience = some-audience-id -management.oauth_authorization_endpoint_params.example = example-value - management.oauth_token_endpoint_params.audience = some-audience-id -management.oauth_token_endpoint_params.other = other-value ``` +You can configure as many parameters as you need. ### Special attention to CSP header `connect-src` {#csp-header} @@ -629,12 +623,11 @@ the following settings: - `resource` : `rabbit_prod` - `scopes` : `openid rabbitmq.tag:management rabbitmq.read:*/*` -### Configure Extra URI Parameters for Authorization and Token Endpoints {#extra-endpoint-params} +#### Configure extra parameters for authorization and token endpoints -Some OAuth 2.0 providers require additional URI parameters to be included into the request sent to the **authorization endpoint** and/or to the **token endpoint**. -These parameters are vendor- or IDP installation-specific. The Management UI already sends all the parameters required by the OAuth 2.0 Authorization Code flow. +There are some OAuth 2.0 providers which require extra parameters in the request sent to the **authorization endpoint** and/or to the **token endpoint**. These parameters are custom parameters and specified per resource. The Management UI already sends all the parameters required by the OAuth 2.0 Authorization Code flow. -The following example sets an extra URI parameter called `audience` for both endpoints for the resource `some-resource-id`: +Here is an example of setting an extra parameter called `audience` for both endpoints for the resource `some-resource-id`: ```ini management.oauth_resource_servers.2.id = some-resource-id diff --git a/docs/oauth2-examples-auth0.md b/docs/oauth2-examples-auth0.md index d05345868d..4ff23840d0 100644 --- a/docs/oauth2-examples-auth0.md +++ b/docs/oauth2-examples-auth0.md @@ -99,8 +99,7 @@ To configure RabbitMQ you need to gather the following information from Auth0: 4. And take note of the *Domain* value 5. Use the last values in *Client ID* and *Domain* fields in the RabbitMQ configuration file -Copy [conf/auth0/rabbitmq.conf.tmpl](https://github.com/rabbitmq/rabbitmq-oauth2-tutorial/blob/main/conf/auth0/rabbitmq.conf.tmpl) as `rabbitmq.conf`. -It must be in same folder as `rabbitmq.conf.tmpl`. +Clone the configuration file [conf/auth0/rabbitmq.conf.tmpl](https://github.com/rabbitmq/rabbitmq-oauth2-tutorial/blob/main/conf/auth0/rabbitmq.conf.tmpl) as `rabbitmq.conf` (in the same folder as `rabbitmq.conf.tmpl`). Edit `rabbitmq.conf` and proceed as follows: diff --git a/docs/oauth2-examples-entra-id/index.md b/docs/oauth2-examples-entra-id/index.md index 4a1f138b4b..e820466d6c 100644 --- a/docs/oauth2-examples-entra-id/index.md +++ b/docs/oauth2-examples-entra-id/index.md @@ -24,15 +24,14 @@ limitations under the License. This guide explains how to set up OAuth 2.0 for RabbitMQ and Microsoft Entra ID as Authorization Server using the following flows: -* Access the management UI via a browser using v2.0 api version - + * Access the management UI via a browser using Entra ID (API version 2.0) ## Prerequisites to follow this guide -* Have an account in https://portal.azure.com. +* Have an [Azure account](https://portal.azure.com.) * Docker -* Openssl -* A local clone of a [GitHub repository](https://github.com/rabbitmq/rabbitmq-oauth2-tutorial/tree/next) for branch `next` that contains all the configuration files and scripts used on this example. +* OpenSSL +* A local clone of a [GitHub repository](https://github.com/rabbitmq/rabbitmq-oauth2-tutorial/tree/next) (the `next` branch) that contains all the configuration files and scripts used on this example. ## Register your app @@ -62,12 +61,12 @@ When using **Entra ID as OAuth 2.0 server**, your client app (in our case Rabbit 5. Click on **Register**. - ![Entra ID OAuth 2.0 App](./entra-id-oauth-registered-app.png) + ![Entra ID OAuth 2.0 App](./entra-id-oauth-registered-app.png) - Note the following values, as you will need it later to configure the `rabbitmq_auth_backend_oauth2` on RabbitMQ side: + Note the following values, as you will need it later to configure the `rabbitmq_auth_backend_oauth2` on RabbitMQ side: - * **Directory (tenant ID)** - * **Application (client) ID** + * Directory (tenant ID) + * Application (client) ID ## Create OAuth 2.0 roles for your app @@ -146,8 +145,24 @@ Now that some roles have been created for your application, you still need to as 9. Repeat the operations for all the roles you want to assign. + ## Create a Scope for Management UI Access +There is one last configuration step required. Without this step, the `access_token` returned +by **Entra ID** is invalid. RabbitMQ cannot validate its signature because the `access_token` is meant for Microsoft resources. +First, you need to create a scope associated to the application you registered for RabbitMQ management UI as follows: + +1. Go to **App registrations**. +2. Click on your application. +3. Go to **Manage** option on the left menu and choose the option **Expose an API**. +4. Click on **Add a scope**. +5. Enter a name, eg. `management-ui`. Enter the same name for **Admin consent display name** and a description and save it. +7. The scope is named `api://{Application (client) ID}/{scope_name}`. + +Check out the last section to see how this scope is used to configure RabbitMQ. + +## Configure Custom Signing Keys + There is one last configuration step required. Without this step, the `access_token` returned by **Entra ID** won't be useable with RabbitMQ. More specifically, RabbitMQ will not be able to validate its signature because the `access_token` is meant for Microsoft resources @@ -167,10 +182,13 @@ This scope will be used further below in this guide. ## Configure Custom Signing Keys Creating a signing key for the application is optional. If a custom key is created, RabbitMQ must be configured accordingly. -In the example below, replace `{Application(client) ID}` with the actual *Application(client) ID*. +In the following example, replace `{Application(client) ID}` with the actual *Application(client) ID*. -Without this bit of configuration, the standard `jwks_uri` endpoint will not include the custom signing key -and therefore RabbitMQ will not find the necessary signing key to validate the token's signature. +```ini +auth_oauth2.discovery_endpoint_params.appid = {Application(client) ID} +``` + +It is optional to create a signing key for your application. If you create one though, you must add the following RabbitMQ configuration. You need to replace `{Application(client) ID}` with your *Application(client) ID*. Without this configuration, the standard jwks_uri endpoint will not include the custom signing key and RabbitMQ will not find the signing key to validate the token's signature. ```ini auth_oauth2.discovery_endpoint_params.appid = {Application(client) ID} @@ -178,7 +196,6 @@ auth_oauth2.discovery_endpoint_params.appid = {Application(client) ID} For more information, check out Microsoft Entra documentation about [configuring custom signing keys](https://learn.microsoft.com/en-us/entra/identity-platform/jwt-claims-customization#validate-token-signing-key). - ## Configure RabbitMQ to Use Entra ID as OAuth 2.0 Authentication Backend The configuration on **Entra ID** side is done. Next, configure RabbitMQ to use these resources. @@ -193,7 +210,17 @@ Edit the new `rabbitmq.conf` file and proceed as follows: 3. If you decide to configure your application with custom signing(s), you need to uncomment the following configuration line. This is required otherwise the `jwks_uri` endpoint announced by the OpenID Discovery endpoint does not contain applications' custom signing keys. ```ini -#auth_oauth2.discovery_endpoint_params.appid = {Application(client) ID} +#... + +management.oauth_enabled = true +management.oauth_client_id = {Application(client) ID} +management.oauth_scopes = openid profile api://{Application(client) ID}/rabbitmq + +auth_oauth2.resource_server_id = {Application(client) ID} +auth_oauth2.additional_scopes_key = roles +auth_oauth2.issuer = https://login.microsoftonline.com/{Directory (tenant) ID}/v2.0 + +#... ``` @@ -207,7 +234,7 @@ make start-rabbitmq ``` This starts a Docker container named `rabbitmq`, with RabbitMQ Management UI/API with HTTPS enabled, and configured to use your Entra ID as OAuth 2.0 authentication backend, -based on the values set in `rabbitmq.conf` in the previous steps of this tutorial. +based on the information you provided in `rabbitmq.conf` in the previous steps of this tutorial. ## Automatic generation of a TLS Certificate and Key Pair diff --git a/docs/oauth2-examples-okta.md b/docs/oauth2-examples-okta.md index 1ff353bf24..0b5a7c0169 100644 --- a/docs/oauth2-examples-okta.md +++ b/docs/oauth2-examples-okta.md @@ -170,35 +170,31 @@ Once you've added the user to the appropriate groups and apps, they should have This step is necessary otherwise the tokens do not carry any of the scopes granted to the users. -1. [Create an access policy](https://developer.okta.com/docs/guides/customize-authz-server/main/#create-access-policies) -2. [Create a rule](https://developer.okta.com/docs/guides/customize-authz-server/main/#create-rules-for-each-access-policy) for the access policy +1. Create access policy following these [instructions](https://developer.okta.com/docs/guides/customize-authz-server/main/#create-access-policies). +2. Create rule for the access policy following these [instructions](https://developer.okta.com/docs/guides/customize-authz-server/main/#create-rules-for-each-access-policy). -## [Optional] Test the Tokens Issued by Okta +## [Optional] Test the tokens issued by Okta -This step is optional but highly recommended. +This is totally optional but it can save you time. -1. Go to the **default Authorization Server** -2. Click on **Token Preview** tab -3. Fill in all the fields. For **grant type** choose `Authorization Code` -4. Click on **Preview Token** button -5. Check the claim `role` to see if it contains the roles assigned earlier in this guide +1. Go to the **default Authorization Server**. +2. Click on **Token Preview** tab. +3. Fill in all the fields. For **grant type** choose `Authorization Code`. +4. Click on **Preview Token** button. +5. Check the claim `role` to see if it contains the roles you assigned to your user. ## Configure RabbitMQ to use Okta as OAuth 2.0 Authentication Backend -The configuration on the Okta side is done. Next, configure RabbitMQ to use the resources created above. +The configuration on Okta side is done. You now have to configure RabbitMQ to use the resources you just created. You took note of the following values: -For that, you will need the following values from the previous steps: - -* **okta_client_app_ID**: the ID of the app registered in Okta to be used with RabbitMQ -* **okta-Issuer**: the **default Authorization server** -* **okta-Metadata-URI**: the **default Authorization server** - -Copy [rabbitmq.conf.tmpl](https://github.com/rabbitmq/rabbitmq-oauth2-tutorial/tree/next/conf/okta/rabbitmq.conf.tmpl) from the tutorial repository -to `rabbitmq.conf`. It must be in the same directory as `rabbitmq.conf.tmpl`. + - **okta_client_app_ID** associated to the okta app that you registered in okta for rabbitMQ. + - **okta-Issuer** associated to the **default Authorization server**. + - **okta-Metadata-URI** associated to the **default Authorization server**. +Clone [rabbitmq.conf.tmpl](https://github.com/rabbitmq/rabbitmq-oauth2-tutorial/tree/next/conf/okta/rabbitmq.conf.tmpl) as `rabbitmq.conf` (in the same folder as `rabbitmq.conf.tmpl`). There is a second configuration file, [advanced.config](https://github.com/rabbitmq/rabbitmq-oauth2-tutorial/tree/next/conf/okta/advanced.config), -that will not need any modifications. This is the RabbitMQ [advanced configuration file](./configure/) where RabbitMQ scopes are mapped to the permissions previously configured in Okta. +that you keep it as it is. This is the RabbitMQ advanced configuration that maps RabbitMQ scopes to the permissions previously configured in Okta. Edit `rabbitmq.conf` and proceed as follows: @@ -210,21 +206,14 @@ or `{okta-issuer}/.well-known/openid-configuration` `auth_oauth2.discovery_endpoint_path` accordingly. For instance, if **okta-Metadata-URI** is `{okta-issuer}/some-other-endpoint`, you update `auth_oauth2.discovery_endpoint_path` with the value `some-other-endpoint`. -### About the OpenId Discovery Endpoint - -RabbitMQ uses the standard OpenId discovery endpoint path `.well-known/openid-configuration`. Okta supports this path in addition to `.well-known/oauth-authorization-server`. -The only difference observed between the two endpoints is that the latter returns more values in the `claims_supported` JSON field. +### About OpenId Discovery Endpoint -The RabbitMQ's template configuration provided in the snippet below has this line. -This means that RabbitMQ will use the standard path. +RabbitMQ uses the standard OpenId discovery endpoint path `.well-known/openid-configuration`. Okta supports this path in addition to `.well-known/oauth-authorization-server`. The only difference observed at the time of writing this guide is that the latter returns more values in the json attribute `claims_supported`. -If the default does not work as expected, try uncommenting this line to use -the alternative path. - -``` ini -## Uncomment to use '.well-known/oauth-authorization-server' as the discovery -## endpoint path -# auth_oauth2.discovery_endpoint_path = .well-known/oauth-authorization-server +The RabbitMQ's template configuration provided in this example has this line commented out meaning that +RabbitMQ will use the standard path. If you find any problems, try uncommenting this line. +``` +#auth_oauth2.discovery_endpoint_path = .well-known/oauth-authorization-server ``` ## Start RabbitMQ diff --git a/docs/oauth2-examples/index.md b/docs/oauth2-examples/index.md index 092d6e4f5c..b4c6ab8ad4 100644 --- a/docs/oauth2-examples/index.md +++ b/docs/oauth2-examples/index.md @@ -45,7 +45,7 @@ The guide is accompanied by [a public GitHub repository](https://github.com/rabb ### Using [JWT tokens in several protocols](#access-other-protocols) to access RabbitMQ -* [Management HTTP API](#management-http-api) +* [Management REST API](#management-rest-api) * [AMQP 0-9-1](#amqp-protocol) (and [scopes for topic exchanges](#using-topic-exchanges) in a separate section) * [AMQP 1.0](#amqp10-protocol) * [JMS](#jms-clients) @@ -190,7 +190,7 @@ It is only when the user clicks **Click here to login** , the user is redirected The following subsections demonstrate how to use access tokens with any messaging protocol and also to access the management HTTP API. -### Management HTTP API {#management-http-api} +### Management REST api {#management-rest-api} In this scenario a monitoring agent uses RabbitMQ HTTP API to collect monitoring information. Because it is not an end user, or human, you refer to it as a *service account*. diff --git a/docs/oauth2.md b/docs/oauth2.md index 24f4c540ff..b608140c33 100644 --- a/docs/oauth2.md +++ b/docs/oauth2.md @@ -108,9 +108,7 @@ Also, the `https://my-oauth2-provider.com/realm/rabbitmq/.well-known/openid-conf *.well-known/openid-configuration* is the OpenID standard path for the OpenID Provider Configuration endpoint ::: -If the Identity Provider used exposes a different path and/or requires adding some extra URI parameters for the OpenID discovery endpoint, -they can be configured as follows: - +If your provider exposes a different path and/or requires some extra http parameters for the OpenId discovery endpoint, you can configure them as follows: ```ini auth_oauth2.discovery_endpoint_path = my/custom/path auth_oauth2.discovery_endpoint_params.appid = some-app-id @@ -127,7 +125,7 @@ Tokens must be digitally signed otherwise they are not accepted. RabbitMQ must h * **JWKS endpoint**: this is the HTTP endpoint that returns the signing keys used to digitally sign the tokens * **OpenID Provider Configuration endpoint**: this endpoint returns the provider's configuration including all of its endpoints, most importantly the **JWKS endpoint** -When RabbitMQ is configured with one of two previous endpoints, RabbitMQ must make a HTTP request (or two, if you specify the latter endpoint) to download the signing keys. This is an operation that occurs once for any signing key not downloaded yet. When the OAuth 2.0 provider rotates the signing keys, newer tokens refer to a new signing key which RabbitMQ does not have yet which triggers another download of the newer signing keys. +When you configure RabbitMQ with one of two previous endpoints, RabbitMQ must make a HTTP request (or two, if you specify the latter endpoint) to download the signing keys. This is an operation that occurs once for any signing key not downloaded yet. When the OAuth 2.0 provider rotates the signing keys, newer tokens refer to a new signing key which RabbitMQ does not have yet which triggers another download of the newer signing keys. The token can be any [JWT token](https://jwt.io/introduction/) which contains the `scope` and `aud` fields. @@ -146,27 +144,28 @@ In chronological order, here is the sequence of events that occur when a client |--------------------------------------------|----------- | `auth_oauth2.resource_server_id` | The [Resource Server ID](#resource-server-id) | `auth_oauth2.resource_server_type` | The Resource Server Type required when using [Rich Authorization Request](#rich-authorization-request) token format -| `auth_oauth2.additional_scopes_key` | Configure the plugin to look for scopes in other fields (maps to `additional_rabbitmq_scopes` in the old format) | -| `auth_oauth2.scope_prefix` | [Configure the prefix for all scopes](#scope-prefix). The default value is `auth_oauth2.resource_server_id` followed by the dot `.` character | -| `auth_oauth2.preferred_username_claims` | [List of the JWT claims](#preferred-username-claims) to look for the username associated with the token -| `auth_oauth2.default_key` | ID of the default signing key -| `auth_oauth2.signing_keys` | Paths to the [signing key files](#signing-key-files) -| `auth_oauth2.issuer` | The [issuer URL](#configure-issuer) of the authorization server. Used to build the discovery endpoint URL to discover other endpoints such as such as `jwks_uri`. Management UI users will be sent to this for logging in +| `auth_oauth2.additional_scopes_key` | Configure the plugin to look for scopes in other fields (maps to `additional_rabbitmq_scopes` in the old format). | +| `auth_oauth2.scope_prefix` | [Configure the prefix for all scopes](#scope-prefix). The default value is `auth_oauth2.resource_server_id` followed by the dot `.` character. | +| `auth_oauth2.preferred_username_claims` | [List of the JWT claims](#preferred-username-claims) to look for the username associated with the token. +| `auth_oauth2.default_key` | ID of the default signing key. +| `auth_oauth2.signing_keys` | Paths to the [signing key files](#signing-key-files). +| `auth_oauth2.issuer` | The [issuer URL](#configure-issuer) of the authorization server that is used to either discover endpoints such as `jwks_uri` and/or where to redirect RabbitMQ management users to login and get a token. | `auth_oauth2.discovery_endpoint_path` | The path used for the [OpenId discovery endpoint](https://openid.net/specs/openid-connect-discovery-1_0.html#ProviderMetadata). The endpoint URI is built using `auth_oauth2.issuer`, this path or else the default path `.well-known/openid-configuration` followed by query parameters configured in the following variable -| `auth_oauth2.discovery_endpoint_params` | [List of HTTP query parameters](#discovery-endpoint-params) sent to the OpenId discovery endpoint -| `auth_oauth2.jwks_url` | The URL of the [JWKS endpoint](#jwks-endpoint). According to the [JWT Specification](https://datatracker.ietf.org/doc/html/rfc7515#section-4.1.2), the endpoint URL must use "https" for schema. Optional if you set `auth_oauth2.issuer`. If this URL is set, it overrides the `jwks_uri` discovered via the discovery endpoint -| `auth_oauth2.token_endpoint` | The URL of the OAuth 2.0 token endpoint. Optional if you set `auth_oauth2.issuer`. If this URL is set, it overrides the `token_endpoint` discovered via the discovery endpoint -| `auth_oauth2.https.cacertfile` | Path to a file containing PEM-encoded CA certificates. The CA certificates are used to connect to any of these endpoints: `jwks_url`, `token_endpoint`, or the discovery endpoint -| `auth_oauth2.https.depth` | The maximum number of non-self-issued intermediate certificates that may follow the peer certificate in a valid [certification path](ssl#peer-verification-depth). The default value is 10 +| `auth_oauth2.discovery_endpoint_params` | [List of HTTP query parameters](#discovery-endpoint-params) sent to the OpenId discovery endpoint. +| `auth_oauth2.jwks_uri` | The URL of the [JWKS endpoint](#jwks-endpoint). According to the [JWT Specification](https://datatracker.ietf.org/doc/html/rfc7515#section-4.1.2), the endpoint URL must be https. Optional if you set `auth_oauth2.issuer`. If this URL is set, it overrides the `jwks_uri` discovered via the discovery endpoint. +| `auth_oauth2.jwks_url` | This variable is **deprecated** and you should use instead `auth_oauth2.jwks_uri`. In RabbitMQ 4.2.0, this variable will be removed. In the meantime, RabbitMQ supports it until you change your configuration. +| `auth_oauth2.token_endpoint` | The URL of the OAuth 2.0 token endpoint. Optional if you set `auth_oauth2.issuer`. If this URL is set, it overrides the `token_endpoint` discovered via the discovery endpoint. +| `auth_oauth2.https.cacertfile` | Path to a file containing PEM-encoded CA certificates. The CA certificates are used to connect to any of these endpoints: `jwks_uri`, `token_endpoint`, or the discovery endpoint. +| `auth_oauth2.https.depth` | The maximum number of non-self-issued intermediate certificates that may follow the peer certificate in a valid [certification path](ssl#peer-verification-depth). The default value is 10. | `auth_oauth2.https.peer_verification` | Configures [peer verification](ssl#peer-verification). Available values: `verify_none`, `verify_peer`. The default value is `verify_peer` if there are trusted CA installed in the OS or `auth_oauth2.https.cacertfile` is set.

**Deprecated**: This variable will be soon replaced by `auth_oauth2.https.verify`. Users should stop using this variable. -| `auth_oauth2.https.fail_if_no_peer_cert` | Used together with `auth_oauth2.https.peer_verification = verify_peer`. When set to `true`, TLS connection will be rejected if the client fails to provide a certificate. The default value is `false` -| `auth_oauth2.https.hostname_verification` | Enable wildcard-aware hostname verification for key server. Available values: `wildcard`, `none`. The default value is `none` -| `auth_oauth2.https.crl_check` | [Perform CRL verification](https://www.erlang.org/doc/man/ssl#type-crl_check) (Certificate Revocation List) verification. Default value is false -| `auth_oauth2.algorithms` | Restrict [the usable algorithms](https://github.com/potatosalad/erlang-jose#algorithm-support) -| `auth_oauth2.verify_aud` | Whether to verify the [token's `aud`](#token-validation) field or not. The default value is `true` -| `auth_oauth2.resource_servers` | [Multiple OAuth 2.0 resources configuration](#multiple-resource-servers-configuration) -| `auth_oauth2.oauth_providers` | [Multiple OAuth 2.0 providers configuration](#multiple-oauth-providers-configuration) -| `auth_oauth2.default_oauth_provider` | ID of the OAuth 2.0 provider used for the `auth_oauth2.resource_servers`, that did not specify any (via the variable `oauth_provider_id`) or when `auth_oauth2.jwks_url` and `auth_oauth2.issuer` are both missing +| `auth_oauth2.https.fail_if_no_peer_cert` | Used together with `auth_oauth2.https.peer_verification = verify_peer`. When set to `true`, TLS connection will be rejected if the client fails to provide a certificate. The default value is `false`. +| `auth_oauth2.https.hostname_verification` | Enable wildcard-aware hostname verification for key server. Available values: `wildcard`, `none`. The default value is `none`. +| `auth_oauth2.https.crl_check` | [Perform CRL verification](https://www.erlang.org/doc/man/ssl#type-crl_check) (Certificate Revocation List) verification. Default value is false. +| `auth_oauth2.algorithms` | Restrict [the usable algorithms](https://github.com/potatosalad/erlang-jose#algorithm-support). +| `auth_oauth2.verify_aud` | Whether to verify the [token's `aud`](#token-validation) field or not. The default value is `true`. +| `auth_oauth2.resource_servers` | [Multiple OAuth 2.0 resources configuration](#multiple-resource-servers-configuration). +| `auth_oauth2.oauth_providers` | [Multiple OAuth 2.0 providers configuration](#multiple-oauth-providers-configuration). +| `auth_oauth2.default_oauth_provider` | ID of the OAuth 2.0 provider used for the `auth_oauth2.resource_servers`, that did not specify any (via the variable `oauth_provider_id`) or when `auth_oauth2.jwks_uri` and `auth_oauth2.issuer` are both missing. #### Resource Server ID {#resource-server-id} @@ -221,7 +220,7 @@ The following configuration sets the JWKS endpoint from which RabbitMQ downloads ```ini auth_oauth2.resource_server_id = new_resource_server_id -auth_oauth2.jwks_url = https://my-jwt-issuer/jwks.json +auth_oauth2.jwks_uri = https://my-jwt-issuer/jwks.json auth_oauth2.https.cacertfile = test/config_schema_SUITE_data/certs/cacert.pem auth_oauth2.https.peer_verification = verify_peer auth_oauth2.https.depth = 5 @@ -247,7 +246,7 @@ Each `auth_oauth2.resource_servers..` entry has the following variable All available configurable parameters for each OAuth 2 provider is documented [in a separate section](#multiple-oauth-providers-configuration). -Usually, a numeric value is used as `index`, for example `auth_oauth2.resource_servers.1.id = rabbit_prod`. However, it can be any string, for example `auth_oauth2.resource_servers.rabbit_prod.jwks_url = http://some_url`. By default, the `index` is the resource server's id. However, you can override it via the `id` variable like in `auth_oauth2.resource_servers.1.id = rabbit_prod`. +Usually, a numeric value is used as `index`, for example `auth_oauth2.resource_servers.1.id = rabbit_prod`. However, it can be any string, for example `auth_oauth2.resource_servers.rabbit_prod.jwks_uri = http://some_url`. By default, the `index` is the resource server's id. However, you can override it via the `id` variable like in `auth_oauth2.resource_servers.1.id = rabbit_prod`. Here is an example which configures two resources (`prod` and `dev`) which are used by the users and clients managed by the same identity provider whose issuer url is `https://my-idp.com/`: @@ -270,7 +269,7 @@ Each `auth_oauth2.oauth_providers.{id/index}` entry has the following sub-keys. | `discovery_endpoint_path` | The path used for the OpenId discovery endpoint. Default value is `.well-known/openid-configuration` | `discovery_endpoint_params` | [List of HTTP query parameters](#discovery-endpoint-params) sent to the OpenId discovery endpoint. | `token_endpoint` | The URL of the OAuth 2.0 token endpoint. Optional if you configured `issuer`. -| `jwks_uri` | The URL of the [JWKS endpoint](#jwks-endpoint). According to the [JWT Specification](https://datatracker.ietf.org/doc/html/rfc7515#section-4.1.2), the endpoint URL must use "https" for schema.

**Warning**: RabbitMQ uses for each OAuth Provider the variable name `jwks_uri` used by the OpenId Connect Discovery Specification rather than `jwks_url`. This variable is optional if you set `issuer`. +| `jwks_uri` | The URL of the [JWKS endpoint](#jwks-endpoint). According to the [JWT Specification](https://datatracker.ietf.org/doc/html/rfc7515#section-4.1.2), the endpoint URL must be https. This variable is optional if you set `issuer`. | `https.cacertfile` | Path to a file containing PEM-encoded CA certificates used to connect `issuer` and/or `jwks_uri` URLs. | `https.depth` | The maximum number of non-self-issued intermediate certificates that may follow the peer certificate in a valid [certification path](ssl#peer-verification-depth). The default value is 10. | `https.verify` | Configures [peer verification](ssl#peer-verification). Available values: `verify_none`, `verify_peer`. The default value is `verify_peer` if there are trusted CA installed in the OS or `auth_oauth2.https.cacertfile` is set. @@ -414,7 +413,7 @@ the `monitoring` tag will be `my_rabbit.tag:monitoring`. ### Configure OAuth 2.0 provider's issuer {#configure-issuer} -Before RabbitMQ 3.13, users had to either configure the JWKS endpoint (that is `auth_oauth2.jwks_url` variable) or statically [configure the signing keys](#configure-signing-keys). Now, users only need to configure the OpenID Provider's **issuer** URL and from this URL RabbitMQ downloads the OpenID Provider configuration which includes the JWKS endpoint in addition to other endpoints which will be useful in other contexts. +Before RabbitMQ 3.13, users had to either configure the JWKS endpoint (that is `auth_oauth2.jwks_uri` variable) or statically [configure the signing keys](#configure-signing-keys). Now, users only need to configure the OpenID Provider's **issuer** URL and from this URL RabbitMQ downloads the OpenID Provider configuration which includes the JWKS endpoint in addition to other endpoints which will be useful in other contexts. Usually, this **issuer** URL is the same URL configured in the management plugin (`management.oauth_provider_url`). From now on, you only need to configure a single URL, specified by the `auth_oauth2.issuer` variable. Except in edge cases where the **issuer** URL does not host the login page. In those cases, the user configures the login page in the `management.oauth_provider_url` variable. @@ -424,18 +423,18 @@ auth_oauth2.resource_server_id = my_rabbit_server auth_oauth2.issuer = https://my-idp-provider/somerealm ``` -Sample configuration which configures the jwks_url rather than the issuer: +Sample configuration which configures the `jwks_uri` rather than the issuer: ```ini auth_oauth2.resource_server_id = my_rabbit_server -auth_oauth2.jwks_url = "https://my-jwt-issuer/jwks.json +auth_oauth2.jwks_uri = "https://my-jwt-issuer/jwks.json ``` :::info -If you have both endpoints configured, RabbitMQ uses `jwks_url` because it does not need to discover it via the `issuer` url. +If you have both endpoints configured, RabbitMQ uses `jwks_uri` because it does not need to discover it via the `issuer` url. ::: :::info -**Note about TLS variables for the `jwks_url` or the `issuer` url**: TLS variable such as the `cacertfile` are configured as follows regardless which url you are using: +**Note about TLS variables for the `jwks_uri` or the `issuer` url**: TLS variable such as the `cacertfile` are configured as follows regardless which url you are using: ::: ```ini @@ -709,7 +708,7 @@ if RabbitMQ nodes `resource_server_id` is equal to `finance`, the plugin compute As long as you have only one OAuth 2.0 provider, you can skip this advanced usage although you can use it. -Under the [basic usage](#configure-issuer) section, you configured the `issuer` url or maybe the `jwks_url` along with the TLS variables if needed. This advanced usage configures everything relative to the OAuth provider into a dedicated configuration. +Under the [basic usage](#configure-issuer) section, you configured the `issuer` url or maybe the `jwks_uri` along with the TLS variables if needed. This advanced usage configures everything relative to the OAuth provider into a dedicated configuration. Here is an example configuration that uses `issuer` to configure the identity provider's URL: @@ -784,7 +783,7 @@ All resource servers share the variables you set so far under `auth_oauth2.` suc - `scope_prefix` - `additional_scopes_key` - `resource_server_type` -- `oauth_provider_id` - This is the identifier of the OAuth provider. It is configured in RabbitMQ. It provides all the variables to contact the authorization server and discover all its endpoints, such as the `jwks_uri` to download the signing keys to validate the token. If this variable is omitted, RabbitMQ looks up the default Authorization Provider's id in the variable `auth_oauth2.default_oauth_provider`, and if it is also omitted, RabbitMQ uses `auth_oauth2.issuer` or `auth_oauth2.jwks_url` to download the signings keys to validate the token. +- `oauth_provider_id` - This is the identifier of the OAuth provider. It is configured in RabbitMQ. It provides all the variables to contact the authorization server and discover all its endpoints, such as the `jwks_uri` to download the signing keys to validate the token. If this variable is omitted, RabbitMQ looks up the default Authorization Provider's id in the variable `auth_oauth2.default_oauth_provider`, and if it is also omitted, RabbitMQ uses `auth_oauth2.issuer` or `auth_oauth2.jwks_uri` to download the signings keys to validate the token. The list of supported resource servers is the combination of `auth_oauth2.resource_servers` and `auth_oauth2.resource_server_id`. You can use both or only one of them. diff --git a/versioned_docs/version-3.13/oauth2.md b/versioned_docs/version-3.13/oauth2.md index 71471f12d3..050fa9a205 100644 --- a/versioned_docs/version-3.13/oauth2.md +++ b/versioned_docs/version-3.13/oauth2.md @@ -137,25 +137,25 @@ In chronological order, here is the sequence of events that occur when a client |--------------------------------------------|----------- | `auth_oauth2.resource_server_id` | The [Resource Server ID](#resource-server-id) | `auth_oauth2.resource_server_type` | The Resource Server Type required when using [Rich Authorization Request](#rich-authorization-request) token format -| `auth_oauth2.additional_scopes_key` | Configure the plugin to look for scopes in other fields (maps to `additional_rabbitmq_scopes` in the old format) | -| `auth_oauth2.scope_prefix` | [Configure the prefix for all scopes](#scope-prefix). The default value is `auth_oauth2.resource_server_id` followed by the dot `.` character | -| `auth_oauth2.preferred_username_claims` | [List of the JWT claims](#preferred-username-claims) to look for the username associated with the token -| `auth_oauth2.default_key` | ID of the default signing key -| `auth_oauth2.signing_keys` | Paths to the [signing key files](#signing-key-files) -| `auth_oauth2.issuer` | The [issuer URL](#configure-issuer) of the authorization server. Used to build the discovery endpoint URL to discover other endpoints such as such as `jwks_uri`. Management UI users will be sent to this for logging in -| `auth_oauth2.jwks_url` | The URL of the [JWKS endpoint](#jwks-endpoint). According to the [JWT Specification](https://datatracker.ietf.org/doc/html/rfc7515#section-4.1.2), the endpoint URL must use "https" for schema -| `auth_oauth2.token_endpoint` | The URL of the OAuth 2.0 token endpoint -| `auth_oauth2.https.cacertfile` | Path to a file containing PEM-encoded CA certificates. The CA certificates are used to connect to any of these endpoints: `jwks_url`, `token_endpoint`, or the `issuer` -| `auth_oauth2.https.depth` | The maximum number of non-self-issued intermediate certificates that may follow the peer certificate in a valid [certification path](ssl#peer-verification-depth). The default value is 10 -| `auth_oauth2.https.peer_verification` | Configures [peer verification](ssl#peer-verification). Available values: `verify_none`, `verify_peer`. The default value is `verify_peer` if there are trusted CA installed in the OS or `auth_oauth2.https.cacertfile` is set.

**Deprecated**: This variable will be soon replaced by `auth_oauth2.https.verify`. Users should stop using this variable -| `auth_oauth2.https.fail_if_no_peer_cert` | Used together with `auth_oauth2.https.peer_verification = verify_peer`. When set to `true`, TLS connection will be rejected if the client fails to provide a certificate. The default value is `false` -| `auth_oauth2.https.hostname_verification` | Enable wildcard-aware hostname verification for key server. Available values: `wildcard`, `none`. The default value is `none` -| `auth_oauth2.https.crl_check` | [Perform CRL verification](https://www.erlang.org/doc/man/ssl#type-crl_check) (Certificate Revocation List) verification. Default value is false -| `auth_oauth2.algorithms` | Restrict [the usable algorithms](https://github.com/potatosalad/erlang-jose#algorithm-support) -| `auth_oauth2.verify_aud` | Whether to verify the [token's `aud`](#token-validation) field or not. The default value is `true` -| `auth_oauth2.resource_servers` | [Multiple OAuth 2.0 resources configuration](#multiple-resource-servers-configuration) -| `auth_oauth2.oauth_providers` | [Multiple OAuth 2.0 providers configuration](#multiple-oauth-providers-configuration) -| `auth_oauth2.default_oauth_provider` | ID of the OAuth 2.0 provider used for the `auth_oauth2.resource_servers`, that did not specify any (via the variable `oauth_provider_id`) or when `auth_oauth2.jwks_url` and `auth_oauth2.issuer` are both missing +| `auth_oauth2.additional_scopes_key` | Configure the plugin to look for scopes in other fields (maps to `additional_rabbitmq_scopes` in the old format). | +| `auth_oauth2.scope_prefix` | [Configure the prefix for all scopes](#scope-prefix). The default value is `auth_oauth2.resource_server_id` followed by the dot `.` character. | +| `auth_oauth2.preferred_username_claims` | [List of the JWT claims](#preferred-username-claims) to look for the username associated with the token. +| `auth_oauth2.default_key` | ID of the default signing key. +| `auth_oauth2.signing_keys` | Paths to the [signing key files](#signing-key-files). +| `auth_oauth2.issuer` | The [issuer URL](#configure-issuer) of the authorization server that is used to discover endpoints such as `jwks_uri` and others (https://openid.net/specs/openid-connect-discovery-1_0.html#ProviderMetadata). +| `auth_oauth2.jwks_url` | The URL of the [JWKS endpoint](#jwks-endpoint). According to the [JWT Specification](https://datatracker.ietf.org/doc/html/rfc7515#section-4.1.2), the endpoint URL must be https. +| `auth_oauth2.token_endpoint` | The URL of the OAuth 2.0 token endpoint. +| `auth_oauth2.https.cacertfile` | Path to a file containing PEM-encoded CA certificates. The CA certificates are used to connect to any of these endpoints: `jwks_url`, `token_endpoint`, or the `issuer`. +| `auth_oauth2.https.depth` | The maximum number of non-self-issued intermediate certificates that may follow the peer certificate in a valid [certification path](ssl#peer-verification-depth). The default value is 10. +| `auth_oauth2.https.peer_verification` | Configures [peer verification](ssl#peer-verification). Available values: `verify_none`, `verify_peer`. The default value is `verify_peer` if there are trusted CA installed in the OS or `auth_oauth2.https.cacertfile` is set.

**Deprecated**: This variable will be soon replaced by `auth_oauth2.https.verify`. Users should stop using this variable. +| `auth_oauth2.https.fail_if_no_peer_cert` | Used together with `auth_oauth2.https.peer_verification = verify_peer`. When set to `true`, TLS connection will be rejected if the client fails to provide a certificate. The default value is `false`. +| `auth_oauth2.https.hostname_verification` | Enable wildcard-aware hostname verification for key server. Available values: `wildcard`, `none`. The default value is `none`. +| `auth_oauth2.https.crl_check` | [Perform CRL verification](https://www.erlang.org/doc/man/ssl#type-crl_check) (Certificate Revocation List) verification. Default value is false. +| `auth_oauth2.algorithms` | Restrict [the usable algorithms](https://github.com/potatosalad/erlang-jose#algorithm-support). +| `auth_oauth2.verify_aud` | Whether to verify the [token's `aud`](#token-validation) field or not. The default value is `true`. +| `auth_oauth2.resource_servers` | [Multiple OAuth 2.0 resources configuration](#multiple-resource-servers-configuration). +| `auth_oauth2.oauth_providers` | [Multiple OAuth 2.0 providers configuration](#multiple-oauth-providers-configuration). +| `auth_oauth2.default_oauth_provider` | ID of the OAuth 2.0 provider used for the `auth_oauth2.resource_servers`, that did not specify any (via the variable `oauth_provider_id`) or when `auth_oauth2.jwks_url` and `auth_oauth2.issuer` are both missing. #### Resource Server ID {#resource-server-id} diff --git a/versioned_docs/version-4.0/oauth2.md b/versioned_docs/version-4.0/oauth2.md index a971f3f63a..f54a907b4e 100644 --- a/versioned_docs/version-4.0/oauth2.md +++ b/versioned_docs/version-4.0/oauth2.md @@ -137,25 +137,26 @@ In chronological order, here is the sequence of events that occur when a client |--------------------------------------------|----------- | `auth_oauth2.resource_server_id` | The [Resource Server ID](#resource-server-id) | `auth_oauth2.resource_server_type` | The Resource Server Type required when using [Rich Authorization Request](#rich-authorization-request) token format -| `auth_oauth2.additional_scopes_key` | Configure the plugin to look for scopes in other fields (maps to `additional_rabbitmq_scopes` in the old format) | -| `auth_oauth2.scope_prefix` | [Configure the prefix for all scopes](#scope-prefix). The default value is `auth_oauth2.resource_server_id` followed by the dot `.` character | -| `auth_oauth2.preferred_username_claims` | [List of the JWT claims](#preferred-username-claims) to look for the username associated with the token -| `auth_oauth2.default_key` | ID of the default signing key -| `auth_oauth2.signing_keys` | Paths to the [signing key files](#signing-key-files) -| `auth_oauth2.issuer` | The [issuer URL](#configure-issuer) of the authorization server. Used to build the discovery endpoint URL to discover other endpoints such as such as `jwks_uri`. Management UI users will be sent to this for logging in -| `auth_oauth2.jwks_url` | The URL of the [JWKS endpoint](#jwks-endpoint). According to the [JWT Specification](https://datatracker.ietf.org/doc/html/rfc7515#section-4.1.2), the endpoint URL must use "https" for schema -| `auth_oauth2.token_endpoint` | The URL of the OAuth 2.0 token endpoint -| `auth_oauth2.https.cacertfile` | Path to a file containing PEM-encoded CA certificates. The CA certificates are used to connect to any of these endpoints: `jwks_url`, `token_endpoint`, or the `issuer` -| `auth_oauth2.https.depth` | The maximum number of non-self-issued intermediate certificates that may follow the peer certificate in a valid [certification path](ssl#peer-verification-depth). The default value is 10 -| `auth_oauth2.https.peer_verification` | Configures [peer verification](ssl#peer-verification). Available values: `verify_none`, `verify_peer`. The default value is `verify_peer` if there are trusted CA installed in the OS or `auth_oauth2.https.cacertfile` is set.

**Deprecated**: This variable will be soon replaced by `auth_oauth2.https.verify`. Users should stop using this variable -| `auth_oauth2.https.fail_if_no_peer_cert` | Used together with `auth_oauth2.https.peer_verification = verify_peer`. When set to `true`, TLS connection will be rejected if the client fails to provide a certificate. The default value is `false` -| `auth_oauth2.https.hostname_verification` | Enable wildcard-aware hostname verification for key server. Available values: `wildcard`, `none`. The default value is `none` -| `auth_oauth2.https.crl_check` | [Perform CRL verification](https://www.erlang.org/doc/man/ssl#type-crl_check) (Certificate Revocation List) verification. Default value is false -| `auth_oauth2.algorithms` | Restrict [the usable algorithms](https://github.com/potatosalad/erlang-jose#algorithm-support) -| `auth_oauth2.verify_aud` | Whether to verify the [token's `aud`](#token-validation) field or not. The default value is `true` -| `auth_oauth2.resource_servers` | [Multiple OAuth 2.0 resources configuration](#multiple-resource-servers-configuration) -| `auth_oauth2.oauth_providers` | [Multiple OAuth 2.0 providers configuration](#multiple-oauth-providers-configuration) -| `auth_oauth2.default_oauth_provider` | ID of the OAuth 2.0 provider used for the `auth_oauth2.resource_servers`, that did not specify any (via the variable `oauth_provider_id`) or when `auth_oauth2.jwks_url` and `auth_oauth2.issuer` are both missing +| `auth_oauth2.additional_scopes_key` | Configure the plugin to look for scopes in other fields (maps to `additional_rabbitmq_scopes` in the old format). | +| `auth_oauth2.scope_prefix` | [Configure the prefix for all scopes](#scope-prefix). The default value is `auth_oauth2.resource_server_id` followed by the dot `.` character. | +| `auth_oauth2.preferred_username_claims` | [List of the JWT claims](#preferred-username-claims) to look for the username associated with the token. +| `auth_oauth2.default_key` | ID of the default signing key. +| `auth_oauth2.signing_keys` | Paths to the [signing key files](#signing-key-files). +| `auth_oauth2.issuer` | The [issuer URL](#configure-issuer) of the authorization server that is used to discover endpoints such as `jwks_uri` and others (https://openid.net/specs/openid-connect-discovery-1_0.html#ProviderMetadata). +| `auth_oauth2.jwks_url` | The URL of the [JWKS endpoint](#jwks-endpoint). According to the [JWT Specification](https://datatracker.ietf.org/doc/html/rfc7515#section-4.1.2), the endpoint URL must be https. +| `auth_oauth2.token_endpoint` | The URL of the OAuth 2.0 token endpoint. +| `auth_oauth2.https.cacertfile` | Path to a file containing PEM-encoded CA certificates. The CA certificates are used to connect to any of these endpoints: `jwks_url`, `token_endpoint`, or the `issuer`. +| `auth_oauth2.https.depth` | The maximum number of non-self-issued intermediate certificates that may follow the peer certificate in a valid [certification path](ssl#peer-verification-depth). The default value is 10. +| `auth_oauth2.https.peer_verification` | Configures [peer verification](ssl#peer-verification). Available values: `verify_none`, `verify_peer`. The default value is `verify_peer` if there are trusted CA installed in the OS or `auth_oauth2.https.cacertfile` is set.

**Deprecated**: This variable will be soon replaced by `auth_oauth2.https.verify`. Users should stop using this variable. +| `auth_oauth2.https.fail_if_no_peer_cert` | Used together with `auth_oauth2.https.peer_verification = verify_peer`. When set to `true`, TLS connection will be rejected if the client fails to provide a certificate. The default value is `false`. +| `auth_oauth2.https.hostname_verification` | Enable wildcard-aware hostname verification for key server. Available values: `wildcard`, `none`. The default value is `none`. +| `auth_oauth2.https.crl_check` | [Perform CRL verification](https://www.erlang.org/doc/man/ssl#type-crl_check) (Certificate Revocation List) verification. Default value is false. +| `auth_oauth2.algorithms` | Restrict [the usable algorithms](https://github.com/potatosalad/erlang-jose#algorithm-support). +| `auth_oauth2.verify_aud` | Whether to verify the [token's `aud`](#token-validation) field or not. The default value is `true`. +| `auth_oauth2.resource_servers` | [Multiple OAuth 2.0 resources configuration](#multiple-resource-servers-configuration). +| `auth_oauth2.oauth_providers` | [Multiple OAuth 2.0 providers configuration](#multiple-oauth-providers-configuration). +| `auth_oauth2.default_oauth_provider` | ID of the OAuth 2.0 provider used for the `auth_oauth2.resource_servers`, that did not specify any (via the variable `oauth_provider_id`) or when `auth_oauth2.jwks_url` and `auth_oauth2.issuer` are both missing. + #### Resource Server ID {#resource-server-id}