Class RequiresRoleAttribute

Assembly: redb.Tsak.Core.dll

Declares the role(s) required to invoke a controller action. Applied to a method it
governs that action; applied to a controller it governs every action the controller
declares (a method-level attribute wins over the controller-level one).

Multiple roles are OR-ed: [RequiresRole(TsakRoles.Operator, "release-bot")] admits
a key holding either. Enforcement happens in ,
which runs only for authenticated requests — auth-exempt technical endpoints
(Kubernetes probes) are never gated.


Actions with no attribute fall back to a method-based default: GET and HEAD
require , everything else requires
. A new endpoint is therefore never open by accident.

[AttributeUsage(AttributeTargets.Class|AttributeTargets.Method, AllowMultiple = false, Inherited = true)]
public sealed class RequiresRoleAttribute : Attribute

Inheritance

Object→Attribute→RequiresRoleAttribute

Properties

Roles

Roles that satisfy this requirement (OR semantics).

public string[] Roles { get; }

Constructors