Refactor the AdminOnly authorization policy to handle cases where a user profile is not found. Instead of throwing a NotFoundException, it now throws a ForbiddenException, ensuring a more appropriate response for unauthorized access attempts. Also introduces PolicyConstants for policy names.
7 lines
No EOL
140 B
C#
7 lines
No EOL
140 B
C#
namespace DrinkRateAPI.AuthorizationPolicies;
|
|
|
|
public static class PolicyConstants
|
|
{
|
|
public const string AdminOnly = "AdminOnly";
|
|
|
|
} |