duanbipu1720 2012-09-26 17:26
浏览 18

是否有支持细粒度访问控制方法的PHP太阳能风格的uri-router? [关闭]

There are at least a dozen well written, permissibly-licensed router packages out there (alloy, aura, solar, symphony, etc), but I have yet to come across one that includes some form of fine-grained (ie, resource or finer) access control.

Important features:

  • Solar style routes
  • Loose couplining to authentication mechanisms (this should only handle authorization)
  • Groups as well as users
  • Scoping capability (ie, you can access resources you have some kind of relationship with, but not ones of the same type that you don't)

I would be more than willing to contribute to a project that wanted to do this, but would rather not reinvent the wheel if someone is already working on this.

Specifically, given a route and some form of authentication, I want have the access controller decide to:

  1. Give the user that resource
  2. Give that user a redacted version of that resource
  3. Suggest authenticating/re-authenticating with different credentials
  4. In the absence of authentication, not confirm or deny the existence of the resource

As a bonus, having a way to request the full resource from the redacted one would be great; eg, you pull up a person resource, and their SSN/DOB are redacted. When you hit a "show" button, it logs it and then gives you the resource with those in it.

Edit: This does not actually have to be the router itself, but it seems like it would make sense to use the same kind of addressing to control access. It's possible that this could be implemented as a standalone tool that is executed post-routing, pre-dispatch.

  • 写回答

1条回答 默认 最新

  • dongyao1915 2012-09-27 12:34
    关注

    Routing, authentication and authorization are three separate parts of application. Each of those steps would be part of the bootstrap state for application.

    1. try to acquire user's identity from authentication token in session or cookies
    2. route the incoming request
    3. check if user is authorized to execute command, that was provided by router

    I usually do the authorization checks by wrapping the target's instance in decorator, which provides me with access control over any structure, that require it. The implementation is usually similar to one described in this example.

    When access is denied or if method is not found, you just throw the appropriate exception.

    This also provides the added benefit of working well with dependency injection. When you inject such decorated object, any method, that gets performed on it, will go through access control.

    评论

报告相同问题?

悬赏问题

  • ¥15 如何在scanpy上做差异基因和通路富集?
  • ¥20 关于#硬件工程#的问题,请各位专家解答!
  • ¥15 关于#matlab#的问题:期望的系统闭环传递函数为G(s)=wn^2/s^2+2¢wn+wn^2阻尼系数¢=0.707,使系统具有较小的超调量
  • ¥15 FLUENT如何实现在堆积颗粒的上表面加载高斯热源
  • ¥30 截图中的mathematics程序转换成matlab
  • ¥15 动力学代码报错,维度不匹配
  • ¥15 Power query添加列问题
  • ¥50 Kubernetes&Fission&Eleasticsearch
  • ¥15 報錯:Person is not mapped,如何解決?
  • ¥15 c++头文件不能识别CDialog