auth

package
v4.0.0-...-0ef4ac4 Latest Latest
Warning

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

Go to latest
Published: Dec 4, 2023 License: MIT Imports: 7 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

func GenerateNonce() (string, error)

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

func GenerateWWWAuthenticate

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

GenerateWWWAuthenticate generates a WWW-Authenticate header.

func Validate

func Validate(
	req *base.Request,
	user string,
	pass string,
	baseURL *base.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.

Jump to

Keyboard shortcuts

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