auth

package
v1.5.0 Latest Latest
Warning

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

Go to latest
Published: May 12, 2024 License: Apache-2.0 Imports: 3 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrAuthrizationFailed = errors.New("authorization failed")

Functions

This section is empty.

Types

type AuthManager

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

AuthManager represent an authenticator manager.

func NewAuthManager

func NewAuthManager() *AuthManager

NewAuthManager returns a new authenticator manager.

func (*AuthManager) AddAuthenticator

func (mgr *AuthManager) AddAuthenticator(authenticator Authenticator)

AddAuthenticator adds a new authenticator.

func (*AuthManager) Authenticate

func (mgr *AuthManager) Authenticate(conn Conn, startup *message.Startup) (bool, error)

Authenticate authenticates the connection with the startup message.

func (*AuthManager) ClearAuthenticators

func (mgr *AuthManager) ClearAuthenticators()

ClearAuthenticators clears all authenticators.

type Authenticator

type Authenticator interface {
	Authenticate(Conn, *message.Startup) (bool, error)
}

Authenticator represents an authenticator interface.

type CleartextPasswordAuthenticator

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

CleartextPasswordAuthenticator represents an authenticator for the cleartext password.

func NewCleartextPasswordAuthenticatorWith

func NewCleartextPasswordAuthenticatorWith(username string, password string) *CleartextPasswordAuthenticator

NewCleartextPasswordAuthenticator returns a new authenticator with the specified username and password.

func (*CleartextPasswordAuthenticator) Authenticate

func (authenticator *CleartextPasswordAuthenticator) Authenticate(conn Conn, startupMessage *message.Startup) (bool, error)

Authenticate authenticates the specified connection.

type Conn

type Conn interface {
	net.Conn
	// MessageReader returns a message reader.
	MessageReader() *message.MessageReader
	// ResponseMessage returns a response message.
	ResponseMessage(resMsg message.Response) error
	// ResponseMessages returns response messages.
	ResponseMessages(resMsgs message.Responses) error
	// ResponseError returns a response error.
	ResponseError(err error) error
}

Conn represents a connection.

Jump to

Keyboard shortcuts

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