Skip to content

fix: username provider appearing when no auth is configured#568

Merged
steveiliop56 merged 8 commits into
tinyauthapp:mainfrom
pushpinderbal:main
Jan 8, 2026
Merged

fix: username provider appearing when no auth is configured#568
steveiliop56 merged 8 commits into
tinyauthapp:mainfrom
pushpinderbal:main

Conversation

@pushpinderbal
Copy link
Copy Markdown
Contributor

@pushpinderbal pushpinderbal commented Jan 7, 2026

AI Summary

Fixes a bug where the username authentication provider would incorrectly appear in the login UI when neither local users nor LDAP were successfully configured, but only OAuth providers were set up.

Root Cause: When LDAP initialization failed, a non-nil (but uninitialized) LDAP service was being passed to AuthService, causing UserAuthConfigured() to return true.

Fix: Pass services.ldapService (which is nil when init fails) instead of the local ldapService variable to AuthService constructor in service_bootstrap.go line 69.

Impact: Username provider now only appears when users are configured or LDAP successfully initializes.

Summary by CodeRabbit

  • Refactor
    • Improved internal service initialization logic for better code maintainability and consistency.

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Jan 7, 2026

📝 Walkthrough

Walkthrough

A parameter in the NewAuthService call within the service bootstrap initialization is updated to reference the LDAP service instance from the Services struct instead of a local variable, maintaining all other initialization and error handling logic.

Changes

Cohort / File(s) Summary
Service Bootstrap Refactoring
internal/bootstrap/service_bootstrap.go
Updated NewAuthService parameter from local ldapService variable to services.ldapService struct field reference in the initServices function

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

Suggested reviewers

  • steveiliop56

Poem

🐰 A little hop through the bootstrap code,
Where services dance down their happy road,
We swap a local for the struct's own keep,
One line of change, so simple and neat!
The LDAP service takes its rightful place,
All with a smile on this rabbit's face. ✨

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main bug fix: preventing the username provider from appearing when authentication is not properly configured. It directly corresponds to the primary change in the PR, which fixes an LDAP service reference bug that caused UserAuthConfigured() to return incorrect values.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings

📜 Recent review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 1dc83c8 and bc3b6cc.

📒 Files selected for processing (1)
  • internal/bootstrap/service_bootstrap.go
🔇 Additional comments (1)
internal/bootstrap/service_bootstrap.go (1)

70-70: Correct fix: LDAP availability now properly signaled to AuthService.

This change correctly passes services.ldapService (which is nil when LDAP initialization fails) instead of the local ldapService variable (which is always non-nil). This ensures that AuthService accurately determines whether LDAP is available, preventing the username provider from appearing when it shouldn't.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@codecov
Copy link
Copy Markdown

codecov Bot commented Jan 7, 2026

Codecov Report

❌ Patch coverage is 0% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 19.25%. Comparing base (1dc83c8) to head (bc3b6cc).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
internal/bootstrap/service_bootstrap.go 0.00% 1 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main     #568   +/-   ##
=======================================
  Coverage   19.25%   19.25%           
=======================================
  Files          39       39           
  Lines        2295     2295           
=======================================
  Hits          442      442           
  Misses       1825     1825           
  Partials       28       28           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@steveiliop56 steveiliop56 merged commit e3c98fa into tinyauthapp:main Jan 8, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants