File tree 3 files changed +11
-6
lines changed
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 {
569
569
func buildAuthGroup () * auth.Group {
570
570
group := auth .NewGroup (
571
571
& 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
574
574
)
575
575
if setting .Service .EnableReverseProxyAuth {
576
576
group .Add (& auth.ReverseProxy {})
@@ -600,8 +600,13 @@ func Routes(sessioner func(http.Handler) http.Handler) *web.Route {
600
600
}
601
601
m .Use (context .APIContexter ())
602
602
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
+
603
608
// Get user from session if logged in.
604
- m .Use (context .APIAuth (buildAuthGroup () ))
609
+ m .Use (context .APIAuth (group ))
605
610
606
611
m .Use (context .ToggleAPI (& context.ToggleOptions {
607
612
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 {
79
79
// for users that have already signed in.
80
80
func buildAuthGroup () * auth_service.Group {
81
81
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
84
84
auth_service .SharedSession ,
85
85
)
86
86
if setting .Service .EnableReverseProxyAuth {
Original file line number Diff line number Diff line change 26
26
_ = handleSignIn
27
27
28
28
// 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
30
30
SharedSession = & Session {}
31
31
)
32
32
You can’t perform that action at this time.
0 commit comments