]> source.dussan.org Git - archiva.git/commitdiff
Add security bypass back to repo servlet tests
authorJames William Dumay <jdumay@apache.org>
Wed, 25 Feb 2009 03:44:17 +0000 (03:44 +0000)
committerJames William Dumay <jdumay@apache.org>
Wed, 25 Feb 2009 03:44:17 +0000 (03:44 +0000)
resourcecontext should have accessor for principal

git-svn-id: https://svn.apache.org/repos/asf/archiva/branches/archiva-with-new-repoapi@747651 13f79535-47bb-0310-9956-ffa450edef68

archiva-modules/archiva-base/archiva-repository-api/pom.xml
archiva-modules/archiva-base/archiva-repository-api/src/main/java/org/apache/archiva/repository/api/MutableResourceContext.java
archiva-modules/archiva-base/archiva-repository-api/src/main/java/org/apache/archiva/repository/api/ResourceContext.java
archiva-modules/archiva-web/archiva-repository-servlet/pom.xml
archiva-modules/archiva-web/archiva-repository-servlet/src/test/resources/org/apache/archiva/web/servlet/RepositoryServletTest.xml

index d3f24cc74587a469695fe9ad5e18fb28e9ace08b..c3be1ccce4cba43350c3cdf801ccbb88304469e5 100644 (file)
@@ -28,7 +28,7 @@
     <modelVersion>4.0.0</modelVersion>
     <artifactId>archiva-repository-api</artifactId>
     <version>1.2-SNAPSHOT</version>
-    <name>Apache Base :: Repository API</name>
+    <name>Archiva Base :: Repository API</name>
     <dependencies>
         <dependency>
             <groupId>commons-io</groupId>
index 84f99e89d4da8f7486601f32c2202c2e1780c359..9ac3e330ce6c8b320d1b2ae7169f58a6242c9b22 100644 (file)
@@ -31,6 +31,8 @@ public class MutableResourceContext implements ResourceContext
 
     private String repositoryId;
 
+    private String principal;
+
     public MutableResourceContext(ResourceContext context)
     {
         this.context = context;
@@ -54,6 +56,24 @@ public class MutableResourceContext implements ResourceContext
         return context.getRepositoryId();
     }
 
+    public String getPrincipal()
+    {
+        if (principal != null)
+        {
+            return principal;
+        }
+        return context.getPrincipal();
+    }
+
+    /**
+     * Sets the principal overriding the internal principal value
+     * @param principal
+     */
+    public void setPrincipal(String principal)
+    {
+        this.principal = principal;
+    }
+
     /**
      * Sets the logicalPath overriding the internal logical path value
      * @param logicalPath
index 94514dbc1850ac99b630aac55b7e3df483bfedba..28783ad87d631880850311bbf428b0c23b77cc83 100644 (file)
@@ -35,4 +35,10 @@ public interface ResourceContext
      * @return
      */
     String getRepositoryId();
+
+    /**
+     * Get the principal used for the resource request
+     * @return
+     */
+    String getPrincipal();
 }
index 0e4a3430b3e2166119c7e46eb8a45b4944a1f345..baf946878a8c5d022b36290af71ce737fd5f12aa 100644 (file)
             <groupId>org.slf4j</groupId>
             <artifactId>slf4j-api</artifactId>
         </dependency>
+        <dependency>
+            <groupId>org.apache.archiva</groupId>
+            <artifactId>archiva-security</artifactId>
+        </dependency>
         <dependency>
             <groupId>org.apache.archiva</groupId>
             <artifactId>archiva-proxy</artifactId>
index 8b546e4f2bcf691c1783b3699395177c2b1d9b62..ef61c1265a2f3a804b90ed454719ae381481bf44 100644 (file)
         </properties>
       </configuration>
     </component>
+
+    <component>
+      <role>org.codehaus.plexus.redback.system.SecuritySystem</role>
+      <role-hint>default</role-hint>
+      <implementation>org.apache.archiva.web.servlet.BypassSecuritySystem</implementation>
+    </component>
     
     <component>
       <role>org.codehaus.plexus.cache.Cache</role>