sasl

package
v0.0.111-test1 Latest Latest
Warning

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

Go to latest
Published: Feb 12, 2021 License: GPL-3.0 Imports: 11 Imported by: 5

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrMechanismAlreadyRegistered indicates an attempt to register a duplicate mechanism
	ErrMechanismAlreadyRegistered = errors.New("the mechanism already registered")
	// ErrUnsupportedMechanism indicates an attempt to use an unregistered mechanism
	ErrUnsupportedMechanism = errors.New("the requested mechanism is not supported")
	// ErrUnsupportedProperty indicates an attempt to set a property unsupported by a mechanism
	ErrUnsupportedProperty = errors.New("unsupported property")
)
View Source
var (

	//ErrMissingParameter indicates a missing parameter from the server challenge
	ErrMissingParameter = errors.New("missing parameter in server challenge")
)
View Source
var Stringprep = transform.Chain(nonASCIISpaceTransformer, mappedToNothing, norm.NFKC)

Stringprep implements Stringprep Profile for User Names and Passwords (RFC 4013) as a transform.Transformer

Functions

func ClientSupport

func ClientSupport(mechanism string) bool

ClientSupport returns whether there is client-side support for a specified mechanism

func RegisterMechanism

func RegisterMechanism(name string, m Mechanism) error

RegisterMechanism registers an SASL mechanism for a name

Types

type AttributeValuePairs

type AttributeValuePairs map[string]string

AttributeValuePairs represents atribute-value pairs

func ParseAttributeValuePairs

func ParseAttributeValuePairs(src []byte) AttributeValuePairs

ParseAttributeValuePairs parses a string of comma-separated attribute=value pairs

type Mechanism

type Mechanism interface {
	NewClient() Session
}

Mechanism represents an SASL mechanism

type Properties

type Properties map[Property]string

Properties represents a map of property and value

type Property

type Property int

Property represents a SASL mechanism property

const (
	AuthID Property = iota
	Password
	AuthZID
	Realm
	Service
	QOP
	ClientNonce
)

All SASL mechanism properties, as defined by GSASL

type PropertyMissingError

type PropertyMissingError struct {
	Property
}

PropertyMissingError represents an error due a missing property

func (PropertyMissingError) Error

func (e PropertyMissingError) Error() string

type Session

type Session interface {
	SetProperty(Property, string) error
	Step(Token) (Token, error)
	NeedsMore() bool
	SetChannelBinding([]byte)
}

Session represents an authorization session

func NewClient

func NewClient(mechanism string) (Session, error)

NewClient returns a client session for a SASL mechanism

type Token

type Token []byte

Token represents a SASL token exchanged by client and server.

func DecodeToken

func DecodeToken(in []byte) (Token, error)

DecodeToken decodes a base64 encoded token

func (Token) Encode

func (t Token) Encode() []byte

Encode encoded the token using base64

func (Token) String

func (t Token) String() string

Directories

Path Synopsis
Package digestmd5 implements the Digest Authentication as a SASL Mechanism according to RFC 2831.
Package digestmd5 implements the Digest Authentication as a SASL Mechanism according to RFC 2831.
Package plain implements the Plain Simple Authentication Mechanism according to RFC 4616
Package plain implements the Plain Simple Authentication Mechanism according to RFC 4616
Package scram implements the Salted Challenge Response Authentication Mechanism according to RFC 5802 and RFC 7677.
Package scram implements the Salted Challenge Response Authentication Mechanism according to RFC 5802 and RFC 7677.

Jump to

Keyboard shortcuts

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