auth

package
v1.40.0 Latest Latest
Warning

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

Go to latest
Published: Dec 9, 2025 License: MIT Imports: 29 Imported by: 0

Documentation

Index

Constants

View Source
const (
	HMACSignaturePrefix = "dumbproxy grant token v1"
	HMACSignatureSize   = 32
	HMACTimestampSize   = 8
	EnvVarHMACSecret    = "DUMBPROXY_HMAC_SECRET"
)
View Source
const AUTH_REQUIRED_MSG = "Proxy authentication required.\n"
View Source
const AUTH_TRIGGERED_MSG = "Browser auth triggered!\n"
View Source
const BAD_REQ_MSG = "Bad Request\n"
View Source
const EPOCH_EXPIRE = "Thu, 01 Jan 1970 00:00:01 GMT"

Variables

This section is empty.

Functions

func CalculateHMACSignature added in v1.14.0

func CalculateHMACSignature(secret []byte, username string, expire int64) []byte

func VerifyHMACLoginAndPassword added in v1.14.1

func VerifyHMACLoginAndPassword(secret []byte, login, password string) bool

Types

type Auth

type Auth interface {
	Validate(ctx context.Context, wr http.ResponseWriter, req *http.Request) (string, bool)
	io.Closer
}

func NewAuth

func NewAuth(paramstr string, logger *clog.CondLogger) (Auth, error)

type BasicAuth

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

func NewBasicFileAuth

func NewBasicFileAuth(param_url *url.URL, logger *clog.CondLogger) (*BasicAuth, error)

func NewStaticAuth

func NewStaticAuth(param_url *url.URL, logger *clog.CondLogger) (*BasicAuth, error)

func (*BasicAuth) Close added in v1.38.0

func (auth *BasicAuth) Close() error

func (*BasicAuth) Valid added in v1.31.0

func (auth *BasicAuth) Valid(user, password, userAddr string) bool

func (*BasicAuth) Validate

func (auth *BasicAuth) Validate(ctx context.Context, wr http.ResponseWriter, req *http.Request) (string, bool)

type CertAuth

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

func NewCertAuth

func NewCertAuth(param_url *url.URL, logger *clog.CondLogger) (*CertAuth, error)

func (*CertAuth) Close added in v1.38.0

func (auth *CertAuth) Close() error

func (*CertAuth) Validate

func (auth *CertAuth) Validate(ctx context.Context, wr http.ResponseWriter, req *http.Request) (string, bool)

type HMACAuth added in v1.14.0

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

func NewHMACAuth added in v1.14.0

func NewHMACAuth(param_url *url.URL, logger *clog.CondLogger) (*HMACAuth, error)

func (*HMACAuth) Close added in v1.38.0

func (auth *HMACAuth) Close() error

func (*HMACAuth) Valid added in v1.31.0

func (auth *HMACAuth) Valid(user, password, userAddr string) bool

func (*HMACAuth) Validate added in v1.14.0

func (auth *HMACAuth) Validate(ctx context.Context, wr http.ResponseWriter, req *http.Request) (string, bool)

type HMACToken added in v1.14.0

type HMACToken struct {
	Expire    int64
	Signature [HMACSignatureSize]byte
}

type NoAuth

type NoAuth struct{}

func (NoAuth) Close added in v1.38.0

func (_ NoAuth) Close() error

func (NoAuth) Validate

func (_ NoAuth) Validate(_ context.Context, _ http.ResponseWriter, _ *http.Request) (string, bool)

type RedisAuth added in v1.27.0

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

func NewRedisAuth added in v1.27.0

func NewRedisAuth(param_url *url.URL, cluster bool, logger *clog.CondLogger) (*RedisAuth, error)

func (*RedisAuth) Close added in v1.38.0

func (auth *RedisAuth) Close() error

func (*RedisAuth) Valid added in v1.31.0

func (auth *RedisAuth) Valid(user, password, userAddr string) bool

func (*RedisAuth) Validate added in v1.27.0

func (auth *RedisAuth) Validate(ctx context.Context, wr http.ResponseWriter, req *http.Request) (string, bool)

type RejectHTTPAuth added in v1.37.0

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

func NewRejectHTTPAuth added in v1.37.0

func NewRejectHTTPAuth(u *url.URL, logger *clog.CondLogger) (*RejectHTTPAuth, error)

func (*RejectHTTPAuth) Close added in v1.38.0

func (_ *RejectHTTPAuth) Close() error

func (*RejectHTTPAuth) Valid added in v1.37.0

func (_ *RejectHTTPAuth) Valid(_, _, _ string) bool

func (*RejectHTTPAuth) Validate added in v1.37.0

type StaticRejectAuth added in v1.37.0

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

func NewStaticRejectAuth added in v1.37.0

func NewStaticRejectAuth(u *url.URL, logger *clog.CondLogger) (*StaticRejectAuth, error)

func (*StaticRejectAuth) Close added in v1.38.0

func (_ *StaticRejectAuth) Close() error

func (*StaticRejectAuth) Valid added in v1.37.0

func (_ *StaticRejectAuth) Valid(_, _, _ string) bool

func (*StaticRejectAuth) Validate added in v1.37.0

Jump to

Keyboard shortcuts

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