Files
2026-06-21 20:10:02 +02:00

27 lines
1.2 KiB
C#

namespace EonaCat.DoxaApi.Attributes
{
// This file is part of the EonaCat project(s) which is released under the Apache License.
// See the LICENSE file or go to https://EonaCat.com/license for full license details.
/// <summary>
/// Declares that an endpoint (or every endpoint in a controller) requires one of the
/// named security schemes registered via <c>DoxaApiOptions.AddSecurityScheme(...)</c>.
/// Multiple attributes may be stacked; any one of the referenced schemes satisfies the
/// endpoint (logical OR), matching OpenAPI's security requirement semantics.
/// </summary>
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Method, AllowMultiple = true)]
public sealed class DoxaApiAuthAttribute : Attribute
{
public string SchemeId { get; }
public DoxaApiAuthAttribute(string schemeId) => SchemeId = schemeId;
}
/// <summary>
/// Marks an endpoint (or controller) as explicitly not requiring authentication,
/// overriding any document-wide default security scheme.
/// </summary>
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Method)]
public sealed class DoxaApiAllowAnonymousAttribute : Attribute
{
}
}