Author: reto
Date: Fri Oct  5 22:49:45 2012
New Revision: 1394853

URL: http://svn.apache.org/viewvc?rev=1394853&view=rev
Log:
STANBOL-721: added Felix WebConsole Security provider

Added:
    stanbol/trunk/commons/security/felixwebconsole/   (props changed)
      - copied from r1394801, stanbol/trunk/commons/security/core/
    
stanbol/trunk/commons/security/felixwebconsole/src/main/java/org/apache/stanbol/commons/security/auth/felix/
    
stanbol/trunk/commons/security/felixwebconsole/src/main/java/org/apache/stanbol/commons/security/auth/felix/WebConsoleSecurityProvider.java
Removed:
    
stanbol/trunk/commons/security/felixwebconsole/src/main/java/org/apache/stanbol/commons/security/PasswordUtil.java
    
stanbol/trunk/commons/security/felixwebconsole/src/main/java/org/apache/stanbol/commons/security/PermissionDefinitions.java
    
stanbol/trunk/commons/security/felixwebconsole/src/main/java/org/apache/stanbol/commons/security/SecurityActivator.java
    
stanbol/trunk/commons/security/felixwebconsole/src/main/java/org/apache/stanbol/commons/security/UserAwarePolicy.java
    
stanbol/trunk/commons/security/felixwebconsole/src/main/java/org/apache/stanbol/commons/security/UserPermissionsCache.java
    
stanbol/trunk/commons/security/felixwebconsole/src/main/java/org/apache/stanbol/commons/security/UserUnregisteredException.java
    
stanbol/trunk/commons/security/felixwebconsole/src/main/java/org/apache/stanbol/commons/security/UserUtil.java
    
stanbol/trunk/commons/security/felixwebconsole/src/main/java/org/apache/stanbol/commons/security/WebIdBasedPermissionProvider.java
    
stanbol/trunk/commons/security/felixwebconsole/src/main/java/org/apache/stanbol/commons/security/auth/AuthenticatingFilter.java
    
stanbol/trunk/commons/security/felixwebconsole/src/main/java/org/apache/stanbol/commons/security/auth/AuthenticationChecker.java
    
stanbol/trunk/commons/security/felixwebconsole/src/main/java/org/apache/stanbol/commons/security/auth/AuthenticationCheckerImpl.java
    
stanbol/trunk/commons/security/felixwebconsole/src/main/java/org/apache/stanbol/commons/security/auth/AuthenticationMethod.java
    
stanbol/trunk/commons/security/felixwebconsole/src/main/java/org/apache/stanbol/commons/security/auth/AuthenticationService.java
    
stanbol/trunk/commons/security/felixwebconsole/src/main/java/org/apache/stanbol/commons/security/auth/CheckAuthenticationPermission.java
    
stanbol/trunk/commons/security/felixwebconsole/src/main/java/org/apache/stanbol/commons/security/auth/LoginException.java
    
stanbol/trunk/commons/security/felixwebconsole/src/main/java/org/apache/stanbol/commons/security/auth/LoginListener.java
    
stanbol/trunk/commons/security/felixwebconsole/src/main/java/org/apache/stanbol/commons/security/auth/NoSuchAgent.java
    
stanbol/trunk/commons/security/felixwebconsole/src/main/java/org/apache/stanbol/commons/security/auth/PrincipalImpl.java
    
stanbol/trunk/commons/security/felixwebconsole/src/main/java/org/apache/stanbol/commons/security/auth/WeightedAuthenticationMethod.java
    stanbol/trunk/commons/security/felixwebconsole/src/main/resources/META-INF/
    
stanbol/trunk/commons/security/felixwebconsole/src/test/java/org/apache/stanbol/commons/security/
Modified:
    stanbol/trunk/commons/security/felixwebconsole/pom.xml

Propchange: stanbol/trunk/commons/security/felixwebconsole/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Fri Oct  5 22:49:45 2012
@@ -0,0 +1,4 @@
+target
+.classpath
+.project
+.settings

Modified: stanbol/trunk/commons/security/felixwebconsole/pom.xml
URL: 
http://svn.apache.org/viewvc/stanbol/trunk/commons/security/felixwebconsole/pom.xml?rev=1394853&r1=1394801&r2=1394853&view=diff
==============================================================================
--- stanbol/trunk/commons/security/felixwebconsole/pom.xml (original)
+++ stanbol/trunk/commons/security/felixwebconsole/pom.xml Fri Oct  5 22:49:45 
2012
@@ -30,14 +30,12 @@
   </parent>
 
   <groupId>org.apache.stanbol</groupId>
-  <artifactId>org.apache.stanbol.commons.security</artifactId>
+  <artifactId>org.apache.stanbol.commons.security.fexilwebconsole</artifactId>
   <version>0.10.0-SNAPSHOT</version>
   <packaging>bundle</packaging>
 
-  <name>Apache Stanbol Commons Security</name>
-  <description>An Servlet Filter authenticating the user if a security 
exception 
-  occurs and executes the following handling chain as the authenticated user.
-  Significant portions of the code are ported from apache clerezza 
platform.security</description>
+  <name>Apache Stanbol Commons Felix Webconsole Security Provider</name>
+  <description>Provides Stanbol security to the Felix Webconsole</description>
   <build>
     <!-- make it an OSGi bundle -->
     <plugins>
@@ -65,50 +63,20 @@
                        <artifactId>junit</artifactId>
                        <scope>test</scope>
                </dependency>
+               
                <dependency>
-                       <groupId>org.easymock</groupId>
-                       <artifactId>easymock</artifactId>
-                       <scope>test</scope>
-                       <version>3.1</version>
-               </dependency>
-               <dependency>
-                       <groupId>org.apache.clerezza</groupId>
-                       <artifactId>rdf.jena.parser</artifactId>
-                       <scope>test</scope>
-               </dependency>
-               <dependency>
-                       <groupId>org.apache.clerezza</groupId>
-                       <artifactId>rdf.core</artifactId>
-               </dependency>
-               <dependency>
-                       <groupId>org.apache.clerezza</groupId>
-                       <artifactId>rdf.ontologies</artifactId>
-               </dependency>
-               <dependency>
-                       <groupId>org.osgi</groupId>
-                       <artifactId>org.osgi.core</artifactId>
-               </dependency>
-               <dependency>
-                       <groupId>org.osgi</groupId>
-                       <artifactId>org.osgi.compendium</artifactId>
+                       <groupId>javax.servlet</groupId>
+                       <artifactId>servlet-api</artifactId>
                </dependency>
-               <dependency>
+        <dependency>
+         <groupId>org.apache.felix</groupId>
+         <artifactId>org.apache.felix.webconsole</artifactId>
+         <version>4.0.0</version>
+         <type>jar</type>
+        </dependency>
+        <dependency>
                        <groupId>org.apache.felix</groupId>
                        
<artifactId>org.apache.felix.scr.annotations</artifactId>
                </dependency>
-               <dependency>
-                       <groupId>org.apache.clerezza</groupId>
-                       <artifactId>platform.config</artifactId>
-                       <version>0.3-incubating</version>
-               </dependency>
-               <!-- <dependency>
-                       <groupId>org.apache.clerezza</groupId>
-                       <artifactId>permissiondescriptions</artifactId>
-                       <version>0.1-incubating</version>
-               </dependency>  -->
-               <dependency>
-                       <groupId>javax.servlet</groupId>
-                       <artifactId>servlet-api</artifactId>
-               </dependency>
        </dependencies>
 </project>

Added: 
stanbol/trunk/commons/security/felixwebconsole/src/main/java/org/apache/stanbol/commons/security/auth/felix/WebConsoleSecurityProvider.java
URL: 
http://svn.apache.org/viewvc/stanbol/trunk/commons/security/felixwebconsole/src/main/java/org/apache/stanbol/commons/security/auth/felix/WebConsoleSecurityProvider.java?rev=1394853&view=auto
==============================================================================
--- 
stanbol/trunk/commons/security/felixwebconsole/src/main/java/org/apache/stanbol/commons/security/auth/felix/WebConsoleSecurityProvider.java
 (added)
+++ 
stanbol/trunk/commons/security/felixwebconsole/src/main/java/org/apache/stanbol/commons/security/auth/felix/WebConsoleSecurityProvider.java
 Fri Oct  5 22:49:45 2012
@@ -0,0 +1,42 @@
+package org.apache.stanbol.commons.security.auth.felix;
+
+import java.security.AccessController;
+import java.security.AllPermission;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.apache.felix.scr.annotations.Component;
+import org.apache.felix.scr.annotations.Service;
+import org.apache.felix.webconsole.WebConsoleSecurityProvider2;
+
+
+/**
+ * Provides a Felix WebConsole Security provider that relies on Stanbol 
Security
+ */
+@Component
+@Service(org.apache.felix.webconsole.WebConsoleSecurityProvider.class)
+public class WebConsoleSecurityProvider implements WebConsoleSecurityProvider2 
{
+
+       @Override
+       public Object authenticate(String username, String password) {
+               // this method should not be called 
+               return null;
+       }
+
+       @Override
+       public boolean authorize(Object user, String role) {
+               // TODO permission checking
+               return false;
+       }
+
+       @Override
+       public boolean authenticate(HttpServletRequest request,
+                       HttpServletResponse response) {
+               // surprisingly this works even when stanbol is started without 
-s for securitymanager
+               //TODO check for some more concrete permission
+               AccessController.checkPermission(new AllPermission());
+               return true;
+       }
+
+}


Reply via email to