Skip to content

Commit

Permalink
log invalid authentication attempts (#186)
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelquigley committed Jan 30, 2023
1 parent 95df9bb commit abb5a5e
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions controller/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
"github.com/openziti/edge/rest_management_api_client"
"github.com/openziti/edge/rest_util"
"github.com/openziti/zrok/rest_model_zrok"
"github.com/sirupsen/logrus"
"net/http"
"strings"
)
Expand All @@ -22,6 +23,7 @@ func newZrokAuthenticator(cfg *Config) *zrokAuthenticator {
func (za *zrokAuthenticator) authenticate(token string) (*rest_model_zrok.Principal, error) {
tx, err := str.Begin()
if err != nil {
logrus.Errorf("error starting transaction for '%v': %v", token, err)
return nil, err
}
defer func() { _ = tx.Rollback() }()
Expand Down Expand Up @@ -49,6 +51,7 @@ func (za *zrokAuthenticator) authenticate(token string) (*rest_model_zrok.Princi
}

// no match
logrus.Warnf("invalid api key '%v'", token)
return nil, errors2.New(401, "invalid api key")
}
}
Expand Down

0 comments on commit abb5a5e

Please sign in to comment.