File tree Expand file tree Collapse file tree 3 files changed +11
-6
lines changed Expand file tree Collapse file tree 3 files changed +11
-6
lines changed Original file line number Diff line number Diff line change @@ -569,8 +569,8 @@ func bind(obj interface{}) http.HandlerFunc {
569569func buildAuthGroup () * auth.Group {
570570 group := auth .NewGroup (
571571 & auth.OAuth2 {},
572- & auth.Basic {},
573- auth .SharedSession ,
572+ & auth.Basic {}, // FIXME: this should be removed once we don't allow basic auth in API
573+ auth .SharedSession , // FIXME: this should be removed once all UI don't reference API/v1, see https://github.com/go-gitea/gitea/pull/16052
574574 )
575575 if setting .Service .EnableReverseProxyAuth {
576576 group .Add (& auth.ReverseProxy {})
@@ -600,8 +600,13 @@ func Routes(sessioner func(http.Handler) http.Handler) *web.Route {
600600 }
601601 m .Use (context .APIContexter ())
602602
603+ group := buildAuthGroup ()
604+ if err := group .Init (); err != nil {
605+ log .Error ("Could not initialize '%s' auth method, error: %s" , group .Name (), err )
606+ }
607+
603608 // Get user from session if logged in.
604- m .Use (context .APIAuth (buildAuthGroup () ))
609+ m .Use (context .APIAuth (group ))
605610
606611 m .Use (context .ToggleAPI (& context.ToggleOptions {
607612 SignInRequired : setting .Service .RequireSignInView ,
Original file line number Diff line number Diff line change @@ -79,8 +79,8 @@ func CorsHandler() func(next http.Handler) http.Handler {
7979// for users that have already signed in.
8080func buildAuthGroup () * auth_service.Group {
8181 group := auth_service .NewGroup (
82- & auth_service.OAuth2 {},
83- & auth_service.Basic {},
82+ & auth_service.OAuth2 {}, // FIXME: this should be removed and only applied in download and oauth realted routers
83+ & auth_service.Basic {}, // FIXME: this should be removed and only applied in download and git/lfs routers
8484 auth_service .SharedSession ,
8585 )
8686 if setting .Service .EnableReverseProxyAuth {
Original file line number Diff line number Diff line change 2626 _ = handleSignIn
2727
2828 // SharedSession the session auth should only be used by web, but now both web and API/v1
29- // will use it. We can remvoe this after Web removed dependent API/v1
29+ // will use it. We can remove this after Web removed dependent API/v1
3030 SharedSession = & Session {}
3131)
3232
You can’t perform that action at this time.
0 commit comments