Implements authorization caching and check in the web client

This commit is contained in:
BinaryAlley committed 2024-12-06 18:46:48 +02:00
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 }];
}
}