You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@archiva.apache.org by ma...@apache.org on 2017/03/10 22:51:24 UTC
[1/5] archiva git commit: Adding Referer Header to REST tests
Repository: archiva
Updated Branches:
refs/heads/master 367997a30 -> a981c1847
Adding Referer Header to REST tests
Project: http://git-wip-us.apache.org/repos/asf/archiva/repo
Commit: http://git-wip-us.apache.org/repos/asf/archiva/commit/65e04d66
Tree: http://git-wip-us.apache.org/repos/asf/archiva/tree/65e04d66
Diff: http://git-wip-us.apache.org/repos/asf/archiva/diff/65e04d66
Branch: refs/heads/master
Commit: 65e04d66ce60621663effbcc35cd48c7e3da7ceb
Parents: 367997a
Author: Martin Stockhammer <ma...@apache.org>
Authored: Mon Jan 30 22:41:55 2017 +0100
Committer: Martin Stockhammer <ma...@apache.org>
Committed: Mon Jan 30 22:41:55 2017 +0100
----------------------------------------------------------------------
.../org/apache/archiva/RuntimeInfoServiceTest.java | 2 ++
.../remotedownload/AbstractDownloadTest.java | 16 ++++++++++++++++
2 files changed, 18 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/archiva/blob/65e04d66/archiva-modules/archiva-web/archiva-web-common/src/test/java/org/apache/archiva/RuntimeInfoServiceTest.java
----------------------------------------------------------------------
diff --git a/archiva-modules/archiva-web/archiva-web-common/src/test/java/org/apache/archiva/RuntimeInfoServiceTest.java b/archiva-modules/archiva-web/archiva-web-common/src/test/java/org/apache/archiva/RuntimeInfoServiceTest.java
index fce64f4..d4dd7b2 100644
--- a/archiva-modules/archiva-web/archiva-web-common/src/test/java/org/apache/archiva/RuntimeInfoServiceTest.java
+++ b/archiva-modules/archiva-web/archiva-web-common/src/test/java/org/apache/archiva/RuntimeInfoServiceTest.java
@@ -25,6 +25,7 @@ import org.apache.commons.io.FileUtils;
import org.apache.commons.lang.StringUtils;
import org.apache.cxf.jaxrs.client.JAXRSClientFactory;
import org.apache.archiva.redback.rest.services.AbstractRestServicesTest;
+import org.apache.cxf.jaxrs.client.WebClient;
import org.junit.Before;
import org.junit.Test;
@@ -84,6 +85,7 @@ public class RuntimeInfoServiceTest
RuntimeInfoService.class,
Collections.singletonList( new JacksonJaxbJsonProvider() ) );
+ WebClient.client(service).header("Referer","http://localhost");
ApplicationRuntimeInfo applicationRuntimeInfo = service.getApplicationRuntimeInfo( "en" );
assertEquals( System.getProperty( "expectedVersion" ), applicationRuntimeInfo.getVersion() );
http://git-wip-us.apache.org/repos/asf/archiva/blob/65e04d66/archiva-modules/archiva-web/archiva-web-common/src/test/java/org/apache/archiva/remotedownload/AbstractDownloadTest.java
----------------------------------------------------------------------
diff --git a/archiva-modules/archiva-web/archiva-web-common/src/test/java/org/apache/archiva/remotedownload/AbstractDownloadTest.java b/archiva-modules/archiva-web/archiva-web-common/src/test/java/org/apache/archiva/remotedownload/AbstractDownloadTest.java
index 227da18..f04148c 100644
--- a/archiva-modules/archiva-web/archiva-web-common/src/test/java/org/apache/archiva/remotedownload/AbstractDownloadTest.java
+++ b/archiva-modules/archiva-web/archiva-web-common/src/test/java/org/apache/archiva/remotedownload/AbstractDownloadTest.java
@@ -173,6 +173,8 @@ public abstract class AbstractDownloadTest
Collections.singletonList( new JacksonJaxbJsonProvider() ) );
WebClient.client( service ).header( "Authorization", authorizationHeader );
+ WebClient.client(service).header("Referer","http://localhost:"+port);
+
WebClient.getConfig( service ).getHttpConduit().getClient().setReceiveTimeout( 300000L );
return service;
}
@@ -185,6 +187,8 @@ public abstract class AbstractDownloadTest
Collections.singletonList( new JacksonJaxbJsonProvider() ) );
WebClient.client( service ).header( "Authorization", authorizationHeader );
+ WebClient.client(service).header("Referer","http://localhost:"+port);
+
WebClient.getConfig( service ).getHttpConduit().getClient().setReceiveTimeout( 300000L );
return service;
}
@@ -197,6 +201,8 @@ public abstract class AbstractDownloadTest
Collections.singletonList( new JacksonJaxbJsonProvider() ) );
WebClient.client( service ).header( "Authorization", authorizationHeader );
+ WebClient.client(service).header("Referer","http://localhost:"+port);
+
WebClient.getConfig( service ).getHttpConduit().getClient().setReceiveTimeout( 300000L );
return service;
}
@@ -210,6 +216,8 @@ public abstract class AbstractDownloadTest
Collections.singletonList( new JacksonJaxbJsonProvider() ) );
WebClient.client( service ).header( "Authorization", authorizationHeader );
+ WebClient.client(service).header("Referer","http://localhost:"+port);
+
WebClient.getConfig( service ).getHttpConduit().getClient().setReceiveTimeout( 300000L );
return service;
}
@@ -222,6 +230,8 @@ public abstract class AbstractDownloadTest
Collections.singletonList( new JacksonJaxbJsonProvider() ) );
WebClient.client( service ).header( "Authorization", authorizationHeader );
+ WebClient.client(service).header("Referer","http://localhost:"+port);
+
WebClient.getConfig( service ).getHttpConduit().getClient().setReceiveTimeout( 300000L );
return service;
}
@@ -234,6 +244,8 @@ public abstract class AbstractDownloadTest
Collections.singletonList( new JacksonJaxbJsonProvider() ) );
WebClient.client( service ).header( "Authorization", authorizationHeader );
+ WebClient.client(service).header("Referer","http://localhost:"+port);
+
WebClient.getConfig( service ).getHttpConduit().getClient().setReceiveTimeout( 300000L );
return service;
}
@@ -252,6 +264,8 @@ public abstract class AbstractDownloadTest
RoleManagementService.class,
Collections.singletonList( new JacksonJaxbJsonProvider() ) );
+ WebClient.client(service).header("Referer","http://localhost:"+port);
+
// for debuging purpose
WebClient.getConfig( service ).getHttpConduit().getClient().setReceiveTimeout( 3000000L );
@@ -268,6 +282,8 @@ public abstract class AbstractDownloadTest
JAXRSClientFactory.create( "http://localhost:" + port + "/" + getRestServicesPath() + "/redbackServices/",
UserService.class, Collections.singletonList( new JacksonJaxbJsonProvider() ) );
+ WebClient.client(service).header("Referer","http://localhost:"+port);
+
// for debuging purpose
WebClient.getConfig( service ).getHttpConduit().getClient().setReceiveTimeout( 3000000L );
[5/5] archiva git commit: Fixing test cases for rest service
Posted by ma...@apache.org.
Fixing test cases for rest service
Project: http://git-wip-us.apache.org/repos/asf/archiva/repo
Commit: http://git-wip-us.apache.org/repos/asf/archiva/commit/a981c184
Tree: http://git-wip-us.apache.org/repos/asf/archiva/tree/a981c184
Diff: http://git-wip-us.apache.org/repos/asf/archiva/diff/a981c184
Branch: refs/heads/master
Commit: a981c1847c11d880c082f4f04c390256a92cf72e
Parents: b2ce531
Author: Martin Stockhammer <ma...@apache.org>
Authored: Fri Mar 10 22:09:08 2017 +0100
Committer: Martin Stockhammer <ma...@apache.org>
Committed: Fri Mar 10 22:09:08 2017 +0100
----------------------------------------------------------------------
.../resources/META-INF/spring-context-test.xml | 15 +++++++++++++++
.../src/test/resources/security.properties | 19 +++++++++++++++++++
.../org/apache/archiva/security.properties | 19 +++++++++++++++++++
3 files changed, 53 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/archiva/blob/a981c184/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/resources/META-INF/spring-context-test.xml
----------------------------------------------------------------------
diff --git a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/resources/META-INF/spring-context-test.xml b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/resources/META-INF/spring-context-test.xml
index 9488526..9b95b94 100644
--- a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/resources/META-INF/spring-context-test.xml
+++ b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/resources/META-INF/spring-context-test.xml
@@ -83,6 +83,21 @@
<constructor-arg value="${appserver.base}/jcr"/>
</bean>
+ <bean name="commons-configuration" class="org.apache.archiva.redback.components.registry.commons.CommonsConfigurationRegistry"
+ init-method="initialize">
+ <property name="properties">
+ <value>
+ <![CDATA[
+ <configuration>
+ <system/>
+ <properties fileName="${basedir}/src/test/resources/security.properties" config-optional="true"
+ config-at="org.apache.archiva.redback"/>
+ </configuration>
+ ]]>
+ </value>
+ </property>
+ </bean>
+
<alias name="userConfiguration#redback" alias="userConfiguration#default"/>
<alias name="authorizer#rbac" alias="authorizer#default"/>
http://git-wip-us.apache.org/repos/asf/archiva/blob/a981c184/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/resources/security.properties
----------------------------------------------------------------------
diff --git a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/resources/security.properties b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/resources/security.properties
new file mode 100644
index 0000000..3607f9f
--- /dev/null
+++ b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/resources/security.properties
@@ -0,0 +1,19 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+rest.csrffilter.disableTokenValidation=true
http://git-wip-us.apache.org/repos/asf/archiva/blob/a981c184/archiva-modules/archiva-web/archiva-web-common/src/test/resources/org/apache/archiva/security.properties
----------------------------------------------------------------------
diff --git a/archiva-modules/archiva-web/archiva-web-common/src/test/resources/org/apache/archiva/security.properties b/archiva-modules/archiva-web/archiva-web-common/src/test/resources/org/apache/archiva/security.properties
new file mode 100644
index 0000000..3607f9f
--- /dev/null
+++ b/archiva-modules/archiva-web/archiva-web-common/src/test/resources/org/apache/archiva/security.properties
@@ -0,0 +1,19 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+rest.csrffilter.disableTokenValidation=true
[2/5] archiva git commit: Adding Header check to archiva rest services
Posted by ma...@apache.org.
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 <ma...@apache.org>
Authored: Tue Jan 31 22:56:50 2017 +0100
Committer: Martin Stockhammer <ma...@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() );
[4/5] archiva git commit: Adding validation token during login
Posted by ma...@apache.org.
Adding validation token during login
Project: http://git-wip-us.apache.org/repos/asf/archiva/repo
Commit: http://git-wip-us.apache.org/repos/asf/archiva/commit/b2ce531f
Tree: http://git-wip-us.apache.org/repos/asf/archiva/tree/b2ce531f
Diff: http://git-wip-us.apache.org/repos/asf/archiva/diff/b2ce531f
Branch: refs/heads/master
Commit: b2ce531fa25df5ca4f92619acf63ab986c49c392
Parents: 709ee5b
Author: Martin Stockhammer <ma...@apache.org>
Authored: Sun Feb 12 18:46:37 2017 +0100
Committer: Martin Stockhammer <ma...@apache.org>
Committed: Sun Feb 12 18:46:37 2017 +0100
----------------------------------------------------------------------
.../src/main/webapp/js/archiva/main.js | 23 ++++++++++++++++++--
.../src/main/webapp/js/redback/user.js | 20 ++++++++++++-----
2 files changed, 35 insertions(+), 8 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/archiva/blob/b2ce531f/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/js/archiva/main.js
----------------------------------------------------------------------
diff --git a/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/js/archiva/main.js b/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/js/archiva/main.js
index cd3f092..4085d44 100644
--- a/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/js/archiva/main.js
+++ b/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/js/archiva/main.js
@@ -37,7 +37,7 @@ function(jquery,ui,sammy,tmpl,i18n,jqueryCookie,bootstrap,archivaSearch,jqueryVa
var kUser = new User(user.username, user.password, user.confirmPassword,user.fullName,user.email,user.permanent,user.validated,
user.timestampAccountCreation,user.timestampLastLogin,user.timestampLastPasswordChange,user.locked,
- user.passwordChangeRequired,null,user.readOnly,user.userManagerId);
+ user.passwordChangeRequired,null,user.readOnly,user.userManagerId, user.validationToken);
kUser.rememberme(user.rememberme());
var userJson=ko.toJSON(kUser);
@@ -73,7 +73,7 @@ function(jquery,ui,sammy,tmpl,i18n,jqueryCookie,bootstrap,archivaSearch,jqueryVa
}
var kUser = new User(user.username, user.password, user.confirmPassword,user.fullName,user.email,user.permanent,user.validated,
user.timestampAccountCreation,user.timestampLastLogin,user.timestampLastPasswordChange,user.locked,
- user.passwordChangeRequired,null,user.readOnly,user.userManagerId);
+ user.passwordChangeRequired,null,user.readOnly,user.userManagerId, user.validationToken);
$.log("user.rememberme:"+user.rememberme);
@@ -860,6 +860,19 @@ function(jquery,ui,sammy,tmpl,i18n,jqueryCookie,bootstrap,archivaSearch,jqueryVa
return $.inArray(karmaName,window.redbackModel.operatioNames)>=0;
};
+ addValidationTokenHeader=function(user) {
+ if (user.validationToken) {
+ $.log("Adding validation token "+user.validationToken);
+ $.ajaxSetup({
+ beforeSend: function (xhr) {
+ xhr.setRequestHeader('X-XSRF-TOKEN', user.validationToken);
+ }
+ });
+ } else {
+ $.log("No validation token in user object "+user.username+", "+user.validationToken);
+ }
+ }
+
startArchivaApplication=function(){
$.log("startArchivaApplication");
@@ -896,6 +909,9 @@ function(jquery,ui,sammy,tmpl,i18n,jqueryCookie,bootstrap,archivaSearch,jqueryVa
window.redbackModel.password=user.password();
loginCall(user.username(),user.password(),user.rememberme()
,successLoginCallbackFn,errorLoginCallbackFn,completeLoginCallbackFn);
+ } else {
+ // Token for origin validation
+ addValidationTokenHeader(user);
}
};
@@ -918,6 +934,7 @@ function(jquery,ui,sammy,tmpl,i18n,jqueryCookie,bootstrap,archivaSearch,jqueryVa
}
if (logged == true) {
var user = mapUser(result);
+ addValidationTokenHeader(user);
if (user.passwordChangeRequired()==true){
changePasswordBox(true,false,user);
@@ -948,6 +965,8 @@ function(jquery,ui,sammy,tmpl,i18n,jqueryCookie,bootstrap,archivaSearch,jqueryVa
}
clearForm("#user-login-form");
decorateMenuWithKarma(user);
+
+ // Token for origin validation
$("#login-welcome" ).show();
$("#welcome-label" ).html( $.i18n.prop("user.login.welcome",user.username()));
return;
http://git-wip-us.apache.org/repos/asf/archiva/blob/b2ce531f/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/js/redback/user.js
----------------------------------------------------------------------
diff --git a/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/js/redback/user.js b/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/js/redback/user.js
index 758a56a..7464b5d 100644
--- a/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/js/redback/user.js
+++ b/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/js/redback/user.js
@@ -36,9 +36,11 @@ function(jquery,utils,i18n,jqueryValidate,ko,koSimpleGrid,purl) {
* @param ownerViewModel
* @param readOnly
* @param uuserManagerId
+ * @param validationToken
*/
User=function(username, password, confirmPassword,fullName,email,permanent,validated,timestampAccountCreation,
- timestampLastLogin,timestampLastPasswordChange,locked,passwordChangeRequired,ownerViewModel,readOnly,userManagerId) {
+ timestampLastLogin,timestampLastPasswordChange,locked,passwordChangeRequired,ownerViewModel,readOnly,
+ userManagerId,validationToken) {
var self=this;
// Potentially Editable Field.
this.username = ko.observable(username);
@@ -84,6 +86,8 @@ function(jquery,utils,i18n,jqueryValidate,ko,koSimpleGrid,purl) {
this.rememberme=ko.observable(false);
+ this.validationToken=validationToken;
+
this.logged=false;
this.remove = function() {
@@ -145,17 +149,20 @@ function(jquery,utils,i18n,jqueryValidate,ko,koSimpleGrid,purl) {
var created = result;
if (created == true) {
displaySuccessMessage( $.i18n.prop("user.admin.created"));
- var onSuccessCall=function(){
+ var onSuccessCall=function(result){
+ var logUser = mapUser(result);
+ currentAdminUser.validationToken=logUser.validationToken;
reccordLoginCookie(currentAdminUser);
+ addValidationTokenHeader(currentAdminUser);
window.archivaModel.adminExists=true;
screenChange();
checkCreateAdminLink();
checkSecurityLinks();
+ if(succesCallbackFn){
+ succesCallbackFn();
+ }
}
loginCall(currentAdminUser.username(), currentAdminUser.password(),false,onSuccessCall);
- if(succesCallbackFn){
- succesCallbackFn();
- }
return this;
} else {
displayErrorMessage("admin user not created");
@@ -757,7 +764,8 @@ function(jquery,utils,i18n,jqueryValidate,ko,koSimpleGrid,purl) {
mapUser=function(data) {
return new User(data.username, data.password, null,data.fullName,data.email,data.permanent,data.validated,
data.timestampAccountCreation,data.timestampLastLogin,data.timestampLastPasswordChange,
- data.locked,data.passwordChangeRequired,self,data.readOnly,data.userManagerId);
+ data.locked,data.passwordChangeRequired,self,data.readOnly,data.userManagerId,
+ data.validationToken);
}
[3/5] archiva git commit: Implementing method after interface change
Posted by ma...@apache.org.
Implementing method after interface change
Project: http://git-wip-us.apache.org/repos/asf/archiva/repo
Commit: http://git-wip-us.apache.org/repos/asf/archiva/commit/709ee5bb
Tree: http://git-wip-us.apache.org/repos/asf/archiva/tree/709ee5bb
Diff: http://git-wip-us.apache.org/repos/asf/archiva/diff/709ee5bb
Branch: refs/heads/master
Commit: 709ee5bb396b5d6e7864a612e0991349b36f58a7
Parents: fc41a79
Author: Martin Stockhammer <ma...@apache.org>
Authored: Sun Feb 12 18:45:57 2017 +0100
Committer: Martin Stockhammer <ma...@apache.org>
Committed: Sun Feb 12 18:45:57 2017 +0100
----------------------------------------------------------------------
.../java/org/apache/archiva/web/rss/SecuritySystemStub.java | 6 ++++++
1 file changed, 6 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/archiva/blob/709ee5bb/archiva-modules/archiva-web/archiva-web-common/src/test/java/org/apache/archiva/web/rss/SecuritySystemStub.java
----------------------------------------------------------------------
diff --git a/archiva-modules/archiva-web/archiva-web-common/src/test/java/org/apache/archiva/web/rss/SecuritySystemStub.java b/archiva-modules/archiva-web/archiva-web-common/src/test/java/org/apache/archiva/web/rss/SecuritySystemStub.java
index 16c84f2..eec7ae9 100644
--- a/archiva-modules/archiva-web/archiva-web-common/src/test/java/org/apache/archiva/web/rss/SecuritySystemStub.java
+++ b/archiva-modules/archiva-web/archiva-web-common/src/test/java/org/apache/archiva/web/rss/SecuritySystemStub.java
@@ -22,6 +22,7 @@ package org.apache.archiva.web.rss;
import org.apache.archiva.redback.authentication.AuthenticationDataSource;
import org.apache.archiva.redback.authentication.AuthenticationException;
import org.apache.archiva.redback.authentication.AuthenticationResult;
+import org.apache.archiva.redback.authentication.TokenManager;
import org.apache.archiva.redback.authorization.AuthorizationException;
import org.apache.archiva.redback.authorization.AuthorizationResult;
import org.apache.archiva.redback.keys.KeyManager;
@@ -703,4 +704,9 @@ public class SecuritySystemStub
{
return true;
}
+
+ @Override
+ public TokenManager getTokenManager() {
+ return null;
+ }
}