auth

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Jul 9, 2022 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	Basic = AuthType("Basic")
	Noop  = AuthType("Noop")
)
View Source
var (
	ErrUnauthorized        = errors.New("unauthorized")
	ErrUnsupportedAuthType = errors.New("unsupported auth type")
)
View Source
var (
	ErrUserExists    = errors.New("user exists")
	ErrUserNotExists = errors.New("user not exists")
)

Functions

This section is empty.

Types

type AuthConfig

type AuthConfig struct {
	Username string
	Password string
	AuthType
}

type AuthType

type AuthType string

type BasicAuthProvider

type BasicAuthProvider interface {
	BasicAuth() (string, string)
}

BasicAuthProvider is the interface an object must support to return basic auth information.

type Credential

type Credential struct {
	Username string `json:"username,omitempty"`
	Password string `json:"password,omitempty"`
}

Credential represents authentication and authorization configuration for a single user.

type CredentialsStore

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

CredentialsStore stores authentication and authorization information for all users.

func NewCredentialsStore

func NewCredentialsStore() *CredentialsStore

NewCredentialsStore returns a new instance of a CredentialStore.

func (*CredentialsStore) Add

func (c *CredentialsStore) Add(username string, password string) error

Add adds a Account

func (*CredentialsStore) Check

func (c *CredentialsStore) Check(username, password string) bool

Check returns true if the password is correct for the given username.

func (*CredentialsStore) CheckRequest

func (c *CredentialsStore) CheckRequest(b BasicAuthProvider) bool

CheckRequest returns true if b contains a valid username and password.

func (*CredentialsStore) Load

func (c *CredentialsStore) Load(r io.Reader) error

Load loads credential information from a reader.

func (*CredentialsStore) Remove

func (c *CredentialsStore) Remove(username string) error

Remove removes a Account

func (*CredentialsStore) Snapshot

func (c *CredentialsStore) Snapshot(w io.Writer) error

Snapshot takes a snapshot

func (*CredentialsStore) Update

func (c *CredentialsStore) Update(username, newPassword string) error

Update updates a Account

Jump to

Keyboard shortcuts

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