basicauthextension

package module
v0.99.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 22, 2024 License: Apache-2.0 Imports: 16 Imported by: 12

README

Basic Authenticator

Status
Stability beta
Distributions contrib
Issues Open issues Closed issues
Code Owners @jpkrohling, @frzifus
Emeritus @svrakitin

This 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.

When used as ServerAuthenticator, if the authentication is successful client.Info.Auth will expose the following attributes:

  • username: The username of the authenticated user.
  • raw: Raw base64 encoded credentials.

The configuration should specify only one instance of basicauth extension for either client or server authentication.

The following are the configuration options:

  • htpasswd.file: The path to the htpasswd file.
  • htpasswd.inline: The htpasswd file inline content.
  • client_auth.username: Username to use for client authentication.
  • client_auth.password: Password to use for client authentication.

To configure the extension as a server authenticator, either one of htpasswd.file or htpasswd.inline has to be set. If both are configured, htpasswd.inline credentials take precedence.

To configure the extension as a client authenticator, client_auth has to be set.

If both the options are configured, the extension will throw an error.

Configuration

extensions:
  basicauth/server:
    htpasswd: 
      file: .htpasswd
      inline: |
        ${env:BASIC_AUTH_USERNAME}:${env:BASIC_AUTH_PASSWORD}
  
  basicauth/client:
    client_auth: 
      username: username
      password: password

receivers:
  otlp:
    protocols:
      http:
        auth:
          authenticator: basicauth/server

processors:

exporters:
  otlp:
    auth:
      authenticator: basicauth/client

service:
  extensions: [basicauth/server, basicauth/client]
  pipelines:
    traces:
      receivers: [otlp]
      processors: []
      exporters: [otlp]

Documentation

Overview

Package basicauthextension implements an extension offering basic auth authentication over HTTP.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewFactory

func NewFactory() extension.Factory

NewFactory creates a factory for the static bearer token Authenticator extension.

Types

type ClientAuthSettings added in v0.50.0

type ClientAuthSettings struct {
	// Username holds the username to use for client authentication.
	Username string `mapstructure:"username"`
	// Password holds the password to use for client authentication.
	Password configopaque.String `mapstructure:"password"`
}

type Config

type Config struct {

	// Htpasswd settings.
	Htpasswd *HtpasswdSettings `mapstructure:"htpasswd,omitempty"`

	// ClientAuth settings
	ClientAuth *ClientAuthSettings `mapstructure:"client_auth,omitempty"`
}

func (*Config) Validate added in v0.50.0

func (cfg *Config) Validate() error

type HtpasswdSettings

type HtpasswdSettings struct {
	// Path to the htpasswd file.
	File string `mapstructure:"file"`
	// Inline contents of the htpasswd file.
	Inline string `mapstructure:"inline"`
}

Directories

Path Synopsis
internal

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL