Documentation
¶
Index ¶
Constants ¶
View Source
const ( // CredsFieldName — имя поля для списка учетных данных (логин:пароль). CredsFieldName = "server.http.auth.basic.creds" // FilePathFieldName — имя поля для пути к файлу с учетными данными. FilePathFieldName = "server.http.auth.basic.filepath" )
Variables ¶
View Source
var Component = compogo.Component{ Init: compogo.StepFunc(func(container compogo.Container) error { return container.Provides( NewConfig, NewAuth, ) }), Configuration: compogo.StepFunc(func(container compogo.Container) error { return container.Invoke(Configuration) }), }
Component — компонент Basic Auth для Compogo. Регистрирует конфигурацию и middleware в DI-контейнере.
Functions ¶
This section is empty.
Types ¶
type Auth ¶
type Auth struct {
// contains filtered or unexported fields
}
Auth реализует HTTP Basic Authentication middleware. Проверяет учетные данные из заголовка Authorization.
type Config ¶
type Config struct {
FilePath string
Creds mapper.Mapper[*Cred]
// contains filtered or unexported fields
}
Config содержит конфигурацию Basic Auth.
func Configuration ¶
func Configuration(config *Config, configurator compogo.Configurator) (*Config, error)
Configuration загружает конфигурацию из Configurator. Поддерживает загрузку учетных данных из:
- Параметра creds (срез строк "логин:пароль")
- Файла (построчное чтение, каждая строка = "логин:пароль")
Пустые строки в файле игнорируются.
Click to show internal directories.
Click to hide internal directories.