Author: fmeschbe
Date: Mon Feb 15 09:05:41 2010
New Revision: 910182
URL: http://svn.apache.org/viewvc?rev=910182&view=rev
Log:
SLING-1375 Allow authentication handler to convey failure to extract existing
credentials to Sling Authenticator and add unit tests for the
AuthenticationInfo class
Added:
sling/trunk/bundles/commons/auth/src/test/java/org/apache/sling/commons/auth/spi/
sling/trunk/bundles/commons/auth/src/test/java/org/apache/sling/commons/auth/spi/AuthenticationInfoTest.java
(with props)
Modified:
sling/trunk/bundles/commons/auth/src/main/java/org/apache/sling/commons/auth/impl/SlingAuthenticator.java
sling/trunk/bundles/commons/auth/src/main/java/org/apache/sling/commons/auth/spi/AuthenticationHandler.java
sling/trunk/bundles/commons/auth/src/main/java/org/apache/sling/commons/auth/spi/AuthenticationInfo.java
Modified:
sling/trunk/bundles/commons/auth/src/main/java/org/apache/sling/commons/auth/impl/SlingAuthenticator.java
URL:
http://svn.apache.org/viewvc/sling/trunk/bundles/commons/auth/src/main/java/org/apache/sling/commons/auth/impl/SlingAuthenticator.java?rev=910182&r1=910181&r2=910182&view=diff
==============================================================================
---
sling/trunk/bundles/commons/auth/src/main/java/org/apache/sling/commons/auth/impl/SlingAuthenticator.java
(original)
+++
sling/trunk/bundles/commons/auth/src/main/java/org/apache/sling/commons/auth/impl/SlingAuthenticator.java
Mon Feb 15 09:05:41 2010
@@ -339,6 +339,12 @@
log.debug("handleSecurity: ongoing authentication in the handler");
return false;
+ } else if (authInfo == AuthenticationInfo.FAIL_AUTH) {
+
+ log.debug("handleSecurity: Credentials present but not valid,
request authentication again");
+ doLogin(request, response);
+ return false;
+
} else if (authInfo == null) {
log.debug("handleSecurity: No credentials in the request,
anonymous");
Modified:
sling/trunk/bundles/commons/auth/src/main/java/org/apache/sling/commons/auth/spi/AuthenticationHandler.java
URL:
http://svn.apache.org/viewvc/sling/trunk/bundles/commons/auth/src/main/java/org/apache/sling/commons/auth/spi/AuthenticationHandler.java?rev=910182&r1=910181&r2=910182&view=diff
==============================================================================
---
sling/trunk/bundles/commons/auth/src/main/java/org/apache/sling/commons/auth/spi/AuthenticationHandler.java
(original)
+++
sling/trunk/bundles/commons/auth/src/main/java/org/apache/sling/commons/auth/spi/AuthenticationHandler.java
Mon Feb 15 09:05:41 2010
@@ -69,7 +69,14 @@
* <td>{...@link AuthenticationInfo#DOING_AUTH}
* <td>the handler is in an ongoing authentication transaction with the
* client. Request processing should be aborted at this stage.
+ * </tr>
* <tr>
+ * <td>{...@link AuthenticationInfo#FAIL_AUTH}
+ * <td>the handler failed extracting the credentials from the request for
+ * any reason. An example of this result is that credentials are present
+ * in the request but they could not be validated and thus not be used
+ * for request processing.
+ * </tr>
* <tr>
* <td><code>AuthenticationInfo</code> object
* <td>The user sent credentials. The returned object contains the
Modified:
sling/trunk/bundles/commons/auth/src/main/java/org/apache/sling/commons/auth/spi/AuthenticationInfo.java
URL:
http://svn.apache.org/viewvc/sling/trunk/bundles/commons/auth/src/main/java/org/apache/sling/commons/auth/spi/AuthenticationInfo.java?rev=910182&r1=910181&r2=910182&view=diff
==============================================================================
---
sling/trunk/bundles/commons/auth/src/main/java/org/apache/sling/commons/auth/spi/AuthenticationInfo.java
(original)
+++
sling/trunk/bundles/commons/auth/src/main/java/org/apache/sling/commons/auth/spi/AuthenticationInfo.java
Mon Feb 15 09:05:41 2010
@@ -19,6 +19,7 @@
package org.apache.sling.commons.auth.spi;
import java.util.HashMap;
+import java.util.Map;
import javax.jcr.Credentials;
import javax.jcr.SimpleCredentials;
@@ -41,7 +42,7 @@
public class AuthenticationInfo extends HashMap<String, Object> {
/**
- * A special instance of this class which is returned by the
+ * A special instance of this class which may be returned from the
* {...@link
AuthenticationHandler#extractCredentials(javax.servlet.http.HttpServletRequest,
javax.servlet.http.HttpServletResponse)}
* method to inform the caller, that a response has been sent to the client
* to request for credentials.
@@ -49,7 +50,22 @@
* If this value is returned, the request should be considered finished and
* no further actions should be taken on this request.
*/
- public static final AuthenticationInfo DOING_AUTH = new
AuthenticationInfo();
+ public static final AuthenticationInfo DOING_AUTH = new
ReadOnlyAuthenticationInfo(
+ "DOING_AUTH");
+
+ /**
+ * A special instance of this class which may be returned from the
+ * {...@link
AuthenticationHandler#extractCredentials(javax.servlet.http.HttpServletRequest,
javax.servlet.http.HttpServletResponse)}
+ * method to inform the caller that credential extraction failed for some
+ * reason.
+ * <p>
+ * If this value is returned, the handler signals that credentials would be
+ * present in the request but the credentials are not valid for use (for
+ * example OpenID identify failed to validate or some authentication cookie
+ * expired).
+ */
+ public static final AuthenticationInfo FAIL_AUTH = new
ReadOnlyAuthenticationInfo(
+ "FAIL_AUTH");
/**
* The name of the special property providing the authentication type
@@ -90,9 +106,9 @@
* The name of the property providing the JCR credentials. These
credentials
* are preset to the credentials given to the
* {...@link #AuthenticationInfo(String, String)} or
- * {...@link #AuthenticationInfo(String, String, char[])} constructors.
- * the {...@link #AuthenticationInfo(String, String, char[], String)}
- * constructor is used the credentials property is set to a JCR
+ * {...@link #AuthenticationInfo(String, String, char[])} constructors. the
+ * {...@link #AuthenticationInfo(String, String, char[], String)}
constructor
+ * is used the credentials property is set to a JCR
* <code>SimpleCredentials</code> instance containing the user id and
* password passed to the constructor.
*/
@@ -109,11 +125,6 @@
*/
public static final String WORKSPACE = "user.jcr.workspace";
- /** Creates an empty instance, used for the {...@link #DOING_AUTH}
constant */
- private AuthenticationInfo() {
- super.put(AUTH_TYPE, "Authentication in Progress");
- }
-
/**
* Creates an instance of this class with just the authentication type. To
* effectively use this instance the user Id with optional password and/or
@@ -189,7 +200,7 @@
* <code>null</code> the current authentication type is not
* replaced.
*/
- public void setAuthType(String authType) {
+ public final void setAuthType(String authType) {
putIfNotNull(AUTH_TYPE, authType);
}
@@ -202,7 +213,7 @@
* of the <code>HttpServletRequest</code> interface. Otherwise the value
may
* be specific to the {...@link AuthenticationHandler} implementation.
*/
- public String getAuthType() {
+ public final String getAuthType() {
return (String) get(AUTH_TYPE);
}
@@ -210,7 +221,7 @@
* @param user The name of the user to authenticate as. If this is
* <code>null</code> the current user name is not replaced.
*/
- public void setUser(String user) {
+ public final void setUser(String user) {
putIfNotNull(USER, user);
}
@@ -218,7 +229,7 @@
* Returns the user name stored as the {...@link #USER} property or
* <code>null</code> if the user is not set in this map.
*/
- public String getUser() {
+ public final String getUser() {
return (String) get(USER);
}
@@ -226,7 +237,7 @@
* @param password The password to authenticate with. If this is
* <code>null</code> the current password is not replaced.
*/
- public void setPassword(char[] password) {
+ public final void setPassword(char[] password) {
putIfNotNull(PASSWORD, password);
}
@@ -234,7 +245,7 @@
* Returns the password stored as the {...@link #PASSWORD} property or
* <code>null</code> if the password is not set in this map.
*/
- public char[] getPassword() {
+ public final char[] getPassword() {
return (char[]) get(PASSWORD);
}
@@ -242,7 +253,7 @@
* @param workspaceName The name of the workspace to connect to. If this is
* <code>null</code> the current workspace name is not replaced.
*/
- public void setWorkspaceName(String workspaceName) {
+ public final void setWorkspaceName(String workspaceName) {
putIfNotNull(WORKSPACE, workspaceName);
}
@@ -250,7 +261,7 @@
* Returns the workspace name stored as the {...@link #WORKSPACE} property
or
* <code>null</code> if the workspace name is not set in this map.
*/
- public String getWorkspaceName() {
+ public final String getWorkspaceName() {
return (String) get(WORKSPACE);
}
@@ -259,7 +270,7 @@
* this is <code>null</code> the currently set credentials are
* not replaced.
*/
- public void setCredentials(Credentials credentials) {
+ public final void setCredentials(Credentials credentials) {
putIfNotNull(CREDENTIALS, credentials);
}
@@ -270,7 +281,7 @@
* based on that user ID and the (optional) {...@link #PASSWORD}. If the
userID
* is not set, this method returns <code>null</code>.
*/
- public Credentials getCredentials() {
+ public final Credentials getCredentials() {
// return credentials explicitly set
final Credentials creds = (Credentials) get(CREDENTIALS);
@@ -348,7 +359,7 @@
+ " property must be a char[]");
}
- if (CREDENTIALS.equals(key) && !(value instanceof String)) {
+ if (CREDENTIALS.equals(key) && !(value instanceof Credentials)) {
throw new IllegalArgumentException(CREDENTIALS
+ " property must be a javax.jcr.Credentials instance");
}
@@ -380,10 +391,78 @@
return super.remove(key);
}
- // helper to only set the property if the value is not null
+ /**
+ * Clears all properties from the map with the exception of the
+ * {...@link #AUTH_TYPE} property.
+ */
+ @Override
+ public void clear() {
+ final String authType = getAuthType();
+ super.clear();
+ setAuthType(authType);
+ }
+
+ /**
+ * Calls {...@link #put(String, Object)} only if the <code>value</code> is
not
+ * <code>null</code>, otherwise does nothing.
+ *
+ * @param key The key of the property to set
+ * @param value The value to set for the property. This may be
+ * <code>null</code> in which case this method does nothing.
+ */
private void putIfNotNull(final String key, final Object value) {
if (value != null) {
- super.put(key, value);
+ put(key, value);
+ }
+ }
+
+ /**
+ * The <code>ReadOnlyAuthenticationInfo</code> extends the
+ * {...@link AuthenticationInfo} class overwriting the
+ * {...@link #put(String, Object)} method such that no property is ever
set.
+ * This acts like kind of a read-only wrapper.
+ */
+ private static final class ReadOnlyAuthenticationInfo extends
+ AuthenticationInfo {
+
+ /**
+ * Creates an instance of this read-only class with the given
+ * authentication type.
+ *
+ * @param authType The authentication type to set
+ */
+ ReadOnlyAuthenticationInfo(final String authType) {
+ super(authType);
+ }
+
+ /**
+ * Does not put the property into the map
+ */
+ @Override
+ public Object put(String key, Object value) {
+ return null;
+ }
+
+ /**
+ * Sets/adds non of the properties
+ */
+ @Override
+ public void putAll(Map<? extends String, ? extends Object> m) {
+ }
+
+ /**
+ * Does not clear the properties
+ */
+ @Override
+ public void clear() {
+ }
+
+ /**
+ * Removes nothing
+ */
+ @Override
+ public Object remove(Object key) {
+ return null;
}
}
}
Added:
sling/trunk/bundles/commons/auth/src/test/java/org/apache/sling/commons/auth/spi/AuthenticationInfoTest.java
URL:
http://svn.apache.org/viewvc/sling/trunk/bundles/commons/auth/src/test/java/org/apache/sling/commons/auth/spi/AuthenticationInfoTest.java?rev=910182&view=auto
==============================================================================
---
sling/trunk/bundles/commons/auth/src/test/java/org/apache/sling/commons/auth/spi/AuthenticationInfoTest.java
(added)
+++
sling/trunk/bundles/commons/auth/src/test/java/org/apache/sling/commons/auth/spi/AuthenticationInfoTest.java
Mon Feb 15 09:05:41 2010
@@ -0,0 +1,338 @@
+/*
+ * 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.
+ */
+package org.apache.sling.commons.auth.spi;
+
+import static junit.framework.Assert.failNotEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertSame;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
+import javax.jcr.Credentials;
+import javax.jcr.SimpleCredentials;
+
+import org.junit.Assert;
+import org.junit.Test;
+
+public class AuthenticationInfoTest {
+
+ @Test
+ public void testClear() {
+ final char[] pwd = new char[6];
+ final AuthenticationInfo info = new AuthenticationInfo("test", "name",
+ pwd);
+ Assert.assertEquals("test", info.getAuthType());
+ Assert.assertEquals("name", info.getUser());
+ assertSame(pwd, info.getPassword());
+
+ info.clear();
+
+ Assert.assertEquals(1, info.size()); // AUTH_TYPE still contained
+ Assert.assertEquals("test", info.getAuthType());
+ assertFalse(info.containsKey(AuthenticationInfo.USER));
+ assertFalse(info.containsKey(AuthenticationInfo.PASSWORD));
+ }
+
+ @Test
+ public void testDOING_AUTH() {
+ final AuthenticationInfo da = AuthenticationInfo.DOING_AUTH;
+ Assert.assertEquals("DOING_AUTH", da.getAuthType());
+ da.clear();
+ Assert.assertEquals("DOING_AUTH", da.getAuthType());
+ da.put("test", "test");
+ assertFalse(da.containsKey("test"));
+ }
+
+ @Test
+ public void testFAIL_AUTH() {
+ final AuthenticationInfo fa = AuthenticationInfo.FAIL_AUTH;
+ Assert.assertEquals("FAIL_AUTH", fa.getAuthType());
+ fa.clear();
+ Assert.assertEquals("FAIL_AUTH", fa.getAuthType());
+ fa.put("test", "test");
+ assertFalse(fa.containsKey("test"));
+ }
+
+ @Test
+ public void testAuthenticationInfoString() {
+ final AuthenticationInfo info = new AuthenticationInfo("test");
+ Assert.assertEquals("test", info.getAuthType());
+ assertNull(info.getUser());
+ assertNull(info.getPassword());
+ assertNull(info.getWorkspaceName());
+ }
+
+ @Test
+ public void testAuthenticationInfoStringString() {
+ final AuthenticationInfo info = new AuthenticationInfo("test", "name");
+ Assert.assertEquals("test", info.getAuthType());
+ Assert.assertEquals("name", info.getUser());
+ assertNull(info.getPassword());
+ assertNull(info.getWorkspaceName());
+ }
+
+ @Test
+ public void testAuthenticationInfoStringStringCharArray() {
+ final char[] pwd = new char[6];
+ final AuthenticationInfo info = new AuthenticationInfo("test", "name",
+ pwd);
+ Assert.assertEquals("test", info.getAuthType());
+ Assert.assertEquals("name", info.getUser());
+ assertSame(pwd, info.getPassword());
+ assertNull(info.getWorkspaceName());
+ }
+
+ @Test
+ public void testAuthenticationInfoStringStringCharArrayString() {
+ final char[] pwd = new char[6];
+ final AuthenticationInfo info = new AuthenticationInfo("test", "name",
+ pwd, "wsp");
+ Assert.assertEquals("test", info.getAuthType());
+ Assert.assertEquals("name", info.getUser());
+ assertSame(pwd, info.getPassword());
+ Assert.assertEquals("wsp", info.getWorkspaceName());
+ }
+
+ @Test
+ public void testSetAuthType() {
+ final AuthenticationInfo info = new AuthenticationInfo("test");
+ Assert.assertEquals("test", info.getAuthType());
+
+ info.setAuthType(null);
+ Assert.assertEquals("test", info.getAuthType());
+
+ info.setAuthType("dummy");
+ Assert.assertEquals("dummy", info.getAuthType());
+
+ info.setAuthType("");
+ Assert.assertEquals("", info.getAuthType());
+ }
+
+ @Test
+ public void testGetAuthType() {
+ final AuthenticationInfo info = new AuthenticationInfo("test");
+ Assert.assertEquals("test", info.getAuthType());
+ Assert.assertEquals("test", info.get(AuthenticationInfo.AUTH_TYPE));
+ Assert.assertEquals(info.get(AuthenticationInfo.AUTH_TYPE),
+ info.getAuthType());
+ }
+
+ @Test
+ public void testSetUser() {
+ final AuthenticationInfo info = new AuthenticationInfo("test", "user");
+ Assert.assertEquals("user", info.getUser());
+
+ info.setUser(null);
+ Assert.assertEquals("user", info.getUser());
+
+ info.setUser("dummy");
+ Assert.assertEquals("dummy", info.getUser());
+
+ info.setUser("");
+ Assert.assertEquals("", info.getUser());
+ }
+
+ @Test
+ public void testGetUser() {
+ final AuthenticationInfo info = new AuthenticationInfo("test");
+ info.put(AuthenticationInfo.USER, "name");
+
+ Assert.assertEquals("name", info.getUser());
+ Assert.assertEquals("name", info.get(AuthenticationInfo.USER));
+ Assert.assertEquals(info.get(AuthenticationInfo.USER), info.getUser());
+ }
+
+ @Test
+ public void testSetPassword() {
+ final char[] pwd = new char[6];
+ final AuthenticationInfo info = new AuthenticationInfo("test", "name");
+
+ assertFalse(info.containsKey(AuthenticationInfo.PASSWORD));
+
+ info.setPassword(pwd);
+ assertSame(pwd, info.get(AuthenticationInfo.PASSWORD));
+
+ info.setPassword(null);
+ assertSame(pwd, info.get(AuthenticationInfo.PASSWORD));
+ }
+
+ @Test
+ public void testGetPassword() {
+ final char[] pwd = new char[6];
+ final AuthenticationInfo info = new AuthenticationInfo("test", "name",
+ pwd);
+
+ assertSame(pwd, info.getPassword());
+ assertEquals(pwd, (char[]) info.get(AuthenticationInfo.PASSWORD));
+ Assert.assertEquals(info.get(AuthenticationInfo.PASSWORD),
+ info.getPassword());
+ }
+
+ @Test
+ public void testSetWorkspaceName() {
+ final AuthenticationInfo info = new AuthenticationInfo("test", "user",
+ new char[0], "wsp");
+ Assert.assertEquals("wsp", info.getWorkspaceName());
+
+ info.setWorkspaceName(null);
+ Assert.assertEquals("wsp", info.getWorkspaceName());
+
+ info.setWorkspaceName("dummy");
+ Assert.assertEquals("dummy", info.getWorkspaceName());
+
+ info.setWorkspaceName("");
+ Assert.assertEquals("", info.getWorkspaceName());
+ }
+
+ @Test
+ public void testGetWorkspaceName() {
+ final AuthenticationInfo info = new AuthenticationInfo("test");
+ info.put(AuthenticationInfo.WORKSPACE, "wsp");
+
+ Assert.assertEquals("wsp", info.getWorkspaceName());
+ Assert.assertEquals("wsp", info.get(AuthenticationInfo.WORKSPACE));
+ Assert.assertEquals(info.get(AuthenticationInfo.WORKSPACE),
+ info.getWorkspaceName());
+ }
+
+ @Test
+ public void testSetCredentials() {
+ final Credentials creds = new SimpleCredentials("user", new char[0]);
+ final AuthenticationInfo info = new AuthenticationInfo("test");
+
+ info.put("user.jcr.credentials", creds);
+ Assert.assertSame(creds, info.getCredentials());
+
+ info.setCredentials(null);
+ Assert.assertSame(creds, info.getCredentials());
+ }
+
+ @Test
+ public void testGetCredentials() {
+ final AuthenticationInfo info = new AuthenticationInfo("test");
+
+ assertNull(info.getCredentials());
+ assertFalse(info.containsKey(AuthenticationInfo.CREDENTIALS));
+
+ final Credentials creds = new SimpleCredentials("user", new char[0]);
+ info.put("user.jcr.credentials", creds);
+
+ assertSame(creds, info.getCredentials());
+ assertSame(creds, info.get(AuthenticationInfo.CREDENTIALS));
+ assertSame(info.get(AuthenticationInfo.CREDENTIALS),
+ info.getCredentials());
+
+ final String user = "user";
+ final char[] pwd = new char[5];
+ final AuthenticationInfo infoCred = new AuthenticationInfo("TEST",
+ user, pwd);
+
+ // credentials auto-generated but not stored in the object
+ assertTrue(infoCred.getCredentials() instanceof SimpleCredentials);
+ assertFalse(infoCred.containsKey(AuthenticationInfo.CREDENTIALS));
+
+ final SimpleCredentials generated = (SimpleCredentials)
infoCred.getCredentials();
+ assertSame(user, generated.getUserID());
+ assertEquals(pwd, generated.getPassword());
+ }
+
+ @Test
+ public void testRemoveObject() {
+ final AuthenticationInfo info = new AuthenticationInfo("test");
+
+ final Object value = "test";
+ info.put("test", value);
+ assertSame(value, info.get("test"));
+
+ final Object removed = info.remove("test");
+ assertSame(value, removed);
+ assertFalse(info.containsKey("test"));
+
+ assertNull(info.remove(AuthenticationInfo.AUTH_TYPE));
+ Assert.assertEquals("test", info.get("sling.authType"));
+ assertNull(info.remove("sling.authType"));
+ Assert.assertEquals("test", info.getAuthType());
+ }
+
+ @Test
+ public void testPutStringObject() {
+ final AuthenticationInfo info = new AuthenticationInfo("test", "user",
+ new char[2], "wsp");
+ info.setCredentials(new SimpleCredentials("user", new char[2]));
+
+ test_put_fail(info, AuthenticationInfo.AUTH_TYPE, null);
+ test_put_fail(info, AuthenticationInfo.USER, null);
+ test_put_fail(info, AuthenticationInfo.PASSWORD, null);
+ test_put_fail(info, AuthenticationInfo.WORKSPACE, null);
+ test_put_fail(info, AuthenticationInfo.CREDENTIALS, null);
+
+ test_put_fail(info, AuthenticationInfo.AUTH_TYPE, 42);
+ test_put_fail(info, AuthenticationInfo.USER, 42);
+ test_put_fail(info, AuthenticationInfo.PASSWORD, "string");
+ test_put_fail(info, AuthenticationInfo.WORKSPACE, 42);
+ test_put_fail(info, AuthenticationInfo.CREDENTIALS, "string");
+
+ test_put_success(info, AuthenticationInfo.AUTH_TYPE, "new_type");
+ test_put_success(info, AuthenticationInfo.USER, "new_user");
+ test_put_success(info, AuthenticationInfo.PASSWORD,
+ "new_pwd".toCharArray());
+ test_put_success(info, AuthenticationInfo.WORKSPACE, "new_wsp");
+ test_put_success(info, AuthenticationInfo.CREDENTIALS,
+ new SimpleCredentials("new_user", new char[0]));
+ }
+
+ private void test_put_success(final AuthenticationInfo info,
+ final String key, final Object value) {
+ final Object oldValue = info.get(key);
+ final Object replacedValue = info.put(key, value);
+ assertSame(oldValue, replacedValue);
+ assertSame(value, info.get(key));
+ }
+
+ private void test_put_fail(final AuthenticationInfo info, final String key,
+ final Object value) {
+ final Object oldValue = info.get(key);
+ try {
+ info.put(key, value);
+ fail("Expected put failure for " + key + "=" + value);
+ } catch (IllegalArgumentException iae) {
+ // expected
+ }
+ assertSame(oldValue, info.get(key));
+ }
+
+ static void assertEquals(final char[] expected, final char[] actual) {
+ if (expected == null && actual != null) {
+ failNotEquals(null, expected, actual);
+ }
+ if (expected != null && actual == null) {
+ failNotEquals(null, expected, actual);
+ }
+ if (expected.length != actual.length) {
+ failNotEquals(null, expected, actual);
+ }
+
+ for (int i = 0; i < expected.length; i++) {
+ if (expected[i] != actual[i]) {
+ failNotEquals(null, expected, actual);
+ }
+ }
+ }
+}
Propchange:
sling/trunk/bundles/commons/auth/src/test/java/org/apache/sling/commons/auth/spi/AuthenticationInfoTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange:
sling/trunk/bundles/commons/auth/src/test/java/org/apache/sling/commons/auth/spi/AuthenticationInfoTest.java
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision Rev Url