Skip to content

Latest commit

 

History

History
28 lines (22 loc) · 1.06 KB

readme.md

File metadata and controls

28 lines (22 loc) · 1.06 KB

PolicyView

Renders different content to the users who met requirements specified by an authorization Policy definition and to users who don't met it. Policies is mechanism to support advanced authorizations. An authorization policy consists of one or more requirements.

Policy registration can look like this:

options.AddPolicy("AtLeast21", 
    policy => policy.Requirements.Add(new MinimumAgeRequirement(21)));

For more information about policies look at official docs.

Sample 1: Basic Usage

Property Policies consists of a comma-separated list of authorization policy names. The user must meet at least one of these authorization policy to render RequirementsMetTemplate otherwise RequirementsNotMetTemplate is rendered.

 <dc:PolicyView Policies="Policy1,Policy2">
    <RequirementsMetTemplate>
        Requirements met
    </RequirementsMetTemplate>
    <RequirementsNotMetTemplate>
        Requirements not met
    </RequirementsNotMetTemplate>
</dc:PolicyView>