Skip to content

Commit 14dc00a

Browse files
GiteaBotlunny
andauthored
Move reverproxyauth before session so the header will not be ignored even if user has login (#27821) (#30948)
Backport #27821 by @lunny When a user logout and then login another user, the reverseproxy auth should be checked before session otherwise the old user is still login. Co-authored-by: Lunny Xiao <[email protected]>
1 parent 94c5a30 commit 14dc00a

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

routers/web/web.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -98,14 +98,14 @@ func optionsCorsHandler() func(next http.Handler) http.Handler {
9898
// The Session plugin is expected to be executed second, in order to skip authentication
9999
// for users that have already signed in.
100100
func buildAuthGroup() *auth_service.Group {
101-
group := auth_service.NewGroup(
102-
&auth_service.OAuth2{}, // FIXME: this should be removed and only applied in download and oauth related routers
103-
&auth_service.Basic{}, // FIXME: this should be removed and only applied in download and git/lfs routers
104-
&auth_service.Session{},
105-
)
101+
group := auth_service.NewGroup()
102+
group.Add(&auth_service.OAuth2{}) // FIXME: this should be removed and only applied in download and oauth related routers
103+
group.Add(&auth_service.Basic{}) // FIXME: this should be removed and only applied in download and git/lfs routers
104+
106105
if setting.Service.EnableReverseProxyAuth {
107-
group.Add(&auth_service.ReverseProxy{})
106+
group.Add(&auth_service.ReverseProxy{}) // reverseproxy should before Session, otherwise the header will be ignored if user has login
108107
}
108+
group.Add(&auth_service.Session{})
109109

110110
if setting.IsWindows && auth_model.IsSSPIEnabled(db.DefaultContext) {
111111
group.Add(&auth_service.SSPI{}) // it MUST be the last, see the comment of SSPI

0 commit comments

Comments
 (0)