Skip to content

MapAAuthResource places signature verification in front of its own discovery endpoints #48

Open

Description

@joshuagay

At commit f44587f6317f886a2b7e1cbe081270ed55d6f8d8, the MapAAuthResource() convenience method appears to make its resource metadata and public keys inaccessible to an ordinary discovery client.

The helper maps the well-known endpoints and then adds global verification middleware. The verification middleware returns immediately when signature headers are absent, without exempting discovery endpoints. Its failure response is 401 in this helper's configuration. The SDK's MetadataClient uses an unsigned GET.

Expected behavior: after configuring the advertised unified helper with signing keys, unsigned GETs to /.well-known/aauth-resource.json and /.well-known/jwks.json return their public JSON, while protected resource endpoints still require valid AAuth requests. The JWKS endpoint is only published when signing keys are configured.

With normal WebApplication routing, ASP.NET Core executes mapped endpoints at the end of the middleware pipeline. Mapping them before app.Use does not bypass that middleware. The source and framework behavior therefore imply that both discovery requests pass through the missing-signature rejection before reaching their handlers. This prevents normal SDK discovery from retrieving the resource metadata and keys, and can stop the first authorization exchange. I have not reproduced the HTTP responses under .NET.

The primary samples use a different setup: MapAAuthWellKnown() plus the route-aware UseAAuth(), which passes endpoints without AAuth requirement metadata through. I found no exact invocation of MapAAuthResource() in the test source. This is therefore specific to the convenience composition, not a claim that the main sample flows all fail.

Suggested regression test: create an in-process resource with signing keys using AddAAuthResource() and MapAAuthResource(), retrieve both discovery documents unsigned, and verify that an unsigned protected resource request remains rejected. The implementation could preserve public discovery through route-aware or explicitly scoped middleware, or the API could be retired in favor of the supported composition if that is the intended direction.

Review basis: declared draft-10, source inspection only; no .NET runtime reproduction was possible in my environment.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions