Skip to content

Commit

Permalink
perf: Set the default value of local-auth to true
Browse files Browse the repository at this point in the history
Signed-off-by: Jianhui Zhao <[email protected]>
  • Loading branch information
zhaojh329 committed Dec 13, 2024
1 parent 3c640cc commit 3327c5e
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
8 changes: 6 additions & 2 deletions api.go
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,10 @@ func apiStart(br *broker) {
isConnect := false
devid := ""

if !cfg.LocalAuth && isLocalRequest(c) {
return
}

if strings.HasPrefix(c.Request.URL.Path, "/connect/") {
devid = c.Param("devid")
if devid == "" {
Expand Down Expand Up @@ -340,9 +344,9 @@ func apiStart(br *broker) {

r.GET("/authorized/:devid", func(c *gin.Context) {
devid := c.Param("devid")
authorized := false
authorized := !cfg.LocalAuth && isLocalRequest(c)

if devInWhiteList(devid, cfg) {
if !authorized && devInWhiteList(devid, cfg) {
authorized = true
}

Expand Down
1 change: 1 addition & 0 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,7 @@ func main() {
},
&cli.BoolFlag{
Name: "local-auth",
Value: true,
Usage: "need auth for local",
},
&cli.BoolFlag{
Expand Down
3 changes: 3 additions & 0 deletions rttys.conf
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,6 @@ db: sqlite://rttys.db

#disable new user sign up
#disable-sign-up: True

# Local access does not require authentication
#local-auth: false

0 comments on commit 3327c5e

Please sign in to comment.