archiva-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From marti...@apache.org
Subject [2/5] archiva git commit: Adding Header check to archiva rest services
Date Fri, 10 Mar 2017 22:51:25 GMT
Adding Header check to archiva rest services


Project: http://git-wip-us.apache.org/repos/asf/archiva/repo
Commit: http://git-wip-us.apache.org/repos/asf/archiva/commit/fc41a798
Tree: http://git-wip-us.apache.org/repos/asf/archiva/tree/fc41a798
Diff: http://git-wip-us.apache.org/repos/asf/archiva/diff/fc41a798

Branch: refs/heads/master
Commit: fc41a798858b6362a50f4b49e28028d328246602
Parents: 65e04d6
Author: Martin Stockhammer <martin_s@apache.org>
Authored: Tue Jan 31 22:56:50 2017 +0100
Committer: Martin Stockhammer <martin_s@apache.org>
Committed: Tue Jan 31 22:56:50 2017 +0100

----------------------------------------------------------------------
 .../src/main/resources/META-INF/spring-context.xml          | 1 +
 .../archiva/rest/services/AbstractArchivaRestTest.java      | 9 +++++++++
 .../archiva/rest/services/RepositoryGroupServiceTest.java   | 2 ++
 3 files changed, 12 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/archiva/blob/fc41a798/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/resources/META-INF/spring-context.xml
----------------------------------------------------------------------
diff --git a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/resources/META-INF/spring-context.xml
b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/resources/META-INF/spring-context.xml
index 77d365c..c9e677d 100644
--- a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/resources/META-INF/spring-context.xml
+++ b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/resources/META-INF/spring-context.xml
@@ -52,6 +52,7 @@
       <ref bean="jsonProvider"/>
       <ref bean="authenticationInterceptor#rest"/>
       <ref bean="permissionInterceptor#rest"/>
+      <ref bean="requestValidationInterceptor#rest" />
       <ref bean="archivaRestServiceExceptionMapper"/>
     </jaxrs:providers>
 

http://git-wip-us.apache.org/repos/asf/archiva/blob/fc41a798/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/java/org/apache/archiva/rest/services/AbstractArchivaRestTest.java
----------------------------------------------------------------------
diff --git a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/java/org/apache/archiva/rest/services/AbstractArchivaRestTest.java
b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/java/org/apache/archiva/rest/services/AbstractArchivaRestTest.java
index 2453e6a..acf9df5 100644
--- a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/java/org/apache/archiva/rest/services/AbstractArchivaRestTest.java
+++ b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/java/org/apache/archiva/rest/services/AbstractArchivaRestTest.java
@@ -138,6 +138,7 @@ public abstract class AbstractArchivaRestTest
         {
             WebClient.client( service ).header( "Authorization", authzHeader );
         }
+        WebClient.client(service).header("Referer","http://localhost:"+port);
         WebClient.getConfig( service ).getHttpConduit().getClient().setReceiveTimeout( 100000000
);
         WebClient.client( service ).accept( MediaType.APPLICATION_JSON_TYPE );
         WebClient.client( service ).type( MediaType.APPLICATION_JSON_TYPE );
@@ -200,6 +201,7 @@ public abstract class AbstractArchivaRestTest
                                        Collections.singletonList( new JacksonJaxbJsonProvider()
) );
 
         WebClient.client( service ).header( "Authorization", authorizationHeader );
+        WebClient.client(service).header("Referer","http://localhost:"+port);
         WebClient.getConfig( service ).getHttpConduit().getClient().setReceiveTimeout( 300000
);
         WebClient.client( service ).accept( MediaType.APPLICATION_JSON_TYPE );
         WebClient.client( service ).type( MediaType.APPLICATION_JSON_TYPE );
@@ -214,6 +216,7 @@ public abstract class AbstractArchivaRestTest
                                        Collections.singletonList( new JacksonJaxbJsonProvider()
) );
 
         WebClient.client( service ).header( "Authorization", authorizationHeader );
+        WebClient.client(service).header("Referer","http://localhost:"+port);
         WebClient.getConfig( service ).getHttpConduit().getClient().setReceiveTimeout( 300000
);
         WebClient.client( service ).accept( MediaType.APPLICATION_JSON_TYPE );
         WebClient.client( service ).type( MediaType.APPLICATION_JSON_TYPE );
@@ -231,6 +234,8 @@ public abstract class AbstractArchivaRestTest
         WebClient.client( service ).type( MediaType.APPLICATION_JSON_TYPE );
 
         WebClient.client( service ).header( "Authorization", authorizationHeader );
+        WebClient.client(service).header("Referer","http://localhost:"+port);
+
         WebClient.getConfig( service ).getHttpConduit().getClient().setReceiveTimeout( 300000
);
         return service;
     }
@@ -246,6 +251,7 @@ public abstract class AbstractArchivaRestTest
         WebClient.client( service ).type( MediaType.APPLICATION_JSON_TYPE );
 
         WebClient.client( service ).header( "Authorization", authorizationHeader );
+        WebClient.client(service).header("Referer","http://localhost:"+port);
         WebClient.getConfig( service ).getHttpConduit().getClient().setReceiveTimeout( 300000
);
         return service;
     }
@@ -262,6 +268,7 @@ public abstract class AbstractArchivaRestTest
         {
             WebClient.client( service ).header( "Authorization", authzHeader );
         }
+        WebClient.client(service).header("Referer","http://localhost:"+port);
 
         WebClient.getConfig( service ).getHttpConduit().getClient().setReceiveTimeout( 100000000
);
         if ( useXml )
@@ -291,6 +298,7 @@ public abstract class AbstractArchivaRestTest
         {
             WebClient.client( service ).header( "Authorization", authzHeader );
         }
+        WebClient.client(service).header("Referer","http://localhost:"+port);
         // to configure read timeout
         WebClient.getConfig( service ).getHttpConduit().getClient().setReceiveTimeout( 100000000
);
         // if you want to use json as exchange format xml is supported too
@@ -312,6 +320,7 @@ public abstract class AbstractArchivaRestTest
         {
             WebClient.client( service ).header( "Authorization", authzHeader );
         }
+        WebClient.client(service).header("Referer","http://localhost:"+port);
         WebClient.getConfig( service ).getHttpConduit().getClient().setReceiveTimeout( 100000000
);
         WebClient.client( service ).accept( MediaType.APPLICATION_JSON_TYPE );
         WebClient.client( service ).type( MediaType.APPLICATION_JSON_TYPE );

http://git-wip-us.apache.org/repos/asf/archiva/blob/fc41a798/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/java/org/apache/archiva/rest/services/RepositoryGroupServiceTest.java
----------------------------------------------------------------------
diff --git a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/java/org/apache/archiva/rest/services/RepositoryGroupServiceTest.java
b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/java/org/apache/archiva/rest/services/RepositoryGroupServiceTest.java
index 0175058..1fee4a3 100644
--- a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/java/org/apache/archiva/rest/services/RepositoryGroupServiceTest.java
+++ b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/java/org/apache/archiva/rest/services/RepositoryGroupServiceTest.java
@@ -39,6 +39,8 @@ public class RepositoryGroupServiceTest
     {
         RepositoryGroupService service = getRepositoryGroupService();
         WebClient.client( service ).header( "Authorization", authorizationHeader );
+        WebClient.client(service).header("Referer","http://localhost:"+port);
+
         WebClient.getConfig( service ).getHttpConduit().getClient().setReceiveTimeout( 300000
);
 
         assertTrue( service.getRepositoriesGroups().isEmpty() );


Mime
View raw message