auth

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Nov 4, 2025 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package auth provides authentication mechanisms for NuGet feeds.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type APIKeyAuthenticator

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

APIKeyAuthenticator implements API key authentication.

func NewAPIKeyAuthenticator

func NewAPIKeyAuthenticator(apiKey string) *APIKeyAuthenticator

NewAPIKeyAuthenticator creates a new API key authenticator.

func (*APIKeyAuthenticator) Authenticate

func (a *APIKeyAuthenticator) Authenticate(req *http.Request) error

Authenticate adds the X-NuGet-ApiKey header to the request.

func (*APIKeyAuthenticator) Type

func (a *APIKeyAuthenticator) Type() Type

Type returns the authentication type.

type Authenticator

type Authenticator interface {
	// Authenticate adds authentication to the request
	Authenticate(req *http.Request) error
}

Authenticator is the interface for NuGet authentication.

type BasicAuthenticator

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

BasicAuthenticator implements HTTP basic authentication.

func NewBasicAuthenticator

func NewBasicAuthenticator(username, password string) *BasicAuthenticator

NewBasicAuthenticator creates a new basic auth authenticator.

func (*BasicAuthenticator) Authenticate

func (a *BasicAuthenticator) Authenticate(req *http.Request) error

Authenticate adds the Authorization: Basic header to the request.

func (*BasicAuthenticator) Type

func (a *BasicAuthenticator) Type() Type

Type returns the authentication type.

type BearerAuthenticator

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

BearerAuthenticator implements bearer token authentication.

func NewBearerAuthenticator

func NewBearerAuthenticator(token string) *BearerAuthenticator

NewBearerAuthenticator creates a new bearer token authenticator.

func (*BearerAuthenticator) Authenticate

func (a *BearerAuthenticator) Authenticate(req *http.Request) error

Authenticate adds the Authorization: Bearer header to the request.

func (*BearerAuthenticator) Type

func (a *BearerAuthenticator) Type() Type

Type returns the authentication type.

type Type

type Type string

Type represents the type of authentication.

const (
	// AuthTypeNone indicates no authentication is required.
	AuthTypeNone Type = "none"
	// AuthTypeAPIKey indicates API key authentication.
	AuthTypeAPIKey Type = "apikey"
	// AuthTypeBearer indicates bearer token authentication.
	AuthTypeBearer Type = "bearer"
	// AuthTypeBasic indicates HTTP basic authentication.
	AuthTypeBasic Type = "basic"
)

Jump to

Keyboard shortcuts

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