feat(auth): install all authentication providers by default
Some checks are pending
lint / docker (push) Waiting to run

All authentication methods (Basic Auth, Flask-Login, OAuth) are now
installed as core dependencies instead of optional extras. This
simplifies setup and eliminates the need to run `uv sync --extra auth-*`
when switching between authentication methods.

Changes:
- Move authlib, bcrypt, and flask-login to core dependencies
- Remove auth-* optional dependency groups from pyproject.toml
- Update documentation to remove installation instructions
- Simplify troubleshooting and migration guides

Benefits:
- No import errors when switching auth methods
- Simpler user experience
- All providers available out of the box

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
k3nny 2025-10-05 21:17:30 +02:00
parent 12f35934a9
commit 38a0d788d4
4 changed files with 18 additions and 89 deletions

View File

@ -23,23 +23,7 @@ password = $2b$12$LQv3c1yqBWVHxkd0LHAkCOYz6TtxMQJqhN8/LewY5GyYWv.5qVQK6
use_bcrypt = True
```
### 2. Install Dependencies
```bash
# For Basic Auth
uv sync --extra auth-basic
# For Flask-Login
uv sync --extra auth-login
# For OAuth
uv sync --extra auth-oauth
# For all auth methods
uv sync --extra auth-all
```
### 3. Restart TISBackup
### 2. Restart TISBackup
```bash
docker compose restart tisbackup_gui
@ -332,12 +316,7 @@ docker logs tisbackup_gui | grep -i "auth"
### Basic Auth Not Working
1. **Check bcrypt installation:**
```bash
uv sync --extra auth-basic
```
2. **Verify password hash:**
1. **Verify password hash:**
```bash
python3 -c "import bcrypt; print(bcrypt.checkpw(b'yourpassword', b'$2b$12$your-hash'))"
```
@ -354,12 +333,7 @@ docker logs tisbackup_gui | grep -i "auth"
chmod 600 /etc/tis/users.txt
```
2. **Module not found:**
```bash
uv sync --extra auth-login
```
3. **Session problems:**
2. **Session problems:**
- Check `TISBACKUP_SECRET_KEY` is set
- Ensure cookies are enabled
@ -373,12 +347,7 @@ docker logs tisbackup_gui | grep -i "auth"
- Verify email matches `authorized_users` or domain matches `authorized_domains`
- Check OAuth provider returns email in user info
3. **Module not found:**
```bash
uv sync --extra auth-oauth
```
4. **Token errors:**
3. **Token errors:**
- Verify client ID and secret are correct
- Check OAuth app is enabled
- Ensure scopes are correct
@ -415,17 +384,15 @@ Or implement API key authentication separately for API endpoints.
### From No Auth to Basic Auth
1. Add authentication section to config
2. Install bcrypt: `uv sync --extra auth-basic`
3. Restart service
4. Update client scripts with credentials
2. Restart service
3. Update client scripts with credentials
### From Basic Auth to OAuth
1. Register OAuth application
2. Update configuration
3. Install dependencies: `uv sync --extra auth-oauth`
4. Test OAuth login flow
5. Update redirect URI if needed
3. Test OAuth login flow
4. Update redirect URI if needed
### From Flask-Login to OAuth

View File

@ -61,11 +61,6 @@ auth = get_auth_provider("basic", {
})
```
**Required dependencies:**
```bash
uv sync --extra auth-basic
```
**Features:**
- HTTP Basic Authentication
- bcrypt password hashing
@ -81,11 +76,6 @@ auth = get_auth_provider("flask-login", {
})
```
**Required dependencies:**
```bash
uv sync --extra auth-login
```
**Features:**
- Session-based authentication
- Multiple users support
@ -111,11 +101,6 @@ auth = get_auth_provider("oauth", {
})
```
**Required dependencies:**
```bash
uv sync --extra auth-oauth
```
**Features:**
- OAuth2 authentication
- Google, GitHub, GitLab support

View File

@ -4,7 +4,10 @@ version = "1.8.0"
description = "Backup server side executed python scripts for managing linux and windows system and application data backups, developed by adminsys for adminsys"
readme = "README.md"
dependencies = [
"authlib>=1.3.0",
"bcrypt>=4.0.0",
"flask==3.1.0",
"flask-login>=0.6.0",
"huey==2.5.3",
"iniparse==0.5",
"paramiko==3.5.1",
@ -19,12 +22,6 @@ dependencies = [
requires-python = ">=3.13"
[project.optional-dependencies]
# Authentication providers
auth-basic = ["bcrypt>=4.0.0"]
auth-login = ["flask-login>=0.6.0", "bcrypt>=4.0.0"]
auth-oauth = ["authlib>=1.3.0", "requests>=2.32.0"]
# Install all auth providers
auth-all = ["bcrypt>=4.0.0", "flask-login>=0.6.0", "authlib>=1.3.0", "requests>=2.32.0"]
# Documentation dependencies
docs = [
"docutils",

34
uv.lock generated
View File

@ -649,7 +649,10 @@ name = "tisbackup"
version = "1.8.0"
source = { virtual = "." }
dependencies = [
{ name = "authlib" },
{ name = "bcrypt" },
{ name = "flask" },
{ name = "flask-login" },
{ name = "huey" },
{ name = "iniparse" },
{ name = "paramiko" },
@ -663,23 +666,6 @@ dependencies = [
]
[package.optional-dependencies]
auth-all = [
{ name = "authlib" },
{ name = "bcrypt" },
{ name = "flask-login" },
{ name = "requests" },
]
auth-basic = [
{ name = "bcrypt" },
]
auth-login = [
{ name = "bcrypt" },
{ name = "flask-login" },
]
auth-oauth = [
{ name = "authlib" },
{ name = "requests" },
]
docs = [
{ name = "docutils" },
{ name = "sphinx" },
@ -691,15 +677,11 @@ docs = [
[package.metadata]
requires-dist = [
{ name = "authlib", marker = "extra == 'auth-all'", specifier = ">=1.3.0" },
{ name = "authlib", marker = "extra == 'auth-oauth'", specifier = ">=1.3.0" },
{ name = "bcrypt", marker = "extra == 'auth-all'", specifier = ">=4.0.0" },
{ name = "bcrypt", marker = "extra == 'auth-basic'", specifier = ">=4.0.0" },
{ name = "bcrypt", marker = "extra == 'auth-login'", specifier = ">=4.0.0" },
{ name = "authlib", specifier = ">=1.3.0" },
{ name = "bcrypt", specifier = ">=4.0.0" },
{ name = "docutils", marker = "extra == 'docs'" },
{ name = "flask", specifier = "==3.1.0" },
{ name = "flask-login", marker = "extra == 'auth-all'", specifier = ">=0.6.0" },
{ name = "flask-login", marker = "extra == 'auth-login'", specifier = ">=0.6.0" },
{ name = "flask-login", specifier = ">=0.6.0" },
{ name = "huey", specifier = "==2.5.3" },
{ name = "iniparse", specifier = "==0.5" },
{ name = "paramiko", specifier = "==3.5.1" },
@ -707,8 +689,6 @@ requires-dist = [
{ name = "pexpect", specifier = "==4.9.0" },
{ name = "redis", specifier = "==5.2.1" },
{ name = "requests", specifier = "==2.32.3" },
{ name = "requests", marker = "extra == 'auth-all'", specifier = ">=2.32.0" },
{ name = "requests", marker = "extra == 'auth-oauth'", specifier = ">=2.32.0" },
{ name = "ruff", specifier = ">=0.13.3" },
{ name = "simplejson", specifier = "==3.20.1" },
{ name = "six", specifier = "==1.17.0" },
@ -718,7 +698,7 @@ requires-dist = [
{ name = "sphinx-tabs", marker = "extra == 'docs'" },
{ name = "sphinxjp-themes-revealjs", marker = "extra == 'docs'" },
]
provides-extras = ["auth-basic", "auth-login", "auth-oauth", "auth-all", "docs"]
provides-extras = ["docs"]
[[package]]
name = "urllib3"