You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by ra...@apache.org on 2018/06/11 10:26:47 UTC
[sling-org-apache-sling-scripting-sightly-repl] branch master
updated: SLING-7721 - [HTL] Redirect user to login form in REPL if the user
is not already authenticated
This is an automated email from the ASF dual-hosted git repository.
radu pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-scripting-sightly-repl.git
The following commit(s) were added to refs/heads/master by this push:
new 545a5df SLING-7721 - [HTL] Redirect user to login form in REPL if the user is not already authenticated
545a5df is described below
commit 545a5df885522be4f25cf4fccde497b3ffcff9d2
Author: Radu Cotescu <ra...@apache.org>
AuthorDate: Mon Jun 11 12:25:56 2018 +0200
SLING-7721 - [HTL] Redirect user to login form in REPL if the user is not already authenticated
* defined /htl as a path that needs authentication
---
pom.xml | 20 +++-----------------
.../sightly/repl/impl/REPLJavaSourceCodeServlet.java | 20 +++++++++++++-------
2 files changed, 16 insertions(+), 24 deletions(-)
diff --git a/pom.xml b/pom.xml
index 7db192a..cb4e952 100644
--- a/pom.xml
+++ b/pom.xml
@@ -60,6 +60,7 @@
<exclude>src/main/resources/SLING-INF/etc/clientlibs/repl/html5shiv.js</exclude>
<exclude>src/main/resources/SLING-INF/etc/clientlibs/repl/jquery.min.js</exclude>
<exclude>src/main/resources/SLING-INF/etc/clientlibs/repl/respond.min.js</exclude>
+ <exclude>src/main/resources/SLING-INF/apps/repl/org.apache.sling.engine.impl.auth.SlingAuthenticator.config</exclude>
</excludes>
</configuration>
</plugin>
@@ -69,20 +70,10 @@
<plugins>
<plugin>
<groupId>org.apache.felix</groupId>
- <artifactId>maven-scr-plugin</artifactId>
- <dependencies>
- <dependency>
- <groupId>javax.jcr</groupId>
- <artifactId>jcr</artifactId>
- <version>2.0</version>
- </dependency>
- </dependencies>
- </plugin>
- <plugin>
- <groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<extensions>true</extensions>
<configuration>
+ <exportScr>true</exportScr>
<instructions>
<Sling-Initial-Content>SLING-INF;overwrite=true</Sling-Initial-Content>
<Require-Capability>io.sightly; filter:="(&(version>=1.0)(!(version>=2.0)))"</Require-Capability>
@@ -104,11 +95,6 @@
<dependencies>
<dependency>
- <groupId>org.apache.felix</groupId>
- <artifactId>org.apache.felix.scr.annotations</artifactId>
- <scope>provided</scope>
- </dependency>
- <dependency>
<groupId>org.osgi</groupId>
<artifactId>osgi.core</artifactId>
<scope>provided</scope>
@@ -137,7 +123,7 @@
<dependency>
<groupId>org.apache.sling</groupId>
<artifactId>org.apache.sling.api</artifactId>
- <version>2.4.0</version>
+ <version>2.16.0</version>
<scope>provided</scope>
</dependency>
</dependencies>
diff --git a/src/main/java/org/apache/sling/scripting/sightly/repl/impl/REPLJavaSourceCodeServlet.java b/src/main/java/org/apache/sling/scripting/sightly/repl/impl/REPLJavaSourceCodeServlet.java
index ec670e5..590cc02 100644
--- a/src/main/java/org/apache/sling/scripting/sightly/repl/impl/REPLJavaSourceCodeServlet.java
+++ b/src/main/java/org/apache/sling/scripting/sightly/repl/impl/REPLJavaSourceCodeServlet.java
@@ -20,25 +20,31 @@ import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
+import javax.servlet.Servlet;
import javax.servlet.ServletException;
import org.apache.commons.io.IOUtils;
-import org.apache.felix.scr.annotations.Activate;
-import org.apache.felix.scr.annotations.sling.SlingServlet;
import org.apache.sling.api.SlingHttpServletRequest;
import org.apache.sling.api.SlingHttpServletResponse;
+import org.apache.sling.api.servlets.ServletResolverConstants;
import org.apache.sling.api.servlets.SlingSafeMethodsServlet;
import org.osgi.framework.Bundle;
import org.osgi.framework.BundleContext;
import org.osgi.service.component.ComponentContext;
+import org.osgi.service.component.annotations.Activate;
+import org.osgi.service.component.annotations.Component;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-@SlingServlet(
- resourceTypes = {"repl/components/repl"},
- selectors = {"java"},
- methods = "GET",
- extensions = "html"
+@Component(
+ service = Servlet.class,
+ property = {
+ ServletResolverConstants.SLING_SERVLET_RESOURCE_TYPES + "=repl/components/repl",
+ ServletResolverConstants.SLING_SERVLET_SELECTORS + "=java",
+ ServletResolverConstants.SLING_SERVLET_METHODS + "=GET",
+ ServletResolverConstants.SLING_SERVLET_EXTENSIONS + "=html",
+ "sling.auth.requirements=+/htl"
+ }
)
public class REPLJavaSourceCodeServlet extends SlingSafeMethodsServlet {
--
To stop receiving notification emails like this one, please contact
radu@apache.org.