auth

package
v4.16.3 Latest Latest
Warning

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

Go to latest
Published: Aug 12, 2025 License: MIT Imports: 9 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package auth contains utilities to perform authentication.

Index

Constants

View Source
const (
	ValidateMethodBasic     = VerifyMethodBasic
	ValidateMethodDigestMD5 = VerifyMethodDigestMD5
	ValidateMethodSHA256    = VerifyMethodDigestSHA256
)

validation methods.

Deprecated.

Variables

This section is empty.

Functions

func GenerateNonce

func GenerateNonce() (string, error)

GenerateNonce generates a nonce that can be used in Validate().

func GenerateWWWAuthenticate

func GenerateWWWAuthenticate(methods []ValidateMethod, realm string, nonce string) base.HeaderValue

GenerateWWWAuthenticate generates a WWW-Authenticate header.

func Validate deprecated

func Validate(
	req *base.Request,
	user string,
	pass string,
	methods []ValidateMethod,
	realm string,
	nonce string,
) error

Validate validates a request sent by a client.

Deprecated: replaced by Verify.

func Verify

func Verify(
	req *base.Request,
	user string,
	pass string,
	methods []VerifyMethod,
	realm string,
	nonce string,
) error

Verify verifies a request sent by a client.

Types

type Sender

type Sender struct {
	WWWAuth base.HeaderValue
	User    string
	Pass    string
	// contains filtered or unexported fields
}

Sender allows to send credentials. It requires a WWW-Authenticate header (provided by the server) and a set of credentials.

func NewSender deprecated

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

NewSender allocates a Sender.

Deprecated: replaced by Sender.Initialize().

func (*Sender) AddAuthorization

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

AddAuthorization adds the Authorization header to a Request.

func (*Sender) Initialize

func (se *Sender) Initialize() error

Initialize initializes a Sender.

type ValidateMethod deprecated

type ValidateMethod = VerifyMethod

ValidateMethod is a validation method.

Deprecated: replaced by VerifyMethod

type VerifyMethod

type VerifyMethod int

VerifyMethod is a validation method.

const (
	VerifyMethodBasic VerifyMethod = iota
	VerifyMethodDigestMD5
	VerifyMethodDigestSHA256
)

validation methods.

Jump to

Keyboard shortcuts

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