Skip to content

feat: #1007 - Option to disable local login when OIDC is enabled - #1020

Open
DerDummePunkt wants to merge 6 commits into
gotify:masterfrom
DerDummePunkt:github_1007_option_to_disable_local_login_when_oidc_enabled
Open

feat: #1007 - Option to disable local login when OIDC is enabled #1020
DerDummePunkt wants to merge 6 commits into
gotify:masterfrom
DerDummePunkt:github_1007_option_to_disable_local_login_when_oidc_enabled

Conversation

@DerDummePunkt

Copy link
Copy Markdown

This PR attempts to implement #1007

Adds configurable local authentication through GOTIFY_LOCALAUTH_ENABLED, defaults to true to preserve existing behavior.

When local authentication is disabled:

  • The server does not register POST /auth/local/login.
  • Basic Auth with local Gotify user credentials is rejected by authentication middleware.
  • The check for a local admin account and subsequent creation is skipped.
  • The UI hides the local username/password login form, registration button, and password-based elevation form.
  • The UI receives the public localauth flag through injected window.config.
  • GET /gotifyinfo exposes the same flag as localauth.

The server exits with a fatal error when both local authentication and OIDC are disabled, preventing startup without an available login method.

disable local login when OIDC is enabled

- Add GOTIFY_LOCALAUTH_ENABLED, defaulting to true
- Block local login and Basic Auth when disabled
- Expose local auth state to the UI and hide local login flows
- Skip default local admin creation when local auth is disabled
- Require either local auth or OIDC at startup
@DerDummePunkt
DerDummePunkt requested a review from a team as a code owner August 4, 2026 18:33

@jmattheis jmattheis left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good so far. I've some remarks and haven't tested it manually.

Comment thread auth/authentication.go Outdated
Comment thread router/router.go
Comment thread app.go Outdated
Comment thread model/gotifyinfo.go Outdated
DerDummePunkt and others added 5 commits August 6, 2026 07:12
* use proper camelCase for `localAuth` ui flag throughout the code
* added new state Enum/iota for LocalAuthDisabled and make
  authentication layer use it isntad of returning skipped state
* do register Login handler in router, but let the handler check if
  local auth is enabled and inject proper context
* move config check, if at least of one of localauth or oidc is enabled,
  to config.get scaffolding, adding futureLogs entry with error message,
  letting startup/serve log the future Logs the same way as for other
  errors

@jmattheis jmattheis left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've made some small fixes.

I'll test this some more and will merge it around end of next week. (For security related stuff I want to take my time and I'm currently a bit busy).

@DerDummePunkt

Copy link
Copy Markdown
Author

No worries, take your time, there's no rush

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants