Table of Contents

Class ApiKeyConstants

Namespace
Tharga.Team.Service
Assembly
Tharga.Team.Service.dll

Well-known constants for API key authentication.

public static class ApiKeyConstants
Inheritance
ApiKeyConstants
Inherited Members

Fields

AccessLevelClaim

Claim type for the access level.

[Obsolete("Use TeamClaimTypes.AccessLevel instead.")]
public const string AccessLevelClaim = "AccessLevel"

Field Value

string

AnyKeyPolicyName

Authorization policy name accepting any valid API key, team or system.

public const string AnyKeyPolicyName = "AnyApiKeyPolicy"

Field Value

string

Remarks

PolicyName and SystemPolicyName are disjoint, not a hierarchy. The first refuses a system key; the second refuses a team key. ASP.NET Core combines policies when several are required, so RequireAuthorization(PolicyName, SystemPolicyName) admits nothing — a trap the naming invites, since "system" reads like "team plus more".

Use this where an endpoint should be reachable by either kind, which was previously only possible by hand-writing a policy. It asserts nothing about IsSystemKey in either direction, which is also what Tharga.Mcp's RequireAuth policy does — so an MCP endpoint already behaves this way and needs no policy named here.

HeaderName

HTTP header name for the API key.

public const string HeaderName = "X-API-KEY"

Field Value

string

OpenApiSchemeId

OpenAPI security scheme identifier.

public const string OpenApiSchemeId = "ApiKey"

Field Value

string

PolicyName

Authorization policy name for team API keys. Use with [Authorize(Policy = ApiKeyConstants.PolicyName)].

public const string PolicyName = "ApiKeyPolicy"

Field Value

string

Remarks

Rejects system keys. This and SystemPolicyName are disjoint, not a hierarchy — see AnyKeyPolicyName.

SchemeName

Authentication scheme name.

public const string SchemeName = "ApiKeyScheme"

Field Value

string

SystemPolicyName

Authorization policy name for system API keys (keys not bound to a team).

public const string SystemPolicyName = "SystemApiKeyPolicy"

Field Value

string

Remarks

Rejects team keys. See AnyKeyPolicyName.

TeamKeyClaim

Claim type for the team key.

[Obsolete("Use TeamClaimTypes.TeamKey instead.")]
public const string TeamKeyClaim = "TeamKey"

Field Value

string

ThargaApiPolicyName

Authorization policy for the toolkit's own HTTP endpoints. Requires an authenticated caller against ThargaControllerOptions.AuthenticationSchemes — the API-key scheme by default.

public const string ThargaApiPolicyName = "ThargaApiPolicy"

Field Value

string