auth

package
v0.0.0-...-aeec266 Latest Latest
Warning

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

Go to latest
Published: Jan 5, 2021 License: BSD-3-Clause Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrSASLIncorrectEncoding represents a 'incorrect-encoding' authentication error.
	ErrSASLIncorrectEncoding = newSASLError("incorrect-encoding")

	// ErrSASLMalformedRequest represents a 'malformed-request' authentication error.
	ErrSASLMalformedRequest = newSASLError("malformed-request")

	// ErrSASLNotAuthorized represents a 'not-authorized' authentication error.
	ErrSASLNotAuthorized = newSASLError("not-authorized")

	// ErrSASLTemporaryAuthFailure represents a 'temporary-auth-failure' authentication error.
	ErrSASLTemporaryAuthFailure = newSASLError("temporary-auth-failure")
)

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, xmpp.XElement) error

	// Reset resets authenticator internal state.
	Reset()
}

Authenticator defines a generic authenticator state machine.

type Plain

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

Plain represents a PLAIN authenticator.

func NewPlain

func NewPlain(stm stream.C2S, userRep repository.User) *Plain

NewPlain returns a new plain authenticator instance.

func (*Plain) Authenticated

func (p *Plain) Authenticated() bool

Authenticated returns whether or not user has been authenticated.

func (*Plain) Mechanism

func (p *Plain) Mechanism() string

Mechanism returns authenticator mechanism name.

func (*Plain) ProcessElement

func (p *Plain) ProcessElement(ctx context.Context, elem xmpp.XElement) error

ProcessElement process an incoming authenticator element.

func (*Plain) Reset

func (p *Plain) Reset()

Reset resets plain authenticator internal state.

func (*Plain) Username

func (p *Plain) Username() string

Username returns authenticated username in case authentication process has been completed.

func (*Plain) UsesChannelBinding

func (p *Plain) UsesChannelBinding() bool

UsesChannelBinding returns whether or not plain authenticator requires channel binding bytes.

type SASLError

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

SASLError represents specific SASL error type.

func (*SASLError) Element

func (se *SASLError) Element() xmpp.XElement

Element returs sasl error XML representation.

func (*SASLError) Error

func (se *SASLError) Error() string

Error satisfies error interface.

type Scram

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

Scram represents a SCRAM authenticator.

func NewScram

func NewScram(stm stream.C2S, tr transport.Transport, scramType ScramType, usesChannelBinding bool, userRep repository.User) *Scram

NewScram returns a new scram authenticator instance.

func (*Scram) Authenticated

func (s *Scram) Authenticated() bool

Authenticated returns whether or not user has been authenticated.

func (*Scram) Mechanism

func (s *Scram) Mechanism() string

Mechanism returns authenticator mechanism name.

func (*Scram) ProcessElement

func (s *Scram) ProcessElement(ctx context.Context, elem xmpp.XElement) error

ProcessElement process an incoming authenticator element.

func (*Scram) Reset

func (s *Scram) Reset()

Reset resets scram internal state.

func (*Scram) Username

func (s *Scram) Username() string

Username returns authenticated username in case authentication process has been completed.

func (*Scram) UsesChannelBinding

func (s *Scram) UsesChannelBinding() bool

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
)

Jump to

Keyboard shortcuts

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