CQ-Dispatcher:如何使用allowAuthorized

CQ-Dispatcher: How to use allowAuthorized

我知道我可以为授权用户通过

调用的页面激活缓存
/allowAuthorized "1"

/cache 部分。

但是如果一个页面被缓存,它将被传递给所有调用它的人,甚至是匿名用户。我能以某种方式检查是否允许用户查看内容吗?

看看(1).

您可以配置定义

的部分/auth_checker
  • url:url 到脚本/servlet,如果请求有效页面,将使用 HEAD 请求调用该脚本/servlet。一个页面是有效的,如果它在 /type "allow"
  • 的过滤器部分
  • filter:定义哪些路径应该被检查,哪些不被检查。
  • headers: 在 servlet 中配置额外的 headers 并且应该转到前端

以下是来自 Adob​​e 在线文档的示例配置:

/auth_checker
  {
  # request is sent to this URL with '?uri=<page>' appended
  /url "/bin/permissioncheck"

  # only the requested pages matching the filter section below are checked,
  # all other pages get delivered unchecked
  /filter
    {
    /0000
      {
      /glob "*"
      /type "deny"
      }
    /0001
      {
      /glob "/content/secure/*.html"
      /type "allow"
      }
    }
  # any header line returned from the auth_checker's HEAD request matching
  # the section below will be returned as well
  /headers
    {
    /0000
      {
      /glob "*"
      /type "deny"
      }
    /0001
      {
      /glob "Set-Cookie:*"
      /type "allow"
      }
    }
  }

页面上还有一个示例 servlet,可用于检查用户在 AEM 中的权限。

(1): https://docs.adobe.com/docs/en/dispatcher/permissions-cache.html