AuthServer
MCP Resource Indicators and Audience
Bind tokens to a protected resource when you need MCP-style OAuth behavior.
For normal owned-app flows, SqlOS can still fall back to the client's configured audience.
For MCP-style flows, the better model is:
resourceaud matches the resolved protected resourceThe authorization server and the protected resource need to agree on what the token is for.
If a caller asks for:
resource=https://todo.example.comthe resulting token should be usable for that resource and rejected by unrelated ones.
SqlOS supports resource indicators end to end:
/authorize accepts and normalizes resource/token checks that the exchange matches the original authorization requestaud claim becomes the resolved resource when presentIf no resource is supplied, SqlOS can preserve the client-audience fallback for non-MCP app flows.
Resource indicators are enabled by default.
You can configure them directly:
builder.AddSqlOS<AppDbContext>(options =>
{
options.AuthServer.ConfigureResourceIndicators(resource =>
{
resource.Enabled = true;
resource.PreserveClientAudienceFallback = true;
resource.EnforceOnTokenExchange = true;
resource.PreserveOriginalBindingOnRefresh = true;
});
});Or turn them on implicitly with portable and compatibility helpers:
builder.AddSqlOS<AppDbContext>(options =>
{
options.AuthServer.EnablePortableMcpClients();
});Your protected resource should still:
/.well-known/oauth-protected-resourceWWW-Authenticate: Bearer resource_metadata="..."The Todo sample demonstrates that end to end.
Use this mental model:
resource and validate aud