Added authentication

This commit is contained in:
2026-06-21 20:10:02 +02:00
parent efe63211ed
commit a50be1ec0b
50 changed files with 2596 additions and 328 deletions
@@ -0,0 +1,27 @@
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
{
}
}
@@ -1,5 +1,8 @@
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.
[AttributeUsage(AttributeTargets.Method)]
public sealed class DoxaApiDescriptionAttribute : Attribute
{
@@ -1,5 +1,8 @@
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.
[AttributeUsage(AttributeTargets.Method)]
public sealed class DoxaApiExampleAttribute : Attribute
{
@@ -1,5 +1,8 @@
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.
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Method)]
public sealed class DoxaApiGroupAttribute : Attribute
{
@@ -1,5 +1,8 @@
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.
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Method)]
public sealed class DoxaApiHiddenAttribute : Attribute
{
@@ -1,5 +1,8 @@
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.
[AttributeUsage(AttributeTargets.Method)]
public sealed class DoxaApiSummaryAttribute : Attribute
{