Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrAuthrizationFailed = errors.New("authorization failed")
Functions ¶
func WithCommonName ¶ added in v1.5.3
func WithCommonName(name string) func(*CertificateAuthenticator)
WithCommonName returns an authenticator option to set the common name.
Types ¶
type AuthManager ¶
type AuthManager interface {
// AddAuthenticator adds a new authenticator.
AddAuthenticator(authenticator Authenticator)
// ClearAuthenticators clears all authenticators.
ClearAuthenticators()
// Authenticate authenticates the connection with the startup protocol.
Authenticate(conn Conn) (bool, error)
}
AuthManager represent an authenticator manager.
func NewAuthManager ¶
func NewAuthManager() AuthManager
NewAuthManager returns a new authenticator manager.
type Authenticator ¶
Authenticator represents an authenticator interface.
type CertificateAuthenticator ¶ added in v1.5.3
type CertificateAuthenticator struct {
// contains filtered or unexported fields
}
CertificateAuthenticator represents an authenticator for TLS certificates.
func NewCertificateAuthenticatorWith ¶ added in v1.5.3
func NewCertificateAuthenticatorWith(opts ...CertificateAuthenticatorOption) *CertificateAuthenticator
NewCertificateAuthenticator returns a new certificate authenticator.
func (*CertificateAuthenticator) Authenticate ¶ added in v1.5.3
func (authenticator *CertificateAuthenticator) Authenticate(conn Conn) (bool, error)
Authenticate authenticates the specified connection.
type CertificateAuthenticatorOption ¶ added in v1.5.3
type CertificateAuthenticatorOption = func(*CertificateAuthenticator)
CertificateAuthenticatorOption represents an authenticator option.
type ClearTextPasswordAuthenticator ¶ added in v1.5.3
type ClearTextPasswordAuthenticator struct {
// contains filtered or unexported fields
}
ClearTextPasswordAuthenticator represents an authenticator for the cleartext password.
func NewClearTextPasswordAuthenticatorWith ¶ added in v1.5.3
func NewClearTextPasswordAuthenticatorWith(username string, password string) *ClearTextPasswordAuthenticator
NewClearTextPasswordAuthenticatorWith returns a new authenticator with the specified username and password.
func (*ClearTextPasswordAuthenticator) Authenticate ¶ added in v1.5.3
func (authenticator *ClearTextPasswordAuthenticator) Authenticate(conn Conn) (bool, error)
Authenticate authenticates the specified connection.
type Conn ¶
type Conn interface {
// StartupMessage return the startup protocol.
StartupMessage() (*protocol.Startup, bool)
// IsTLSConnection return true if the connection is enabled TLS.
IsTLSConnection() bool
// TLSConnectionState returns the TLS connection state.
TLSConnectionState() (*tls.ConnectionState, bool)
// MessageReader returns a message reader.
MessageReader() *protocol.MessageReader
// ResponseMessage returns a response protocol.
ResponseMessage(resMsg protocol.Response) error
// ResponseMessages returns response messages.
ResponseMessages(resMsgs protocol.Responses) error
// ResponseError returns a response error.
ResponseError(err error) error
}
Conn represents a connection.