You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by mg...@apache.org on 2015/02/25 22:37:14 UTC
[1/3] wicket git commit: Fix the compilation of wicket-datetime module
Repository: wicket
Updated Branches:
refs/heads/master dca0a2fca -> c36f95e94
Fix the compilation of wicket-datetime module
It seems BuildBot doesn't work at the moment
Project: http://git-wip-us.apache.org/repos/asf/wicket/repo
Commit: http://git-wip-us.apache.org/repos/asf/wicket/commit/10ff4ad1
Tree: http://git-wip-us.apache.org/repos/asf/wicket/tree/10ff4ad1
Diff: http://git-wip-us.apache.org/repos/asf/wicket/diff/10ff4ad1
Branch: refs/heads/master
Commit: 10ff4ad1960d985e6a8488ba9c405f0166e13a4c
Parents: dca0a2f
Author: Martin Tzvetanov Grigorov <mg...@apache.org>
Authored: Wed Feb 25 23:34:26 2015 +0200
Committer: Martin Tzvetanov Grigorov <mg...@apache.org>
Committed: Wed Feb 25 23:34:26 2015 +0200
----------------------------------------------------------------------
.../org/apache/wicket/datetime/markup/html/basic/DateLabel.java | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/wicket/blob/10ff4ad1/wicket-datetime/src/main/java/org/apache/wicket/datetime/markup/html/basic/DateLabel.java
----------------------------------------------------------------------
diff --git a/wicket-datetime/src/main/java/org/apache/wicket/datetime/markup/html/basic/DateLabel.java b/wicket-datetime/src/main/java/org/apache/wicket/datetime/markup/html/basic/DateLabel.java
index 1b3111a..6f5610b 100644
--- a/wicket-datetime/src/main/java/org/apache/wicket/datetime/markup/html/basic/DateLabel.java
+++ b/wicket-datetime/src/main/java/org/apache/wicket/datetime/markup/html/basic/DateLabel.java
@@ -19,7 +19,7 @@ package org.apache.wicket.datetime.markup.html.basic;
import java.text.SimpleDateFormat;
import java.util.Date;
-import org.apache.wicket.IGenericComponent
+import org.apache.wicket.IGenericComponent;
import org.apache.wicket.datetime.DateConverter;
import org.apache.wicket.datetime.PatternDateConverter;
import org.apache.wicket.datetime.StyleDateConverter;
[2/3] wicket git commit: WICKET-5841 Fix broken test
Posted by mg...@apache.org.
WICKET-5841 Fix broken test
The test needs to use a proper request cycle to submit the form so that NonResettingRestartResponseException is handled by Wicket
Project: http://git-wip-us.apache.org/repos/asf/wicket/repo
Commit: http://git-wip-us.apache.org/repos/asf/wicket/commit/5a2ca37e
Tree: http://git-wip-us.apache.org/repos/asf/wicket/tree/5a2ca37e
Diff: http://git-wip-us.apache.org/repos/asf/wicket/diff/5a2ca37e
Branch: refs/heads/master
Commit: 5a2ca37ec2e8b1fff8592572b0080f642adb96d2
Parents: 10ff4ad
Author: Martin Tzvetanov Grigorov <mg...@apache.org>
Authored: Wed Feb 25 23:35:24 2015 +0200
Committer: Martin Tzvetanov Grigorov <mg...@apache.org>
Committed: Wed Feb 25 23:35:24 2015 +0200
----------------------------------------------------------------------
.../apache/wicket/markup/html/form/login/InterceptTest.java | 6 ++++--
.../apache/wicket/markup/html/form/login/MockLoginPage.java | 6 +-----
2 files changed, 5 insertions(+), 7 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/wicket/blob/5a2ca37e/wicket-core/src/test/java/org/apache/wicket/markup/html/form/login/InterceptTest.java
----------------------------------------------------------------------
diff --git a/wicket-core/src/test/java/org/apache/wicket/markup/html/form/login/InterceptTest.java b/wicket-core/src/test/java/org/apache/wicket/markup/html/form/login/InterceptTest.java
index f84d64c..ae441b5 100644
--- a/wicket-core/src/test/java/org/apache/wicket/markup/html/form/login/InterceptTest.java
+++ b/wicket-core/src/test/java/org/apache/wicket/markup/html/form/login/InterceptTest.java
@@ -94,8 +94,10 @@ public class InterceptTest extends WicketTestCase
assertEquals(((MyMockWebApplication)tester.getApplication()).getLoginPage(),
loginPage.getClass());
- // bypass form completely to login but continue to intercept page
- assertTrue(((MockLoginPage)tester.getLastRenderedPage()).login("admin"));
+ // bypass formTester completely to login but continue to intercept page
+ FormTester formTester = tester.newFormTester("form");
+ formTester.setValue("username", "admin");
+ formTester.submit();
tester.startPage(tester.getApplication().getHomePage());
assertEquals(tester.getApplication().getHomePage(), tester.getLastRenderedPage().getClass());
http://git-wip-us.apache.org/repos/asf/wicket/blob/5a2ca37e/wicket-core/src/test/java/org/apache/wicket/markup/html/form/login/MockLoginPage.java
----------------------------------------------------------------------
diff --git a/wicket-core/src/test/java/org/apache/wicket/markup/html/form/login/MockLoginPage.java b/wicket-core/src/test/java/org/apache/wicket/markup/html/form/login/MockLoginPage.java
index 1715540..52f4a8a 100644
--- a/wicket-core/src/test/java/org/apache/wicket/markup/html/form/login/MockLoginPage.java
+++ b/wicket-core/src/test/java/org/apache/wicket/markup/html/form/login/MockLoginPage.java
@@ -26,8 +26,6 @@ import org.apache.wicket.markup.html.form.Form;
import org.apache.wicket.markup.html.form.TextField;
import org.apache.wicket.markup.html.form.login.InterceptTest.MySession;
import org.apache.wicket.model.Model;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
/**
@@ -37,8 +35,6 @@ public class MockLoginPage extends WebPage
{
private static final long serialVersionUID = 1L;
- private static final Logger log = LoggerFactory.getLogger(MockLoginPage.class);
-
private Form<Void> form;
private TextField<Serializable> textField;
@@ -60,7 +56,7 @@ public class MockLoginPage extends WebPage
login(get("username").getDefaultModelObjectAsString());
}
});
- form.add(textField = new TextField<Serializable>("username", new Model<Serializable>()));
+ form.add(textField = new TextField<>("username", new Model<>()));
}
/**
[3/3] wicket git commit: WICKET-5823 DefaultAuthenticationStrategy
should be modified to reduce copy/paste while extending it's functionality
Posted by mg...@apache.org.
WICKET-5823 DefaultAuthenticationStrategy should be modified to reduce copy/paste while extending it's functionality
Project: http://git-wip-us.apache.org/repos/asf/wicket/repo
Commit: http://git-wip-us.apache.org/repos/asf/wicket/commit/c36f95e9
Tree: http://git-wip-us.apache.org/repos/asf/wicket/tree/c36f95e9
Diff: http://git-wip-us.apache.org/repos/asf/wicket/diff/c36f95e9
Branch: refs/heads/master
Commit: c36f95e94bebd16cb5cfe50a8f4cbcdee4f5729f
Parents: 5a2ca37
Author: Martin Tzvetanov Grigorov <mg...@apache.org>
Authored: Wed Feb 25 23:36:51 2015 +0200
Committer: Martin Tzvetanov Grigorov <mg...@apache.org>
Committed: Wed Feb 25 23:36:51 2015 +0200
----------------------------------------------------------------------
.../authentication/IAuthenticationStrategy.java | 19 ++++++++-----
.../strategy/DefaultAuthenticationStrategy.java | 28 ++++++++++++++++----
.../strategy/NoOpAuthenticationStrategy.java | 19 +------------
3 files changed, 36 insertions(+), 30 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/wicket/blob/c36f95e9/wicket-core/src/main/java/org/apache/wicket/authentication/IAuthenticationStrategy.java
----------------------------------------------------------------------
diff --git a/wicket-core/src/main/java/org/apache/wicket/authentication/IAuthenticationStrategy.java b/wicket-core/src/main/java/org/apache/wicket/authentication/IAuthenticationStrategy.java
index 95bae54..dacbafe 100644
--- a/wicket-core/src/main/java/org/apache/wicket/authentication/IAuthenticationStrategy.java
+++ b/wicket-core/src/main/java/org/apache/wicket/authentication/IAuthenticationStrategy.java
@@ -28,23 +28,28 @@ import org.apache.wicket.Application;
public interface IAuthenticationStrategy
{
/**
- * If "rememberMe" is enabled, than load login name and password from the persistence storage
+ * If "rememberMe" is enabled, then load the saved credentials (e.g. username and password) from the persistence storage
* (e.g. Cookie) for automatic sign in. This is useful for applications which users typically
* have open the whole day but where the server invalidates the session after a timeout and you
* want to force the user to sign in again and again during the day.
*
- * @return [0] = username, [1] = password, null if not found
+ * @return The {@link #save(String, String...) saved} credentials
*/
String[] load();
/**
- * If "rememberMe" is enabled and login was successful, than store username and password in the
+ * If "rememberMe" is enabled and login was successful, then store the given credentials in the
* persistence store (e.g. Cookie).
- *
- * @param username
- * @param password
+ *
+ * <p>The implementation of this method should be symmetrical with the implementation of
+ * {@link #load()}.</p>
+ *
+ * @param credential
+ * The credential to store. For example: a security token or username.
+ * @param extraCredentials
+ * Optional extra credentials. For example: a password
*/
- void save(final String username, final String password);
+ void save(final String credential, final String... extraCredentials);
/**
* When the user logs out (session invalidation), than remove username and password from the
http://git-wip-us.apache.org/repos/asf/wicket/blob/c36f95e9/wicket-core/src/main/java/org/apache/wicket/authentication/strategy/DefaultAuthenticationStrategy.java
----------------------------------------------------------------------
diff --git a/wicket-core/src/main/java/org/apache/wicket/authentication/strategy/DefaultAuthenticationStrategy.java b/wicket-core/src/main/java/org/apache/wicket/authentication/strategy/DefaultAuthenticationStrategy.java
index 62c324a..59bb484 100644
--- a/wicket-core/src/main/java/org/apache/wicket/authentication/strategy/DefaultAuthenticationStrategy.java
+++ b/wicket-core/src/main/java/org/apache/wicket/authentication/strategy/DefaultAuthenticationStrategy.java
@@ -141,19 +141,37 @@ public class DefaultAuthenticationStrategy implements IAuthenticationStrategy
/**
* @see org.apache.wicket.authentication.IAuthenticationStrategy#save(java.lang.String,
- * java.lang.String)
+ * java.lang.String...)
*/
@Override
- public void save(final String username, final String password)
+ public void save(final String credential, final String... extraCredentials)
{
- String value = username + VALUE_SEPARATOR + password;
-
- String encryptedValue = getCrypt().encryptUrlSafe(value);
+ String encryptedValue = getCrypt().encryptUrlSafe(encode(credential, extraCredentials));
getCookieUtils().save(cookieKey, encryptedValue);
}
/**
+ * This method can be overridden to provide different encoding mechanism
+ *
+ * @param credential
+ * @param extraCredentials
+ * @return String representation of the parameters given
+ */
+ protected String encode(final String credential, final String... extraCredentials)
+ {
+ StringBuilder value = new StringBuilder(credential);
+ if (extraCredentials != null)
+ {
+ for (String extraCredential : extraCredentials)
+ {
+ value.append(VALUE_SEPARATOR).append(extraCredential);
+ }
+ }
+ return value.toString();
+ }
+
+ /**
* @see org.apache.wicket.authentication.IAuthenticationStrategy#remove()
*/
@Override
http://git-wip-us.apache.org/repos/asf/wicket/blob/c36f95e9/wicket-core/src/main/java/org/apache/wicket/authentication/strategy/NoOpAuthenticationStrategy.java
----------------------------------------------------------------------
diff --git a/wicket-core/src/main/java/org/apache/wicket/authentication/strategy/NoOpAuthenticationStrategy.java b/wicket-core/src/main/java/org/apache/wicket/authentication/strategy/NoOpAuthenticationStrategy.java
index fb92047..2146063 100644
--- a/wicket-core/src/main/java/org/apache/wicket/authentication/strategy/NoOpAuthenticationStrategy.java
+++ b/wicket-core/src/main/java/org/apache/wicket/authentication/strategy/NoOpAuthenticationStrategy.java
@@ -25,34 +25,17 @@ import org.apache.wicket.authentication.IAuthenticationStrategy;
*/
public class NoOpAuthenticationStrategy implements IAuthenticationStrategy
{
- /**
- * Constructor
- */
- public NoOpAuthenticationStrategy()
- {
- }
-
- /**
- * @see org.apache.wicket.authentication.IAuthenticationStrategy#load()
- */
@Override
public String[] load()
{
return null;
}
- /**
- * @see org.apache.wicket.authentication.IAuthenticationStrategy#save(java.lang.String,
- * java.lang.String)
- */
@Override
- public void save(final String username, final String password)
+ public void save(final String credential, final String... extraCredentials)
{
}
- /**
- * @see org.apache.wicket.authentication.IAuthenticationStrategy#remove()
- */
@Override
public void remove()
{