diff options
author | kali kaneko (leap communications) <kali@leap.se> | 2020-01-31 14:53:29 -0600 |
---|---|---|
committer | kali kaneko (leap communications) <kali@leap.se> | 2020-02-11 17:39:04 +0100 |
commit | ecaa22111ee8e34111080139e1e8a92b90e30158 (patch) | |
tree | 65f34061265cb346e5380416ba806b92a010fe13 /pkg/web/middleware.go | |
parent | 6da07c8be89be0d40e8bdae9d773bfb5d2d33ad9 (diff) |
[feat] add prometheus instrumentation
Diffstat (limited to 'pkg/web/middleware.go')
-rw-r--r-- | pkg/web/middleware.go | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/pkg/web/middleware.go b/pkg/web/middleware.go index 3a74477..fbbdbaf 100644 --- a/pkg/web/middleware.go +++ b/pkg/web/middleware.go @@ -18,6 +18,7 @@ package web import ( "0xacab.org/leap/vpnweb/pkg/auth/creds" "0xacab.org/leap/vpnweb/pkg/config" + "0xacab.org/leap/vpnweb/pkg/metrics" "encoding/json" "github.com/auth0/go-jwt-middleware" "github.com/dgrijalva/jwt-go" @@ -53,11 +54,14 @@ func AuthMiddleware(authenticationFunc func(*creds.Credentials) bool, opts *conf valid := authenticationFunc(&c) if !valid { + metrics.FailedLogins.Inc() log.Println("Wrong auth for user", c.User) http.Error(w, "Wrong user and/or password", http.StatusUnauthorized) return } + metrics.SuccessfulLogins.Inc() + if strings.ToLower(debugAuth) == "yes" { log.Println("Valid auth for user", c.User) } |