]> source.dussan.org Git - archiva.git/commitdiff
[MRM-1736] map roles to ldap groups
authorOlivier Lamy <olamy@apache.org>
Tue, 8 Jan 2013 22:47:13 +0000 (22:47 +0000)
committerOlivier Lamy <olamy@apache.org>
Tue, 8 Jan 2013 22:47:13 +0000 (22:47 +0000)
git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1430606 13f79535-47bb-0310-9956-ffa450edef68

archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/AbstractRestService.java
archiva-modules/archiva-web/archiva-web-common/src/main/java/org/apache/archiva/web/security/ArchivaAuthorizer.java
archiva-modules/archiva-web/archiva-webapp/pom.xml
archiva-modules/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/applicationContext.xml
archiva-modules/archiva-web/archiva-webapp/src/test/tomcat/log4j2-test.xml
pom.xml

index b81d65c839e47f966039908e2c65a1430723f682..1951f7ad71c93fa14ab5a1629e127036f35a6cad 100644 (file)
@@ -30,6 +30,8 @@ import org.apache.archiva.maven2.model.Artifact;
 import org.apache.archiva.metadata.model.ArtifactMetadata;
 import org.apache.archiva.metadata.repository.RepositorySessionFactory;
 import org.apache.archiva.redback.components.taskqueue.TaskQueueException;
+import org.apache.archiva.redback.configuration.UserConfiguration;
+import org.apache.archiva.redback.configuration.UserConfigurationKeys;
 import org.apache.archiva.redback.rest.services.RedbackAuthenticationThreadLocal;
 import org.apache.archiva.redback.rest.services.RedbackRequestInformation;
 import org.apache.archiva.redback.users.User;
@@ -95,6 +97,11 @@ public abstract class AbstractRestService
     @Named(value = "archivaTaskScheduler#repository")
     protected DefaultRepositoryArchivaTaskScheduler repositoryTaskScheduler;
 
+
+    @Inject
+    @Named( value = "userConfiguration#default" )
+    protected UserConfiguration config;
+
     @Context
     protected HttpServletRequest httpServletRequest;
 
@@ -143,9 +150,9 @@ public abstract class AbstractRestService
         RedbackRequestInformation redbackRequestInformation = RedbackAuthenticationThreadLocal.get();
 
         return redbackRequestInformation == null
-            ? UserManager.GUEST_USERNAME
+            ? config.getString( UserConfigurationKeys.DEFAULT_GUEST )
             : ( redbackRequestInformation.getUser() == null
-                ? UserManager.GUEST_USERNAME
+                ? config.getString( UserConfigurationKeys.DEFAULT_GUEST )
                 : redbackRequestInformation.getUser().getUsername() );
     }
 
index 3ea5acd94a95502302953e19c6be7f9c02eff96e..d5f6c9eed3d472d73bd5460a881d7d28e8e1ad42 100644 (file)
@@ -43,6 +43,11 @@ public class ArchivaAuthorizer
     @Named( value = "authorizer#rbac" )
     private Authorizer rbacAuthorizer;
 
+
+    @Inject
+    @Named( value = "authorizer#ldap" )
+    private Authorizer ldapAuthorizer;
+
     public String getId()
     {
         return "archiva";
@@ -52,6 +57,11 @@ public class ArchivaAuthorizer
         throws AuthorizationException
     {
         log.debug( "isAuthorized source: {}", source );
+
+        AuthorizationResult result = ldapAuthorizer.isAuthorized( source );
+
+
+
         return rbacAuthorizer.isAuthorized( source );
     }
 
index 6344b9c51b0d54ddc77292042bcd32049d9ee682..9cea0581e45084115b06f85b63ed377812a58042 100644 (file)
       </exclusions>
     </dependency>
 
+    <dependency>
+      <groupId>org.apache.archiva.redback.components.registry</groupId>
+      <artifactId>spring-registry-api</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.archiva.redback.components.registry</groupId>
+      <artifactId>spring-registry-commons</artifactId>
+      <exclusions>
+        <exclusion>
+          <groupId>ant</groupId>
+          <artifactId>ant-optional</artifactId>
+        </exclusion>
+        <exclusion>
+          <groupId>jdom</groupId>
+          <artifactId>jdom</artifactId>
+        </exclusion>
+        <exclusion>
+          <groupId>commons-logging</groupId>
+          <artifactId>commons-logging-api</artifactId>
+        </exclusion>
+        <exclusion>
+          <groupId>commons-logging</groupId>
+          <artifactId>commons-logging</artifactId>
+        </exclusion>
+      </exclusions>
+    </dependency>
+
     <dependency>
       <groupId>org.apache.archiva</groupId>
       <artifactId>archiva-rest-api</artifactId>
       <groupId>org.apache.archiva.redback</groupId>
       <artifactId>redback-integrations-security</artifactId>
     </dependency>
+    <dependency>
+      <groupId>org.apache.archiva.redback</groupId>
+      <artifactId>redback-authorization-ldap</artifactId>
+      <exclusions>
+        <exclusion>
+          <groupId>commons-logging</groupId>
+          <artifactId>commons-logging</artifactId>
+        </exclusion>
+      </exclusions>
+    </dependency>
     <dependency>
       <groupId>org.slf4j</groupId>
       <artifactId>jcl-over-slf4j</artifactId>
index b55090452d63cc37f08a7c4914f80850550b6577..23d2b58acd97ccb162ce86b8afb1f5993496eadb 100644 (file)
@@ -56,7 +56,8 @@
   </bean>
 
   <!-- START SNIPPET: configuration-files-list -->
-  <bean name="commons-configuration" class="org.apache.archiva.redback.components.registry.commons.CommonsConfigurationRegistry">
+  <bean name="commons-configuration" class="org.apache.archiva.redback.components.registry.commons.CommonsConfigurationRegistry"
+    init-method="initialize">
     <property name="properties">
       <value>
         <![CDATA[
index aa94a6cac32cfce2d3062d045e1ce13a891dd723..9986ad7d33065a63c71da6043a0a11de8fa985d8 100644 (file)
@@ -85,6 +85,8 @@
 
     <logger name="org.apache.archiva.web.security.ArchivaAuthorizer" level="debug"/>
 
+    <logger name="org.apache.archiva.redback.components.registry.commons.CommonsConfigurationRegistry" level="debug"/>
+
     <root level="info">
       <appender-ref ref="console"/>
     </root>
diff --git a/pom.xml b/pom.xml
index 9c6a9d26451dcf9f1058b71c22b87d6d381fd138..b0da171082c1bb297fae05a63ae09d596173661c 100644 (file)
--- a/pom.xml
+++ b/pom.xml
           </exclusion>
         </exclusions>
       </dependency>
+      <dependency>
+        <groupId>org.apache.archiva.redback</groupId>
+        <artifactId>redback-authorization-ldap</artifactId>
+        <version>${redback.version}</version>
+        <exclusions>
+          <exclusion>
+            <groupId>commons-logging</groupId>
+            <artifactId>commons-logging</artifactId>
+          </exclusion>
+        </exclusions>
+      </dependency>
       <dependency>
         <groupId>org.apache.archiva.redback</groupId>
         <artifactId>redback-users-memory</artifactId>