db

package
v1.22.6 Latest Latest
Warning

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

Go to latest
Published: Dec 13, 2024 License: MIT Imports: 6 Imported by: 2

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 added in v1.20.0

type ErrUserPasswordInvalid struct {
	UID  int64
	Name string
}

ErrUserPasswordInvalid represents a "ErrUserPasswordInvalid" kind of error.

func (ErrUserPasswordInvalid) Error added in v1.20.0

func (err ErrUserPasswordInvalid) Error() string

func (ErrUserPasswordInvalid) Unwrap added in v1.20.0

func (err ErrUserPasswordInvalid) Unwrap() error

Unwrap unwraps this error as a ErrInvalidArgument error

type ErrUserPasswordNotSet added in v1.20.0

type ErrUserPasswordNotSet struct {
	UID  int64
	Name string
}

ErrUserPasswordNotSet represents a "ErrUserPasswordNotSet" kind of error.

func (ErrUserPasswordNotSet) Error added in v1.20.0

func (err ErrUserPasswordNotSet) Error() string

func (ErrUserPasswordNotSet) Unwrap added in v1.20.0

func (err ErrUserPasswordNotSet) Unwrap() error

Unwrap unwraps this error as a ErrInvalidArgument error

type Source

type Source struct{}

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