Skip to content

Commit

Permalink
Simplify EditAuthorizationHandler
Browse files Browse the repository at this point in the history
  • Loading branch information
romandykyi committed Dec 19, 2023
1 parent 0b34456 commit 2235d31
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions PollsAppBlazor/Server/Policy/EditAuthorizationHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public abstract class EditAuthorizationHandler<TRequirement> : AuthorizationHand
/// </returns>
protected bool BasicCheck(AuthorizationHandlerContext context, TRequirement requirement)
{
if (context.User.Identity == null || !context.User.IsAuthenticated())
if (!context.User.IsAuthenticated())
{
context.Fail();
return true;
Expand Down Expand Up @@ -48,7 +48,7 @@ protected int GetIntIdFromRoute(AuthorizationHandlerContext context, string idNa
{
throw new InvalidOperationException("Cannot get HTTP context");
}
var idValue = httpContext.GetRouteData().Values[idName] ??
var idValue = httpContext.GetRouteValue(idName) ??
throw new InvalidOperationException("Cannot get poll id from HTTP context");

return Convert.ToInt32(idValue);
Expand Down

0 comments on commit 2235d31

Please sign in to comment.