Skip to content

Commit 1d58331

Browse files
authored
docs: removed dated README section
1 parent b773939 commit 1d58331

1 file changed

Lines changed: 0 additions & 41 deletions

File tree

README.md

Lines changed: 0 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -469,47 +469,6 @@ Generally:
469469

470470
It's important to note that custom policies can not be automatically resolved with `AutomaticallyCheckPermissions`. That doesn't mean that you have to remove `AutomaticallyCheckPermissions` if you use any custom policies, but you'll need to be deliberate with how you set up your controllers. Sepcifically, you can still add the `Authorize` attribute, but you won't pass it a policy like you normally would. Instead, you'll build the custom requirement and involk your custom handler, which could (and likely should) leverage HeimGuard with DI.
471471

472-
```c#
473-
using HeimGuard;
474-
using Microsoft.AspNetCore.Authorization;
475-
using Microsoft.AspNetCore.Mvc;
476-
477-
[ApiController]
478-
[Route("recipes")]
479-
public class RecipesController : ControllerBase
480-
{
481-
private readonly IAuthorizationService _authService;
482-
483-
public RecipesController(IAuthorizationService authService)
484-
{
485-
_authService = authService;
486-
}
487-
488-
[HttpGet]
489-
[Authorize(Policy = "RecipesFullAccess")]
490-
public IActionResult Get()
491-
{
492-
return Ok();
493-
}
494-
495-
[HttpGet]
496-
[Authorize]
497-
public IActionResult Get()
498-
{
499-
var requirement = new CustomRequirement();
500-
501-
// this call with involk the custom handler that uses HeimGuard
502-
var result = _authService.AuthorizeAsync(User, null, requirement);
503-
504-
return result.Succedded
505-
? Ok()
506-
: Forbidden();
507-
}
508-
}
509-
```
510-
511-
512-
513472
## Tenants
514473

515474
When working in a multitenant app, you might end up having different roles across different tenants. For example, say I am an `Admin` in Organization 1, but a `User` in Organization 2. The `Admin` role will likely add a lot of permissions that the user role wouldnt have, but how do we check what organization the user is in for that particular request?

0 commit comments

Comments
 (0)