From 7a12c5e0ef48415797cf43fbab5e5bc74be8d802 Mon Sep 17 00:00:00 2001 From: Gilles De Mey Date: Fri, 3 May 2024 13:23:37 +0200 Subject: [PATCH] Alerting: Add OAuth2 to HTTP settings for vanilla Alertmanager / Mimir (#87272) add OAuth2 to HTTP settings for vanilla Alertmanager / Mimir --- .../cloud-alertmanager-notifier-types.ts | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/public/app/features/alerting/unified/utils/cloud-alertmanager-notifier-types.ts b/public/app/features/alerting/unified/utils/cloud-alertmanager-notifier-types.ts index 9c45bac800d..c530fa122c6 100644 --- a/public/app/features/alerting/unified/utils/cloud-alertmanager-notifier-types.ts +++ b/public/app/features/alerting/unified/utils/cloud-alertmanager-notifier-types.ts @@ -29,6 +29,25 @@ const tlsConfigOption: NotificationChannelOption = option('tls_config', 'TLS con ], }); +const oauth2ConfigOption: NotificationChannelOption = option('oauth2', 'OAuth2', 'Configures the OAuth2 settings.', { + element: 'subform', + subformOptions: [ + option('client_id', 'Client ID', 'The OAuth2 client ID', { required: true }), + option('client_secret', 'Client secret', 'The OAuth2 client secret', { required: true }), + // ths "client_secret_file" is not allowed for security reasons in Mimir / Cloud Alertmanager so we also disable it for OSS Alertmanager – sorry! + // option( + // 'client_secret_file', + // 'Client secret file', + // 'OAuth2 client secret file location. Mutually exclusive with client_secret.', + // ), + option('token_url', 'Token URL', 'The OAuth2 token exchange URL', { required: true }), + option('scopes', 'Scopes', 'Comma-separated list of scopes', { + element: 'string_array', + }), + option('endpoint_params', 'Additional parameters', '', { element: 'key_value_map' }), + ], +}); + const httpConfigOption: NotificationChannelOption = option( 'http_config', 'HTTP Config', @@ -45,6 +64,7 @@ const httpConfigOption: NotificationChannelOption = option( option('proxy_url', 'Proxy URL', 'Optional proxy URL.'), basicAuthOption, tlsConfigOption, + oauth2ConfigOption, ], } );