feat: allow custom auth HTML templates#169
Open
jowgo wants to merge 1 commit into
Open
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
Adds support for overriding embedded auth HTML templates via a configurable template directory, wiring it through CLI/env into the proxy’s auth router construction.
Changes:
- Added
--auth-template-dir/AUTH_TEMPLATE_DIRto pass a custom auth template directory into the server. - Implemented
NewAuthRouterWithTemplateDirwith helpers to load templates from disk with embedded fallbacks (plus optionalstyles.html). - Added unit tests and updated existing tests to cover the new parameter/flag.
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| pkg/mcp-proxy/main.go | Threads authTemplateDir into Run() and uses the new auth constructor. |
| pkg/mcp-proxy/main_test.go | Updates Run test invocations to include the new parameter. |
| pkg/auth/auth.go | Adds template-dir validation and template loading/parsing with disk/embedded fallback. |
| pkg/auth/auth_test.go | Adds tests for custom template directory loading and missing-dir rejection. |
| main.go | Adds CLI flag/env var and passes authTemplateDir into runner. |
| main_test.go | Adds CLI flag test and updates runner signatures in other tests. |
| docs/docs/configuration.md | Documents the new flag/env var and template override behavior. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
4940916 to
8577049
Compare
hvsio
approved these changes
May 27, 2026
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
8577049 to
f73c691
Compare
f73c691 to
75c909d
Compare
Production sidecars need branding changes without carrying a source fork or rebuilding embedded templates for each environment. The proxy now accepts an auth template directory and loads matching page files from it while keeping embedded defaults for missing files. Constraint: Existing embedded templates must remain the default behavior when no override directory is configured Rejected: Add separate flags for each template file | A single directory is easier to mount in containers and supports incremental overrides Confidence: high Scope-risk: narrow Directive: Keep template data contracts stable when editing default auth pages; external templates depend on those fields Tested: go test ./... Tested: go build -o bin/mcp-auth-proxy .
75c909d to
ec9edc1
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds an auth template override directory so deployments can customize the HTML auth pages without rebuilding the binary or forking embedded templates. The new
--auth-template-dir/AUTH_TEMPLATE_DIRsetting loads matchinglogin.html,unauthorized.html,error.html, and optionalstyles.htmlfiles from a mounted directory, while falling back to embedded defaults for missing files.Type of Change
Related Issues