From c3cf57e65ea9b28acb3f322046f7a9b83be15e9c Mon Sep 17 00:00:00 2001 From: Paulin Todev Date: Wed, 4 Oct 2023 22:34:52 +0100 Subject: [PATCH] Change the type of the `client_secret` argument (#5372) Change the type of the `client_secret` argument of the `otelcol.auth.oauth2` component from `string` to `secret`. --- CHANGELOG.md | 3 +++ component/otelcol/auth/oauth2/oauth2.go | 3 ++- docs/sources/flow/reference/components/otelcol.auth.oauth2.md | 2 +- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 24fbf76cf9bb..5ff119c5aa4a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -154,6 +154,9 @@ Main (unreleased) - Update Prometheus dependency to v2.46.0. (@tpaschalis) +- The `client_secret` config argument in the `otelcol.auth.oauth2` component is + now of type `secret` instead of type `string`. (@ptodev) + ### Bugfixes - Fixed `otelcol.exporter.prometheus` label names for the `otel_scope_info` diff --git a/component/otelcol/auth/oauth2/oauth2.go b/component/otelcol/auth/oauth2/oauth2.go index 917ec12997ac..3396dca94d06 100644 --- a/component/otelcol/auth/oauth2/oauth2.go +++ b/component/otelcol/auth/oauth2/oauth2.go @@ -8,6 +8,7 @@ import ( "github.com/grafana/agent/component/otelcol" "github.com/grafana/agent/component/otelcol/auth" otel_service "github.com/grafana/agent/service/otel" + "github.com/grafana/river/rivertypes" "github.com/open-telemetry/opentelemetry-collector-contrib/extension/oauth2clientauthextension" otelcomponent "go.opentelemetry.io/collector/component" "go.opentelemetry.io/collector/config/configopaque" @@ -31,7 +32,7 @@ func init() { // Arguments configures the otelcol.auth.oauth2 component. type Arguments struct { ClientID string `river:"client_id,attr"` - ClientSecret string `river:"client_secret,attr"` + ClientSecret rivertypes.Secret `river:"client_secret,attr"` TokenURL string `river:"token_url,attr"` EndpointParams url.Values `river:"endpoint_params,attr,optional"` Scopes []string `river:"scopes,attr,optional"` diff --git a/docs/sources/flow/reference/components/otelcol.auth.oauth2.md b/docs/sources/flow/reference/components/otelcol.auth.oauth2.md index 429cab7a6c0c..b4f0cdd686e9 100644 --- a/docs/sources/flow/reference/components/otelcol.auth.oauth2.md +++ b/docs/sources/flow/reference/components/otelcol.auth.oauth2.md @@ -39,7 +39,7 @@ otelcol.auth.oauth2 "LABEL" { Name | Type | Description | Default | Required ---- | ---- | ----------- | ------- | -------- `client_id` | `string` | The client identifier issued to the client. | | yes -`client_secret` | `string` | The secret string associated with the client identifier. | | yes +`client_secret` | `secret` | The secret string associated with the client identifier. | | yes `token_url` | `string` | The server endpoint URL from which to get tokens. | | yes `endpoint_params` | `map(list(string))` | Additional parameters that are sent to the token endpoint. | `{}` | no `scopes` | `list(string)` | Requested permissions associated for the client. | `[]` | no