mirror of
https://github.com/BinaryAlley/Nemera.git
synced 2026-12-03 17:11:10 +00:00
Implements authorization caching and check in the web client
This commit is contained in:
1 parent
7bca5b1ba3
commit
8eb1b9f13c
108 files changed
+5931
-73
No files matched your search
@@ -0,0 +1,25 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Lumina.Presentation.Web.Common.Enums.Authorization;
|
||||
using Lumina.Presentation.Web.Common.Filters.TypeFilters;
|
||||
using Lumina.Presentation.Web.Common.Models.Authorization;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Presentation.Web.Common.Attributes;
|
||||
|
||||
/// <summary>
|
||||
/// Attribute that restricts endpoint access to users with specified roles.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Can be applied to controllers or individual actions. Multiple roles create an OR condition.
|
||||
/// </remarks>
|
||||
public class RequireRoleAttribute : ApiAuthorizationAttribute
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="RequireRoleAttribute"/> class.
|
||||
/// </summary>
|
||||
/// <param name="roles">One or more roles that are allowed to access the endpoint.</param>
|
||||
public RequireRoleAttribute(params AuthorizationRole[] roles) : base()
|
||||
{
|
||||
Arguments = [new AuthorizationRequirementModel { Roles = roles }];
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user