Class ProtectedResourceAttribute
- Namespace
- Keycloak.AuthServices.Authorization
- Assembly
- Keycloak.AuthServices.Authorization.dll
Specifies that the class or method that this attribute is applied to requires the specified authorization.
[AttributeUsage(AttributeTargets.Class|AttributeTargets.Method, AllowMultiple = true, Inherited = true)]
public sealed class ProtectedResourceAttribute : Attribute, IProtectedResourceData
- Inheritance
-
ProtectedResourceAttribute
- Implements
- Inherited Members
Remarks
Initializes a new instance of the ProtectedResourceAttribute class with the specified policy.
Constructors
ProtectedResourceAttribute(string, string?)
Initializes a new instance of the ProtectedResourceAttribute class with the specified policy.
public ProtectedResourceAttribute(string resource, string? scope = null)
Parameters
ProtectedResourceAttribute(string, string[])
Specifies that the class or method that this attribute is applied to requires the specified authorization.
public ProtectedResourceAttribute(string resource, string[] scopes)
Parameters
Remarks
Initializes a new instance of the ProtectedResourceAttribute class with the specified policy.
Properties
Audience
Gets the Keycloak client ID of the resource server to use as the UMA audience parameter.
When null, the global KeycloakAuthorizationServerOptions.Resource value is used.
public string? Audience { get; set; }
Property Value
ResolverType
Gets or sets the type of IParameterResolver used to resolve resource template parameters.
When null, the default RouteParameterResolver is used.
public Type? ResolverType { get; set; }
Property Value
Resource
Gets or sets resource name
public string Resource { get; }
Property Value
Scopes
Get or sets scopes
public string[]? Scopes { get; }
Property Value
- string[]