- commit
- f083f44
- parent
- f10bd2a
- author
- Antonio Mika
- date
- 2023-11-10 20:38:26 +0000 UTC
Put key auth behind feature flag
1 files changed,
+6,
-1
+6,
-1
1@@ -209,13 +209,18 @@ func keyHandler(w http.ResponseWriter, r *http.Request) {
2
3 client.Logger.Infof("handle key (%s, %s, %s)", data.RemoteAddress, data.Username, data.PublicKey)
4
5- _, err = client.Dbpool.FindUserForKey(data.Username, data.PublicKey)
6+ user, err := client.Dbpool.FindUserForKey(data.Username, data.PublicKey)
7 if err != nil {
8 client.Logger.Error(err)
9 http.Error(w, err.Error(), http.StatusUnauthorized)
10 return
11 }
12
13+ if !client.Dbpool.HasFeatureForUser(user.ID, "tuns") {
14+ w.WriteHeader(http.StatusUnauthorized)
15+ return
16+ }
17+
18 w.WriteHeader(http.StatusOK)
19 }
20