auth

package
v2.0.0-alpha2+incompat... Latest Latest
Warning

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

Go to latest
Published: Aug 28, 2015 License: BSD-3-Clause Imports: 16 Imported by: 0

Documentation

Overview

Package auth provides authentication codecs

Index

Constants

View Source
const CRAMMD5MaxRequests = 2

CRAMMD5MaxRequests is the maximum number of requests that an unauthenticated client is allowed to make (this should be enough to perform authentication).

Variables

View Source
var (
	// AuthenticationServer holds a default server for authentication
	AuthenticationServer = rpc.NewServer()

	// DefaultAuthenticatorCRAMMD5 holds a default authenticator
	DefaultAuthenticatorCRAMMD5 = NewAuthenticatorCRAMMD5()
)
View Source
var AuthenticationFailed = errors.New("authentication error: authentication failed")

AuthenticationFailed is returned when the client fails to authenticate.

Functions

func Authenticate

func Authenticate(ctx context.Context, c rpc.ServerCodec) (bool, error)

Authenticate returns true if it the client manages to authenticate the codec in at most maxRequest number of requests.

func CRAMMD5GetChallenge

func CRAMMD5GetChallenge() (string, error)

CRAMMD5GetChallenge creates a new RFC822 compatible ID

func CRAMMD5GetExpected

func CRAMMD5GetExpected(username, secret, challenge string) string

CRAMMD5GetExpected creates a "possible" ID with the given credentials

func LoadCredentials

func LoadCredentials(filename string) error

LoadCredentials loads credentials stored in the JSON file named filename into the default authenticator.

Types

type AuthenticateReply

type AuthenticateReply struct{}

AuthenticateReply holds reply data for Authenticate

type AuthenticateRequest

type AuthenticateRequest struct {
	Proof string
	// contains filtered or unexported fields
}

AuthenticateRequest holds request data for AuthenticateRequest

type AuthenticatorCRAMMD5

type AuthenticatorCRAMMD5 struct {
	Credentials cramMD5Credentials
}

AuthenticatorCRAMMD5 is an authenticator that uses the SASL CRAM-MD5 authentication mechanism.

func NewAuthenticatorCRAMMD5

func NewAuthenticatorCRAMMD5() *AuthenticatorCRAMMD5

NewAuthenticatorCRAMMD5 creates a new CRAM-MD5 authenticator

func (*AuthenticatorCRAMMD5) Authenticate

Authenticate checks if the client proof is correct.

func (*AuthenticatorCRAMMD5) GetNewChallenge

func (a *AuthenticatorCRAMMD5) GetNewChallenge(_ UnusedArgument, reply *GetNewChallengeReply) error

GetNewChallenge gives the client a new challenge for authentication.

type GetNewChallengeReply

type GetNewChallengeReply struct {
	Challenge string
}

GetNewChallengeReply holds reply data for Challenge

type UnusedArgument

type UnusedArgument string

UnusedArgument is a type used to indicate an argument that is necessary because of net/rpc requirements.

Jump to

Keyboard shortcuts

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