c# - How can I access the current request from my own authorization class? -
I need to access the request
object from my own authorization class. There is no alternative and why is it here.
Objects Can be made public (read / write too)
Due to this system I have to write my authorization argument and this is not a problem, I was thinking something like this:
pseudo code
public class object controller: API controller {private readonly authorization service _auth = new The Authority Services (); [Root] Public Eschnic Tasks & lt; IHttpActionResult & gt; Get () {var obj = new object (); // This is the object that we are working with // Note: This is just for the demo, the real object will be like `item` if (obj.IsPublic || _auth.CurrentUser.CanRead (obj)) OK Obj); } Return unauthorized (); }}
How do I test the current user
- Check whether the header
token
- check URL is the ultimate
? Token =
- Get user from token
- user or return zero
problem
now because I need to check the weather. This user has read this item
(obj) AFAIK. I can not use the controller feature because I need to first get the actual object from the database. What are my options? Can I use an existing request
object to extract the values required in my authority service
class?
You can access
Comments
Post a Comment