@@ -617,7 +617,7 @@ func (hs *HTTPServer) addMiddlewaresAndStaticRoutes() {
|
||||
m.UseMiddleware(hs.ContextHandler.Middleware)
|
||||
m.Use(middleware.OrgRedirect(hs.Cfg, hs.userService))
|
||||
|
||||
if !hs.Features.IsEnabled(featuremgmt.FlagAuthnService) {
|
||||
if !hs.Cfg.AuthBrokerEnabled {
|
||||
m.Use(accesscontrol.LoadPermissionsMiddleware(hs.accesscontrolService))
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -194,7 +194,7 @@ func (hs *HTTPServer) LoginAPIPing(c *contextmodel.ReqContext) response.Response
|
||||
}
|
||||
|
||||
func (hs *HTTPServer) LoginPost(c *contextmodel.ReqContext) response.Response {
|
||||
if hs.Features.IsEnabled(featuremgmt.FlagAuthnService) {
|
||||
if hs.Cfg.AuthBrokerEnabled {
|
||||
identity, err := hs.authnService.Login(c.Req.Context(), authn.ClientForm, &authn.Request{HTTPRequest: c.Req, Resp: c.Resp})
|
||||
if err != nil {
|
||||
tokenErr := &auth.CreateTokenErr{}
|
||||
|
||||
@@ -19,7 +19,6 @@ import (
|
||||
"github.com/grafana/grafana/pkg/middleware/cookies"
|
||||
"github.com/grafana/grafana/pkg/services/authn"
|
||||
contextmodel "github.com/grafana/grafana/pkg/services/contexthandler/model"
|
||||
"github.com/grafana/grafana/pkg/services/featuremgmt"
|
||||
loginservice "github.com/grafana/grafana/pkg/services/login"
|
||||
"github.com/grafana/grafana/pkg/services/org"
|
||||
"github.com/grafana/grafana/pkg/services/user"
|
||||
@@ -84,7 +83,7 @@ func (hs *HTTPServer) OAuthLogin(ctx *contextmodel.ReqContext) {
|
||||
|
||||
code := ctx.Query("code")
|
||||
|
||||
if hs.Features.IsEnabled(featuremgmt.FlagAuthnService) {
|
||||
if hs.Cfg.AuthBrokerEnabled {
|
||||
req := &authn.Request{HTTPRequest: ctx.Req, Resp: ctx.Resp}
|
||||
if code == "" {
|
||||
redirect, err := hs.authnService.RedirectURL(ctx.Req.Context(), authn.ClientWithPrefix(name), req)
|
||||
@@ -381,7 +380,7 @@ func (hs *HTTPServer) handleOAuthLoginError(ctx *contextmodel.ReqContext, info l
|
||||
ctx.Handle(hs.Cfg, err.HttpStatus, err.PublicMessage, err.Err)
|
||||
|
||||
// login hooks is handled by authn.Service
|
||||
if !hs.Features.IsEnabled(featuremgmt.FlagAuthnService) {
|
||||
if !hs.Cfg.AuthBrokerEnabled {
|
||||
info.Error = err.Err
|
||||
if info.Error == nil {
|
||||
info.Error = errors.New(err.PublicMessage)
|
||||
@@ -396,7 +395,7 @@ func (hs *HTTPServer) handleOAuthLoginErrorWithRedirect(ctx *contextmodel.ReqCon
|
||||
hs.redirectWithError(ctx, err, v...)
|
||||
|
||||
// login hooks is handled by authn.Service
|
||||
if !hs.Features.IsEnabled(featuremgmt.FlagAuthnService) {
|
||||
if !hs.Cfg.AuthBrokerEnabled {
|
||||
info.Error = err
|
||||
hs.HooksService.RunLoginHook(&info, ctx)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user