Conversation
…ints() Co-authored-by: intel352 <77607+intel352@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
Adds configurable OAuth2 endpoint path suffixes to the auth.m2m module so deployments can expose token/revoke/introspect/JWKS under non-default paths (while still supporting mounting behind a router prefix via suffix matching).
Changes:
- Add
M2MEndpointPaths+SetEndpoints()and routeHandle()via configurable suffixes. - Wire new
endpointsconfig into the auth plugin factory + schema, and add unit tests covering overrides. - Apply
gofmt-style formatting cleanups in a few module test/files.
Reviewed changes
Copilot reviewed 4 out of 7 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
module/auth_m2m.go |
Introduces endpoint path configuration and uses it for request routing. |
plugins/auth/plugin.go |
Adds endpoints config plumbing and exposes it in the module schema. |
plugins/auth/plugin_test.go |
Tests auth.m2m factory behavior with custom endpoint paths. |
module/auth_m2m_test.go |
Adds unit tests verifying defaults and override behavior for endpoint paths. |
module/scan_provider_test.go |
Formatting-only adjustments. |
module/platform_do_database.go |
Formatting-only adjustments to struct field comments. |
module/platform_do_database_test.go |
Formatting-only alignment changes in test config map. |
| // SetEndpoints overrides the URL path suffixes used by Handle() to route incoming | ||
| // requests to the token, revocation, introspection, and JWKS sub-handlers. | ||
| // Any empty field in paths is left at its current value (defaulting to the standard | ||
| // paths set by NewM2MAuthModule). | ||
| // |
There was a problem hiding this comment.
SetEndpoints accepts arbitrary strings which are later used with strings.HasSuffix for routing, but there’s no validation to catch common misconfigurations (e.g., missing leading '/', duplicate paths between Token/Revoke/Introspect/JWKS, or values that are too generic like "/token" causing unintended matches). Consider validating the resulting endpoint paths (non-empty, distinct, and maybe must start with '/') and surfacing a clear init error when invalid so the module doesn’t start with unreachable/ambiguous endpoints.
|
@copilot apply changes based on the comments in this thread Ensure all linters, tests, config validation are passing. |
⏱ Benchmark Results✅ No significant performance regressions detected. benchstat comparison (baseline → PR)
|
…ription Co-authored-by: intel352 <77607+intel352@users.noreply.github.com>
Done in b197df5. Three changes applied:
|
auth.m2mhardcodesstrings.HasSuffixchecks against/oauth/token,/oauth/revoke,/oauth/introspect, and/oauth/jwks, breaking compatibility with Fosite/Auth0/Okta-style servers that expose revocation and introspection as sub-paths of the token endpoint.Changes
module/auth_m2m.go: AddedM2MEndpointPathsstruct andDefaultM2MEndpointPaths(). AddedendpointPathsfield toM2MAuthModule, initialized to defaults inNewM2MAuthModule. AddedSetEndpoints(M2MEndpointPaths)— merges only non-empty fields, so partial overrides preserve remaining defaults. UpdatedHandle()to route against configured paths.plugins/auth/plugin.go:auth.m2mfactory reads anendpointsmap from YAML config and callsSetEndpoints.ModuleSchemas()documents the new field.Usage
Programmatic override:
Original prompt
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.