Help us shape the future of Go! Take the 2026 Go Developer Survey

db

package
v1.27.3 Latest Latest
Warning

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

Go to latest
Published: Aug 29, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Authenticate

func Authenticate(ctx context.Context, user *user_model.User, login, password string) (*user_model.User, error)

Authenticate authenticates the provided user against the DB

Types

type ErrUserPasswordInvalid

type ErrUserPasswordInvalid struct {
	UID  int64
	Name string
}

ErrUserPasswordInvalid represents a "ErrUserPasswordInvalid" kind of error.

func (ErrUserPasswordInvalid) Error

func (err ErrUserPasswordInvalid) Error() string

func (ErrUserPasswordInvalid) Unwrap

func (err ErrUserPasswordInvalid) Unwrap() error

Unwrap unwraps this error as a ErrInvalidArgument error

type ErrUserPasswordNotSet

type ErrUserPasswordNotSet struct {
	UID  int64
	Name string
}

ErrUserPasswordNotSet represents a "ErrUserPasswordNotSet" kind of error.

func (ErrUserPasswordNotSet) Error

func (err ErrUserPasswordNotSet) Error() string

func (ErrUserPasswordNotSet) Unwrap

func (err ErrUserPasswordNotSet) Unwrap() error

Unwrap unwraps this error as a ErrInvalidArgument error

type Source

type Source struct {
	auth.ConfigBase `json:"-"`
}

Source is a password authentication service

func (*Source) Authenticate

func (source *Source) Authenticate(ctx context.Context, user *user_model.User, login, password string) (*user_model.User, error)

Authenticate queries if login/password is valid against the PAM, and create a local user if success when enabled.

func (*Source) FromDB

func (source *Source) FromDB(bs []byte) error

FromDB fills up an OAuth2Config from serialized format.

func (*Source) ToDB

func (source *Source) ToDB() ([]byte, error)

ToDB exports the config to a byte slice to be saved into database (this method is just dummy and does nothing for DB source)

Jump to

Keyboard shortcuts

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