为什么吊索:OsgiConfig节点无法在AEM的/ etc /文件夹中工作?

Dil*_*epa 7 java osgi jcr sling aem

我有一个具有如下属性的组件.

@Component(immediate = true, metatype = true, label = "Conf Details")
@Service(value = { LocationConfigurationUtil.class })
@Properties({
        @Property(label = "location blueprint", name = "locationPath", value = "", description = "..."),
        @Property(label = "location page template", name = "locationTemplate", value = "", description = "..."),
        @Property(label = "basepath live copies", name = "liveCopyRoot", value = "/content/WebRoot", description = "...") })
public class LocationConfigurationUtil {
@Activate
    protected void activate(Map<String, Object> mapCreated) {
          // some code
    }
}
Run Code Online (Sandbox Code Playgroud)

为了使它成为jcr节点中的可编辑属性,我使用了非标准方法.我sling:OsgiConfig在路径/apps/system/config中创建了具有在java代码中声明的属性,它工作正常.

屏幕截图

但如果我sling:OsgiConfig内心相同/etc/myapp/myconfig,它就行不通.

awd*_*awd 10

使用默认设置时,JCR安装程序提供程序不会sling:OsgiConfig在除/libs和之外的文件夹中查找可安装的程序包和节点()/apps.所以任何配置/etc都不会被加载.

如果要更改此行为,请在osgi配置控制台的"Apache Sling JCR Installer"配置中创建搜索路径条目.但请注意,不建议您,不应该首先放置任何sling:osgiconfig节点/etc.


Rob*_*anu 5

请注意,放置配置节点/etc是一个非常糟糕的主意.

从安全的角度来看,/libs并且/apps被锁定,但是/etc/你打开自己至少有两个主要的安全漏洞:

  • 匿名用户可以读取OSGi配置
  • 代码可以由非特权用户部署

请重新考虑添加/etcJCR安装程序搜索路径条目的路径,然后将配置部署到/apps.