Updated Branches:
  refs/heads/master 42af7491f -> 7effdc8c0

WICKET-4720 WebSession#authenticate() is superfluous


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

Branch: refs/heads/master
Commit: 7effdc8c0f242fdb8859f7d88ab967e48bf39e61
Parents: 42af749
Author: svenmeier <[email protected]>
Authored: Tue Aug 21 10:12:44 2012 +0200
Committer: svenmeier <[email protected]>
Committed: Tue Aug 21 10:12:44 2012 +0200

----------------------------------------------------------------------
 .../authentication/AuthenticatedWebSession.java    |   14 +++++++++++-
 .../authentication/panel/SignInPanelTest.java      |    6 +++++
 .../apache/wicket/protocol/http/WebSession.java    |   17 ---------------
 3 files changed, 19 insertions(+), 18 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/wicket/blob/7effdc8c/wicket-auth-roles/src/main/java/org/apache/wicket/authroles/authentication/AuthenticatedWebSession.java
----------------------------------------------------------------------
diff --git 
a/wicket-auth-roles/src/main/java/org/apache/wicket/authroles/authentication/AuthenticatedWebSession.java
 
b/wicket-auth-roles/src/main/java/org/apache/wicket/authroles/authentication/AuthenticatedWebSession.java
index 62455eb..13c47d5 100644
--- 
a/wicket-auth-roles/src/main/java/org/apache/wicket/authroles/authentication/AuthenticatedWebSession.java
+++ 
b/wicket-auth-roles/src/main/java/org/apache/wicket/authroles/authentication/AuthenticatedWebSession.java
@@ -71,12 +71,24 @@ public abstract class AuthenticatedWebSession extends 
AbstractAuthenticatedWebSe
        }
 
        /**
+        * Actual authentication check, has to be implemented by subclasses.
+        * 
+        * @param username
+        *            The username
+        * @param password
+        *            The password
+        * @return True if the user was authenticated successfully
+        */
+       public abstract boolean authenticate(final String username, final 
String password);
+
+       /**
         * Cookie based logins (remember me) may not rely on putting username 
and password into the
         * cookie but something else that safely identifies the user. This 
method is meant to support
         * these use cases.
         * 
         * It is protected (and not public) to enforce that cookie based 
authentication gets implemented
-        * in a subclass (like you need to subclass authenticate() for 'normal' 
authentication).
+        * in a subclass (like you need to implement {@link 
#authenticate(String, String)} for 'normal'
+        * authentication).
         * 
         * @see #authenticate(String, String)
         * 

http://git-wip-us.apache.org/repos/asf/wicket/blob/7effdc8c/wicket-auth-roles/src/test/java/org/apache/wicket/authroles/authentication/panel/SignInPanelTest.java
----------------------------------------------------------------------
diff --git 
a/wicket-auth-roles/src/test/java/org/apache/wicket/authroles/authentication/panel/SignInPanelTest.java
 
b/wicket-auth-roles/src/test/java/org/apache/wicket/authroles/authentication/panel/SignInPanelTest.java
index 803b077..73735f5 100644
--- 
a/wicket-auth-roles/src/test/java/org/apache/wicket/authroles/authentication/panel/SignInPanelTest.java
+++ 
b/wicket-auth-roles/src/test/java/org/apache/wicket/authroles/authentication/panel/SignInPanelTest.java
@@ -99,6 +99,12 @@ public class SignInPanelTest extends Assert
                {
                        return null;
                }
+
+               @Override
+               public boolean authenticate(String username, String password)
+               {
+                       return false;
+               }
        }
 
        private static class TestApplication extends AuthenticatedWebApplication

http://git-wip-us.apache.org/repos/asf/wicket/blob/7effdc8c/wicket-core/src/main/java/org/apache/wicket/protocol/http/WebSession.java
----------------------------------------------------------------------
diff --git 
a/wicket-core/src/main/java/org/apache/wicket/protocol/http/WebSession.java 
b/wicket-core/src/main/java/org/apache/wicket/protocol/http/WebSession.java
index 2c478cb..84a76bd 100644
--- a/wicket-core/src/main/java/org/apache/wicket/protocol/http/WebSession.java
+++ b/wicket-core/src/main/java/org/apache/wicket/protocol/http/WebSession.java
@@ -19,7 +19,6 @@ package org.apache.wicket.protocol.http;
 import org.apache.wicket.MetaDataKey;
 import org.apache.wicket.RestartResponseAtInterceptPageException;
 import org.apache.wicket.Session;
-import org.apache.wicket.WicketRuntimeException;
 import org.apache.wicket.feedback.FeedbackMessage;
 import org.apache.wicket.feedback.IFeedbackMessageFilter;
 import org.apache.wicket.markup.html.WebPage;
@@ -110,22 +109,6 @@ public class WebSession extends Session
        }
 
        /**
-        * Note: You must subclass WebSession and implement your own. We didn't 
want to make it abstract
-        * to force every application to implement it. Instead we throw an 
exception.
-        * 
-        * @param username
-        *            The username
-        * @param password
-        *            The password
-        * @return True if the user was authenticated successfully
-        */
-       public boolean authenticate(final String username, final String 
password)
-       {
-               throw new WicketRuntimeException(
-                       "You must subclass WebSession and implement your own 
authentication method for all Wicket applications using authentication.");
-       }
-
-       /**
         * {@inheritDoc}
         * 
         * <p>

Reply via email to