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 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) (bool, error)
Authenticate authenticates the connection with the startup message.
func (*AuthManager) ClearAuthenticators ¶
func (mgr *AuthManager) ClearAuthenticators()
ClearAuthenticators clears all authenticators.
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 { net.Conn // StartupMessage return the startup message. StartupMessage() (*message.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() *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.