You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by dk...@apache.org on 2021/08/11 02:56:49 UTC

[sling-whiteboard] branch master updated (e3d25e0 -> 211617b)

This is an automated email from the ASF dual-hosted git repository.

dklco pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/sling-whiteboard.git.


    from e3d25e0  [OSGi Features] Remove some unused code
     new 19816f5  Updating the UI and documentation
     new 211617b  Using the resource resolver set as a request attribute in the webconsole security provider

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 org.apache.sling.repoinit.webconsole/README.md     |  18 +--
 .../docs/Error.png                                 | Bin 38257 -> 89239 bytes
 .../docs/Evaluate.png                              | Bin 102160 -> 79112 bytes
 org.apache.sling.repoinit.webconsole/pom.xml       |  12 ++
 .../repoinit/webconsole/RepoInitWebConsole.java    |  22 ++-
 .../src/main/resources/res/ui/repoinit.css         |   7 +-
 .../src/main/resources/res/ui/repoinit.js          |   5 +-
 .../src/main/resources/tpl/main.html               |   9 +-
 .../webconsole/RepoInitWebConsoleTest.java         |  49 ++++++-
 .../org.apache.sling.startup.tracker/pom.xml       | 159 +++++++++++++++++++++
 .../sling/startup/tracker/AbstractStartupItem.java |  29 ++++
 .../sling/startup/tracker/BundleEventItem.java     |  47 ++++++
 .../sling/startup/tracker/BundleStartup.java       |  28 ++++
 .../org/apache/sling/startup/tracker/ItemType.java |  10 ++
 .../sling/startup/tracker/StartupListener.java     |  67 +++++++++
 15 files changed, 427 insertions(+), 35 deletions(-)
 create mode 100644 startup-tracker/org.apache.sling.startup.tracker/pom.xml
 create mode 100644 startup-tracker/org.apache.sling.startup.tracker/src/main/java/org/apache/sling/startup/tracker/AbstractStartupItem.java
 create mode 100644 startup-tracker/org.apache.sling.startup.tracker/src/main/java/org/apache/sling/startup/tracker/BundleEventItem.java
 create mode 100644 startup-tracker/org.apache.sling.startup.tracker/src/main/java/org/apache/sling/startup/tracker/BundleStartup.java
 create mode 100644 startup-tracker/org.apache.sling.startup.tracker/src/main/java/org/apache/sling/startup/tracker/ItemType.java
 create mode 100644 startup-tracker/org.apache.sling.startup.tracker/src/main/java/org/apache/sling/startup/tracker/StartupListener.java

[sling-whiteboard] 01/02: Updating the UI and documentation

Posted by dk...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

dklco pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/sling-whiteboard.git

commit 19816f50335126c8a86804f6b0c46b095dbd0830
Author: Dan Klco <kl...@adobe.com>
AuthorDate: Tue Aug 3 09:39:37 2021 -0400

    Updating the UI and documentation
---
 org.apache.sling.repoinit.webconsole/README.md     |   2 +-
 .../docs/Error.png                                 | Bin 38257 -> 89239 bytes
 .../docs/Evaluate.png                              | Bin 102160 -> 79112 bytes
 .../src/main/resources/res/ui/repoinit.css         |   7 +-
 .../src/main/resources/res/ui/repoinit.js          |   5 +-
 .../src/main/resources/tpl/main.html               |   9 +-
 .../org.apache.sling.startup.tracker/pom.xml       | 159 +++++++++++++++++++++
 .../sling/startup/tracker/AbstractStartupItem.java |  29 ++++
 .../sling/startup/tracker/BundleEventItem.java     |  47 ++++++
 .../sling/startup/tracker/BundleStartup.java       |  28 ++++
 .../org/apache/sling/startup/tracker/ItemType.java |  10 ++
 .../sling/startup/tracker/StartupListener.java     |  67 +++++++++
 12 files changed, 356 insertions(+), 7 deletions(-)

diff --git a/org.apache.sling.repoinit.webconsole/README.md b/org.apache.sling.repoinit.webconsole/README.md
index ca23c66..0a4bb1d 100644
--- a/org.apache.sling.repoinit.webconsole/README.md
+++ b/org.apache.sling.repoinit.webconsole/README.md
@@ -34,7 +34,7 @@ Assuming the script is valid a JSON representation will be displayed in the `Par
 
 ![Evaluating a RepoInit Statement](docs/Evaluate.png)
 
-If your script is not valid, an error message will be displayed in the `Parsed Statements` section. 
+If your script is not valid, an error message will be displayed in the `Messages` section. 
 
 ![Example Error Message](docs/Error.png)
 
diff --git a/org.apache.sling.repoinit.webconsole/docs/Error.png b/org.apache.sling.repoinit.webconsole/docs/Error.png
index 1848904..e186594 100644
Binary files a/org.apache.sling.repoinit.webconsole/docs/Error.png and b/org.apache.sling.repoinit.webconsole/docs/Error.png differ
diff --git a/org.apache.sling.repoinit.webconsole/docs/Evaluate.png b/org.apache.sling.repoinit.webconsole/docs/Evaluate.png
index 2993bc6..7a6a434 100644
Binary files a/org.apache.sling.repoinit.webconsole/docs/Evaluate.png and b/org.apache.sling.repoinit.webconsole/docs/Evaluate.png differ
diff --git a/org.apache.sling.repoinit.webconsole/src/main/resources/res/ui/repoinit.css b/org.apache.sling.repoinit.webconsole/src/main/resources/res/ui/repoinit.css
index bb2eed0..5433a1d 100644
--- a/org.apache.sling.repoinit.webconsole/src/main/resources/res/ui/repoinit.css
+++ b/org.apache.sling.repoinit.webconsole/src/main/resources/res/ui/repoinit.css
@@ -14,13 +14,18 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
+h2 {
+  font-size: large;
+  margin: 1em 0;
+}
 pre {
   border: 1px solid silver;
 }
 .d-none {
   display: none;
 }
-.wrapper, pre {
+.wrapper,
+pre {
   position: relative;
   height: 300px;
   width: 100%;
diff --git a/org.apache.sling.repoinit.webconsole/src/main/resources/res/ui/repoinit.js b/org.apache.sling.repoinit.webconsole/src/main/resources/res/ui/repoinit.js
index 038628c..68d7ec7 100644
--- a/org.apache.sling.repoinit.webconsole/src/main/resources/res/ui/repoinit.js
+++ b/org.apache.sling.repoinit.webconsole/src/main/resources/res/ui/repoinit.js
@@ -47,7 +47,7 @@ goButton.addEventListener("click", async function () {
   });
 
   // if there are operations diplay the statements and feature
-  if (json.operations) {
+  if (json.hasOwnProperty('operations') && json.operations) {
     parsedEl.innerText = JSON.stringify(json.operations, null, 2);
     parsedContainerEl.classList.remove("d-none");
     featureEl.innerText = JSON.stringify(
@@ -58,6 +58,9 @@ goButton.addEventListener("click", async function () {
       2
     );
     featureContainerEl.classList.remove("d-none");
+  } else {
+    parsedContainerEl.classList.add("d-none");
+    featureContainerEl.classList.add("d-none");
   }
 
   // show the results
diff --git a/org.apache.sling.repoinit.webconsole/src/main/resources/tpl/main.html b/org.apache.sling.repoinit.webconsole/src/main/resources/tpl/main.html
index ea1d630..7527434 100644
--- a/org.apache.sling.repoinit.webconsole/src/main/resources/tpl/main.html
+++ b/org.apache.sling.repoinit.webconsole/src/main/resources/tpl/main.html
@@ -5,8 +5,8 @@
     the License for the specific language governing permissions and limitations under the License. -->
 <link rel="stylesheet" type="text/css" href="repoinit/res/ui/tln.min.css" />
 <link rel="stylesheet" type="text/css" href="repoinit/res/ui/repoinit.css" />
-<p class="statline ui-state-highlight">Source</p>
 <p>Test and verify Repository Initialization (repoint) scripts</p>
+<h2>RepoInit Script:</h2>
 <div class="wrapper">
   <textarea id="source"></textarea>
 </div>
@@ -14,13 +14,14 @@
 <input type="checkbox" id="execute" name="execute" />
 <label for="execute">Execute</label>
 <div class="d-none" id="results-container">
-  <div class="statline ui-state-highlight" id="messages"></div>
+  <h2>Messages:</h2>
+  <div id="messages"></div>
   <div class="d-none" id="parsed-container">
-    <p class="statline ui-state-highlight">Parsed Statements</p>
+    <h2>Parsed Statements:</h2>
     <pre id="parsed"></pre>
   </div>
   <div class="d-none" id="feature-container">
-    <p class="statline ui-state-highlight">Feature Model JSON</p>
+    <h2>Feature Model JSON:</h2>
     <pre id="feature"></pre>
   </div>
 </div>
diff --git a/startup-tracker/org.apache.sling.startup.tracker/pom.xml b/startup-tracker/org.apache.sling.startup.tracker/pom.xml
new file mode 100644
index 0000000..297efc3
--- /dev/null
+++ b/startup-tracker/org.apache.sling.startup.tracker/pom.xml
@@ -0,0 +1,159 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!--
+  Licensed to the Apache Software Foundation (ASF) under one
+  or more contributor license agreements.  See the NOTICE file
+  distributed with this work for additional information
+  regarding copyright ownership.  The ASF licenses this file
+  to you under the Apache License, Version 2.0 (the
+  "License"); you may not use this file except in compliance
+  with the License.  You may obtain a copy of the License at
+
+   http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing,
+  software distributed under the License is distributed on an
+  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+  KIND, either express or implied.  See the License for the
+  specific language governing permissions and limitations
+  under the License.
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+    <modelVersion>4.0.0</modelVersion>
+    <groupId>org.apache.sling</groupId>
+    <artifactId>org.apache.sling.startup.tracker</artifactId>
+    <version>1.0-SNAPSHOT</version>
+    <name>org.apache.sling.startup.tracker</name>
+    <description>org.apache.sling - org.apache.sling.startup.tracker</description>
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>biz.aQute.bnd</groupId>
+                <artifactId>bnd-maven-plugin</artifactId>
+                <version>3.5.0</version>
+                <executions>
+                    <execution>
+                        <id>run-bnd</id>
+                        <goals>
+                            <goal>bnd-process</goal>
+                        </goals>
+                    </execution>
+                </executions>
+            </plugin>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-jar-plugin</artifactId>
+                <version>2.6</version>
+                <configuration>
+                    <archive>
+                        <manifestFile>${project.build.outputDirectory}/META-INF/MANIFEST.MF</manifestFile>
+                    </archive>
+                </configuration>
+            </plugin>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-compiler-plugin</artifactId>
+                <version>3.7.0</version>
+                <configuration>
+                    <source>8</source>
+                    <target>8</target>
+                </configuration>
+            </plugin>
+            <plugin>
+                <groupId>org.apache.sling</groupId>
+                <artifactId>maven-sling-plugin</artifactId>
+                <version>2.3.4</version>
+                <configuration>
+                    <slingUrl>http://localhost:8080/system/console</slingUrl>
+                    <user>admin</user>
+                    <password>admin</password>
+                </configuration>
+            </plugin>
+        </plugins>
+    </build>
+    <dependencies>
+        <dependency>
+            <groupId>javax.servlet</groupId>
+            <artifactId>servlet-api</artifactId>
+            <version>2.5</version>
+            <scope>provided</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.osgi</groupId>
+            <artifactId>org.osgi.compendium</artifactId>
+            <version>4.2.0</version>
+            <scope>provided</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.osgi</groupId>
+            <artifactId>org.osgi.core</artifactId>
+            <version>4.2.0</version>
+            <scope>provided</scope>
+        </dependency>
+        <dependency>
+            <groupId>javax.jcr</groupId>
+            <artifactId>jcr</artifactId>
+            <version>2.0</version>
+            <scope>provided</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.sling</groupId>
+            <artifactId>org.apache.sling.api</artifactId>
+            <version>2.9.0</version>
+            <scope>provided</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.slf4j</groupId>
+            <artifactId>slf4j-api</artifactId>
+            <version>1.7.6</version>
+            <scope>provided</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.osgi</groupId>
+            <artifactId>org.osgi.annotation.versioning</artifactId>
+            <version>1.0.0</version>
+            <scope>provided</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.osgi</groupId>
+            <artifactId>org.osgi.service.component.annotations</artifactId>
+            <version>1.3.0</version>
+            <scope>provided</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.osgi</groupId>
+            <artifactId>org.osgi.service.metatype.annotations</artifactId>
+            <version>1.3.0</version>
+            <scope>provided</scope>
+        </dependency>
+        <dependency>
+            <groupId>junit</groupId>
+            <artifactId>junit</artifactId>
+            <version>4.12</version>
+            <scope>test</scope>
+        </dependency>
+    </dependencies>
+    <profiles>
+        <profile>
+            <id>autoInstallBundle</id>
+            <build>
+                <plugins>
+                    <plugin>
+                        <groupId>org.apache.sling</groupId>
+                        <artifactId>maven-sling-plugin</artifactId>
+                        <executions>
+                            <execution>
+                                <id>install-bundle</id>
+                                <goals>
+                                    <goal>install</goal>
+                                </goals>
+                            </execution>
+                        </executions>
+                    </plugin>
+                </plugins>
+            </build>
+        </profile>
+    </profiles>
+    <properties>
+        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+    </properties>
+</project>
diff --git a/startup-tracker/org.apache.sling.startup.tracker/src/main/java/org/apache/sling/startup/tracker/AbstractStartupItem.java b/startup-tracker/org.apache.sling.startup.tracker/src/main/java/org/apache/sling/startup/tracker/AbstractStartupItem.java
new file mode 100644
index 0000000..447d785
--- /dev/null
+++ b/startup-tracker/org.apache.sling.startup.tracker/src/main/java/org/apache/sling/startup/tracker/AbstractStartupItem.java
@@ -0,0 +1,29 @@
+package org.apache.sling.startup.tracker;
+
+public abstract class AbstractStartupItem {
+    private final long start;
+    private long complete;
+
+    protected AbstractStartupItem() {
+        this.start = System.currentTimeMillis();
+    }
+
+    public long getComplete() {
+        return complete;
+    }
+
+    public void setComplete(long complete) {
+        this.complete = complete;
+    }
+
+    public abstract String getId();
+
+    public abstract String getMessage();
+
+    public abstract String getParentId();
+
+    public long getStart() {
+        return start;
+    }
+
+}
diff --git a/startup-tracker/org.apache.sling.startup.tracker/src/main/java/org/apache/sling/startup/tracker/BundleEventItem.java b/startup-tracker/org.apache.sling.startup.tracker/src/main/java/org/apache/sling/startup/tracker/BundleEventItem.java
new file mode 100644
index 0000000..87a813f
--- /dev/null
+++ b/startup-tracker/org.apache.sling.startup.tracker/src/main/java/org/apache/sling/startup/tracker/BundleEventItem.java
@@ -0,0 +1,47 @@
+package org.apache.sling.startup.tracker;
+
+import java.util.Collections;
+import java.util.Map;
+import java.util.stream.Collectors;
+import java.util.stream.Stream;
+
+import org.osgi.framework.BundleEvent;
+
+public class BundleEventItem extends AbstractStartupItem {
+
+    public static final Map<Integer, String> EVENT_TYPES = Stream
+            .of(new Object[][] { { 0x00000001, "INSTALLED" }, { 0x00000002, "STARTED" }, { 0x00000004, "STOPPED" },
+                    { 0x00000008, "UPDATED" }, { 0x00000010, "UNINSTALLED" }, { 0x00000020, "RESOLVED" },
+                    { 0x00000040, "UNRESOLVED" }, { 0x00000080, "STARTING" }, { 0x00000100, "STOPPING" },
+                    { 0x00000200, "LAZY_ACTIVATION" }, })
+            .collect(Collectors.collectingAndThen(Collectors.toMap(data -> (Integer) data[0], data -> (String) data[1]),
+                    Collections::<Integer, String>unmodifiableMap));
+
+    private final String event;
+    private final String bundlePid;
+
+    public BundleEventItem(BundleEvent event) {
+        super();
+        this.setComplete(System.currentTimeMillis());
+
+        this.bundlePid = event.getBundle().getSymbolicName();
+        this.event = EVENT_TYPES.get(event.getType());
+
+    }
+
+    @Override
+    public String getId() {
+        return ItemType.getId(ItemType.BUNDLE_EVENT, bundlePid + "/" + event);
+    }
+
+    @Override
+    public String getMessage() {
+        return String.format("Bundle %s: %s", bundlePid, event);
+    }
+
+    @Override
+    public String getParentId() {
+        return ItemType.getId(ItemType.BUNDLE, bundlePid);
+    }
+
+}
diff --git a/startup-tracker/org.apache.sling.startup.tracker/src/main/java/org/apache/sling/startup/tracker/BundleStartup.java b/startup-tracker/org.apache.sling.startup.tracker/src/main/java/org/apache/sling/startup/tracker/BundleStartup.java
new file mode 100644
index 0000000..4f07511
--- /dev/null
+++ b/startup-tracker/org.apache.sling.startup.tracker/src/main/java/org/apache/sling/startup/tracker/BundleStartup.java
@@ -0,0 +1,28 @@
+package org.apache.sling.startup.tracker;
+
+public class BundleStartup extends AbstractStartupItem {
+
+    private final String bundlePid;
+    private final String startLevel;
+
+    public BundleStartup(String startLevel, String bundlePid) {
+        super();
+        this.bundlePid = bundlePid;
+        this.startLevel = startLevel;
+    }
+
+    @Override
+    public String getId() {
+        return ItemType.getId(ItemType.BUNDLE, bundlePid);
+    }
+
+    @Override
+    public String getMessage() {
+        return "Bundle " + bundlePid;
+    }
+
+    @Override
+    public String getParentId() {
+        return ItemType.getId(ItemType.START_LEVEL, startLevel);
+    }
+}
diff --git a/startup-tracker/org.apache.sling.startup.tracker/src/main/java/org/apache/sling/startup/tracker/ItemType.java b/startup-tracker/org.apache.sling.startup.tracker/src/main/java/org/apache/sling/startup/tracker/ItemType.java
new file mode 100644
index 0000000..5365b7c
--- /dev/null
+++ b/startup-tracker/org.apache.sling.startup.tracker/src/main/java/org/apache/sling/startup/tracker/ItemType.java
@@ -0,0 +1,10 @@
+package org.apache.sling.startup.tracker;
+
+public enum ItemType {
+
+    BUNDLE, BUNDLE_EVENT, SERVICE, START_LEVEL;
+
+    public static final String getId(ItemType type, String itemId) {
+        return type.name() + "::" + itemId;
+    }
+}
diff --git a/startup-tracker/org.apache.sling.startup.tracker/src/main/java/org/apache/sling/startup/tracker/StartupListener.java b/startup-tracker/org.apache.sling.startup.tracker/src/main/java/org/apache/sling/startup/tracker/StartupListener.java
new file mode 100644
index 0000000..dee0906c3
--- /dev/null
+++ b/startup-tracker/org.apache.sling.startup.tracker/src/main/java/org/apache/sling/startup/tracker/StartupListener.java
@@ -0,0 +1,67 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.sling.startup.tracker;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.osgi.framework.BundleEvent;
+import org.osgi.framework.FrameworkEvent;
+import org.osgi.framework.FrameworkListener;
+import org.osgi.framework.ServiceEvent;
+import org.osgi.framework.ServiceListener;
+import org.osgi.framework.SynchronousBundleListener;
+import org.osgi.service.component.annotations.Component;
+
+/**
+ * 
+ */
+@Component(service = { ServiceListener.class, SynchronousBundleListener.class, FrameworkListener.class })
+public class StartupListener implements ServiceListener, SynchronousBundleListener, FrameworkListener {
+
+    private Map<String, AbstractStartupItem> startupRecords = new HashMap<>();
+
+    private String currentStartLevel = "0";
+
+    @Override
+    public void serviceChanged(ServiceEvent event) {
+        event.
+    }
+
+    @Override
+    public void bundleChanged(BundleEvent event) {
+        String bundlePid = event.getBundle().getSymbolicName();
+        if (event.getType() == BundleEvent.INSTALLED) {
+            BundleStartup bundle = new BundleStartup(currentStartLevel, bundlePid);
+            startupRecords.put(bundle.getId(), bundle);
+        } else if (event.getType() == BundleEvent.STARTED || event.getType() == BundleEvent.LAZY_ACTIVATION) {
+            startupRecords.get(ItemType.getId(ItemType.BUNDLE, bundlePid)).setComplete(System.currentTimeMillis());
+        } else {
+            BundleEventItem evt = new BundleEventItem(event);
+            startupRecords.put(evt.getId(), evt);
+        }
+    }
+
+    @Override
+    public void frameworkEvent(FrameworkEvent event) {
+        // TODO Auto-generated method stub
+
+    }
+
+}

[sling-whiteboard] 02/02: Using the resource resolver set as a request attribute in the webconsole security provider

Posted by dk...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

dklco pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/sling-whiteboard.git

commit 211617b98dae060ff565644fc473b5b5df82411d
Author: Dan Klco <kl...@adobe.com>
AuthorDate: Tue Aug 10 22:56:44 2021 -0400

    Using the resource resolver set as a request attribute in the webconsole security provider
---
 org.apache.sling.repoinit.webconsole/README.md     | 16 -------
 org.apache.sling.repoinit.webconsole/pom.xml       | 12 ++++++
 .../repoinit/webconsole/RepoInitWebConsole.java    | 22 +++++++---
 .../webconsole/RepoInitWebConsoleTest.java         | 49 +++++++++++++++++++---
 4 files changed, 71 insertions(+), 28 deletions(-)

diff --git a/org.apache.sling.repoinit.webconsole/README.md b/org.apache.sling.repoinit.webconsole/README.md
index 0a4bb1d..7dd7afa 100644
--- a/org.apache.sling.repoinit.webconsole/README.md
+++ b/org.apache.sling.repoinit.webconsole/README.md
@@ -6,10 +6,6 @@
 
 Test and run [Sling RepoInit](https://sling.apache.org/documentation/bundles/repository-initialization.html) scripts from the web console.
 
-## Not For Production Use
-
-**Do not install in production systems.** This bundle is not for production use and is only meant to be used for testing and development. 
-
 ## Installation
 
 Either download the latest version of this bundle from the [Sling Downloads page](https://sling.apache.org/downloads.cgi) or build from source by checking out the project from Git and building with Maven:
@@ -20,12 +16,6 @@ Note installing from source requires Java 11 or later and Maven 3.x or later.
 
 This project has been tested to work with Sling 11+.
 
-## Configuration
-
-To enable execute functionality of the web console, you must add a Apache Sling Login Admin Whitelist entry. Open the OSGi console to [/system/console/configMgr](http://localhost:8080/system/console/configMgr) and add an entry for `org.apache.sling.repoinit.webconsole` either to an existing configuration fragment or a new one.
-
-![Configuring the Whitelist](docs/Configure-Whitelist.png)
-
 ## Use
 
 To use the plugin, navigate to [/system/console/repoinit](http://localhost:8080/system/console/repoinit) and enter the script you want to run into the source text area. Select the `Evaluate` button to validate the script, if you want to execute the script, select the `Execute` checkbox.
@@ -37,9 +27,3 @@ Assuming the script is valid a JSON representation will be displayed in the `Par
 If your script is not valid, an error message will be displayed in the `Messages` section. 
 
 ![Example Error Message](docs/Error.png)
-
-If you get the error message:
-
-> Failed to apply statements [LoginException]: Bundle org.apache.sling.repoinit.webconsole is NOT whitelisted
-
-You need to add the bundle to the login admin whitelist. See Configuration above.
\ No newline at end of file
diff --git a/org.apache.sling.repoinit.webconsole/pom.xml b/org.apache.sling.repoinit.webconsole/pom.xml
index 5bb4c68..f6ef7ba 100644
--- a/org.apache.sling.repoinit.webconsole/pom.xml
+++ b/org.apache.sling.repoinit.webconsole/pom.xml
@@ -165,6 +165,18 @@
         </dependency>
         <dependency>
             <groupId>org.apache.sling</groupId>
+            <artifactId>org.apache.sling.api</artifactId>
+            <version>2.16.2</version>
+            <scope>provided</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.sling</groupId>
+            <artifactId>org.apache.sling.auth.core</artifactId>
+            <version>1.5.2</version>
+            <scope>provided</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.sling</groupId>
             <artifactId>org.apache.sling.jcr.api</artifactId>
             <version>2.4.0</version>
             <scope>provided</scope>
diff --git a/org.apache.sling.repoinit.webconsole/src/main/java/org/apache/sling/repoinit/webconsole/RepoInitWebConsole.java b/org.apache.sling.repoinit.webconsole/src/main/java/org/apache/sling/repoinit/webconsole/RepoInitWebConsole.java
index 9567eb6..a007390 100644
--- a/org.apache.sling.repoinit.webconsole/src/main/java/org/apache/sling/repoinit/webconsole/RepoInitWebConsole.java
+++ b/org.apache.sling.repoinit.webconsole/src/main/java/org/apache/sling/repoinit/webconsole/RepoInitWebConsole.java
@@ -26,6 +26,7 @@ import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 import java.util.Map.Entry;
+import java.util.Optional;
 
 import javax.jcr.Session;
 import javax.servlet.Servlet;
@@ -42,14 +43,14 @@ import com.fasterxml.jackson.databind.ObjectMapper;
 import org.apache.commons.io.IOUtils;
 import org.apache.felix.webconsole.AbstractWebConsolePlugin;
 import org.apache.felix.webconsole.WebConsoleConstants;
-import org.apache.sling.jcr.api.SlingRepository;
+import org.apache.sling.api.resource.ResourceResolver;
+import org.apache.sling.auth.core.AuthenticationSupport;
 import org.osgi.framework.BundleContext;
 import org.osgi.framework.Constants;
 import org.osgi.framework.ServiceReference;
 import org.osgi.service.component.ComponentContext;
 import org.osgi.service.component.annotations.Activate;
 import org.osgi.service.component.annotations.Component;
-import org.osgi.service.component.annotations.Reference;
 
 @Component(property = { Constants.SERVICE_DESCRIPTION + "=RepoInit Web Console Plugin",
         Constants.SERVICE_VENDOR + "=The Apache Software Foundation",
@@ -70,9 +71,6 @@ public class RepoInitWebConsole extends AbstractWebConsolePlugin {
         RESOURCES.put("repoinit.js", "application/javascript");
     }
 
-    @Reference
-    protected SlingRepository slingRepository;
-
     private BundleContext context;
 
     @Activate
@@ -149,8 +147,11 @@ public class RepoInitWebConsole extends AbstractWebConsolePlugin {
         if ("true".equals(request.getParameter("execute"))) {
             try {
 
-                process(slingRepository.loginAdministrative(null), operations);
+                Session session = getSession(request);
+
+                process(session, operations);
                 apiResponse.addMessage("Executed statements successfully!");
+
             } catch (InvocationTargetException e) {
                 response.setStatus(400);
                 apiResponse.setErrorMessage("Failed to apply statements", (Exception) e.getCause());
@@ -163,6 +164,15 @@ public class RepoInitWebConsole extends AbstractWebConsolePlugin {
         writeResponse(response, apiResponse);
     }
 
+    private Session getSession(HttpServletRequest request) {
+        Object resolver = request.getAttribute(AuthenticationSupport.REQUEST_ATTRIBUTE_RESOLVER);
+        if (resolver instanceof ResourceResolver) {
+            return Optional.ofNullable(((ResourceResolver) resolver).adaptTo(Session.class))
+                    .orElseThrow(() -> new IllegalStateException("No session available"));
+        }
+        throw new IllegalStateException("No resource resolver available");
+    }
+
     @Override
     protected void renderContent(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException {
         IOUtils.copy(getClass().getClassLoader().getResourceAsStream("tpl/main.html"), res.getWriter(),
diff --git a/org.apache.sling.repoinit.webconsole/src/test/java/org/apache/sling/repoinit/webconsole/RepoInitWebConsoleTest.java b/org.apache.sling.repoinit.webconsole/src/test/java/org/apache/sling/repoinit/webconsole/RepoInitWebConsoleTest.java
index 90c7c01..32c4c65 100644
--- a/org.apache.sling.repoinit.webconsole/src/test/java/org/apache/sling/repoinit/webconsole/RepoInitWebConsoleTest.java
+++ b/org.apache.sling.repoinit.webconsole/src/test/java/org/apache/sling/repoinit/webconsole/RepoInitWebConsoleTest.java
@@ -34,7 +34,8 @@ import javax.jcr.Session;
 import javax.servlet.ServletException;
 
 import org.apache.commons.io.IOUtils;
-import org.apache.sling.jcr.api.SlingRepository;
+import org.apache.sling.api.resource.ResourceResolver;
+import org.apache.sling.auth.core.AuthenticationSupport;
 import org.apache.sling.jcr.repoinit.JcrRepoInitOpsProcessor;
 import org.apache.sling.repoinit.parser.RepoInitParser;
 import org.apache.sling.repoinit.parser.RepoInitParsingException;
@@ -48,7 +49,6 @@ public class RepoInitWebConsoleTest {
     @Rule
     public SlingContext context = new SlingContext();
     private RepoInitParser parser;
-    private SlingRepository slingRepository;
     private JcrRepoInitOpsProcessor processor;
     private RepoInitWebConsole webConsole;
 
@@ -57,15 +57,17 @@ public class RepoInitWebConsoleTest {
         context.request().setServletPath("/system/console/");
         this.parser = mock(RepoInitParser.class);
         context.registerService(RepoInitParser.class, parser);
-        this.slingRepository = mock(SlingRepository.class);
-        when(slingRepository.loginAdministrative(null)).thenReturn(mock(Session.class));
         this.processor = mock(JcrRepoInitOpsProcessor.class);
         when(parser.parse(any())).thenReturn(Collections.emptyList());
         context.registerService(JcrRepoInitOpsProcessor.class, processor);
 
+        ResourceResolver resolver = mock(ResourceResolver.class);
+        when(resolver.adaptTo(Session.class)).thenReturn(mock(Session.class));
+
+        context.request().setAttribute(AuthenticationSupport.REQUEST_ATTRIBUTE_RESOLVER, resolver);
+
         webConsole = new RepoInitWebConsole();
 
-        webConsole.slingRepository = slingRepository;
         webConsole.activate(context.componentContext());
 
     }
@@ -118,7 +120,8 @@ public class RepoInitWebConsoleTest {
 
         assertEquals(200, context.response().getStatus());
         assertEquals("application/json", context.response().getContentType());
-        assertEquals("{\"succeeded\":true,\"operations\":[],\"messages\":[\"Parsed Repoinit script successfully!\"]}", context.response().getOutputAsString());
+        assertEquals("{\"succeeded\":true,\"operations\":[],\"messages\":[\"Parsed Repoinit script successfully!\"]}",
+                context.response().getOutputAsString());
     }
 
     @Test
@@ -165,4 +168,38 @@ public class RepoInitWebConsoleTest {
                 context.response().getOutputAsString());
 
     }
+
+    @Test
+    public void testNoResourceResolver() throws ServletException, IOException, RepoInitParsingException {
+
+        context.request().setAttribute(AuthenticationSupport.REQUEST_ATTRIBUTE_RESOLVER, null);
+
+        context.request().setContent("create user".getBytes());
+        context.request().addRequestParameter("execute", "true");
+        webConsole.doPost(context.request(), context.response());
+
+        assertEquals(400, context.response().getStatus());
+        assertEquals("application/json", context.response().getContentType());
+        assertEquals(
+                "{\"succeeded\":false,\"operations\":[],\"messages\":[\"Parsed Repoinit script successfully!\",\"Failed to apply statements [IllegalStateException]: No resource resolver available\"]}",
+                context.response().getOutputAsString());
+
+    }
+
+    @Test
+    public void testNoSession() throws ServletException, IOException, RepoInitParsingException {
+
+        context.request().setAttribute(AuthenticationSupport.REQUEST_ATTRIBUTE_RESOLVER, mock(ResourceResolver.class));
+
+        context.request().setContent("create user".getBytes());
+        context.request().addRequestParameter("execute", "true");
+        webConsole.doPost(context.request(), context.response());
+
+        assertEquals(400, context.response().getStatus());
+        assertEquals("application/json", context.response().getContentType());
+        assertEquals(
+                "{\"succeeded\":false,\"operations\":[],\"messages\":[\"Parsed Repoinit script successfully!\",\"Failed to apply statements [IllegalStateException]: No session available\"]}",
+                context.response().getOutputAsString());
+
+    }
 }