auth

package
v1.0.7 Latest Latest
Warning

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

Go to latest
Published: Jan 14, 2020 License: MIT Imports: 6 Imported by: 1

Documentation

Index

Constants

View Source
const (
	Apr1MD5 hashing = 0
	Bcrypt          = 1
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Auth

type Auth struct {
	Username     string
	PasswordHash string
	// contains filtered or unexported fields
}

type Auths

type Auths struct {

	// All indicates whether everybody is granted access.
	All bool
	// contains filtered or unexported fields
}

Auths represents an authentication registry.

func New

func New(cfgAuths map[string]*config.Auth) (auths *Auths, err error)

New creates a new authentication registry.

func (*Auths) Authenticate

func (aa *Auths) Authenticate(username string, password string) (ok bool, msg string, err error)

Authenticate checks whether the user is authentic by checking his/her password against the authentication registry.

If the authentication passes, ok is set to true. In case that the authentication fails, ok is false and the message indicates the reason of the authentication failure.

If there was an error during the authentication, err will be set.

Jump to

Keyboard shortcuts

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