Documentation ¶
Overview ¶
Package auth provides authentication codecs
Index ¶
- Constants
- Variables
- func Authenticate(ctx context.Context, c rpc.ServerCodec) (bool, error)
- func CRAMMD5GetChallenge() (string, error)
- func CRAMMD5GetExpected(username, secret, challenge string) string
- func LoadCredentials(filename string) error
- type AuthenticateReply
- type AuthenticateRequest
- type AuthenticatorCRAMMD5
- type GetNewChallengeReply
- type UnusedArgument
Constants ¶
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 ¶
var ( // AuthenticationServer holds a default server for authentication AuthenticationServer = rpc.NewServer() // DefaultAuthenticatorCRAMMD5 holds a default authenticator DefaultAuthenticatorCRAMMD5 = NewAuthenticatorCRAMMD5() )
var AuthenticationFailed = errors.New("authentication error: authentication failed")
AuthenticationFailed is returned when the client fails to authenticate.
Functions ¶
func Authenticate ¶
Authenticate returns true if it the client manages to authenticate the codec in at most maxRequest number of requests.
func CRAMMD5GetChallenge ¶
CRAMMD5GetChallenge creates a new RFC822 compatible ID
func CRAMMD5GetExpected ¶
CRAMMD5GetExpected creates a "possible" ID with the given credentials
func LoadCredentials ¶
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 ¶
func (a *AuthenticatorCRAMMD5) Authenticate(ctx context.Context, req *AuthenticateRequest, reply *AuthenticateReply) error
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.