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:28 UTC

[sling-org-apache-sling-extensions-webconsolesecurityprovider] annotated tag org.apache.sling.extensions.webconsolesecurityprovider-1.1.2 created (now d65ac37)

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

rombert pushed a change to annotated tag org.apache.sling.extensions.webconsolesecurityprovider-1.1.2
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-extensions-webconsolesecurityprovider.git.


      at d65ac37  (tag)
 tagging 896cc0cfb0be188ff860760e06c45691f5491b09 (commit)
      by Carsten Ziegeler
      on Wed Dec 11 23:13:21 2013 +0000

- Log -----------------------------------------------------------------
org.apache.sling.extensions.webconsolesecurityprovider-1.1.2
-----------------------------------------------------------------------

This annotated tag includes the following new commits:

     new 1ace893  SLING-1670 add repository based security provider for the Web Console
     new 91abea9  SLING-1650 JavaDoc
     new 6bb2a26  Fix license header
     new b23ee6e  Prevent JavaDoc reporting to run (nothing to JavaDoc here) and refer to the JIRA version ID for the changes plugin
     new c985d71  [maven-release-plugin] prepare release org.apache.sling.extensions.webconsolesecurityprovider-1.0.0
     new 4c3dc5b  [maven-release-plugin] prepare for next development iteration
     new 8b4f59e  updating all modules to parent 10-SNAPSHOT in anticipation of emma additions to parent
     new 3bf478e  fixing relativePaths
     new 6cc5940  SLING-1869 - upgrading to latest SCR plugin and putting scr.annotations in parent
     new 459da09  Update to recent snapshots
     new 6d96920  Use latest releases.
     new e10cb65  SLING-2150 : Update plugins to use the latest available versions
     new 3f75d51  Update to recent snapshot
     new 23bcb20  Using latest released parent pom
     new 378fbc7  SLING-2187 - adding new module to contain our custom notice file; adding remote-resources plugin configuration to parent pom and removing all existing appended-resources NOTICE files
     new 00bc58d  temporarily using snapshots during release vote
     new 6371108  using latest releases
     new 5deac44  SLING-2480 : Add config for maven-sling-plugin to m2e configuration
     new 2229d50  Update to latest parent pom
     new 9408629  Use released versions
     new 814dacc  Use latest releases and update to new parent pom
     new f9e6500  Update to latest parent pom and use latest releases in launchpad
     new 149f619  Correct reactor pom and update to parent pom 16
     new 2300014  Update to latest parent pom
     new 4acdb77  SLING-3023 - catch and report Exception
     new 548b609  Update to parent pom 18
     new f8b1c0b  SLING-3193 : Implement WebConsoleSecurityProvider2 for integration with Sling Authenticator
     new 88832c9  [maven-release-plugin] prepare release org.apache.sling.extensions.webconsolesecurityprovider-1.1.0
     new eaf7ecc  [maven-release-plugin] prepare for next development iteration
     new 739bbc5  SLING-3271 : Make Sling imports dynamic
     new 8a90464  SLING-3272 : Only register security provider 2 if startup is finished
     new f56c18c  SLING-3273 : Switch to login page if user is not allowed to access the web console
     new e839ffd  SLING-3273 : Switch to login page if user is not allowed to access the web console
     new 36082cf  SLING-3273 : Switch to login page if user is not allowed to access the web console
     new 722d24f  [maven-release-plugin] prepare release org.apache.sling.extensions.webconsolesecurityprovider-1.1.2
     new 896cc0c  [maven-release-plugin]  copy for tag org.apache.sling.extensions.webconsolesecurityprovider-1.1.2

The 36 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.


-- 
To stop receiving notification emails like this one, please contact
['"commits@sling.apache.org" <co...@sling.apache.org>'].

[sling-org-apache-sling-extensions-webconsolesecurityprovider] 05/08: SLING-3273 : Switch to login page if user is not allowed to access the web console

Posted by ro...@apache.org.
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.1.2
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-extensions-webconsolesecurityprovider.git

commit e839ffd456493cec1aa253cf7e7535ebbc3ad42b
Author: Carsten Ziegeler <cz...@apache.org>
AuthorDate: Tue Dec 10 05:24:52 2013 +0000

    SLING-3273 : Switch to login page if user is not allowed to access the web console
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/bundles/extensions/webconsolesecurityprovider@1549760 13f79535-47bb-0310-9956-ffa450edef68
---
 pom.xml | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/pom.xml b/pom.xml
index 68b98d5..5a093ed 100644
--- a/pom.xml
+++ b/pom.xml
@@ -63,10 +63,12 @@
                         </Bundle-Activator>
                         <Import-Package>
                             !org.apache.sling.auth.core,
+                            !org.apache.sling.api.auth,
                             !org.apache.sling.api.resource,
                             *
                         </Import-Package>
                         <DynamicImport-Package>
+                            org.apache.sling.api.auth;version="[1.0,2)",
                             org.apache.sling.api.resource;version="[2.3,3)",
                             org.apache.sling.auth.core;version="[1.0,2)"
                         </DynamicImport-Package>

-- 
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.

[sling-org-apache-sling-extensions-webconsolesecurityprovider] 01/08: [maven-release-plugin] prepare for next development iteration

Posted by ro...@apache.org.
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.1.2
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-extensions-webconsolesecurityprovider.git

commit eaf7ecc6d3b0879072c99808dcfded70f83526ae
Author: Carsten Ziegeler <cz...@apache.org>
AuthorDate: Mon Oct 21 08:18:35 2013 +0000

    [maven-release-plugin] prepare for next development iteration
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/bundles/extensions/webconsolesecurityprovider@1534061 13f79535-47bb-0310-9956-ffa450edef68
---
 pom.xml | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/pom.xml b/pom.xml
index 998ff41..c4650a2 100644
--- a/pom.xml
+++ b/pom.xml
@@ -27,7 +27,7 @@
 
     <groupId>org.apache.sling</groupId>
     <artifactId>org.apache.sling.extensions.webconsolesecurityprovider</artifactId>
-    <version>1.1.0</version>
+    <version>1.1.1-SNAPSHOT</version>
     <packaging>bundle</packaging>
 
     <name>Apache Sling Web Console Security Provider</name>
@@ -37,9 +37,9 @@
     </description>
 
     <scm>
-        <connection>scm:svn:http://svn.apache.org/repos/asf/sling/tags/org.apache.sling.extensions.webconsolesecurityprovider-1.1.0</connection>
-        <developerConnection>scm:svn:https://svn.apache.org/repos/asf/sling/tags/org.apache.sling.extensions.webconsolesecurityprovider-1.1.0</developerConnection>
-        <url>http://svn.apache.org/viewvc/sling/tags/org.apache.sling.extensions.webconsolesecurityprovider-1.1.0</url>
+        <connection>scm:svn:http://svn.apache.org/repos/asf/sling/trunk/bundles/extensions/webconsolesecurityprovider</connection>
+        <developerConnection>scm:svn:https://svn.apache.org/repos/asf/sling/trunk/bundles/extensions/webconsolesecurityprovider</developerConnection>
+        <url>http://svn.apache.org/viewvc/sling/trunk/bundles/extensions/webconsolesecurityprovider</url>
     </scm>
 
     <properties>

-- 
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.

[sling-org-apache-sling-extensions-webconsolesecurityprovider] 07/08: [maven-release-plugin] prepare release org.apache.sling.extensions.webconsolesecurityprovider-1.1.2

Posted by ro...@apache.org.
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.1.2
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-extensions-webconsolesecurityprovider.git

commit 722d24fb9770563e2edf7aa33a05a6158d4ed817
Author: Carsten Ziegeler <cz...@apache.org>
AuthorDate: Wed Dec 11 23:13:17 2013 +0000

    [maven-release-plugin] prepare release org.apache.sling.extensions.webconsolesecurityprovider-1.1.2
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/bundles/extensions/webconsolesecurityprovider@1550309 13f79535-47bb-0310-9956-ffa450edef68
---
 pom.xml | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/pom.xml b/pom.xml
index 5a093ed..10a9439 100644
--- a/pom.xml
+++ b/pom.xml
@@ -27,7 +27,7 @@
 
     <groupId>org.apache.sling</groupId>
     <artifactId>org.apache.sling.extensions.webconsolesecurityprovider</artifactId>
-    <version>1.1.1-SNAPSHOT</version>
+    <version>1.1.2</version>
     <packaging>bundle</packaging>
 
     <name>Apache Sling Web Console Security Provider</name>
@@ -37,9 +37,9 @@
     </description>
 
     <scm>
-        <connection>scm:svn:http://svn.apache.org/repos/asf/sling/trunk/bundles/extensions/webconsolesecurityprovider</connection>
-        <developerConnection>scm:svn:https://svn.apache.org/repos/asf/sling/trunk/bundles/extensions/webconsolesecurityprovider</developerConnection>
-        <url>http://svn.apache.org/viewvc/sling/trunk/bundles/extensions/webconsolesecurityprovider</url>
+        <connection>scm:svn:http://svn.apache.org/repos/asf/sling/tags/org.apache.sling.extensions.webconsolesecurityprovider-1.1.2</connection>
+        <developerConnection>scm:svn:https://svn.apache.org/repos/asf/sling/tags/org.apache.sling.extensions.webconsolesecurityprovider-1.1.2</developerConnection>
+        <url>http://svn.apache.org/viewvc/sling/tags/org.apache.sling.extensions.webconsolesecurityprovider-1.1.2</url>
     </scm>
 
     <properties>

-- 
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.

[sling-org-apache-sling-extensions-webconsolesecurityprovider] 03/08: SLING-3272 : Only register security provider 2 if startup is finished

Posted by ro...@apache.org.
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.1.2
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-extensions-webconsolesecurityprovider.git

commit 8a904648d23105a44e2ff1a6bb631520f9fc2cfa
Author: Carsten Ziegeler <cz...@apache.org>
AuthorDate: Tue Dec 10 04:40:48 2013 +0000

    SLING-3272 : Only register security provider 2 if startup is finished
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/bundles/extensions/webconsolesecurityprovider@1549757 13f79535-47bb-0310-9956-ffa450edef68
---
 pom.xml                                            |  6 ++++
 .../internal/Activator.java                        |  9 ++++++
 .../internal/ServicesListener.java                 | 35 ++++++++++++++++++++--
 3 files changed, 48 insertions(+), 2 deletions(-)

diff --git a/pom.xml b/pom.xml
index 31c1f3a..68b98d5 100644
--- a/pom.xml
+++ b/pom.xml
@@ -116,6 +116,12 @@
             <scope>provided</scope>
         </dependency>
         <dependency>
+            <groupId>org.apache.sling</groupId>
+            <artifactId>org.apache.sling.launchpad.api</artifactId>
+            <version>1.1.0</version>
+            <scope>provided</scope>
+        </dependency>
+        <dependency>
             <groupId>javax.servlet</groupId>
             <artifactId>servlet-api</artifactId>
         </dependency>
diff --git a/src/main/java/org/apache/sling/extensions/webconsolesecurityprovider/internal/Activator.java b/src/main/java/org/apache/sling/extensions/webconsolesecurityprovider/internal/Activator.java
index 018ee6d..be6e303 100644
--- a/src/main/java/org/apache/sling/extensions/webconsolesecurityprovider/internal/Activator.java
+++ b/src/main/java/org/apache/sling/extensions/webconsolesecurityprovider/internal/Activator.java
@@ -16,24 +16,33 @@
  */
 package org.apache.sling.extensions.webconsolesecurityprovider.internal;
 
+import org.apache.sling.launchpad.api.StartupListener;
 import org.osgi.framework.BundleActivator;
 import org.osgi.framework.BundleContext;
+import org.osgi.framework.ServiceRegistration;
 
 public class Activator implements BundleActivator {
 
     private ServicesListener listener;
 
+    private ServiceRegistration registration;
+
     /**
      * @see org.osgi.framework.BundleActivator#start(org.osgi.framework.BundleContext)
      */
     public void start(final BundleContext context) throws Exception {
         listener = new ServicesListener(context);
+        registration = context.registerService(StartupListener.class.getName(), listener, null);
     }
 
     /**
      * @see org.osgi.framework.BundleActivator#stop(org.osgi.framework.BundleContext)
      */
     public void stop(final BundleContext context) throws Exception {
+        if ( registration != null ) {
+            registration.unregister();
+            registration = null;
+        }
         if ( listener != null ) {
             listener.deactivate();
             listener = null;
diff --git a/src/main/java/org/apache/sling/extensions/webconsolesecurityprovider/internal/ServicesListener.java b/src/main/java/org/apache/sling/extensions/webconsolesecurityprovider/internal/ServicesListener.java
index 4dda83f..99d93d3 100644
--- a/src/main/java/org/apache/sling/extensions/webconsolesecurityprovider/internal/ServicesListener.java
+++ b/src/main/java/org/apache/sling/extensions/webconsolesecurityprovider/internal/ServicesListener.java
@@ -21,11 +21,14 @@ package org.apache.sling.extensions.webconsolesecurityprovider.internal;
 
 import java.util.Dictionary;
 import java.util.Hashtable;
+import java.util.concurrent.atomic.AtomicBoolean;
 
 import javax.jcr.Repository;
 
 import org.apache.felix.webconsole.WebConsoleSecurityProvider;
 import org.apache.sling.auth.core.AuthenticationSupport;
+import org.apache.sling.launchpad.api.StartupListener;
+import org.apache.sling.launchpad.api.StartupMode;
 import org.osgi.framework.BundleContext;
 import org.osgi.framework.Constants;
 import org.osgi.framework.InvalidSyntaxException;
@@ -39,7 +42,7 @@ import org.osgi.service.cm.ManagedService;
  * The <code>ServicesListener</code> listens for the required services
  * and registers the security provider when required services are available
  */
-public class ServicesListener {
+public class ServicesListener implements StartupListener {
 
     private static final String AUTH_SUPPORT_CLASS = AuthenticationSupport.class.getName();
     private static final String REPO_CLASS = Repository.class.getName();
@@ -68,6 +71,9 @@ public class ServicesListener {
     /** The registration for the provider2 */
     private ServiceRegistration provider2Reg;
 
+    /** Flag for marking if startup is finished. */
+    private final AtomicBoolean startupFinished = new AtomicBoolean(false);
+
     /**
      * Start listeners
      */
@@ -80,11 +86,36 @@ public class ServicesListener {
     }
 
     /**
+     * @see org.apache.sling.launchpad.api.StartupListener#inform(org.apache.sling.launchpad.api.StartupMode, boolean)
+     */
+    public void inform(final StartupMode mode, final boolean finished) {
+        if ( finished && this.startupFinished.compareAndSet(false, true) ) {
+            notifyChange();
+        }
+    }
+
+    /**
+     * @see org.apache.sling.launchpad.api.StartupListener#startupFinished(org.apache.sling.launchpad.api.StartupMode)
+     */
+    public void startupFinished(final StartupMode mode) {
+        if ( this.startupFinished.compareAndSet(false, true) ) {
+            notifyChange();
+        }
+    }
+
+    /**
+     * @see org.apache.sling.launchpad.api.StartupListener#startupProgress(float)
+     */
+    public void startupProgress(float arg0) {
+        // nothing to do
+    }
+
+    /**
      * Notify of service changes from the listeners.
      */
     public synchronized void notifyChange() {
         // check if all services are available
-        final Object authSupport = this.authSupportListener.getService();
+        final Object authSupport = this.startupFinished.get() ? this.authSupportListener.getService() : null;
         final Object repository = this.repositoryListener.getService();
         if ( registrationState == State.NONE ) {
             if ( authSupport != null ) {

-- 
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.

[sling-org-apache-sling-extensions-webconsolesecurityprovider] 06/08: SLING-3273 : Switch to login page if user is not allowed to access the web console

Posted by ro...@apache.org.
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.1.2
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-extensions-webconsolesecurityprovider.git

commit 36082cf10ea8fded751eb23baf030aa7ade03771
Author: Carsten Ziegeler <cz...@apache.org>
AuthorDate: Tue Dec 10 05:37:09 2013 +0000

    SLING-3273 : Switch to login page if user is not allowed to access the web console
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/bundles/extensions/webconsolesecurityprovider@1549762 13f79535-47bb-0310-9956-ffa450edef68
---
 .../internal/SlingWebConsoleSecurityProvider2.java                  | 6 ------
 1 file changed, 6 deletions(-)

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 8762a58..4d55d2d 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
@@ -51,12 +51,6 @@ public class SlingWebConsoleSecurityProvider2
     extends AbstractWebConsoleSecurityProvider
     implements WebConsoleSecurityProvider2 {
 
-    private static final String HEADER_WWW_AUTHENTICATE = "WWW-Authenticate";
-
-    private static final String AUTHENTICATION_SCHEME_BASIC = "Basic";
-
-    private static final String DEFAULT_REALM = "OSGi Management Console"; //$NON-NLS-1$
-
     private final AuthenticationSupport authentiationSupport;
 
     private final Authenticator authenticator;

-- 
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.

[sling-org-apache-sling-extensions-webconsolesecurityprovider] 02/08: SLING-3271 : Make Sling imports dynamic

Posted by ro...@apache.org.
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.1.2
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-extensions-webconsolesecurityprovider.git

commit 739bbc56c300d439b85e5e9e019d997cf5528417
Author: Carsten Ziegeler <cz...@apache.org>
AuthorDate: Tue Dec 10 04:07:10 2013 +0000

    SLING-3271 : Make Sling imports dynamic
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/bundles/extensions/webconsolesecurityprovider@1549754 13f79535-47bb-0310-9956-ffa450edef68
---
 pom.xml                                            |  9 ++++++
 .../internal/ServicesListener.java                 | 32 ++++++++--------------
 .../internal/SlingWebConsoleSecurityProvider.java  |  5 ++--
 .../internal/SlingWebConsoleSecurityProvider2.java |  6 ++--
 4 files changed, 26 insertions(+), 26 deletions(-)

diff --git a/pom.xml b/pom.xml
index c4650a2..31c1f3a 100644
--- a/pom.xml
+++ b/pom.xml
@@ -61,6 +61,15 @@
                         <Bundle-Activator>
                             org.apache.sling.extensions.webconsolesecurityprovider.internal.Activator
                         </Bundle-Activator>
+                        <Import-Package>
+                            !org.apache.sling.auth.core,
+                            !org.apache.sling.api.resource,
+                            *
+                        </Import-Package>
+                        <DynamicImport-Package>
+                            org.apache.sling.api.resource;version="[2.3,3)",
+                            org.apache.sling.auth.core;version="[1.0,2)"
+                        </DynamicImport-Package>
                     </instructions>                
                 </configuration>
             </plugin>
diff --git a/src/main/java/org/apache/sling/extensions/webconsolesecurityprovider/internal/ServicesListener.java b/src/main/java/org/apache/sling/extensions/webconsolesecurityprovider/internal/ServicesListener.java
index fad370e..4dda83f 100644
--- a/src/main/java/org/apache/sling/extensions/webconsolesecurityprovider/internal/ServicesListener.java
+++ b/src/main/java/org/apache/sling/extensions/webconsolesecurityprovider/internal/ServicesListener.java
@@ -41,6 +41,9 @@ import org.osgi.service.cm.ManagedService;
  */
 public class ServicesListener {
 
+    private static final String AUTH_SUPPORT_CLASS = AuthenticationSupport.class.getName();
+    private static final String REPO_CLASS = Repository.class.getName();
+
     /** The bundle context. */
     private final BundleContext bundleContext;
 
@@ -50,10 +53,6 @@ public class ServicesListener {
     /** The listener for the authentication support. */
     private final Listener authSupportListener;
 
-    private final SlingWebConsoleSecurityProvider provider = new SlingWebConsoleSecurityProvider();
-
-    private final SlingWebConsoleSecurityProvider2 provider2 = new SlingWebConsoleSecurityProvider2();
-
     private enum State {
         NONE,
         PROVIDER,
@@ -69,14 +68,13 @@ public class ServicesListener {
     /** The registration for the provider2 */
     private ServiceRegistration provider2Reg;
 
-
     /**
      * Start listeners
      */
     public ServicesListener(final BundleContext bundleContext) {
         this.bundleContext = bundleContext;
-        this.authSupportListener = new Listener(AuthenticationSupport.class.getName());
-        this.repositoryListener = new Listener(Repository.class.getName());
+        this.authSupportListener = new Listener(AUTH_SUPPORT_CLASS);
+        this.repositoryListener = new Listener(REPO_CLASS);
         this.authSupportListener.start();
         this.repositoryListener.start();
     }
@@ -86,8 +84,8 @@ public class ServicesListener {
      */
     public synchronized void notifyChange() {
         // check if all services are available
-        final AuthenticationSupport authSupport = (AuthenticationSupport)this.authSupportListener.getService();
-        final Repository repository = (Repository)this.repositoryListener.getService();
+        final Object authSupport = this.authSupportListener.getService();
+        final Object repository = this.repositoryListener.getService();
         if ( registrationState == State.NONE ) {
             if ( authSupport != null ) {
                 registerProvider2(authSupport);
@@ -101,8 +99,6 @@ public class ServicesListener {
             } else if ( repository == null ) {
                 unregisterProvider();
                 this.registrationState = State.NONE;
-            } else {
-                this.provider.setService(repository);
             }
         } else {
             if ( authSupport == null ) {
@@ -112,8 +108,6 @@ public class ServicesListener {
                     this.registrationState = State.NONE;
                 }
                 unregisterProvider2();
-            } else {
-                this.provider2.setService(authSupport);
             }
         }
     }
@@ -123,7 +117,6 @@ public class ServicesListener {
             this.provider2Reg.unregister();
             this.provider2Reg = null;
         }
-        this.provider2.setService(null);
     }
 
     private void unregisterProvider() {
@@ -131,28 +124,25 @@ public class ServicesListener {
             this.providerReg.unregister();
             this.providerReg = null;
         }
-        this.provider.setService(null);
     }
 
-    private void registerProvider2(final AuthenticationSupport authSupport) {
-        this.provider2.setService(authSupport);
+    private void registerProvider2(final Object authSupport) {
         final Dictionary<String, Object> props = new Hashtable<String, Object>();
         props.put(Constants.SERVICE_PID, SlingWebConsoleSecurityProvider.class.getName());
         props.put(Constants.SERVICE_DESCRIPTION, "Apache Sling Web Console Security Provider 2");
         props.put(Constants.SERVICE_VENDOR, "The Apache Software Foundation");
         this.provider2Reg = this.bundleContext.registerService(
-            new String[] {ManagedService.class.getName(), WebConsoleSecurityProvider.class.getName()}, this.provider2, props);
+            new String[] {ManagedService.class.getName(), WebConsoleSecurityProvider.class.getName()}, new SlingWebConsoleSecurityProvider2(authSupport), props);
         this.registrationState = State.PROVIDER2;
     }
 
-    private void registerProvider(final Repository repository) {
-        this.provider.setService(repository);
+    private void registerProvider(final Object repository) {
         final Dictionary<String, Object> props = new Hashtable<String, Object>();
         props.put(Constants.SERVICE_PID, SlingWebConsoleSecurityProvider.class.getName());
         props.put(Constants.SERVICE_DESCRIPTION, "Apache Sling Web Console Security Provider");
         props.put(Constants.SERVICE_VENDOR, "The Apache Software Foundation");
         this.providerReg = this.bundleContext.registerService(
-            new String[] {ManagedService.class.getName(), WebConsoleSecurityProvider.class.getName()}, this.provider, props);
+            new String[] {ManagedService.class.getName(), WebConsoleSecurityProvider.class.getName()}, new SlingWebConsoleSecurityProvider(repository), props);
         this.registrationState = State.PROVIDER;
     }
 
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 566da32..37454e2 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
@@ -72,9 +72,10 @@ public class SlingWebConsoleSecurityProvider extends AbstractWebConsoleSecurityP
 
     private Repository repository;
 
-    public void setService(final Repository repo) {
-        this.repository = repo;
+    public SlingWebConsoleSecurityProvider(final Object repository) {
+        this.repository = (Repository)repository;
     }
+
     // ---------- SCR integration
 
     /**
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 8a8f1a2..7521fc9 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
@@ -50,10 +50,10 @@ public class SlingWebConsoleSecurityProvider2
     extends AbstractWebConsoleSecurityProvider
     implements WebConsoleSecurityProvider2 {
 
-    private AuthenticationSupport authenticator;
+    private final AuthenticationSupport authenticator;
 
-    public void setService(final AuthenticationSupport support) {
-        this.authenticator = support;
+    public SlingWebConsoleSecurityProvider2(final Object support) {
+        this.authenticator = (AuthenticationSupport)support;
     }
 
     private void invokeAuthenticator(final HttpServletRequest request, final HttpServletResponse response) {

-- 
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.

[sling-org-apache-sling-extensions-webconsolesecurityprovider] 08/08: [maven-release-plugin] copy for tag org.apache.sling.extensions.webconsolesecurityprovider-1.1.2

Posted by ro...@apache.org.
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.1.2
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-extensions-webconsolesecurityprovider.git

commit 896cc0cfb0be188ff860760e06c45691f5491b09
Author: Carsten Ziegeler <cz...@apache.org>
AuthorDate: Wed Dec 11 23:13:21 2013 +0000

    [maven-release-plugin]  copy for tag org.apache.sling.extensions.webconsolesecurityprovider-1.1.2
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/tags/org.apache.sling.extensions.webconsolesecurityprovider-1.1.2@1550310 13f79535-47bb-0310-9956-ffa450edef68

-- 
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.

[sling-org-apache-sling-extensions-webconsolesecurityprovider] 04/08: SLING-3273 : Switch to login page if user is not allowed to access the web console

Posted by ro...@apache.org.
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.1.2
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-extensions-webconsolesecurityprovider.git

commit f56c18c6a1a4d7ef1dbb95e22ed708e5a927a6ad
Author: Carsten Ziegeler <cz...@apache.org>
AuthorDate: Tue Dec 10 05:23:38 2013 +0000

    SLING-3273 : Switch to login page if user is not allowed to access the web console
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/bundles/extensions/webconsolesecurityprovider@1549759 13f79535-47bb-0310-9956-ffa450edef68
---
 .../internal/ServicesListener.java                 | 25 ++++++---
 .../internal/SlingWebConsoleSecurityProvider2.java | 59 ++++++++++++----------
 2 files changed, 50 insertions(+), 34 deletions(-)

diff --git a/src/main/java/org/apache/sling/extensions/webconsolesecurityprovider/internal/ServicesListener.java b/src/main/java/org/apache/sling/extensions/webconsolesecurityprovider/internal/ServicesListener.java
index 99d93d3..cb8663b 100644
--- a/src/main/java/org/apache/sling/extensions/webconsolesecurityprovider/internal/ServicesListener.java
+++ b/src/main/java/org/apache/sling/extensions/webconsolesecurityprovider/internal/ServicesListener.java
@@ -26,6 +26,7 @@ import java.util.concurrent.atomic.AtomicBoolean;
 import javax.jcr.Repository;
 
 import org.apache.felix.webconsole.WebConsoleSecurityProvider;
+import org.apache.sling.api.auth.Authenticator;
 import org.apache.sling.auth.core.AuthenticationSupport;
 import org.apache.sling.launchpad.api.StartupListener;
 import org.apache.sling.launchpad.api.StartupMode;
@@ -45,6 +46,7 @@ import org.osgi.service.cm.ManagedService;
 public class ServicesListener implements StartupListener {
 
     private static final String AUTH_SUPPORT_CLASS = AuthenticationSupport.class.getName();
+    private static final String AUTHENTICATOR_CLASS = Authenticator.class.getName();
     private static final String REPO_CLASS = Repository.class.getName();
 
     /** The bundle context. */
@@ -56,6 +58,9 @@ public class ServicesListener implements StartupListener {
     /** The listener for the authentication support. */
     private final Listener authSupportListener;
 
+    /** The listener for the authenticator. */
+    private final Listener authListener;
+
     private enum State {
         NONE,
         PROVIDER,
@@ -81,8 +86,10 @@ public class ServicesListener implements StartupListener {
         this.bundleContext = bundleContext;
         this.authSupportListener = new Listener(AUTH_SUPPORT_CLASS);
         this.repositoryListener = new Listener(REPO_CLASS);
+        this.authListener = new Listener(AUTHENTICATOR_CLASS);
         this.authSupportListener.start();
         this.repositoryListener.start();
+        this.authListener.start();
     }
 
     /**
@@ -106,7 +113,7 @@ public class ServicesListener implements StartupListener {
     /**
      * @see org.apache.sling.launchpad.api.StartupListener#startupProgress(float)
      */
-    public void startupProgress(float arg0) {
+    public void startupProgress(final float progress) {
         // nothing to do
     }
 
@@ -116,16 +123,18 @@ public class ServicesListener implements StartupListener {
     public synchronized void notifyChange() {
         // check if all services are available
         final Object authSupport = this.startupFinished.get() ? this.authSupportListener.getService() : null;
+        final Object authenticator = this.startupFinished.get() ? this.authListener.getService() : null;
+        final boolean hasAuthServices = authSupport != null && authenticator != null;
         final Object repository = this.repositoryListener.getService();
         if ( registrationState == State.NONE ) {
-            if ( authSupport != null ) {
-                registerProvider2(authSupport);
+            if ( hasAuthServices ) {
+                registerProvider2(authSupport, authenticator);
             } else if ( repository != null ) {
                 registerProvider(repository);
             }
         } else if ( registrationState == State.PROVIDER ) {
-            if ( authSupport != null ) {
-                registerProvider2(authSupport);
+            if ( hasAuthServices ) {
+                registerProvider2(authSupport, authenticator);
                 unregisterProvider();
             } else if ( repository == null ) {
                 unregisterProvider();
@@ -157,13 +166,14 @@ public class ServicesListener implements StartupListener {
         }
     }
 
-    private void registerProvider2(final Object authSupport) {
+    private void registerProvider2(final Object authSupport, final Object authenticator) {
         final Dictionary<String, Object> props = new Hashtable<String, Object>();
         props.put(Constants.SERVICE_PID, SlingWebConsoleSecurityProvider.class.getName());
         props.put(Constants.SERVICE_DESCRIPTION, "Apache Sling Web Console Security Provider 2");
         props.put(Constants.SERVICE_VENDOR, "The Apache Software Foundation");
         this.provider2Reg = this.bundleContext.registerService(
-            new String[] {ManagedService.class.getName(), WebConsoleSecurityProvider.class.getName()}, new SlingWebConsoleSecurityProvider2(authSupport), props);
+            new String[] {ManagedService.class.getName(), WebConsoleSecurityProvider.class.getName()},
+                          new SlingWebConsoleSecurityProvider2(authSupport, authenticator), props);
         this.registrationState = State.PROVIDER2;
     }
 
@@ -183,6 +193,7 @@ public class ServicesListener implements StartupListener {
     public void deactivate() {
         this.repositoryListener.deactivate();
         this.authSupportListener.deactivate();
+        this.authListener.deactivate();
         this.unregisterProvider();
         this.unregisterProvider2();
     }
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 7521fc9..8762a58 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
@@ -31,6 +31,7 @@ import org.apache.jackrabbit.api.security.user.Authorizable;
 import org.apache.jackrabbit.api.security.user.Group;
 import org.apache.jackrabbit.api.security.user.User;
 import org.apache.jackrabbit.api.security.user.UserManager;
+import org.apache.sling.api.auth.Authenticator;
 import org.apache.sling.api.resource.ResourceResolver;
 import org.apache.sling.auth.core.AuthenticationSupport;
 
@@ -50,17 +51,19 @@ public class SlingWebConsoleSecurityProvider2
     extends AbstractWebConsoleSecurityProvider
     implements WebConsoleSecurityProvider2 {
 
-    private final AuthenticationSupport authenticator;
+    private static final String HEADER_WWW_AUTHENTICATE = "WWW-Authenticate";
 
-    public SlingWebConsoleSecurityProvider2(final Object support) {
-        this.authenticator = (AuthenticationSupport)support;
-    }
+    private static final String AUTHENTICATION_SCHEME_BASIC = "Basic";
 
-    private void invokeAuthenticator(final HttpServletRequest request, final HttpServletResponse response) {
-        final AuthenticationSupport localAuthenticator = this.authenticator;
-        if (localAuthenticator != null) {
-            localAuthenticator.handleSecurity(request, response);
-        }
+    private static final String DEFAULT_REALM = "OSGi Management Console"; //$NON-NLS-1$
+
+    private final AuthenticationSupport authentiationSupport;
+
+    private final Authenticator authenticator;
+
+    public SlingWebConsoleSecurityProvider2(final Object support, final Object authenticator) {
+        this.authentiationSupport = (AuthenticationSupport)support;
+        this.authenticator = (Authenticator)authenticator;
     }
 
     /**
@@ -68,27 +71,29 @@ public class SlingWebConsoleSecurityProvider2
      */
     public boolean authenticate(final HttpServletRequest request,
             final HttpServletResponse response) {
-        invokeAuthenticator(request, response);
-        // get ResourceResolver (set by AuthenticationSupport)
-        Object resolverObject = request.getAttribute(AuthenticationSupport.REQUEST_ATTRIBUTE_RESOLVER);
-        final ResourceResolver resolver = (resolverObject instanceof ResourceResolver)
-                ? (ResourceResolver) resolverObject
-                : null;
-        if ( resolver != null ) {
-            final Session session = resolver.adaptTo(Session.class);
-            if ( session != null ) {
-                try {
-                    final User u = this.authenticate(session);
-                    if ( u != null ) {
-                        request.setAttribute(USER_ATTRIBUTE, u);
-                        return true;
+        if ( this.authentiationSupport.handleSecurity(request, response) ) {
+            // get ResourceResolver (set by AuthenticationSupport)
+            Object resolverObject = request.getAttribute(AuthenticationSupport.REQUEST_ATTRIBUTE_RESOLVER);
+            final ResourceResolver resolver = (resolverObject instanceof ResourceResolver)
+                    ? (ResourceResolver) resolverObject
+                    : null;
+            if ( resolver != null ) {
+                final Session session = resolver.adaptTo(Session.class);
+                if ( session != null ) {
+                    try {
+                        final User u = this.authenticate(session);
+                        if ( u != null ) {
+                            request.setAttribute(USER_ATTRIBUTE, u);
+                            return true;
+                        }
+                    } catch (final Exception re) {
+                        logger.info("authenticate: Generic problem trying grant User "
+                            + " access to the Web Console", re);
                     }
-                    return false;
-                } catch (final Exception re) {
-                    logger.info("authenticate: Generic problem trying grant User "
-                        + " access to the Web Console", re);
                 }
             }
+
+            this.authenticator.login(request, response);
         }
         return false;
     }

-- 
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.