sasl

package module
v0.0.0-...-1e2af45 Latest Latest
Warning

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

Go to latest
Published: Oct 31, 2016 License: MIT Imports: 2 Imported by: 0

README

go-sasl

GoDoc Build Status

A SASL library written in Go.

Implemented mechanisms:

License

MIT

Documentation

Overview

Library for Simple Authentication and Security Layer (SASL) defined in RFC 4422.

Index

Constants

View Source
const Anonymous = "ANONYMOUS"

The ANONYMOUS mechanism name.

View Source
const External = "EXTERNAL"

The EXTERNAL mechanism name.

View Source
const Login = "LOGIN"

The LOGIN mechanism name.

View Source
const Plain = "PLAIN"

The PLAIN mechanism name.

View Source
const Xoauth2 = "XOAUTH2"

The XOAUTH2 mechanism name.

Variables

View Source
var (
	ErrUnexpectedClientResponse  = errors.New("sasl: unexpected client response")
	ErrUnexpectedServerChallenge = errors.New("sasl: unexpected server challenge")
)

Common SASL errors.

Functions

This section is empty.

Types

type AnonymousAuthenticator

type AnonymousAuthenticator func(trace string) error

Get trace information from clients logging in anonymously.

type Client

type Client interface {
	// Begins SASL authentication with the server. It returns the
	// authentication mechanism name and "initial response" data (if required by
	// the selected mechanism). A non-nil error causes the client to abort the
	// authentication attempt.
	//
	// A nil ir value is different from a zero-length value. The nil value
	// indicates that the selected mechanism does not use an initial response,
	// while a zero-length value indicates an empty initial response, which must
	// be sent to the server.
	Start() (mech string, ir []byte, err error)

	// Continues challenge-response authentication. A non-nil error causes
	// the client to abort the authentication attempt.
	Next(challenge []byte) (response []byte, err error)
}

Client interface to perform challenge-response authentication.

func NewAnonymousClient

func NewAnonymousClient(trace string) Client

A client implementation of the ANONYMOUS authentication mechanism, as described in RFC 4505.

func NewExternalClient

func NewExternalClient(identity string) Client

An implementation of the EXTERNAL authentication mechanism, as described in RFC 4422. Authorization identity may be left blank to indicate that the client is requesting to act as the identity associated with the authentication credentials.

func NewPlainClient

func NewPlainClient(identity, username, password string) Client

A client implementation of the PLAIN authentication mechanism, as described in RFC 4616. Authorization identity may be left blank to indicate that it is the same as the username.

func NewXoauth2Client

func NewXoauth2Client(username, token string) Client

An implementation of the XOAUTH2 authentication mechanism, as described in https://developers.google.com/gmail/xoauth2_protocol.

type LoginAuthenticator

type LoginAuthenticator func(username, password string) error

Authenticates users with an username and a password.

type PlainAuthenticator

type PlainAuthenticator func(identity, username, password string) error

Authenticates users with an identity, a username and a password. If the identity is left blank, it indicates that it is the same as the username. If identity is not empty and the server doesn't support it, an error must be returned.

type Server

type Server interface {
	// Begins or continues challenge-response authentication. If the client
	// supplies an initial response, response is non-nil.
	//
	// If the authentication is finished, done is set to true. If the
	// authentication has failed, an error is returned.
	Next(response []byte) (challenge []byte, done bool, err error)
}

Server interface to perform challenge-response authentication.

func NewAnonymousServer

func NewAnonymousServer(authenticator AnonymousAuthenticator) Server

A server implementation of the ANONYMOUS authentication mechanism, as described in RFC 4505.

func NewLoginServer

func NewLoginServer(authenticator LoginAuthenticator) Server

A server implementation of the LOGIN authentication mechanism, as described in https://tools.ietf.org/html/draft-murchison-sasl-login-00.

func NewPlainServer

func NewPlainServer(authenticator PlainAuthenticator) Server

A server implementation of the PLAIN authentication mechanism, as described in RFC 4616.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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