소스 검색

[dav] configurable auth realm

cgars 7 년 전
부모
커밋
dd545c8b5a
3개의 변경된 파일6개의 추가작업 그리고 3개의 파일을 삭제
  1. 2 0
      conf/app.ini
  2. 1 1
      pkg/dav/dav.go
  3. 3 2
      pkg/setting/setting.go

+ 2 - 0
conf/app.ini

@@ -514,6 +514,8 @@ DOI_BASE = 123454/789.gty
 ON = false
 ; is login required for webdav
 LOGGED = true
+; authorisation REALM
+AUTH_REALM = localhost
 
 [cliconfig]
 RSA_HOST_KEY = notset

+ 1 - 1
pkg/dav/dav.go

@@ -345,7 +345,7 @@ func getROwnerID(path string) (int64, error) {
 }
 
 func Webdav401(c *gctx.Context) {
-	c.Header().Add("WWW-Authenticate", fmt.Sprintf("Basic realm=\"%s\"", setting.AppURL))
+	c.Header().Add("WWW-Authenticate", fmt.Sprintf("Basic realm=\"%s\"", setting.WebDav.AuthRealm))
 	c.WriteHeader(http.StatusUnauthorized)
 	return
 }

+ 3 - 2
pkg/setting/setting.go

@@ -335,8 +335,9 @@ var (
 	}
 
 	WebDav struct {
-		On     bool
-		Logged bool
+		On        bool
+		Logged    bool
+		AuthRealm string
 	}
 )