// Copyright (c) Microsoft. All rights reserved. namespace Microsoft.Agents.AI.DevUI; /// /// Options that control the security posture of the DevUI HTTP surface. /// /// /// DevUI exposes agent metadata that is sensitive in production contexts: /// system instructions, tool definitions, model identifiers, and workflow /// structure. By default, DevUI rejects any request whose remote endpoint /// is not a loopback address. Hosts that intentionally expose DevUI on a /// non-loopback interface must opt in via /// and should also configure or /// to attach an authorization policy. /// public sealed class DevUIOptions { /// /// Environment variable inspected for a default bearer token when /// is not explicitly set. /// public const string AuthTokenEnvironmentVariable = "DEVUI_AUTH_TOKEN"; /// /// Gets or sets a value indicating whether DevUI may be served to /// non-loopback callers. Defaults to . /// /// /// When , any request whose /// is /// not a loopback address (or is missing) is rejected with HTTP 403 before /// reaching the DevUI handlers. Enable only when the host is responsible /// for fronting DevUI with its own authentication, network policy, or both. /// public bool AllowRemoteAccess { get; set; } /// /// Gets or sets a shared bearer token required on every DevUI request. /// When or empty, the value of the /// DEVUI_AUTH_TOKEN environment variable is used instead. /// /// /// When a token is configured, requests must include the header /// Authorization: Bearer <token>. Comparison is performed /// in constant time. This is a convenience for development scenarios. /// Production hosts should prefer a real ASP.NET Core authentication /// scheme attached via . /// public string? AuthToken { get; set; } /// /// Gets or sets a callback invoked with the DevUI endpoint group so the /// host can attach authorization, rate limiting, or other endpoint /// conventions (for example /// group.RequireAuthorization("DevUIPolicy")). /// public Action? ConfigureEndpoints { get; set; } }