You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by ro...@apache.org on 2017/11/07 09:34:57 UTC
[sling-org-apache-sling-extensions-webconsolesecurityprovider]
04/09: SLING-6234 : Web Console Security Provider should supprt logout
This is an automated email from the ASF dual-hosted git repository.
rombert pushed a commit to annotated tag org.apache.sling.extensions.webconsolesecurityprovider-1.2.0
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-extensions-webconsolesecurityprovider.git
commit c12f0aca0ffb97993eeb4e9bf3aa0487dd69d7c6
Author: Carsten Ziegeler <cz...@apache.org>
AuthorDate: Wed Nov 2 16:27:15 2016 +0000
SLING-6234 : Web Console Security Provider should supprt logout
git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/bundles/extensions/webconsolesecurityprovider@1767718 13f79535-47bb-0310-9956-ffa450edef68
---
pom.xml | 27 +++++++---------------
.../internal/SlingWebConsoleSecurityProvider.java | 26 ++-------------------
.../internal/SlingWebConsoleSecurityProvider2.java | 14 ++++++++---
...rnal.SlingWebConsoleSecurityProvider.properties | 24 +++++++++++++++++++
...er.internal.SlingWebConsoleSecurityProvider.xml | 26 +++++++++++++++++++++
5 files changed, 71 insertions(+), 46 deletions(-)
diff --git a/pom.xml b/pom.xml
index e75d187..03f9f55 100644
--- a/pom.xml
+++ b/pom.xml
@@ -21,7 +21,7 @@
<parent>
<artifactId>sling</artifactId>
<groupId>org.apache.sling</groupId>
- <version>26</version>
+ <version>29</version>
<relativePath />
</parent>
@@ -50,10 +50,6 @@
<plugins>
<plugin>
<groupId>org.apache.felix</groupId>
- <artifactId>maven-scr-plugin</artifactId>
- </plugin>
- <plugin>
- <groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<extensions>true</extensions>
<configuration>
@@ -75,11 +71,6 @@
</instructions>
</configuration>
</plugin>
- </plugins>
- </build>
-
- <reporting>
- <plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
@@ -88,21 +79,23 @@
</configuration>
</plugin>
</plugins>
- </reporting>
+ </build>
<dependencies>
<dependency>
<groupId>org.osgi</groupId>
- <artifactId>org.osgi.core</artifactId>
+ <artifactId>osgi.core</artifactId>
</dependency>
<dependency>
<groupId>org.osgi</groupId>
- <artifactId>org.osgi.compendium</artifactId>
+ <artifactId>org.osgi.service.cm</artifactId>
+ <version>1.5.0</version>
+ <scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.felix</groupId>
<artifactId>org.apache.felix.webconsole</artifactId>
- <version>4.2.0</version>
+ <version>4.2.10</version>
<scope>provided</scope>
</dependency>
<dependency>
@@ -125,7 +118,7 @@
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
- <artifactId>servlet-api</artifactId>
+ <artifactId>javax.servlet-api</artifactId>
</dependency>
<dependency>
<groupId>javax.jcr</groupId>
@@ -138,10 +131,6 @@
<scope>provided</scope>
</dependency>
<dependency>
- <groupId>org.apache.felix</groupId>
- <artifactId>org.apache.felix.scr.annotations</artifactId>
- </dependency>
- <dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
</dependency>
diff --git a/src/main/java/org/apache/sling/extensions/webconsolesecurityprovider/internal/SlingWebConsoleSecurityProvider.java b/src/main/java/org/apache/sling/extensions/webconsolesecurityprovider/internal/SlingWebConsoleSecurityProvider.java
index 37454e2..c35432a 100644
--- a/src/main/java/org/apache/sling/extensions/webconsolesecurityprovider/internal/SlingWebConsoleSecurityProvider.java
+++ b/src/main/java/org/apache/sling/extensions/webconsolesecurityprovider/internal/SlingWebConsoleSecurityProvider.java
@@ -26,9 +26,6 @@ import javax.jcr.Repository;
import javax.jcr.Session;
import javax.jcr.SimpleCredentials;
-import org.apache.felix.scr.annotations.Component;
-import org.apache.felix.scr.annotations.Properties;
-import org.apache.felix.scr.annotations.Property;
import org.apache.jackrabbit.api.JackrabbitSession;
import org.apache.jackrabbit.api.security.user.Authorizable;
import org.apache.jackrabbit.api.security.user.Group;
@@ -47,27 +44,6 @@ import org.apache.jackrabbit.api.security.user.UserManager;
* only registered as a security provider service once such a JCR Repository is
* available.
*/
-@Component(ds=false, metatype=true,
- label="Apache Sling Web Console Security Provider",
- description="Configuration for the security provider used to verfiy user " +
- "credentials and grant access to the Apache Felix Web Console " +
- "based on registered JCR Repository users.")
-@Properties({
- @Property(name = "users", value=AbstractWebConsoleSecurityProvider.PROP_GROUPS_DEFAULT_USER, cardinality=20,
- label="User Names",
- description="Names of users granted full access to the Apache Felix " +
- "Web Console. By default this lists the \"admin\" user. A maximum of 20 users" +
- " may be configured. Administrators are encouraged to create a group whose" +
- " members are to be granted access to Web Console instead of allowing access" +
- " to individual users."),
- @Property(name = "groups", cardinality=20,
- label="Group Names",
- description="Names of groups whose members are granted full access to the Apache Felix " +
- "Web Console. The default lists no groups. Administrators are encouraged to " +
- "create a group whose members are to be granted access to the Web Console." +
- " A maximum of 20 groups may be configured. Using groups to control" +
- " access requires a Jackrabbit based repository.")
-})
public class SlingWebConsoleSecurityProvider extends AbstractWebConsoleSecurityProvider {
private Repository repository;
@@ -105,6 +81,7 @@ public class SlingWebConsoleSecurityProvider extends AbstractWebConsoleSecurityP
* @throws NullPointerException if <code>userName</code> is
* <code>null</code>.
*/
+ @Override
public Object authenticate(String userName, String password) {
final Credentials creds = new SimpleCredentials(userName,
(password == null) ? new char[0] : password.toCharArray());
@@ -167,6 +144,7 @@ public class SlingWebConsoleSecurityProvider extends AbstractWebConsoleSecurityP
* All users authenticated with the repository and being a member of the
* authorized groups are granted access for all roles in the Web Console.
*/
+ @Override
public boolean authorize(Object user, String role) {
logger.debug("authorize: Grant user {} access for role {}", user, role);
return true;
diff --git a/src/main/java/org/apache/sling/extensions/webconsolesecurityprovider/internal/SlingWebConsoleSecurityProvider2.java b/src/main/java/org/apache/sling/extensions/webconsolesecurityprovider/internal/SlingWebConsoleSecurityProvider2.java
index 144d431..cceb080 100644
--- a/src/main/java/org/apache/sling/extensions/webconsolesecurityprovider/internal/SlingWebConsoleSecurityProvider2.java
+++ b/src/main/java/org/apache/sling/extensions/webconsolesecurityprovider/internal/SlingWebConsoleSecurityProvider2.java
@@ -25,7 +25,7 @@ import javax.jcr.Session;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
-import org.apache.felix.webconsole.WebConsoleSecurityProvider2;
+import org.apache.felix.webconsole.WebConsoleSecurityProvider3;
import org.apache.jackrabbit.api.JackrabbitSession;
import org.apache.jackrabbit.api.security.user.Authorizable;
import org.apache.jackrabbit.api.security.user.Group;
@@ -49,7 +49,7 @@ import org.apache.sling.auth.core.AuthenticationSupport;
*/
public class SlingWebConsoleSecurityProvider2
extends AbstractWebConsoleSecurityProvider
- implements WebConsoleSecurityProvider2 {
+ implements WebConsoleSecurityProvider3 {
private final AuthenticationSupport authentiationSupport;
@@ -63,6 +63,7 @@ public class SlingWebConsoleSecurityProvider2
/**
* @see org.apache.felix.webconsole.WebConsoleSecurityProvider2#authenticate(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
*/
+ @Override
public boolean authenticate(final HttpServletRequest request,
final HttpServletResponse response) {
if ( this.authentiationSupport.handleSecurity(request, response) ) {
@@ -88,11 +89,17 @@ public class SlingWebConsoleSecurityProvider2
}
if (request.getAuthType() == null) {
this.authenticator.login(request, response);
- }
+ }
}
return false;
}
+ @Override
+ public void logout(HttpServletRequest request, HttpServletResponse response) {
+ this.authenticator.logout(request, response);
+ }
+
+ @Override
public User authenticate(String userName, String password) {
return null; // this method is never invoked
}
@@ -138,6 +145,7 @@ public class SlingWebConsoleSecurityProvider2
* All users authenticated with the repository and being a member of the
* authorized groups are granted access for all roles in the Web Console.
*/
+ @Override
public boolean authorize(Object user, String role) {
logger.debug("authorize: Grant user {} access for role {}", user, role);
return true;
diff --git a/src/main/resources/OSGI-INF/metatype/org.apache.sling.extensions.webconsolesecurityprovider.internal.SlingWebConsoleSecurityProvider.properties b/src/main/resources/OSGI-INF/metatype/org.apache.sling.extensions.webconsolesecurityprovider.internal.SlingWebConsoleSecurityProvider.properties
new file mode 100644
index 0000000..031fbd8
--- /dev/null
+++ b/src/main/resources/OSGI-INF/metatype/org.apache.sling.extensions.webconsolesecurityprovider.internal.SlingWebConsoleSecurityProvider.properties
@@ -0,0 +1,24 @@
+#
+# 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.
+#
+org.apache.sling.extensions.webconsolesecurityprovider.internal.SlingWebConsoleSecurityProvider.users.name=User Names
+org.apache.sling.extensions.webconsolesecurityprovider.internal.SlingWebConsoleSecurityProvider.users.description=Names of users granted full access to the Apache Felix Web Console. By default this lists the "admin" user. A maximum of 20 users may be configured. Administrators are encouraged to create a group whose members are to be granted access to Web Console instead of allowing access to individual users.
+org.apache.sling.extensions.webconsolesecurityprovider.internal.SlingWebConsoleSecurityProvider.groups.description=Names of groups whose members are granted full access to the Apache Felix Web Console. The default lists no groups. Administrators are encouraged to create a group whose members are to be granted access to the Web Console. A maximum of 20 groups may be configured. Using groups to control access requires a Jackrabbit based repository.
+org.apache.sling.extensions.webconsolesecurityprovider.internal.SlingWebConsoleSecurityProvider.groups.name=Group Names
+org.apache.sling.extensions.webconsolesecurityprovider.internal.SlingWebConsoleSecurityProvider.description=Configuration for the security provider used to verfiy user credentials and grant access to the Apache Felix Web Console based on registered JCR Repository users.
+org.apache.sling.extensions.webconsolesecurityprovider.internal.SlingWebConsoleSecurityProvider.name=Apache Sling Web Console Security Provider
diff --git a/src/main/resources/OSGI-INF/metatype/org.apache.sling.extensions.webconsolesecurityprovider.internal.SlingWebConsoleSecurityProvider.xml b/src/main/resources/OSGI-INF/metatype/org.apache.sling.extensions.webconsolesecurityprovider.internal.SlingWebConsoleSecurityProvider.xml
new file mode 100644
index 0000000..46280b6
--- /dev/null
+++ b/src/main/resources/OSGI-INF/metatype/org.apache.sling.extensions.webconsolesecurityprovider.internal.SlingWebConsoleSecurityProvider.xml
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="UTF-8"?>
+ <!--
+ 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.
+ -->
+<metatype:MetaData xmlns:metatype="http://www.osgi.org/xmlns/metatype/v1.0.0" localization="OSGI-INF/metatype/org.apache.sling.extensions.webconsolesecurityprovider.internal.SlingWebConsoleSecurityProvider">
+ <OCD id="org.apache.sling.extensions.webconsolesecurityprovider.internal.SlingWebConsoleSecurityProvider" name="%org.apache.sling.extensions.webconsolesecurityprovider.internal.SlingWebConsoleSecurityProvider.name" description="%org.apache.sling.extensions.webconsolesecurityprovider.internal.SlingWebConsoleSecurityProvider.description">
+ <AD id="users" type="String" default="admin" name="%org.apache.sling.extensions.webconsolesecurityprovider.internal.SlingWebConsoleSecurityProvider.users.name" description="%org.apache.sling.extensions.webconsolesecurityprovider.internal.SlingWebConsoleSecurityProvider.users.description" cardinality="20"/>
+ <AD id="groups" type="String" name="%org.apache.sling.extensions.webconsolesecurityprovider.internal.SlingWebConsoleSecurityProvider.groups.name" description="%org.apache.sling.extensions.webconsolesecurityprovider.internal.SlingWebConsoleSecurityProvider.groups.description" cardinality="20"/>
+ </OCD>
+ <Designate pid="org.apache.sling.extensions.webconsolesecurityprovider.internal.SlingWebConsoleSecurityProvider">
+ <Object ocdref="org.apache.sling.extensions.webconsolesecurityprovider.internal.SlingWebConsoleSecurityProvider"/>
+ </Designate>
+</metatype:MetaData>
--
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.