Table of Contents

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

Constructors

ProtectedResourceAttribute(string, string?)

Initializes a new instance of the ProtectedResourceAttribute class with the specified policy.

public ProtectedResourceAttribute(string resource, string? scope = null)

Parameters

resource string
scope string

ProtectedResourceAttribute(string, string[])

Initializes a new instance of the ProtectedResourceAttribute class with the specified policy.

public ProtectedResourceAttribute(string resource, string[] scopes)

Parameters

resource string
scopes string[]

Properties

Resource

Gets or sets resource name

public string Resource { get; }

Property Value

string

Scopes

Get or sets scopes

public string[]? Scopes { get; }

Property Value

string[]