Fixes #1605: make ErrorList introspectable by replacing ErrorList and

ErrorList#ToError with []error and util.SliceToError() respectively
This commit is contained in:
George Kuan
2014-12-12 10:56:31 -08:00
parent 771c538932
commit 5e1fc1f4e0
9 changed files with 30 additions and 44 deletions

View File

@@ -35,7 +35,7 @@ func New(authRequestHandlers ...authenticator.Request) authenticator.Request {
// AuthenticateRequest authenticates the request using a chain of authenticator.Request objects. The first
// success returns that identity. Errors are only returned if no matches are found.
func (authHandler unionAuthRequestHandler) AuthenticateRequest(req *http.Request) (user.Info, bool, error) {
var errors util.ErrorList
var errors []error
for _, currAuthRequestHandler := range authHandler {
info, ok, err := currAuthRequestHandler.AuthenticateRequest(req)
if err != nil {
@@ -48,5 +48,5 @@ func (authHandler unionAuthRequestHandler) AuthenticateRequest(req *http.Request
}
}
return nil, false, errors.ToError()
return nil, false, util.SliceToError(errors)
}

View File

@@ -55,7 +55,7 @@ func (a *Authenticator) AuthenticateRequest(req *http.Request) (user.Info, bool,
return nil, false, nil
}
var errors util.ErrorList
var errors []error
for _, cert := range req.TLS.PeerCertificates {
chains, err := cert.Verify(a.opts)
if err != nil {
@@ -75,7 +75,7 @@ func (a *Authenticator) AuthenticateRequest(req *http.Request) (user.Info, bool,
}
}
}
return nil, false, errors.ToError()
return nil, false, util.SliceToError(errors)
}
// DefaultVerifyOptions returns VerifyOptions that use the system root certificates, current time,