You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Connected.Framework/Connected.Services/Annotations/ServiceAuthorizationAttribu...

36 lines
795 B

2 years ago
namespace Connected.Services.Annotations
{
public enum AuthorizationPolicyBehavior
{
Mandatory = 1,
Optional = 2
}
public enum AuthorizationStage
{
Init = 1,
Result = 2
}
internal enum EnumOperation
{
HigherThan = 1,
AtLeast = 2,
}
[AttributeUsage(AttributeTargets.Method, AllowMultiple = true, Inherited = true)]
public sealed class ServiceAuthorizationAttribute : Attribute
{
public ServiceAuthorizationAttribute(params string[] claims)
{
if (claims.Any())
Claims = new List<string>(claims);
}
public AuthorizationPolicyBehavior Behavior { get; set; } = AuthorizationPolicyBehavior.Mandatory;
public int Priority { get; set; }
public AuthorizationStage Stage { get; set; } = AuthorizationStage.Init;
public List<string> Claims { get; }
}
}