Skip to content

update to fully disable auth #10

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open

update to fully disable auth #10

wants to merge 2 commits into from

Conversation

cholmes
Copy link
Member

@cholmes cholmes commented May 23, 2025

Hey, not sure if this is the right approach, it's just what cursor gave to me. But if I just set the config.yaml file to 'auth_disabled: true' then it still was requiring auth. The readme said you can disable authentication by editing the app/core/auth.py, but I wasn't sure what to do to disable there. So perhaps this just could be a readme fix to explain how to disable the authentication there. But this seemed to work, and uses the config yaml file to disable it.

@cholmes cholmes requested a review from Copilot May 23, 2025 22:13
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR updates the authentication mechanism to allow for disabling auth via the config.yaml file. The changes include:

  • Modifying the security scheme initialization to conditionally disable auto error handling based on configuration.
  • Adjusting the verify_auth dependency to manually raise an error when credentials are absent and auth is enabled.

# Create two security schemes:
# 1. When auth is enabled: Required bearer token
# 2. When auth is disabled: Optional bearer token
security = HTTPBearer(auto_error=not get_settings().auth_disabled)
Copy link
Preview

Copilot AI May 23, 2025

Choose a reason for hiding this comment

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

Initializing the HTTPBearer instance at module import using get_settings() may capture stale configuration if the settings are updated at runtime. Consider instantiating HTTPBearer within a dependency function or another runtime context to ensure it uses the latest configuration.

Suggested change
security = HTTPBearer(auto_error=not get_settings().auth_disabled)
def get_security() -> HTTPBearer:
"""
Dynamically create an HTTPBearer instance based on the current configuration.
"""
return HTTPBearer(auto_error=not get_settings().auth_disabled)

Copilot uses AI. Check for mistakes.

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.

1 participant