| | | 1 | | using Kestrun.Utilities; |
| | | 2 | | |
| | | 3 | | namespace Kestrun.Hosting.Options; |
| | | 4 | | /// <summary> |
| | | 5 | | /// Options for mapping a route, including pattern, HTTP verbs, script code, authorization, and metadata. |
| | | 6 | | /// </summary> |
| | | 7 | | public record MapRouteOptions |
| | | 8 | | { |
| | | 9 | | /// <summary> |
| | | 10 | | /// The route pattern to match for this option. |
| | | 11 | | /// </summary> |
| | 482 | 12 | | public string? Pattern { get; set; } |
| | | 13 | | /// <summary> |
| | | 14 | | /// The HTTP verbs (methods) that this route responds to. |
| | | 15 | | /// </summary> |
| | 334 | 16 | | public List<HttpVerb> HttpVerbs { get; set; } = []; |
| | | 17 | | /// <summary> |
| | | 18 | | /// Authorization Scheme names required for this route. |
| | | 19 | | /// </summary> |
| | 134 | 20 | | public string[] RequireSchemes { get; set; } = []; // Authorization scheme name, if any |
| | | 21 | | /// <summary> |
| | | 22 | | /// Authorization policy names required for this route. |
| | | 23 | | /// </summary> |
| | 119 | 24 | | public string[]? RequirePolicies { get; set; } = []; // Authorization policies, if any |
| | | 25 | | /// <summary> |
| | | 26 | | /// Name of the CORS policy to apply, if any. |
| | | 27 | | /// </summary> |
| | 109 | 28 | | public string CorsPolicyName { get; set; } = string.Empty; // Name of the CORS policy to apply, if any |
| | | 29 | | /// <summary> |
| | | 30 | | /// If true, short-circuits the pipeline after this route. |
| | | 31 | | /// </summary> |
| | 39 | 32 | | public bool ShortCircuit { get; set; } // If true, short-circuit the pipeline after this route |
| | | 33 | | /// <summary> |
| | | 34 | | /// Status code to return if short-circuiting the pipeline after this route. |
| | | 35 | | /// </summary> |
| | 4 | 36 | | public int? ShortCircuitStatusCode { get; set; } = null; // Status code to return if short-circuiting |
| | | 37 | | /// <summary> |
| | | 38 | | /// If true, allows anonymous access to this route. |
| | | 39 | | /// </summary> |
| | 37 | 40 | | public bool AllowAnonymous { get; set; } |
| | | 41 | | /// <summary> |
| | | 42 | | /// If true, disables antiforgery protection for this route. |
| | | 43 | | /// </summary> |
| | 62 | 44 | | public bool DisableAntiforgery { get; set; } |
| | | 45 | | /// <summary> |
| | | 46 | | /// If true, disables response compression for this route. |
| | | 47 | | /// </summary> |
| | 41 | 48 | | public bool DisableResponseCompression { get; set; } |
| | | 49 | | /// <summary> |
| | | 50 | | /// The name of the rate limit policy to apply to this route, if any. |
| | | 51 | | /// </summary> |
| | 38 | 52 | | public string? RateLimitPolicyName { get; set; } |
| | | 53 | | |
| | | 54 | | /// <summary> |
| | | 55 | | /// Endpoints to bind the route to, if any. |
| | | 56 | | /// </summary> |
| | 125 | 57 | | public string[]? Endpoints { get; set; } = []; |
| | | 58 | | |
| | | 59 | | /// <summary> |
| | | 60 | | /// OpenAPI metadata for this route. |
| | | 61 | | /// </summary> |
| | 240 | 62 | | public OpenAPIMetadata OpenAPI { get; set; } = new OpenAPIMetadata(); // OpenAPI metadata for this route |
| | | 63 | | |
| | | 64 | | /// <summary> |
| | | 65 | | /// Script code and language options for this route. |
| | | 66 | | /// </summary> |
| | 291 | 67 | | public LanguageOptions ScriptCode { get; init; } = new LanguageOptions(); |
| | | 68 | | /// <summary> |
| | | 69 | | /// If true, throws an exception on duplicate routes. |
| | | 70 | | /// </summary> |
| | 8 | 71 | | public bool ThrowOnDuplicate { get; set; } |
| | | 72 | | } |