Added authentication
This commit is contained in:
@@ -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
|
||||
{
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user