auth

package
v0.43.0 Latest Latest
Warning

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

Go to latest
Published: Nov 27, 2025 License: MIT Imports: 10 Imported by: 0

Documentation

Overview

Package auth provides HTTP client authentication support.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Authenticator

type Authenticator interface {
	Type() string
	User() string
	Password() string
	// Challenge is the values from "WWW-Authenticate" header
	Challenge([]string) Authenticator
	Authorize(*http.Request)
}

Authenticator stub

var Anonymous Authenticator = &noAuth{}

func Basic

func Basic(user string, pw string) Authenticator

Basic provides HTTP basic authentication. See https://tools.ietf.org/html/rfc7617

func Deferred

func Deferred(user string, pw string) Authenticator

type DigestAuth

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

DigestAuth structure holds our credentials.

func Digest

func Digest(user string, pw string) *DigestAuth

Digest implements HTTP digest authentication. See https://tools.ietf.org/html/rfc7616 TODO finish this: it only supports MD5 and the tests are inadequate

func (*DigestAuth) Authorize

func (d *DigestAuth) Authorize(req *http.Request)

Authorize the current request.

func (*DigestAuth) Challenge

func (d *DigestAuth) Challenge(ss []string) Authenticator

func (*DigestAuth) DigestParts

func (d *DigestAuth) DigestParts(wwwAuthenticateHeader string) Authenticator

func (*DigestAuth) Password

func (d *DigestAuth) Password() string

Password holds the DigestAuth password.

func (*DigestAuth) Type

func (d *DigestAuth) Type() string

Type identifies the Digest authenticator.

func (*DigestAuth) User

func (d *DigestAuth) User() string

User holds the DigestAuth username.

Jump to

Keyboard shortcuts

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