Skip to content

Separate auth server and resource server hostname#58

Merged
DavidBuchanan314 merged 6 commits intomainfrom
auth-hostname
Oct 5, 2025
Merged

Separate auth server and resource server hostname#58
DavidBuchanan314 merged 6 commits intomainfrom
auth-hostname

Conversation

@DavidBuchanan314
Copy link
Copy Markdown
Owner

Adds support for configuring a separate hostname for the OAuth authorization server, distinct from the PDS resource server hostname.

  • Add auth_pfx column to config table (db schema v3->v4)
  • Add migration script to populate auth_pfx from pds_pfx for existing DBs
  • Update init command with --auth_host option
  • Update config command with --auth_pfx option
  • Document nginx setup for separate auth hostname

Adds support for configuring a separate hostname for the OAuth
authorization server, distinct from the PDS resource server hostname.

- Add auth_pfx column to config table (db schema v3->v4)
- Add migration script to populate auth_pfx from pds_pfx for existing DBs
- Update init command with --auth_host option
- Update config command with --auth_pfx option
- Document nginx setup for separate auth hostname
@DavidBuchanan314
Copy link
Copy Markdown
Owner Author

Hm, the challenge here is how to do hostname-based routing in aiohttp.

Fix AnnotatedRouteTableDef to correctly set _is_as_route attribute on
handler functions after decoration. The previous implementation was
setting the attribute on the decorator function itself rather than on
the returned handler.

Add comprehensive test suite for split AS/RS configuration that verifies:
- OAuth AS endpoints only accessible via auth hostname
- OAuth RS endpoints only accessible via PDS hostname
- XRPC endpoints only accessible via PDS hostname
- Session management works correctly with split configuration

All 78 tests passing.
@DavidBuchanan314 DavidBuchanan314 marked this pull request as ready for review October 5, 2025 15:50
Copy link
Copy Markdown
Contributor

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 adds support for separating the OAuth authorization server hostname from the PDS resource server hostname, allowing the authorization endpoints to be served on a different domain while maintaining proper endpoint routing.

  • Updated database schema to include separate auth_pfx configuration field
  • Added middleware-based routing to enforce endpoint separation based on hostname
  • Updated CLI to support configuring separate auth hostname during initialization

Reviewed Changes

Copilot reviewed 11 out of 11 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
tests/test_split_as_rs.py Comprehensive test suite for split AS/RS hostname functionality
tests/test_database.py Updated existing tests to include auth_pfx in config
tests/conftest.py Updated test fixture to include auth_pfx configuration
src/millipds/util.py Added hostname extraction utility function
src/millipds/static_config.py Bumped database schema version to 4
src/millipds/service.py Added middleware for hostname-based routing enforcement
src/millipds/database.py Extended database schema and config to support auth_pfx
src/millipds/auth_oauth.py Split OAuth routes and updated metadata endpoints
src/millipds/main.py Added CLI support for separate auth hostname configuration
migration_scripts/v4.py Database migration script for schema v3 to v4
docs/DEPLOY.md Updated nginx configuration documentation for split hostnames

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Comment thread src/millipds/util.py Outdated
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@DavidBuchanan314 DavidBuchanan314 merged commit 1c38f33 into main Oct 5, 2025
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