mirror of
https://github.com/openziti/zrok.git
synced 2025-06-27 05:01:26 +02:00
log invalid authentication attempts (#186)
This commit is contained in:
parent
95df9bba82
commit
abb5a5e537
@ -7,6 +7,7 @@ import (
|
|||||||
"github.com/openziti/edge/rest_management_api_client"
|
"github.com/openziti/edge/rest_management_api_client"
|
||||||
"github.com/openziti/edge/rest_util"
|
"github.com/openziti/edge/rest_util"
|
||||||
"github.com/openziti/zrok/rest_model_zrok"
|
"github.com/openziti/zrok/rest_model_zrok"
|
||||||
|
"github.com/sirupsen/logrus"
|
||||||
"net/http"
|
"net/http"
|
||||||
"strings"
|
"strings"
|
||||||
)
|
)
|
||||||
@ -22,6 +23,7 @@ func newZrokAuthenticator(cfg *Config) *zrokAuthenticator {
|
|||||||
func (za *zrokAuthenticator) authenticate(token string) (*rest_model_zrok.Principal, error) {
|
func (za *zrokAuthenticator) authenticate(token string) (*rest_model_zrok.Principal, error) {
|
||||||
tx, err := str.Begin()
|
tx, err := str.Begin()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
logrus.Errorf("error starting transaction for '%v': %v", token, err)
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
defer func() { _ = tx.Rollback() }()
|
defer func() { _ = tx.Rollback() }()
|
||||||
@ -49,6 +51,7 @@ func (za *zrokAuthenticator) authenticate(token string) (*rest_model_zrok.Princi
|
|||||||
}
|
}
|
||||||
|
|
||||||
// no match
|
// no match
|
||||||
|
logrus.Warnf("invalid api key '%v'", token)
|
||||||
return nil, errors2.New(401, "invalid api key")
|
return nil, errors2.New(401, "invalid api key")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user