httpauth

package
v0.0.0-...-7839e87 Latest Latest
Warning

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

Go to latest
Published: Apr 21, 2024 License: Apache-2.0 Imports: 23 Imported by: 3

Documentation

Overview

Package httpauth is a generated GoMock package.

Package httpauth is a generated GoMock package.

Index

Constants

View Source
const (
	AuthorizationKey      string = "Authorization"
	ProxyAuthorizationKey string = "Proxy-Authorization"
	ProxyAuthenticateKey  string = "Proxy-Authenticate"
)
View Source
const (
	NTLMSSP_NAME string = "NTLMSSP"
	SPNEGO_NAME  string = string(gssapi.OIDSPNEGO)
)

Variables

This section is empty.

Functions

func CanonicalAddr

func CanonicalAddr(url *url.URL) string

CanonicalAddr returns url.Host but always with a ":port" suffix

func GetMechanismsFromHttpFieldValue

func GetMechanismsFromHttpFieldValue(token string) ([]string, error)

func IsNTLMToken

func IsNTLMToken(token string) bool

func IsSupportedMechanism

func IsSupportedMechanism(mechanism AuthenticationMechanism) bool

func LookupSchemeFromCannonicalAddress

func LookupSchemeFromCannonicalAddress(addr string, defaultScheme string) string

func StringFromAuthenticationMechanism

func StringFromAuthenticationMechanism(mechanism AuthenticationMechanism) string

Types

type AuthenticationHandler

type AuthenticationHandler struct {
	Mechanism AuthenticationMechanism
	// contains filtered or unexported fields
}

func (*AuthenticationHandler) Cancel

func (a *AuthenticationHandler) Cancel()

func (*AuthenticationHandler) Close

func (a *AuthenticationHandler) Close()

func (*AuthenticationHandler) GetAuthorizationValue

func (a *AuthenticationHandler) GetAuthorizationValue(url *url.URL, responseToken string) (authorizeValue string, err error)

func (*AuthenticationHandler) IsStopped

func (a *AuthenticationHandler) IsStopped() bool

func (*AuthenticationHandler) SetBasicAuthentication

func (a *AuthenticationHandler) SetBasicAuthentication(userInfo *url.Userinfo) error

func (*AuthenticationHandler) SetLogger

func (a *AuthenticationHandler) SetLogger(logger *log.Logger)

func (*AuthenticationHandler) SetSpnegoProvider

func (a *AuthenticationHandler) SetSpnegoProvider(spnegoProvider SpnegoProvider)

func (*AuthenticationHandler) Succesful

func (a *AuthenticationHandler) Succesful()

func (*AuthenticationHandler) Update

func (a *AuthenticationHandler) Update(availableMechanism map[AuthenticationMechanism]string) (responseToken string, err error)

type AuthenticationHandlerInterface

type AuthenticationHandlerInterface interface {
	Close()
	Cancel()
	Succesful()
	IsStopped() bool
	GetAuthorizationValue(url *url.URL, responseToken string) (string, error)
	Update(availableMechanism map[AuthenticationMechanism]string) (string, error)
	SetBasicAuthentication(userInfo *url.Userinfo) error
	SetLogger(logger *log.Logger)
	SetSpnegoProvider(spnegoProvider SpnegoProvider)
}

type AuthenticationMechanism

type AuthenticationMechanism string
const (
	NoAuth           AuthenticationMechanism = "noauth"
	Negotiate        AuthenticationMechanism = "negotiate"
	AnyAuth          AuthenticationMechanism = "anyauth"
	BasicAuth        AuthenticationMechanism = "basic"
	UnknownMechanism AuthenticationMechanism = "unknownmechanism"
)

func AuthenticationMechanismFromString

func AuthenticationMechanismFromString(mechanism string) AuthenticationMechanism

func GetMechanismAndToken

func GetMechanismAndToken(HttpFieldValue string) (AuthenticationMechanism, string)

type AuthenticationState

type AuthenticationState int

type MockAuthenticationHandlerInterface

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

MockAuthenticationHandlerInterface is a mock of AuthenticationHandlerInterface interface.

func NewMockAuthenticationHandlerInterface

func NewMockAuthenticationHandlerInterface(ctrl *gomock.Controller) *MockAuthenticationHandlerInterface

NewMockAuthenticationHandlerInterface creates a new mock instance.

func (*MockAuthenticationHandlerInterface) Cancel

Cancel mocks base method.

func (*MockAuthenticationHandlerInterface) Close

Close mocks base method.

func (*MockAuthenticationHandlerInterface) EXPECT

EXPECT returns an object that allows the caller to indicate expected use.

func (*MockAuthenticationHandlerInterface) GetAuthorizationValue

func (m *MockAuthenticationHandlerInterface) GetAuthorizationValue(url *url.URL, responseToken string) (string, error)

GetAuthorizationValue mocks base method.

func (*MockAuthenticationHandlerInterface) IsStopped

IsStopped mocks base method.

func (*MockAuthenticationHandlerInterface) SetBasicAuthentication

func (m *MockAuthenticationHandlerInterface) SetBasicAuthentication(userInfo *url.Userinfo) error

SetBasicAuthentication mocks base method.

func (*MockAuthenticationHandlerInterface) SetLogger

func (m *MockAuthenticationHandlerInterface) SetLogger(logger *log.Logger)

SetLogger mocks base method.

func (*MockAuthenticationHandlerInterface) SetSpnegoProvider

func (m *MockAuthenticationHandlerInterface) SetSpnegoProvider(spnegoProvider SpnegoProvider)

SetSpnegoProvider mocks base method.

func (*MockAuthenticationHandlerInterface) Succesful

func (m *MockAuthenticationHandlerInterface) Succesful()

Succesful mocks base method.

func (*MockAuthenticationHandlerInterface) Update

func (m *MockAuthenticationHandlerInterface) Update(availableMechanism map[AuthenticationMechanism]string) (string, error)

Update mocks base method.

type MockAuthenticationHandlerInterfaceMockRecorder

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

MockAuthenticationHandlerInterfaceMockRecorder is the mock recorder for MockAuthenticationHandlerInterface.

func (*MockAuthenticationHandlerInterfaceMockRecorder) Cancel

Cancel indicates an expected call of Cancel.

func (*MockAuthenticationHandlerInterfaceMockRecorder) Close

Close indicates an expected call of Close.

func (*MockAuthenticationHandlerInterfaceMockRecorder) GetAuthorizationValue

func (mr *MockAuthenticationHandlerInterfaceMockRecorder) GetAuthorizationValue(url, responseToken interface{}) *gomock.Call

GetAuthorizationValue indicates an expected call of GetAuthorizationValue.

func (*MockAuthenticationHandlerInterfaceMockRecorder) IsStopped

IsStopped indicates an expected call of IsStopped.

func (*MockAuthenticationHandlerInterfaceMockRecorder) SetBasicAuthentication

func (mr *MockAuthenticationHandlerInterfaceMockRecorder) SetBasicAuthentication(userInfo interface{}) *gomock.Call

SetBasicAuthentication indicates an expected call of SetBasicAuthentication.

func (*MockAuthenticationHandlerInterfaceMockRecorder) SetLogger

func (mr *MockAuthenticationHandlerInterfaceMockRecorder) SetLogger(logger interface{}) *gomock.Call

SetLogger indicates an expected call of SetLogger.

func (*MockAuthenticationHandlerInterfaceMockRecorder) SetSpnegoProvider

func (mr *MockAuthenticationHandlerInterfaceMockRecorder) SetSpnegoProvider(spnegoProvider interface{}) *gomock.Call

SetSpnegoProvider indicates an expected call of SetSpnegoProvider.

func (*MockAuthenticationHandlerInterfaceMockRecorder) Succesful

Succesful indicates an expected call of Succesful.

func (*MockAuthenticationHandlerInterfaceMockRecorder) Update

func (mr *MockAuthenticationHandlerInterfaceMockRecorder) Update(availableMechanism interface{}) *gomock.Call

Update indicates an expected call of Update.

type MockSpnegoProvider

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

MockSpnegoProvider is a mock of SpnegoProvider interface.

func NewMockSpnegoProvider

func NewMockSpnegoProvider(ctrl *gomock.Controller) *MockSpnegoProvider

NewMockSpnegoProvider creates a new mock instance.

func (*MockSpnegoProvider) Close

func (m *MockSpnegoProvider) Close() error

Close mocks base method.

func (*MockSpnegoProvider) EXPECT

EXPECT returns an object that allows the caller to indicate expected use.

func (*MockSpnegoProvider) GetToken

func (m *MockSpnegoProvider) GetToken(url *url.URL, responseToken string) (string, bool, error)

GetToken mocks base method.

func (*MockSpnegoProvider) SetLogger

func (m *MockSpnegoProvider) SetLogger(logger *log.Logger)

SetLogger mocks base method.

type MockSpnegoProviderMockRecorder

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

MockSpnegoProviderMockRecorder is the mock recorder for MockSpnegoProvider.

func (*MockSpnegoProviderMockRecorder) Close

Close indicates an expected call of Close.

func (*MockSpnegoProviderMockRecorder) GetToken

func (mr *MockSpnegoProviderMockRecorder) GetToken(url, responseToken interface{}) *gomock.Call

GetToken indicates an expected call of GetToken.

func (*MockSpnegoProviderMockRecorder) SetLogger

func (mr *MockSpnegoProviderMockRecorder) SetLogger(logger interface{}) *gomock.Call

SetLogger indicates an expected call of SetLogger.

type NonwindowsSpnegoProvider

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

func (*NonwindowsSpnegoProvider) Close

func (s *NonwindowsSpnegoProvider) Close() error

func (*NonwindowsSpnegoProvider) GetToken

func (s *NonwindowsSpnegoProvider) GetToken(url *url.URL, responseToken string) (string, bool, error)

func (*NonwindowsSpnegoProvider) SetLogger

func (s *NonwindowsSpnegoProvider) SetLogger(logger *log.Logger)

type ProxyAuthenticator

type ProxyAuthenticator struct {
	CreateHandler func(mechanism AuthenticationMechanism) AuthenticationHandlerInterface
	// contains filtered or unexported fields
}

func NewProxyAuthenticator

func NewProxyAuthenticator(mechanism AuthenticationMechanism, upstreamProxy func(*http.Request) (*url.URL, error), logger *log.Logger) *ProxyAuthenticator

func (*ProxyAuthenticator) DialContext

func (p *ProxyAuthenticator) DialContext(ctx context.Context, network, addr string) (net.Conn, error)

This is the main entry point function for the ProxyAuthenticator when being used with http.Transport. It should be used like this: transport.DialContext = DialContext It'll be invoked by http.Transport when it requires a new TCP connection.

func (*ProxyAuthenticator) GetMechanism

func (p *ProxyAuthenticator) GetMechanism() AuthenticationMechanism

func (*ProxyAuthenticator) SendRequest

func (p *ProxyAuthenticator) SendRequest(ctx context.Context, connection net.Conn, request *http.Request) (*http.Response, error)

type SpnegoProvider

type SpnegoProvider interface {
	GetToken(url *url.URL, responseToken string) (string, bool, error)
	Close() error
	SetLogger(logger *log.Logger)
}

func SpnegoProviderInstance

func SpnegoProviderInstance() SpnegoProvider

Jump to

Keyboard shortcuts

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