aboutsummaryrefslogtreecommitdiffstats
path: root/routers/api/v1
diff options
context:
space:
mode:
Diffstat (limited to 'routers/api/v1')
-rw-r--r--routers/api/v1/api.go5
-rw-r--r--routers/api/v1/auth.go10
-rw-r--r--routers/api/v1/auth_windows.go19
3 files changed, 4 insertions, 30 deletions
diff --git a/routers/api/v1/api.go b/routers/api/v1/api.go
index ca74a23a4b..d58e39920b 100644
--- a/routers/api/v1/api.go
+++ b/routers/api/v1/api.go
@@ -705,7 +705,10 @@ func buildAuthGroup() *auth.Group {
if setting.Service.EnableReverseProxyAuthAPI {
group.Add(&auth.ReverseProxy{})
}
- specialAdd(group)
+
+ if setting.IsWindows && auth_model.IsSSPIEnabled() {
+ group.Add(&auth.SSPI{}) // it MUST be the last, see the comment of SSPI
+ }
return group
}
diff --git a/routers/api/v1/auth.go b/routers/api/v1/auth.go
deleted file mode 100644
index e44271ba14..0000000000
--- a/routers/api/v1/auth.go
+++ /dev/null
@@ -1,10 +0,0 @@
-// Copyright 2022 The Gitea Authors. All rights reserved.
-// SPDX-License-Identifier: MIT
-
-//go:build !windows
-
-package v1
-
-import auth_service "code.gitea.io/gitea/services/auth"
-
-func specialAdd(group *auth_service.Group) {}
diff --git a/routers/api/v1/auth_windows.go b/routers/api/v1/auth_windows.go
deleted file mode 100644
index 3514e21baa..0000000000
--- a/routers/api/v1/auth_windows.go
+++ /dev/null
@@ -1,19 +0,0 @@
-// Copyright 2022 The Gitea Authors. All rights reserved.
-// SPDX-License-Identifier: MIT
-
-package v1
-
-import (
- "code.gitea.io/gitea/models/auth"
- auth_service "code.gitea.io/gitea/services/auth"
-)
-
-// specialAdd registers the SSPI auth method as the last method in the list.
-// The SSPI plugin is expected to be executed last, as it returns 401 status code if negotiation
-// fails (or if negotiation should continue), which would prevent other authentication methods
-// to execute at all.
-func specialAdd(group *auth_service.Group) {
- if auth.IsSSPIEnabled() {
- group.Add(&auth_service.SSPI{})
- }
-}