comparison auth.go @ 12:66b46b3d73be default tip

Handle capabilities sent by the server after negotiating a SASL security layer
author Guido Berhoerster <guido+managesieve@berhoerster.name>
date Tue, 09 Feb 2021 23:01:02 +0100
parents 6369453d47a3
children
comparison
equal deleted inserted replaced
11:b790df0733d4 12:66b46b3d73be
56 // Handle a challenge received from the server, if more is true the 56 // Handle a challenge received from the server, if more is true the
57 // server expects a response, otherwise the response should be nil. If 57 // server expects a response, otherwise the response should be nil. If
58 // an error is returned SASL authentication will be aborted and an 58 // an error is returned SASL authentication will be aborted and an
59 // AuthenticationError will be returned to the caller. 59 // AuthenticationError will be returned to the caller.
60 Next(challenge []byte, more bool) (response []byte, err error) 60 Next(challenge []byte, more bool) (response []byte, err error)
61 // Returns true if a SASL security layer was negotiated.
62 SASLSecurityLayer() bool
61 } 63 }
62 64
63 var ( 65 var (
64 // ErrPlainAuthNotSupported is returned if the server does not support 66 // ErrPlainAuthNotSupported is returned if the server does not support
65 // the SASL PLAIN authentication mechanism. 67 // the SASL PLAIN authentication mechanism.
112 114
113 func (a *plainAuth) Next(challenge []byte, more bool) ([]byte, error) { 115 func (a *plainAuth) Next(challenge []byte, more bool) ([]byte, error) {
114 return nil, nil 116 return nil, nil
115 } 117 }
116 118
119 func (a *plainAuth) SASLSecurityLayer() bool {
120 return false
121 }
122
117 // PlainAuth provides an Auth implementation of SASL PLAIN authentication as 123 // PlainAuth provides an Auth implementation of SASL PLAIN authentication as
118 // specified in RFC 4616 using the provided authorization identity, username 124 // specified in RFC 4616 using the provided authorization identity, username
119 // and password. If the identity is an empty string the server will derive an 125 // and password. If the identity is an empty string the server will derive an
120 // identity from the credentials. 126 // identity from the credentials.
121 func PlainAuth(identity, username, password, host string) Auth { 127 func PlainAuth(identity, username, password, host string) Auth {