auth

package
v0.3.5 Latest Latest
Warning

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

Go to latest
Published: Nov 9, 2018 License: GPL-3.0 Imports: 18 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(xmpp.XElement) error

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

Authenticator defines a generic authenticator state machine.

type DigestMD5

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

DigestMD5 represents a DIGEST-MD5 authenticator.

func NewDigestMD5

func NewDigestMD5(stm stream.C2S) *DigestMD5

NewDigestMD5 returns a new digest-md5 authenticator instance.

func (*DigestMD5) Authenticated

func (d *DigestMD5) Authenticated() bool

Authenticated returns whether or not user has been authenticated.

func (*DigestMD5) Mechanism

func (d *DigestMD5) Mechanism() string

Mechanism returns authenticator mechanism name.

func (*DigestMD5) ProcessElement

func (d *DigestMD5) ProcessElement(elem xmpp.XElement) error

ProcessElement process an incoming authenticator element.

func (*DigestMD5) Reset

func (d *DigestMD5) Reset()

Reset resets digest-md5 authenticator internal state.

func (*DigestMD5) Username

func (d *DigestMD5) Username() string

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

func (*DigestMD5) UsesChannelBinding

func (d *DigestMD5) UsesChannelBinding() bool

UsesChannelBinding returns whether or not digest-md5 authenticator requires channel binding bytes.

type Plain

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

Plain represents a PLAIN authenticator.

func NewPlain

func NewPlain(stm stream.C2S) *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(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) *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(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-SHA1 authentication method.
	ScramSHA1 ScramType = iota

	// ScramSHA256 represents SCRAM-SHA256 authentication method.
	ScramSHA256
)

Jump to

Keyboard shortcuts

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