Skip to content

Instantly share code, notes, and snippets.

@kkadir
Created March 3, 2020 18:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kkadir/90f90e21c607188b9670a82d7cbb25d0 to your computer and use it in GitHub Desktop.
Save kkadir/90f90e21c607188b9670a82d7cbb25d0 to your computer and use it in GitHub Desktop.
Commont methods.
using Microsoft.AspNetCore.Authorization;
using System;
using System.Linq;
namespace CustomPolicyProvidersDemo.Authorization
{
public static class Utility
{
public static void Succeed(AuthorizationHandlerContext context, Guid identifier)
{
var groupedRequirements = context.Requirements.Where(r => (r as IIdentifiable)?.Identifier == identifier);
foreach (var requirement in groupedRequirements)
{
context.Succeed(requirement);
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment