Class ThargaControllerOptions
Options for configuring Tharga controller registration.
public class ThargaControllerOptions
- Inheritance
-
ThargaControllerOptions
- Inherited Members
Properties
AuthenticationSchemes
Authentication schemes the toolkit's HTTP endpoints accept. Defaults to the API-key scheme.
public IList<string> AuthenticationSchemes { get; }
Property Value
Remarks
Named explicitly rather than left to the application's default scheme. A bare [Authorize]
authenticates against the default, which in a host with interactive sign-in is OIDC — so an
API-key caller would be answered with a redirect to a login page instead of data. That is exactly
the defect fixed upstream in Tharga/Mcp#18
for the MCP endpoint, and it would reappear here unmodified.
Add your own — a cookie scheme, say — to let a signed-in user reach these endpoints too.
SwaggerRoutePrefix
Swagger UI route prefix. Defaults to "swagger".
public string SwaggerRoutePrefix { get; set; }
Property Value
SwaggerTitle
Title shown in Swagger UI. Defaults to "API v1".
public string SwaggerTitle { get; set; }
Property Value
Methods
ConfigureOpenApi(Action<OpenApiOptions>)
Registers additional OpenAPI configuration — such as an
IOpenApiDocumentTransformer or IOpenApiOperationTransformer — that
is applied to the same OpenAPI document Tharga manages via AddThargaControllers.
public ThargaControllerOptions ConfigureOpenApi(Action<OpenApiOptions> configure)
Parameters
configureAction<OpenApiOptions>A callback that receives the OpenApiOptions Tharga passes to
AddOpenApi. Use it to add document/operation transformers (e.g.api => api.AddDocumentTransformer<ScopeFilteringDocumentTransformer>()).
Returns
- ThargaControllerOptions
The same ThargaControllerOptions instance so calls can be chained.
Remarks
Multiple calls compose — every registered callback runs, in registration order, against
Tharga's document. Prefer this over calling AddOpenApi("v1", …) directly: it keeps
the consumer's transformers on the document Tharga already manages and avoids the .NET 10
OpenAPI XML-comment source generator emitting an interceptor into the consumer project.
Available on .NET 10 and later only; on .NET 9 the Swashbuckle-based document is used and this
hook is not present.