Skip to content
This repository was archived by the owner on Sep 2, 2025. It is now read-only.

Commit 42d50d0

Browse files
WIP
1 parent 0c5a448 commit 42d50d0

File tree

1 file changed

+138
-2
lines changed

1 file changed

+138
-2
lines changed

gdi/opentelemetry/components/bearertokenauth-extension.rst

Lines changed: 138 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,143 @@ Authenticator - Bearer extension
77
.. meta::
88
:description: Implements both ``configauth.ServerAuthenticator`` and ``configauth.ClientAuthenticator``. It can be used in both http and gRPC exporters inside the ``auth`` settings to embed a static token for every RPC call made.
99

10-
The Splunk Distribution of the OpenTelemetry Collector supports the Authenticator - Bearer extension. Documentation is planned for a future release.
10+
The ``basicauth`` extension implements both ``configauth.ServerAuthenticator`` and ``configauth.ClientAuthenticator`` to authenticate clients and servers using basic authentication. The authenticator type has to be set to ``basicauth``.
11+
12+
When used to authenticate servers, if the authentication is successful, ``client.Info.Auth`` exposes the following attributes:
13+
14+
* ``username``: The username of the authenticated user.
15+
* ``raw``: Raw base64 encoded credentials.
16+
17+
.. caution:: You can either authenticate servers or clients with the extension. If you configure both options, the extension throws an error. See more in :ref:`basic-auth-extension-settings`.
18+
19+
Get started
20+
======================
21+
22+
Follow these steps to configure and activate the component:
23+
24+
1. Deploy the Splunk Distribution of the the OpenTelemetry Collector to your host or container platform:
25+
26+
- :ref:`otel-install-linux`
27+
- :ref:`otel-install-windows`
28+
- :ref:`otel-install-k8s`
29+
30+
2. Configure the ``basicauth`` extension as described in the next section.
31+
3. Restart the Collector.
32+
33+
Sample configurations
34+
--------------------------------------------
35+
36+
To activate the component add ``basicauth`` to the ``extensions`` section of your configuration file, as shown in the following example:
37+
38+
.. code:: yaml
39+
40+
extensions:
41+
basicauth/server:
42+
htpasswd:
43+
file: .htpasswd
44+
inline: |
45+
${env:BASIC_AUTH_USERNAME}:${env:BASIC_AUTH_PASSWORD}
46+
47+
basicauth/client:
48+
client_auth:
49+
username: username
50+
password: password
51+
52+
receivers:
53+
otlp:
54+
protocols:
55+
http:
56+
auth:
57+
authenticator: basicauth/server
58+
59+
processors:
60+
61+
exporters:
62+
otlp:
63+
auth:
64+
authenticator: basicauth/client
65+
66+
To complete the configuration, include the extension in any pipeline of the ``service`` section of your
67+
configuration file. For example:
68+
69+
.. code:: yaml
70+
71+
service:
72+
extensions: [basicauth/server, basicauth/client]
73+
pipelines:
74+
traces:
75+
receivers: [otlp]
76+
processors: []
77+
exporters: [otlp]
78+
79+
.. _basic-auth-lightprometheus-settings:
80+
81+
Configuration example: Simple Prometheus receiver
82+
---------------------------------------------------
83+
84+
The following example illustrates how to configure the ``basicauth`` extension for the :ref:`simple-prometheus-receiver`:
85+
86+
.. code:: yaml
87+
88+
receivers:
89+
lightprometheus/myjob:
90+
auth:
91+
authenticator: basicauth
92+
collection_interval: 1s
93+
endpoint: "http://localhost:8000/metrics"
94+
95+
exporters:
96+
otlp:
97+
endpoint: "${OTLP_ENDPOINT}"
98+
tls:
99+
insecure: true
100+
101+
extensions:
102+
basicauth:
103+
client_auth:
104+
username: foo
105+
password: bar
106+
107+
service:
108+
extensions: [ basicauth ]
109+
pipelines:
110+
metrics:
111+
receivers: [ lightprometheus/myjob ]
112+
exporters: [ otlp ]
113+
114+
.. _basic-auth-extension-settings:
115+
116+
Settings
117+
======================
118+
119+
The following table shows the configuration options for the ``basicauth`` extension:
120+
121+
.. raw:: html
122+
123+
<div class="metrics-standard" category="included" url="https://raw.githubusercontent.com/splunk/collector-config-tools/main/cfg-metadata/extension/basicauth.yaml"></div>
124+
125+
Authenticate servers or clients
126+
--------------------------------------------
127+
128+
You can either authenticate servers or clients with the extension. If you configure both options, the extension throws an error.
129+
130+
* To configure the extension as a server authenticator, set either ``htpasswd.file`` or ``htpasswd.inline``. If you configure both, ``htpasswd.inline`` credentials takes precedence.
131+
132+
* To configure the extension as a client authenticator, set ``client_auth``.
133+
134+
Troubleshooting
135+
======================
136+
137+
138+
139+
.. raw:: html
140+
141+
<div class="include-start" id="troubleshooting-components.rst"></div>
142+
143+
.. include:: /_includes/troubleshooting-components.rst
144+
145+
.. raw:: html
146+
147+
<div class="include-stop" id="troubleshooting-components.rst"></div>
11148

12-
To find information about this component in the meantime, see :new-page:`Authenticator Bearer extension <https://github.com/open-telemetry/opentelemetry-collector-contrib/tree/main/extension/bearertokenauthextension>` on GitHub.
13149

0 commit comments

Comments
 (0)