auth

package
v0.0.0-...-3b681cf Latest Latest
Warning

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

Go to latest
Published: Feb 25, 2022 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package auth contains utilities to perform authentication.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Sender

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

Sender allows to generate credentials for a Validator.

func NewSender

func NewSender(v base.HeaderValue, user string, pass string) (*Sender, error)

NewSender allocates a Sender with the WWW-Authenticate header provided by a Validator and a set of credentials.

func (*Sender) AddAuthorization

func (se *Sender) AddAuthorization(req *base.Request)

AddAuthorization adds the Authorization header to a Request.

type Validator

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

Validator allows to validate credentials generated by a Sender.

func NewValidator

func NewValidator(user string, pass string, methods []headers.AuthMethod) *Validator

NewValidator allocates a Validator. If methods is nil, the Basic and Digest methods are used.

func (*Validator) Header

func (va *Validator) Header() base.HeaderValue

Header generates the WWW-Authenticate header needed by a client to authenticate.

func (*Validator) ValidateRequest

func (va *Validator) ValidateRequest(req *base.Request) error

ValidateRequest validates a request sent by a client.

Jump to

Keyboard shortcuts

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