Skip to content

Commit af9d97f

Browse files
lunnyGiteaBot
authored andcommitted
Move reverproxyauth before session so the header will not be ignored even if user has login (go-gitea#27821)
When a user logout and then login another user, the reverseproxy auth should be checked before session otherwise the old user is still login.
1 parent 17c6a38 commit af9d97f

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
@@ -100,14 +100,14 @@ func optionsCorsHandler() func(next http.Handler) http.Handler {
100100
// The Session plugin is expected to be executed second, in order to skip authentication
101101
// for users that have already signed in.
102102
func buildAuthGroup() *auth_service.Group {
103-
group := auth_service.NewGroup(
104-
&auth_service.OAuth2{}, // FIXME: this should be removed and only applied in download and oauth related routers
105-
&auth_service.Basic{}, // FIXME: this should be removed and only applied in download and git/lfs routers
106-
&auth_service.Session{},
107-
)
103+
group := auth_service.NewGroup()
104+
group.Add(&auth_service.OAuth2{}) // FIXME: this should be removed and only applied in download and oauth related routers
105+
group.Add(&auth_service.Basic{}) // FIXME: this should be removed and only applied in download and git/lfs routers
106+
108107
if setting.Service.EnableReverseProxyAuth {
109-
group.Add(&auth_service.ReverseProxy{})
108+
group.Add(&auth_service.ReverseProxy{}) // reverseproxy should before Session, otherwise the header will be ignored if user has login
110109
}
110+
group.Add(&auth_service.Session{})
111111

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

0 commit comments

Comments
 (0)