aboutsummaryrefslogtreecommitdiffstats
path: root/routers/web/auth
diff options
context:
space:
mode:
authorwxiaoguang <wxiaoguang@gmail.com>2024-11-13 16:58:09 +0800
committerGitHub <noreply@github.com>2024-11-13 16:58:09 +0800
commit0aedb03996d7bdce88b1f0086151f8778b10c1a4 (patch)
treea6586b4efd51cb7c392fde331062005f9c3a9b86 /routers/web/auth
parent840ad7eefe2b49ab453b9a89b153a264a8c9f8a2 (diff)
downloadgitea-0aedb03996d7bdce88b1f0086151f8778b10c1a4.tar.gz
gitea-0aedb03996d7bdce88b1f0086151f8778b10c1a4.zip
Fix LFS route mock, realm, middleware names (#32488)
1. move "internal-lfs" route mock to "common-lfs" 2. fine tune tests 3. fix "realm" strings, according to RFC: https://datatracker.ietf.org/doc/html/rfc2617: * realm = "realm" "=" realm-value * realm-value = quoted-string 4. clarify some names of the middlewares, rename `ignXxx` to `optXxx` to match `reqXxx`, and rename ambiguous `requireSignIn` to `reqGitSignIn`
Diffstat (limited to 'routers/web/auth')
-rw-r--r--routers/web/auth/oauth2_provider.go4
1 files changed, 2 insertions, 2 deletions
diff --git a/routers/web/auth/oauth2_provider.go b/routers/web/auth/oauth2_provider.go
index 29827b062d..faea34959f 100644
--- a/routers/web/auth/oauth2_provider.go
+++ b/routers/web/auth/oauth2_provider.go
@@ -91,7 +91,7 @@ type userInfoResponse struct {
// InfoOAuth manages request for userinfo endpoint
func InfoOAuth(ctx *context.Context) {
if ctx.Doer == nil || ctx.Data["AuthedMethod"] != (&auth_service.OAuth2{}).Name() {
- ctx.Resp.Header().Set("WWW-Authenticate", `Bearer realm=""`)
+ ctx.Resp.Header().Set("WWW-Authenticate", `Bearer realm="Gitea OAuth2"`)
ctx.PlainText(http.StatusUnauthorized, "no valid authorization")
return
}
@@ -136,7 +136,7 @@ func IntrospectOAuth(ctx *context.Context) {
clientIDValid = err == nil && app.ValidateClientSecret([]byte(clientSecret))
}
if !clientIDValid {
- ctx.Resp.Header().Set("WWW-Authenticate", `Basic realm=""`)
+ ctx.Resp.Header().Set("WWW-Authenticate", `Basic realm="Gitea OAuth2"`)
ctx.PlainText(http.StatusUnauthorized, "no valid authorization")
return
}