diff options
author | George Tsiamasiotis <gtsiam@windowslive.com> | 2024-11-26 07:51:51 +0100 |
---|---|---|
committer | Squel <squeljur+git@gmail.com> | 2024-12-01 15:50:10 +0100 |
commit | a126477e866c5d28b3dbe51f5e3ce97dffcbf199 (patch) | |
tree | 782f651f6b5772011ecc28f1f8c72b33fe8bc5dc /routers/web | |
parent | Merge pull request 'Improve Swagger documentation for user endpoints' (#6050)... (diff) | |
download | forgejo-a126477e866c5d28b3dbe51f5e3ce97dffcbf199.tar.xz forgejo-a126477e866c5d28b3dbe51f5e3ce97dffcbf199.zip |
feat: Add option to disable builtin authentication.
Setting ENABLE_INTERNAL_SIGNIN to false will disable the built-in
signin form, should the administrator prefer to limit users to SSO.
Continuation of forgejo/forgejo#6076
Diffstat (limited to 'routers/web')
-rw-r--r-- | routers/web/auth/auth.go | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/routers/web/auth/auth.go b/routers/web/auth/auth.go index 941586db72..71d7b8ca11 100644 --- a/routers/web/auth/auth.go +++ b/routers/web/auth/auth.go @@ -164,6 +164,7 @@ func SignIn(ctx *context.Context) { ctx.Data["PageIsSignIn"] = true ctx.Data["PageIsLogin"] = true ctx.Data["EnableSSPI"] = auth.IsSSPIEnabled(ctx) + ctx.Data["EnableInternalSignIn"] = setting.Service.EnableInternalSignIn if setting.Service.EnableCaptcha && setting.Service.RequireCaptchaForLogin { context.SetCaptchaData(ctx) @@ -187,6 +188,13 @@ func SignInPost(ctx *context.Context) { ctx.Data["PageIsSignIn"] = true ctx.Data["PageIsLogin"] = true ctx.Data["EnableSSPI"] = auth.IsSSPIEnabled(ctx) + ctx.Data["EnableInternalSignIn"] = setting.Service.EnableInternalSignIn + + // Permission denied if EnableInternalSignIn is false + if !setting.Service.EnableInternalSignIn { + ctx.Error(http.StatusForbidden) + return + } if ctx.HasError() { ctx.HTML(http.StatusOK, tplSignIn) |