You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by ju...@apache.org on 2012/03/23 15:02:14 UTC

svn commit: r1304352 - in /sling/trunk/bundles/auth/core/src: main/java/org/apache/sling/auth/core/spi/AuthenticationInfo.java main/java/org/apache/sling/auth/core/spi/package-info.java test/java/org/apache/sling/auth/core/spi/AuthenticationInfoTest.java

Author: justin
Date: Fri Mar 23 14:02:13 2012
New Revision: 1304352

URL: http://svn.apache.org/viewvc?rev=1304352&view=rev
Log:
SLING-2441 - allowing put(AUTH_TYPE, null) in AuthenticationInfo. Bumping export version as it is an API change.

Modified:
    sling/trunk/bundles/auth/core/src/main/java/org/apache/sling/auth/core/spi/AuthenticationInfo.java
    sling/trunk/bundles/auth/core/src/main/java/org/apache/sling/auth/core/spi/package-info.java
    sling/trunk/bundles/auth/core/src/test/java/org/apache/sling/auth/core/spi/AuthenticationInfoTest.java

Modified: sling/trunk/bundles/auth/core/src/main/java/org/apache/sling/auth/core/spi/AuthenticationInfo.java
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/auth/core/src/main/java/org/apache/sling/auth/core/spi/AuthenticationInfo.java?rev=1304352&r1=1304351&r2=1304352&view=diff
==============================================================================
--- sling/trunk/bundles/auth/core/src/main/java/org/apache/sling/auth/core/spi/AuthenticationInfo.java (original)
+++ sling/trunk/bundles/auth/core/src/main/java/org/apache/sling/auth/core/spi/AuthenticationInfo.java Fri Mar 23 14:02:13 2012
@@ -82,7 +82,8 @@ public class AuthenticationInfo extends 
      * effectively use this instance the user Id with optional password and/or
      * the credentials should be set.
      *
-     * @param authType The authentication type, must not be <code>null</code>.
+     * @param authType The authentication type.  Can be <code>null</code> to
+     *                 indicate anonymous access.
      */
     public AuthenticationInfo(final String authType) {
         this(authType, null, null);
@@ -132,7 +133,7 @@ public class AuthenticationInfo extends 
 
     /**
      * Returns the authentication type stored as the {@link #AUTH_TYPE} property
-     * in this map. This value is expected to never be <code>null</code>.
+     * in this map.
      * <p>
      * If authentication is taking place through one of the standard ways, such
      * as Basic or Digest, the return value is one of the predefined constants
@@ -209,7 +210,7 @@ public class AuthenticationInfo extends 
     @Override
     public Object put(final String key, final Object value) {
 
-        if (AUTH_TYPE.equals(key) && !(value instanceof String)) {
+        if (AUTH_TYPE.equals(key) && !(value == null || value instanceof String)) {
             throw new IllegalArgumentException(AUTH_TYPE
                 + " property must be a String");
         }

Modified: sling/trunk/bundles/auth/core/src/main/java/org/apache/sling/auth/core/spi/package-info.java
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/auth/core/src/main/java/org/apache/sling/auth/core/spi/package-info.java?rev=1304352&r1=1304351&r2=1304352&view=diff
==============================================================================
--- sling/trunk/bundles/auth/core/src/main/java/org/apache/sling/auth/core/spi/package-info.java (original)
+++ sling/trunk/bundles/auth/core/src/main/java/org/apache/sling/auth/core/spi/package-info.java Fri Mar 23 14:02:13 2012
@@ -28,7 +28,7 @@
  *
  * @version 1.0.4
  */
-@Version("1.0.4")
+@Version("1.1.0")
 package org.apache.sling.auth.core.spi;
 
 import aQute.bnd.annotation.Version;

Modified: sling/trunk/bundles/auth/core/src/test/java/org/apache/sling/auth/core/spi/AuthenticationInfoTest.java
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/auth/core/src/test/java/org/apache/sling/auth/core/spi/AuthenticationInfoTest.java?rev=1304352&r1=1304351&r2=1304352&view=diff
==============================================================================
--- sling/trunk/bundles/auth/core/src/test/java/org/apache/sling/auth/core/spi/AuthenticationInfoTest.java (original)
+++ sling/trunk/bundles/auth/core/src/test/java/org/apache/sling/auth/core/spi/AuthenticationInfoTest.java Fri Mar 23 14:02:13 2012
@@ -241,7 +241,7 @@ public class AuthenticationInfoTest {
         info.put(CREDENTIALS,
                 new SimpleCredentials("user", new char[2]));
 
-        test_put_fail(info, AuthenticationInfo.AUTH_TYPE, null);
+        test_put_success(info, AuthenticationInfo.AUTH_TYPE, null);
         test_put_fail(info, ResourceResolverFactory.USER, null);
         test_put_fail(info, ResourceResolverFactory.PASSWORD, null);