auth

package
v3.11.0 Latest Latest
Warning

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

Go to latest
Published: Aug 26, 2023 License: MIT Imports: 10 Imported by: 0

Documentation

Overview

Package auth contains utilities to perform authentication.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GenerateNonce deprecated added in v3.6.0

func GenerateNonce() string

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

Deprecated: use GenerateNonce2.

func GenerateNonce2 added in v3.10.0

func GenerateNonce2() (string, error)

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

func GenerateWWWAuthenticate added in v3.6.0

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

GenerateWWWAuthenticate generates a WWW-Authenticate header.

func Validate added in v3.6.0

func Validate(
	req *base.Request,
	user string,
	pass string,
	baseURL *url.URL,
	methods []headers.AuthMethod,
	realm string,
	nonce string,
) error

Validate validates a request sent by a client.

Types

type Sender

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

Sender allows to send credentials.

func NewSender

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

NewSender allocates a Sender. It requires a WWW-Authenticate header (provided by the server) 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 deprecated

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

Validator allows to validate credentials generated by a Sender.

Deprecated: Validator{} has been replaced by Validate()

func NewValidator deprecated

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.

Deprecated: Validator{} has been replaced by Validate()

func (*Validator) Header deprecated

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

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

Deprecated: Validator{} has been replaced by Validate()

func (*Validator) ValidateRequest deprecated

func (va *Validator) ValidateRequest(req *base.Request, baseURL *url.URL) error

ValidateRequest validates a request sent by a client.

Deprecated: Validator{} has been replaced by Validate()

Jump to

Keyboard shortcuts

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