Last active
March 3, 2020 18:21
-
-
Save kkadir/e79d7ea8e79f34dabd0f649261f5edd8 to your computer and use it in GitHub Desktop.
The requirements for our custom policy providers
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using Microsoft.AspNetCore.Authorization; | |
namespace CustomPolicyProvidersDemo.Authorization | |
{ | |
public interface IIdentifiable | |
{ | |
Guid Identifier { get; } | |
} | |
public class PermissionsRequirement : IAuthorizationRequirement, IIdentifiable | |
{ | |
public PermissionsRequirement(string permissions, Guid identifier) | |
{ | |
Permissions = permissions; | |
Identifier = identifier; | |
} | |
public string Permissions { get; } | |
public Guid Identifier { get; set; } | |
} | |
public class RolesRequirement : IAuthorizationRequirement, IIdentifiable | |
{ | |
public RolesRequirement(string roles, Guid identifier) | |
{ | |
Roles = roles; | |
Identifier = identifier; | |
} | |
public string Roles { get; } | |
public Guid Identifier { get; set; } | |
} | |
public class ScopesRequirement : IAuthorizationRequirement, IIdentifiable | |
{ | |
public ScopesRequirement(string scopes, Guid identifier) | |
{ | |
Scopes = scopes; | |
Identifier = identifier; | |
} | |
public string Scopes { get; } | |
public Guid Identifier { get; set; } | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment