Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions lib/auth/methods.go
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,9 @@ func (s *Server) AuthenticateUser(ctx context.Context, req AuthenticateUserReque
}

var (
// authenticateHeadlessError is the generic error returned for failed headless
// authentication attempts.
authenticateHeadlessError = trace.AccessDenied("headless authentication failed")
// authenticateWebauthnError is the generic error returned for failed WebAuthn
// authentication attempts.
authenticateWebauthnError = trace.AccessDenied("invalid Webauthn response")
Expand All @@ -171,9 +174,6 @@ var (
// invalidUserpass2FError is the error for when either the provided username,
// password, or second factor is incorrect.
invalidUserPass2FError = trace.AccessDenied("invalid username, password or second factor")
// invalidHeadlessAuthenticationError is the generic error returned for failed headless
// authentication attempts.
invalidHeadlessAuthenticationError = trace.AccessDenied("invalid Headless authentication")
)

// IsInvalidLocalCredentialError checks if an error resulted from an incorrect username,
Expand Down Expand Up @@ -208,12 +208,12 @@ func (s *Server) authenticateUser(ctx context.Context, req AuthenticateUserReque
mfaDevice, err := s.authenticateHeadless(ctx, req)
if err != nil {
log.Debugf("Headless Authentication for user %q failed while waiting for approval: %v", user, err)
return nil, "", trace.Wrap(invalidHeadlessAuthenticationError)
return nil, "", trace.Wrap(authenticateHeadlessError)
}
authenticateFn = func() (*types.MFADevice, error) {
return mfaDevice, nil
}
authErr = invalidHeadlessAuthenticationError
authErr = authenticateHeadlessError
case req.Webauthn != nil:
authenticateFn = func() (*types.MFADevice, error) {
mfaResponse := &proto.MFAAuthenticateResponse{
Expand Down