casbin-net / casbin-aspnetcore

Casbin.NET integration middleware and sample code for ASP.NET Core
https://github.com/casbin/Casbin.NET
Apache License 2.0
69 stars 21 forks source link

Typo in sample policy file? Get should be GET? #25

Closed LeiYangGH closed 2 years ago

LeiYangGH commented 3 years ago

I cloned and ran the sample. after some experiments, I found that if in basic_policy.csv, GET works but Get not work.

  1. I searched and found this issue Case Insensitive Policy Enforcement, and it means casbin is case sensitive. so i assue this sample has a minor typo.
  2. I searched the entire library code, didn't find anywhere to specify the action of GET or POST, etc. could you please explain a little why in policy.csv the action syntax must be all upper case? Is it related to some http specification? Is it implement dependent(is the behaviour related to operation system/browser versions)?
sagilio commented 3 years ago

Thank you! I will fix the typo later.

https://github.com/casbin-net/casbin-aspnetcore/blob/e5dc07746742f04ed17e2c9ebb07b34baa1e6585/src/Casbin.AspNetCore.Core/Transformers/KeyMatchRequestTransformer.cs#L16

It use c.HttpContext.Request.Method directly now, so the format like GET, POST.

pspeybro commented 2 years ago

there is another typo in a folder name: https://github.com/casbin-net/casbin-aspnetcore/tree/master/src/Casbin.AspNetCore.**Astractions**

I suppose this needs to be Abstractions

hsluoyz commented 2 years ago

@sagilio any update on this issue?

pspeybro commented 2 years ago

I guess this is (at least partially) closed by https://github.com/casbin-net/casbin-aspnetcore/pull/39

hsluoyz commented 2 years ago

Fixed in: https://github.com/casbin-net/casbin-aspnetcore/pull/39