From 5b1257452bdd3b7b28004f75bacf3fc57b674b30 Mon Sep 17 00:00:00 2001 From: Michael DePouw Date: Mon, 30 Oct 2017 14:11:00 -0400 Subject: [PATCH] add heading for handler registration (#4663) * add heading for handler registration this will allow for an anchor link (I think, I know ## does, hoping ### does too). this will help to fix "Illegal link: `[Authorization handlers must be registered](policies.md#security-authorization-policies-based-handler-registration)` -- missing bookmark." on aspnetcore/security/authorization/dependencyinjection.md reference: https://opbuildstorageprod.blob.core.windows.net/report/2017%5C10%5C13%5C6a0d29ae-bb37-09f1-c55a-4cfa862c6784%5CPullRequest%5C201710131248087361-4562%5Cworkflow_report.html?sv=2015-02-21&sr=b&sig=GbG0qgcJNtJMXYbbzHZqcp2BJNdAKtUYmbwoSscw5IY%3D&st=2017-10-13T12%3A50%3A41Z&se=2017-11-13T12%3A55%3A41Z&sp=r * change title to sentence case * change ## titles to sentence case --- aspnetcore/security/authorization/policies.md | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/aspnetcore/security/authorization/policies.md b/aspnetcore/security/authorization/policies.md index 01369cd1b3..551514f39b 100644 --- a/aspnetcore/security/authorization/policies.md +++ b/aspnetcore/security/authorization/policies.md @@ -1,5 +1,5 @@ --- -title: Custom Policy-Based Authorization +title: Custom policy-based authorization author: rick-anderson description: keywords: ASP.NET Core, @@ -12,7 +12,7 @@ ms.technology: aspnet ms.prod: asp.net-core uid: security/authorization/policies --- -# Custom Policy-Based Authorization +# Custom policy-based authorization @@ -71,7 +71,7 @@ A requirement doesn't need to have data or properties. -## Authorization Handlers +## Authorization handlers An authorization handler is responsible for the evaluation of any properties of a requirement. The authorization handler must evaluate them against a provided `AuthorizationHandlerContext` to decide if authorization is allowed. A requirement can have [multiple handlers](policies.md#security-authorization-policies-based-multiple-handlers). Handlers must inherit `AuthorizationHandler` where T is the requirement it handles. @@ -113,6 +113,7 @@ In the code above we first look to see if the current user principal has a date +### Handler registration Handlers must be registered in the services collection during configuration, for example; ```csharp @@ -206,7 +207,7 @@ services.AddAuthorization(options => } ``` -## Accessing MVC Request Context In Handlers +## Accessing MVC request context in handlers The `Handle` method you must implement in an authorization handler has two parameters, an `AuthorizationContext` and the `Requirement` you are handling. Frameworks such as MVC or Jabbr are free to add any object to the `Resource` property on the `AuthorizationContext` to pass through extra information.