auth

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Jan 17, 2026 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalidCredentials = errors.New("invalid username or password")

	// HTTP API errors
	ErrHTTPAPIConnection  = errors.New("failed to connect to authentication API")
	ErrHTTPAPIAuthFailed  = errors.New("authentication API rejected credentials")
	ErrHTTPAPIInvalidResp = errors.New("invalid response from authentication API")
)

Functions

This section is empty.

Types

type APIAuthRequest

type APIAuthRequest struct {
	Username string `json:"username"`
	Password string `json:"password"`
}

APIAuthRequest is the request payload sent to external API

type APIAuthResponse

type APIAuthResponse struct {
	Success  bool   `json:"success"`
	UserID   string `json:"user_id,omitempty"`
	Email    string `json:"email,omitempty"`
	FullName string `json:"full_name,omitempty"`
	Message  string `json:"message,omitempty"`
}

APIAuthResponse is the expected response from external API

type AuthResult

type AuthResult struct {
	Username   string
	ExternalID string // External user ID (e.g., LDAP DN, API user ID)
	Email      string // Optional
	FullName   string // Optional
	Success    bool
}

AuthResult represents the result of authentication

type HTTPAPIAuthProvider

type HTTPAPIAuthProvider struct {
	// contains filtered or unexported fields
}

HTTPAPIAuthProvider handles HTTP API-based authentication

func NewHTTPAPIAuthProvider

func NewHTTPAPIAuthProvider(cfg *config.Config) *HTTPAPIAuthProvider

NewHTTPAPIAuthProvider creates a new HTTP API authentication provider

func (*HTTPAPIAuthProvider) Authenticate

func (p *HTTPAPIAuthProvider) Authenticate(
	ctx context.Context,
	username, password string,
) (*AuthResult, error)

Authenticate verifies credentials against external HTTP API

func (*HTTPAPIAuthProvider) Name

func (p *HTTPAPIAuthProvider) Name() string

Name returns provider name for logging

type LocalAuthProvider

type LocalAuthProvider struct {
	// contains filtered or unexported fields
}

LocalAuthProvider handles local database authentication

func NewLocalAuthProvider

func NewLocalAuthProvider(s *store.Store) *LocalAuthProvider

NewLocalAuthProvider creates a new local authentication provider

func (*LocalAuthProvider) Authenticate

func (p *LocalAuthProvider) Authenticate(
	ctx context.Context,
	username, password string,
) (*AuthResult, error)

Authenticate verifies credentials against local database

func (*LocalAuthProvider) Name

func (p *LocalAuthProvider) Name() string

Name returns provider name for logging

Jump to

Keyboard shortcuts

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