Documentation
¶
Index ¶
- type Authenticator
- type External
- func (e *External) Authenticated() bool
- func (e *External) Mechanism() string
- func (e *External) ProcessElement(ctx context.Context, elem stravaganza.Element) (stravaganza.Element, *SASLError)
- func (e *External) Reset()
- func (e *External) Start(ctx context.Context) error
- func (e *External) Stop(_ context.Context) error
- func (e *External) Username() string
- func (e *External) UsesChannelBinding() bool
- type SASLError
- type SASLErrorReason
- type Scram
- type ScramType
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Authenticator ¶
type Authenticator interface {
// Mechanism returns authenticator mechanism name.
Mechanism() string
// Username returns authenticated username in case authentication process has been completed.
Username() string
// Authenticated returns whether or not user has been authenticated.
Authenticated() bool
// UsesChannelBinding returns whether or not this authenticator requires channel binding bytes.
UsesChannelBinding() bool
// ProcessElement process an incoming authenticator element.
ProcessElement(context.Context, stravaganza.Element) (stravaganza.Element, *SASLError)
// Reset resets authenticator internal state.
Reset()
}
Authenticator defines a generic authenticator state machine.
type External ¶
type External struct {
// contains filtered or unexported fields
}
External represents external authentication mechanism (PLAIN).
func NewExternal ¶
NewExternal returns a new external authenticator.
func (*External) Authenticated ¶
Authenticated returns whether or not user has been authenticated.
func (*External) ProcessElement ¶
func (e *External) ProcessElement(ctx context.Context, elem stravaganza.Element) (stravaganza.Element, *SASLError)
ProcessElement process an incoming authenticator element.
func (*External) Username ¶
Username returns authenticated username in case authentication process has been completed.
func (*External) UsesChannelBinding ¶
UsesChannelBinding returns whether or not this authenticator requires channel binding bytes.
type SASLError ¶
type SASLError struct {
Reason SASLErrorReason
Err error
}
SASLError represents specific SASL error type.
func (*SASLError) Element ¶
func (se *SASLError) Element() stravaganza.Element
Element returs sasl error XML representation.
type SASLErrorReason ¶
type SASLErrorReason uint8
SASLErrorReason defines the SASL error reason.
const ( // IncorrectEncoding represents a 'incorrect-encoding' authentication error. IncorrectEncoding SASLErrorReason = iota // MalformedRequest represents a 'malformed-request' authentication error. MalformedRequest // NotAuthorized represents a 'not-authorized' authentication error. NotAuthorized // TemporaryAuthFailure represents a 'temporary-auth-failure' authentication error. TemporaryAuthFailure )
func (SASLErrorReason) String ¶
func (r SASLErrorReason) String() string
String returns SASLErrorReason string representation.
type Scram ¶
type Scram struct {
// contains filtered or unexported fields
}
Scram represents a SCRAM authenticator.
func NewScram ¶
func NewScram( tr transport.Transport, scramType ScramType, usesChannelBinding bool, rep repository.User, peppers *pepper.Keys, ) *Scram
NewScram returns a new scram authenticator instance.
func (*Scram) Authenticated ¶
Authenticated returns whether or not user has been authenticated.
func (*Scram) ProcessElement ¶
func (s *Scram) ProcessElement(ctx context.Context, elem stravaganza.Element) (stravaganza.Element, *SASLError)
ProcessElement process an incoming authenticator element.
func (*Scram) Username ¶
Username returns authenticated username in case authentication process has been completed.
func (*Scram) UsesChannelBinding ¶
UsesChannelBinding returns whether or not scram authenticator requires channel binding bytes.
type ScramType ¶
type ScramType int
ScramType represents a scram autheticator class
const ( // ScramSHA1 represents SCRAM-SHA-1 authentication method. ScramSHA1 ScramType = iota // ScramSHA256 represents SCRAM-SHA-256 authentication method. ScramSHA256 // ScramSHA512 represents SCRAM-SHA-512 authentication method. ScramSHA512 // ScramSHA3512 represents SCRAM-SHA3-512 authentication method. ScramSHA3512 )