(no commit message)
authorErik Brakkee <erik@brakkee.org>
Sat, 31 Jul 2010 17:32:15 +0000 (17:32 +0000)
committerErik Brakkee <erik@brakkee.org>
Sat, 31 Jul 2010 17:32:15 +0000 (17:32 +0000)
57 files changed:
security/usermgt/src/main/java/org/wamblee/security/authentication/AbstractUserSet.java
security/usermgt/src/main/java/org/wamblee/security/authentication/GroupSet.java
security/usermgt/src/main/java/org/wamblee/security/authentication/InMemoryUserSet.java
security/usermgt/src/main/java/org/wamblee/security/authentication/JaasUserAccessor.java
security/usermgt/src/main/java/org/wamblee/security/authentication/Md5HexMessageDigester.java
security/usermgt/src/main/java/org/wamblee/security/authentication/MessageDigester.java
security/usermgt/src/main/java/org/wamblee/security/authentication/NameValidator.java
security/usermgt/src/main/java/org/wamblee/security/authentication/User.java
security/usermgt/src/main/java/org/wamblee/security/authentication/UserAccessor.java
security/usermgt/src/main/java/org/wamblee/security/authentication/UserAdminInitializer.java
security/usermgt/src/main/java/org/wamblee/security/authentication/UserAdministration.java
security/usermgt/src/main/java/org/wamblee/security/authentication/UserAdministrationImpl.java
security/usermgt/src/main/java/org/wamblee/security/authentication/UserMgtException.java
security/usermgt/src/main/java/org/wamblee/security/authentication/UserSet.java
security/usermgt/src/main/java/org/wamblee/security/authentication/jpa/JpaGroupSet.java
security/usermgt/src/main/java/org/wamblee/security/authentication/jpa/JpaUserSet.java
security/usermgt/src/main/java/org/wamblee/security/authentication/package-info.java
security/usermgt/src/main/java/org/wamblee/security/authorization/AbstractAuthorizationRule.java
security/usermgt/src/main/java/org/wamblee/security/authorization/AbstractAuthorizationService.java
security/usermgt/src/main/java/org/wamblee/security/authorization/AbstractOperationCondition.java
security/usermgt/src/main/java/org/wamblee/security/authorization/AbstractPathCondition.java
security/usermgt/src/main/java/org/wamblee/security/authorization/AbstractUserCondition.java
security/usermgt/src/main/java/org/wamblee/security/authorization/AllOperation.java
security/usermgt/src/main/java/org/wamblee/security/authorization/AnyUserCondition.java
security/usermgt/src/main/java/org/wamblee/security/authorization/AuthorizationException.java
security/usermgt/src/main/java/org/wamblee/security/authorization/AuthorizationInitializer.java
security/usermgt/src/main/java/org/wamblee/security/authorization/AuthorizationResult.java
security/usermgt/src/main/java/org/wamblee/security/authorization/AuthorizationRule.java
security/usermgt/src/main/java/org/wamblee/security/authorization/AuthorizationService.java
security/usermgt/src/main/java/org/wamblee/security/authorization/CreateOperation.java
security/usermgt/src/main/java/org/wamblee/security/authorization/DefaultOperationRegistry.java
security/usermgt/src/main/java/org/wamblee/security/authorization/DeleteOperation.java
security/usermgt/src/main/java/org/wamblee/security/authorization/GroupUserCondition.java
security/usermgt/src/main/java/org/wamblee/security/authorization/IsaOperationCondition.java
security/usermgt/src/main/java/org/wamblee/security/authorization/Operation.java
security/usermgt/src/main/java/org/wamblee/security/authorization/OperationCondition.java
security/usermgt/src/main/java/org/wamblee/security/authorization/OperationRegistry.java
security/usermgt/src/main/java/org/wamblee/security/authorization/PathCondition.java
security/usermgt/src/main/java/org/wamblee/security/authorization/ReadOperation.java
security/usermgt/src/main/java/org/wamblee/security/authorization/RegexpPathCondition.java
security/usermgt/src/main/java/org/wamblee/security/authorization/StartsWithPathCondition.java
security/usermgt/src/main/java/org/wamblee/security/authorization/UrlAuthorizationRule.java
security/usermgt/src/main/java/org/wamblee/security/authorization/UserCondition.java
security/usermgt/src/main/java/org/wamblee/security/authorization/WriteOperation.java
security/usermgt/src/main/java/org/wamblee/security/authorization/jpa/JpaAuthorizationService.java
security/usermgt/src/main/java/org/wamblee/security/authorization/package-info.java
security/usermgt/src/test/java/org/wamblee/security/authentication/InMemoryGroupSetTest.java
security/usermgt/src/test/java/org/wamblee/security/authentication/MessageDigesterTest.java
security/usermgt/src/test/java/org/wamblee/security/authentication/UsermgtTestUtils.java
security/usermgt/src/test/java/org/wamblee/security/authorization/AuthorizationServiceTest.java
security/usermgt/src/test/java/org/wamblee/security/authorization/DefaultOperationRegistryTest.java
security/usermgt/src/test/java/org/wamblee/security/authorization/RegexpPathConditionTest.java
security/usermgt/src/test/java/org/wamblee/security/authorization/StartsWithPathConditionTest.java
security/usermgt/src/test/java/org/wamblee/security/authorization/TestAuthorizationRule.java
security/usermgt/src/test/java/org/wamblee/security/authorization/TestResource.java
security/usermgt/src/test/java/org/wamblee/security/authorization/TestUserAccessor.java
security/usermgt/src/test/java/org/wamblee/security/authorization/UrlAuthorizationRuleTest.java

index 04f59edcf2970bb5adda818bbaae5bb495a32ee6..7278f05a2dcffaa86c501c742fbbcb1ab9f2ca54 100644 (file)
  * 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.wamblee.security.authentication;
 
-
 import static org.wamblee.security.authentication.UserMgtException.Reason.*;
 
 /**
index c6964a74467de5caaa0bcf2cd1dc58259d83fc67..298424657a99bd6b4de8343c3ff868ac46a715c5 100644 (file)
@@ -12,7 +12,7 @@
  * 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.wamblee.security.authentication;
 
 import java.util.Set;
index 5988b40bab70f7ecf0ad09a2d5e6e556b34edf4c..dd03f24b0380b0de69468939f87e5834b53757dc 100644 (file)
  * 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.wamblee.security.authentication;
 
-
 import java.util.Set;
 import java.util.TreeSet;
 
@@ -99,9 +98,9 @@ public class InMemoryUserSet extends AbstractUserSet {
     public int size() {
         return users.size();
     }
-    
+
     @Override
     public void clearCache() {
-        // Empty   
+        // Empty
     }
 }
index 0ac6aa730073d36f9f89654809b1d04f29a24b31..c86de35681074fd99ea9b45f2e82a4b9b2352a12 100644 (file)
@@ -12,7 +12,7 @@
  * 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.wamblee.security.authentication;
 
 import java.security.AccessController;
index b992f5d78f4689f04cdaab9cde8126d9cc972bfa..1481ee76afbe43130f6350490c15c4c6b20da140 100644 (file)
@@ -12,7 +12,7 @@
  * 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.wamblee.security.authentication;
 
 import org.apache.commons.codec.binary.Hex;
index 6e3b1f03409fbb2a6984dc303b6b6d4ddbc3a5ee..f30086faa334c3a9f1b30228f38e0348516122b5 100644 (file)
@@ -12,7 +12,7 @@
  * 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.wamblee.security.authentication;
 
 /**
index 910b345eee23a1ce2cae16e09dbc4b50d57220cc..c0c7ef111fffbbc3eb164e957221834e068aa94d 100644 (file)
@@ -12,7 +12,7 @@
  * 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.wamblee.security.authentication;
 
 /**
@@ -27,7 +27,7 @@ public interface NameValidator {
      * @param aName
      *            Name
      * 
-     * @return True iff the validationo is ok. 
+     * @return True iff the validationo is ok.
      */
     boolean validate(String aName);
 }
index 997748324bddb32515fe174f92b9f2aa2f7ac02c..7d13197fba8c82e7e96404d55ac097169269d478 100644 (file)
@@ -85,13 +85,13 @@ public class User implements Serializable, Comparable {
      * Password validator.
      */
     @Transient
-    private NameValidator passwordValidator;
+    private transient NameValidator passwordValidator;
 
     /**
      * Password encoder.
      */
     @Transient
-    private MessageDigester passwordEncoder;
+    private transient MessageDigester passwordEncoder;
 
     /**
      * Constructs the user.
@@ -376,13 +376,14 @@ public class User implements Serializable, Comparable {
      */
     @Override
     public String toString() {
-        String result = "User(name=" + name + ", password=" + password;
+        StringBuffer result = new StringBuffer("User(name=" + name + ", password=" + password);
 
         for (Group group : groups) {
-            result += (", group=" + group);
+            result.append(", group=" + group);
         }
+        result.append(")");
 
-        return result + ")";
+        return result.toString();
     }
 
     /*
index 37d5eb73cfdfe74f5d5ecd4734cc3e26017ad24f..352f657e7774b7a33b783ab86242e5aef972ef2f 100644 (file)
@@ -12,7 +12,7 @@
  * 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.wamblee.security.authentication;
 
 /**
index 31a4d4653f6d4d187d90cfe33ab87c1ceca39168..5b07ff481b0bbfb3b575f46dcf9c6973e8ce92f9 100644 (file)
@@ -12,7 +12,7 @@
  * 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.wamblee.security.authentication;
 
 import java.util.logging.Logger;
index 7ed58086f5083a3532e34937552be296fb9bcab0..74508b3ee2572fd7025881af4314718dfd6e3ff0 100644 (file)
@@ -12,7 +12,7 @@
  * 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.wamblee.security.authentication;
 
 import java.util.List;
@@ -50,31 +50,35 @@ public interface UserAdministration {
      *             In case there is a conflict with an existing group.
      */
     void createGroup(String aName);
-    
+
     /**
-     * Checks if a user exists. 
-     * @param aUser User to check.
-     * @return True iff user exists. 
+     * Checks if a user exists.
+     * 
+     * @param aUser
+     *            User to check.
+     * @return True iff user exists.
      */
     boolean checkUser(String aUser);
-    
-    
+
     /**
-     * Check if a group exists. 
-     * @param aGroup Group. 
-     * @return True iff group exists. 
+     * Check if a group exists.
+     * 
+     * @param aGroup
+     *            Group.
+     * @return True iff group exists.
      */
     boolean checkGroup(String aGroup);
-    
+
     /**
      * Checks the password.
      * 
-     * @param aUser 
+     * @param aUser
      *            User to check password for.
      * @param aPassword
      *            Password to check.
-     * @throws UserMgtException In case user does not exist. 
-     * @return True iff password is ok. 
+     * @throws UserMgtException
+     *             In case user does not exist.
+     * @return True iff password is ok.
      */
     boolean checkPassword(String aUser, String aPassword);
 
@@ -82,16 +86,18 @@ public interface UserAdministration {
      * Changes the password.
      * 
      * @param aUser
-     *            User. 
+     *            User.
      * @param aOldPassword
      *            Old password.
      * @param aNewPassword
      *            New password.
      * 
-     * @throws UserMgtException Inc ase the user does not exist. 
-     * @return True if the password was changed. 
+     * @throws UserMgtException
+     *             Inc ase the user does not exist.
+     * @return True if the password was changed.
      */
-    boolean changePassword(String aUser, String aOldPassword, String aNewPassword);
+    boolean changePassword(String aUser, String aOldPassword,
+        String aNewPassword);
 
     /**
      * 
@@ -100,18 +106,23 @@ public interface UserAdministration {
      * @param aPassword
      *            The password to set.
      * 
-     * @throws UserMgtException Inc ase the user does not exist.
+     * @throws UserMgtException
+     *             Inc ase the user does not exist.
      */
     void setPassword(String aUser, String aPassword);
 
     /**
      * Checks if the user belongs to the given group.
-     * @param aUser User
-     * @param aGroup Group. 
+     * 
+     * @param aUser
+     *            User
+     * @param aGroup
+     *            Group.
      * @return True iff user is in group
-     * @throws UserMgtException In case the user or group do not exist. 
+     * @throws UserMgtException
+     *             In case the user or group do not exist.
      */
-    boolean isInGroup(String aUser, String aGroup); 
+    boolean isInGroup(String aUser, String aGroup);
 
     /**
      * 
@@ -151,11 +162,12 @@ public interface UserAdministration {
     /**
      * Gets all groups for a given user.
      * 
-     * @param aUser user. 
+     * @param aUser
+     *            user.
      * @return Groups.
      */
     List<String> getGroups(String aUser);
-    
+
     /**
      * Renames a user.
      * 
index 61505a9fa627d705f3cc0cc8715eaff1fd0fbbfa..1a515db072b613198b14b257b8f6cb23cf7a7b03 100644 (file)
@@ -236,8 +236,9 @@ public class UserAdministrationImpl implements UserAdministration {
 
         group.setName(aNewGroup);
         groups.groupModified(group);
-        // Because a group has changed, a cached user could contain reference to an old copy of the 
-        // group. Therefore, we clear the cache in this case. 
+        // Because a group has changed, a cached user could contain reference to
+        // an old copy of the
+        // group. Therefore, we clear the cache in this case.
         users.clearCache();
     }
 
index 744c0d8a717aa46ddab20c70f7b9600e27736eea..6f4f2b8351adce1d163dc72cbfbdd55e3320ee1b 100644 (file)
@@ -12,7 +12,7 @@
  * 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.wamblee.security.authentication;
 
 import java.util.EnumMap;
index 7e6f9721e69134bbd41003f6d91ece3e0f1a5ddf..cbe216d930abd4ba9bc7702a6775849804995410 100644 (file)
@@ -12,7 +12,7 @@
  * 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.wamblee.security.authentication;
 
 import java.util.Set;
@@ -38,8 +38,7 @@ public interface UserSet {
      * @throws UserMgtException
      *             In case the user cannot be created.
      */
-    User createUser(String aUsername, String aPassword)
-        throws UserMgtException;
+    User createUser(String aUsername, String aPassword) throws UserMgtException;
 
     /**
      * Must be called whenever a user object has been modified to notify the
@@ -81,9 +80,10 @@ public interface UserSet {
     boolean add(User aUser);
 
     /**
-     * Removes a user. 
-     *  
-     * @param aUser User to remove
+     * Removes a user.
+     * 
+     * @param aUser
+     *            User to remove
      * @return True iff user was removed.
      * 
      */
@@ -110,9 +110,9 @@ public interface UserSet {
      * @return The number of users.
      */
     int size();
-    
+
     /**
-     * Clears the user cache. 
+     * Clears the user cache.
      */
     void clearCache();
 }
index c928b843eba8d4f02149e381a0b1a089523c60eb..f15454ef70eaf953c6678030edb7445d9895f0be 100644 (file)
@@ -36,8 +36,10 @@ public class JpaGroupSet implements GroupSet {
     private EntityManager em;
 
     /**
-     * Constructs the group set. 
-     * @param aEm Contextual reference to an entity manager. 
+     * Constructs the group set.
+     * 
+     * @param aEm
+     *            Contextual reference to an entity manager.
      */
     public JpaGroupSet(EntityManager aEm) {
         em = aEm;
@@ -50,7 +52,7 @@ public class JpaGroupSet implements GroupSet {
             return false;
         }
         em.persist(aGroup);
-        em.flush(); // to make sure the version is updated. 
+        em.flush(); // to make sure the version is updated.
         return true;
     }
 
index be3ebcdf8976c22bf92a78c4e7d809b96d160689..74609a1fdbb4a46f4161be92514bf4c9495c1305 100644 (file)
@@ -64,7 +64,7 @@ public class JpaUserSet extends AbstractUserSet {
     public void userModified(User aUser) {
         assert aUser.getPrimaryKey() != null;
         User merged = entityManager.merge(aUser);
-        // Need to flush the entity manager to make sure the version is updated. 
+        // Need to flush the entity manager to make sure the version is updated.
         entityManager.flush();
         JpaMergeSupport.merge(merged, aUser);
         cache.remove(aUser.getName());
@@ -107,7 +107,7 @@ public class JpaUserSet extends AbstractUserSet {
         }
 
         entityManager.persist(aUser);
-        entityManager.flush(); // to make sure the version is updated. 
+        entityManager.flush(); // to make sure the version is updated.
         setPasswordInfo(aUser);
         cache.put(aUser.getName(), aUser);
 
@@ -147,7 +147,7 @@ public class JpaUserSet extends AbstractUserSet {
         TypedQuery<User> query = entityManager.createNamedQuery(
             User.QUERY_FIND_BY_GROUP_NAME, User.class);
         query.setParameter(User.NAME_PARAM, aGroup.getName());
-        
+
         List<User> list = query.getResultList();
         users.addAll(list);
         for (User user : users) {
@@ -159,12 +159,13 @@ public class JpaUserSet extends AbstractUserSet {
 
     @Override
     public int size() {
-        Long result = entityManager.createNamedQuery(User.QUERY_COUNT_USERS, Long.class).getSingleResult();
+        Long result = entityManager.createNamedQuery(User.QUERY_COUNT_USERS,
+            Long.class).getSingleResult();
         return result.intValue();
     }
-    
+
     @Override
     public void clearCache() {
-        cache.clear();   
+        cache.clear();
     }
 }
index 7501a294389f92ffb418093c658d9d5ade8d76ce..4118f2c3748b1f5a45bf16d70ed6fb6e26f625a7 100644 (file)
@@ -12,7 +12,7 @@
  * 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.
- */ 
+ */
 /**
  * This package provides support for managing users and their authentication. 
  * 
@@ -75,3 +75,4 @@
  * <br/>
  */
 package org.wamblee.security.authentication;
+
index 828a89151e51c9e41185261f9ab8f575b87fd6e9..9ac92424068524f56c7526f6e5dd5122e9ea9f5b 100644 (file)
@@ -12,7 +12,7 @@
  * 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.wamblee.security.authorization;
 
 import javax.persistence.DiscriminatorColumn;
@@ -36,19 +36,19 @@ import javax.persistence.Version;
 @Inheritance(strategy = InheritanceType.SINGLE_TABLE)
 @DiscriminatorColumn(name = "TYPE")
 public abstract class AbstractAuthorizationRule implements AuthorizationRule {
-    
+
     @Id
     @GeneratedValue(strategy = GenerationType.AUTO)
     private Long id;
 
     @Version
     private int version;
-    
-    public AbstractAuthorizationRule() { 
+
+    public AbstractAuthorizationRule() {
         // Empty
     }
-    
-    public AbstractAuthorizationRule(AbstractAuthorizationRule aRule) { 
+
+    public AbstractAuthorizationRule(AbstractAuthorizationRule aRule) {
         id = aRule.id;
         version = aRule.version;
     }
index 79b9d3d0df5b8a55ef0c1cf52f8b7fadb87d55a1..2cbc4367497aa8c54085d2b54a0c6bade7bbf7b5 100644 (file)
@@ -12,7 +12,7 @@
  * 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.wamblee.security.authorization;
 
 import javax.persistence.DiscriminatorColumn;
@@ -36,42 +36,40 @@ import javax.persistence.Version;
 @Table(name = "SEC_AUTH_SVC")
 @Inheritance(strategy = InheritanceType.SINGLE_TABLE)
 @DiscriminatorColumn(name = "TYPE")
-@NamedQueries( 
-    @NamedQuery(name = AbstractAuthorizationService.QUERY_FIND_BY_NAME, 
-        query = "select s from AbstractAuthorizationService s where s.name = :" +
-        AbstractAuthorizationService.NAME_PARAM)
-        )
-public abstract class AbstractAuthorizationService implements AuthorizationService {
+@NamedQueries(@NamedQuery(name = AbstractAuthorizationService.QUERY_FIND_BY_NAME, query = "select s from AbstractAuthorizationService s where s.name = :" +
+    AbstractAuthorizationService.NAME_PARAM))
+public abstract class AbstractAuthorizationService implements
+    AuthorizationService {
+
     public static final String QUERY_FIND_BY_NAME = "AuthorizationService.findByName";
     public static final String NAME_PARAM = "name";
-    
+
     @Id
     @GeneratedValue(strategy = GenerationType.AUTO)
     private Long id;
 
     @Version
     private int version;
-    
+
     /**
      * Name for this instance of the authorization service.
      */
-    private String name; 
-    
-    public AbstractAuthorizationService() { 
-        // Empty. 
+    private String name;
+
+    public AbstractAuthorizationService() {
+        // Empty.
     }
-    
-    public AbstractAuthorizationService(String aName) { 
-        name = aName; 
+
+    public AbstractAuthorizationService(String aName) {
+        name = aName;
     }
-    
-    public AbstractAuthorizationService(AbstractAuthorizationService aSvc) { 
+
+    public AbstractAuthorizationService(AbstractAuthorizationService aSvc) {
         id = aSvc.id;
         version = aSvc.version;
         name = aSvc.name;
     }
-    
+
     public String getName() {
         return name;
     }
index f933309204bf243d51819d3bcabefb47f28a9dc0..ccb893b1256028cfe72ed4283acab467ec870043 100644 (file)
@@ -12,7 +12,7 @@
  * 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.wamblee.security.authorization;
 
 import javax.persistence.DiscriminatorColumn;
@@ -35,19 +35,19 @@ import javax.persistence.Version;
 @Inheritance(strategy = InheritanceType.SINGLE_TABLE)
 @DiscriminatorColumn(name = "TYPE")
 public abstract class AbstractOperationCondition implements OperationCondition {
-    
+
     @Id
     @GeneratedValue(strategy = GenerationType.AUTO)
     private Long id;
 
     @Version
     private int version;
-    
-    public AbstractOperationCondition() { 
+
+    public AbstractOperationCondition() {
         // Empty
     }
-    
-    public AbstractOperationCondition(AbstractOperationCondition aCondition) { 
+
+    public AbstractOperationCondition(AbstractOperationCondition aCondition) {
         id = aCondition.id;
         version = aCondition.version;
     }
index f131dea31a9d799497747a31e5c083c6fb4b18c1..7aaa0c83609da9f368e2e4f979e6da2585afcce0 100644 (file)
@@ -12,7 +12,7 @@
  * 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.wamblee.security.authorization;
 
 import javax.persistence.DiscriminatorColumn;
@@ -35,19 +35,19 @@ import javax.persistence.Version;
 @Inheritance(strategy = InheritanceType.SINGLE_TABLE)
 @DiscriminatorColumn(name = "TYPE")
 public abstract class AbstractPathCondition implements PathCondition {
-    
+
     @Id
     @GeneratedValue(strategy = GenerationType.AUTO)
     private Long id;
 
     @Version
     private int version;
-    
-    public AbstractPathCondition() { 
+
+    public AbstractPathCondition() {
         // Empty
     }
-    
-    public AbstractPathCondition(AbstractPathCondition aCondition) { 
+
+    public AbstractPathCondition(AbstractPathCondition aCondition) {
         id = aCondition.id;
         version = aCondition.version;
     }
index 74487bce9e67d56ff894924909d4a7784cb7450c..07282989be0b6921e966744e4f67d10fafd1a152 100644 (file)
@@ -12,7 +12,7 @@
  * 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.wamblee.security.authorization;
 
 import javax.persistence.DiscriminatorColumn;
@@ -35,19 +35,19 @@ import javax.persistence.Version;
 @Inheritance(strategy = InheritanceType.SINGLE_TABLE)
 @DiscriminatorColumn(name = "TYPE")
 public abstract class AbstractUserCondition implements UserCondition {
-    
+
     @Id
     @GeneratedValue(strategy = GenerationType.AUTO)
     private Long id;
 
     @Version
     private int version;
-    
-    public AbstractUserCondition() { 
+
+    public AbstractUserCondition() {
         // Empty.
     }
-    
-    public AbstractUserCondition(AbstractUserCondition aCondition) { 
+
+    public AbstractUserCondition(AbstractUserCondition aCondition) {
         id = aCondition.id;
         version = aCondition.version;
     }
index 83b7a4e0a65424bf44fbc89cf61d7da4424093fb..913d1a6c2968027f66f91d99496814d51e906834 100644 (file)
@@ -12,7 +12,7 @@
  * 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.wamblee.security.authorization;
 
 /**
index 88ee8013ce8c83f6e8a8a3637896451f6593e52f..60764c4381e751934ec08fafb8f2dda72e632e1a 100644 (file)
  * 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.wamblee.security.authorization;
 
-
 import javax.persistence.DiscriminatorValue;
 import javax.persistence.Entity;
 
@@ -36,10 +35,10 @@ public class AnyUserCondition extends AbstractUserCondition {
     public AnyUserCondition() {
         // Empty.
     }
-    
+
     @Override
     public void setUserAdmin(UserAdministration aAdmin) {
-        // Empty. Don't need user admin.    
+        // Empty. Don't need user admin.
     }
 
     @Override
index e06a91449037a018401cc1ecc8c126ba1da70376..d67357535e3c2a8f597fe39538c83e6552e9cd63 100644 (file)
@@ -12,7 +12,7 @@
  * 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.wamblee.security.authorization;
 
 /**
index 3c6e7c7deb029e013e0ff00a008c934d9404b25a..dab949ceac2944a362759e1ae91906961295dd97 100644 (file)
@@ -12,7 +12,7 @@
  * 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.wamblee.security.authorization;
 
 import java.util.logging.Logger;
index e187caaae167298031eed8cc22d2069e266f351e..b8ff5063b6fc4ef5885e9b20ee08d0e765c25b4b 100644 (file)
@@ -12,7 +12,7 @@
  * 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.wamblee.security.authorization;
 
 /**
index 37ce1c872ac62980162d37321b9694b33e7d446d..4323ac9ac261f44541af7b9d7bb283343d1d8050 100644 (file)
@@ -24,12 +24,14 @@ import org.wamblee.security.authentication.UserAdministration;
  * @author Erik Brakkee
  */
 public interface AuthorizationRule {
-    
+
     /**
-     * Sets the user admnistration to use. 
-     * @param aAdmin User administration. 
+     * Sets the user admnistration to use.
+     * 
+     * @param aAdmin
+     *            User administration.
      */
-    void setUserAdministration(UserAdministration aAdmin); 
+    void setUserAdministration(UserAdministration aAdmin);
 
     /**
      * Returns the supported object types for which this authorization rule
@@ -54,7 +56,7 @@ public interface AuthorizationRule {
      * 
      * @return Authorization result.
      */
-    AuthorizationResult isAllowed(Object aResource,
-        Operation aOperation, String aUser);
+    AuthorizationResult isAllowed(Object aResource, Operation aOperation,
+        String aUser);
 
 }
\ No newline at end of file
index bfbe0f8443ac3706fb68f6a341dbb9a0e7b8a799..7f380ab2a0cf7a139fe7b421d316a0cc511386a6 100644 (file)
@@ -93,13 +93,14 @@ public interface AuthorizationService {
      *            User accessor.
      */
     void setUserAccessor(UserAccessor aUserAccessor);
-    
+
     /**
-     * Sets the user administration so that the authorization service can check 
+     * Sets the user administration so that the authorization service can check
      * information for the the current user.
-     *  
-     * @param aUserAdmin User administration. 
+     * 
+     * @param aUserAdmin
+     *            User administration.
      */
-    void setUserAdministration(UserAdministration aUserAdmin); 
+    void setUserAdministration(UserAdministration aUserAdmin);
 
 }
\ No newline at end of file
index 7a6214df450b8259f9242de87ea714806e1d9308..9611d0b65cf62bd719245695dfecd6cf1a823769 100644 (file)
@@ -12,7 +12,7 @@
  * 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.wamblee.security.authorization;
 
 /**
index 2ebce1c78d80b921b19c839300dca40f0051500d..0a548975199d423fac59db03dd6dc7eb538af933 100644 (file)
@@ -12,7 +12,7 @@
  * 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.wamblee.security.authorization;
 
 import java.util.ArrayList;
index 14901149ceca3def3bebaf0ac003c7f3564887b8..09e58b87377871c1105dcc168cc844afb6d13ed2 100644 (file)
@@ -12,7 +12,7 @@
  * 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.wamblee.security.authorization;
 
 /**
index f50c3d120bfb38468cbe115c44b23928f72b4052..234c75c15998f1d0aeee9cbf028a6daf08f21faa 100644 (file)
  * 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.wamblee.security.authorization;
 
-
 import javax.persistence.Column;
 import javax.persistence.DiscriminatorValue;
 import javax.persistence.Entity;
@@ -23,7 +22,6 @@ import javax.persistence.Transient;
 
 import org.wamblee.security.authentication.UserAdministration;
 
-
 /**
  * Checks if a user against a specific group.
  * 
@@ -37,9 +35,9 @@ public class GroupUserCondition extends AbstractUserCondition {
      */
     @Column(name = "GRP")
     private String group;
-    
+
     @Transient
-    private UserAdministration admin; 
+    private UserAdministration admin;
 
     /**
      * Constructs the condition.
@@ -58,10 +56,10 @@ public class GroupUserCondition extends AbstractUserCondition {
     protected GroupUserCondition() {
         group = null;
     }
-    
+
     @Override
     public void setUserAdmin(UserAdministration aAdmin) {
-        admin = aAdmin;   
+        admin = aAdmin;
     }
 
     @Override
index b42f5d0ea114d382677f3bade9420573f7faf327..3e43069f585f47604fc6486d79b5ff9d1f5a9297 100644 (file)
@@ -12,7 +12,7 @@
  * 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.wamblee.security.authorization;
 
 import javax.persistence.Access;
index 54a959e44a036f0dfdc98c6cc5cc63176b9f0d1e..87ff1990ee8c6f926e373d0c89c9044667cbe937 100644 (file)
@@ -12,7 +12,7 @@
  * 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.wamblee.security.authorization;
 
 /**
index 06ef988bbf90e10168079c76b4e0013666bab429..e8cb48c420617ab6fe6b47858bed819298df3b51 100644 (file)
@@ -12,7 +12,7 @@
  * 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.wamblee.security.authorization;
 
 /**
index 0986148d1eaaaf5e2a1cc55fafd46fa5feac3cdf..42465857a16c39c03c6f64181b15f4ab152ccf67 100644 (file)
@@ -12,7 +12,7 @@
  * 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.wamblee.security.authorization;
 
 /**
index 0fd91916791ac1812538db4a9db81b73d645bb22..e25594da711ec0f3ae189541345af113bad59bc2 100644 (file)
@@ -12,7 +12,7 @@
  * 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.wamblee.security.authorization;
 
 /**
index 2ff67b5378a14f71345000325cd26581109acc78..73547eeefd8c3d3ad573308d136de54040401512 100644 (file)
@@ -12,7 +12,7 @@
  * 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.wamblee.security.authorization;
 
 /**
index e40d4acab50370b50c1334cef8adacc4f3e780ea..c740391c1db3a0c841d2e723390b3254760596ea 100644 (file)
@@ -12,7 +12,7 @@
  * 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.wamblee.security.authorization;
 
 import javax.persistence.DiscriminatorValue;
index 9233d800340700f3dcd01c9a93b10e633cfa1073..0e58c39d40083a24a0cf4264761bb94bfce75293 100644 (file)
@@ -12,7 +12,7 @@
  * 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.wamblee.security.authorization;
 
 import javax.persistence.DiscriminatorValue;
index 2aa759cb7862d3f6eae8283a9d3f0fba7628e575..a9a941a398017457b551c7df1b57b719193d6769 100644 (file)
@@ -12,7 +12,7 @@
  * 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.wamblee.security.authorization;
 
 import static org.wamblee.security.authorization.AuthorizationResult.*;
@@ -42,8 +42,8 @@ import org.wamblee.security.authentication.UserAdministration;
  * appropriate is determined by a
  * {@link org.wamblee.security.authorization.AbstractUserCondition}.</li>
  * <li>The operation that is requested. Whether the operation is appropriate is
- * determined by a {@link org.wamblee.security.authorization.AbstractOperationCondition}
- * .</li>
+ * determined by a
+ * {@link org.wamblee.security.authorization.AbstractOperationCondition} .</li>
  * </ul>
  * In case all three conditions match, the condition returns the configured
  * result passed at construction (GRANTED or DENIED). If the resource is not of
@@ -79,7 +79,7 @@ public abstract class UrlAuthorizationRule extends AbstractAuthorizationRule {
     /**
      * Operation that this rule is for.
      */
-    
+
     private OperationCondition operationCondition;
 
     /**
@@ -177,8 +177,8 @@ public abstract class UrlAuthorizationRule extends AbstractAuthorizationRule {
      * 
      * @return Authorization result,
      */
-    protected AuthorizationResult isAllowedWithPath(String aPath, Operation aOperation,
-        String aUser) {
+    protected AuthorizationResult isAllowedWithPath(String aPath,
+        Operation aOperation, String aUser) {
         if (!pathCondition.matches(aPath)) {
             return UNDECIDED;
         }
@@ -254,8 +254,8 @@ public abstract class UrlAuthorizationRule extends AbstractAuthorizationRule {
         try {
             resourceClass = Class.forName(aResourceClass);
         } catch (ClassNotFoundException e) {
-            LOGGER.log(Level.SEVERE, "Cannot find resource class '" + aResourceClass + "'",
-                e);
+            LOGGER.log(Level.SEVERE, "Cannot find resource class '" +
+                aResourceClass + "'", e);
             throw new IllegalArgumentException(e.getMessage(), e);
         }
     }
@@ -316,10 +316,10 @@ public abstract class UrlAuthorizationRule extends AbstractAuthorizationRule {
     protected void setUserCondition(UserCondition aUserCondition) {
         userCondition = aUserCondition;
     }
-    
+
     @Override
     public void setUserAdministration(UserAdministration aAdmin) {
-        userCondition.setUserAdmin(aAdmin);   
+        userCondition.setUserAdmin(aAdmin);
     }
 
 }
index af0feb041809d95b08c5f419f62396d8a2aefa48..4e9df78bd133ead254c5da59a7b6c7f31354e950 100644 (file)
@@ -12,7 +12,7 @@
  * 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.wamblee.security.authorization;
 
 import org.wamblee.security.authentication.UserAdministration;
@@ -23,10 +23,12 @@ import org.wamblee.security.authentication.UserAdministration;
  * @author Erik Brakkee
  */
 public interface UserCondition {
-    
+
     /**
-     * Sets the user administration object. 
-     * @param aAdmin User administration.
+     * Sets the user administration object.
+     * 
+     * @param aAdmin
+     *            User administration.
      */
     void setUserAdmin(UserAdministration aAdmin);
 
index 5819f42275f0c4effc679954bfeb4d12d6b69e47..4b0c91e71ea61a100664b5de8ceebdd56ffd4adc 100644 (file)
@@ -12,7 +12,7 @@
  * 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.wamblee.security.authorization;
 
 /**
index 43bfee33671b793bd320dc2367bf515c2f10e85c..b3d501c2b626738819500df84b2a3dbd867e9716 100644 (file)
@@ -190,7 +190,7 @@ public class JpaAuthorizationService implements AuthorizationService {
         // been made.
         service.set(null);
     }
-    
+
     /*
      * (non-Javadoc)
      * 
index 2977aa6e71add661645ab36dc4d63ae2702443bc..43d331de1795ab57f75bdb5a5bc643c230f35eeb 100644 (file)
@@ -12,7 +12,7 @@
  * 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.
- */ 
+ */
 /**
  * The authorization package provides an authorization service that can be used to 
  * check whether users have the rights to perform certain operations. 
index 9ff7a4a655fed3ec5aa40453f0e698ff1fb53695..56a298a3c9cf73b931f4cbf88c1dc54e8be0990f 100644 (file)
@@ -12,7 +12,7 @@
  * 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.wamblee.security.authentication;
 
 import java.util.Set;
@@ -197,10 +197,10 @@ public class InMemoryGroupSetTest extends TestCase {
 
         checkGroupCount(3);
     }
-    
-    public void testRenameGroupTwice() { 
-        Group group = new Group("x"); 
-        groups.add(group); 
+
+    public void testRenameGroupTwice() {
+        Group group = new Group("x");
+        groups.add(group);
         groups.groupModified(group);
         group.setName("y");
         groups.groupModified(group);
index d5b4f854cad7f8413929de6f0c9f4fb3c87ed83f..9ca01e8f7a011c15e87ad2063a699cd5a4656634 100644 (file)
@@ -12,7 +12,7 @@
  * 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.wamblee.security.authentication;
 
 import org.wamblee.security.authentication.Md5HexMessageDigester;
index 234ed2664b13731a170f3f11cc385a8676ce272c..0e8f1095b10408c70de68cd12b172c25106a31ee 100644 (file)
@@ -12,7 +12,7 @@
  * 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.wamblee.security.authentication;
 
 import org.wamblee.security.authentication.Group;
@@ -21,7 +21,6 @@ import org.wamblee.security.authentication.User;
 import org.wamblee.security.authentication.UserMgtException;
 import org.wamblee.security.authentication.UserMgtException.Reason;
 
-
 /**
  * User management test utilities.
  * 
@@ -56,7 +55,7 @@ public class UsermgtTestUtils {
             RegexpNameValidator.PASSWORD_PATTERN, Reason.INVALID_PASSWORD,
             "Password must be at least 6 chars"), new Md5HexMessageDigester());
         user.addGroup(aGroup);
-        return user; 
+        return user;
     }
 
     public static void addUserToGroup(User aUser, Group aGroup)
index 3e6f159412448e29d7d9e199dec025919e5f5c59..bcd0a4cabe25b1ad9a10e3848e08aa9399912459 100644 (file)
@@ -12,7 +12,7 @@
  * 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.wamblee.security.authorization;
 
 import static org.wamblee.security.authorization.AuthorizationResult.*;
@@ -36,7 +36,6 @@ public class AuthorizationServiceTest extends TestCase {
     private AuthorizationService service;
 
     private TestUserAccessor userAccessor;
-    
 
     protected AuthorizationService getService() {
         return service;
@@ -51,8 +50,8 @@ public class AuthorizationServiceTest extends TestCase {
     protected void setUp() throws Exception {
         super.setUp();
 
-        userAccessor = new TestUserAccessor(); 
-        
+        userAccessor = new TestUserAccessor();
+
         rule1 = createRule(GRANTED, "users", "/oni/", AllOperation.class);
         rule2 = createRule(DENIED, "users", "/abc/", ReadOperation.class);
         rule3 = createRule(GRANTED, "users", "/abc/", AllOperation.class);
@@ -71,10 +70,10 @@ public class AuthorizationServiceTest extends TestCase {
     }
 
     protected UserAccessor getUserAccessor() {
-        return userAccessor; 
+        return userAccessor;
     }
-    
-    protected UserAdministration getUserAdministration() { 
+
+    protected UserAdministration getUserAdministration() {
         return userAccessor.getUserAdmin();
     }
 
index e09f7fa1cd52ff93535143dc829ab49dcd41e16f..444b589a46117454761ce6f8cc1330b0f0816a6e 100644 (file)
@@ -12,7 +12,7 @@
  * 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.wamblee.security.authorization;
 
 import junit.framework.TestCase;
index 5876c46f0ffb55ef48933a5bc567bba8c3bf82be..cba576573cf38236efb72cdeb1e9a057e0837ed7 100644 (file)
@@ -12,7 +12,7 @@
  * 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.wamblee.security.authorization;
 
 import junit.framework.TestCase;
index 49666ce06320c56d5e44e6f08deaab58087136f0..64536ff54636ef2ba39d6acd3390db5eb7151ac7 100644 (file)
@@ -12,7 +12,7 @@
  * 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.wamblee.security.authorization;
 
 import junit.framework.TestCase;
index d633840be746e453d659729fbb17c604e5f64a23..986d62bdf23b3640133659642178656a9a59bc95 100644 (file)
@@ -12,7 +12,7 @@
  * 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.wamblee.security.authorization;
 
 import static org.wamblee.security.authorization.AuthorizationResult.*;
index cb600d73642fa5e7512188794060bb6d3746b337..776a8e7f70b77930e2c782d9e68b729ed996b13e 100644 (file)
@@ -12,7 +12,7 @@
  * 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.wamblee.security.authorization;
 
 /**
index e4cc232e2580986aa7986473da32b53b0e9b65c2..f04a10ed0a302d7fb65b912ac368d319b00c5776 100644 (file)
@@ -12,7 +12,7 @@
  * 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.wamblee.security.authorization;
 
 import org.wamblee.security.authentication.InMemoryGroupSet;
@@ -24,7 +24,6 @@ import org.wamblee.security.authentication.UserAdministration;
 import org.wamblee.security.authentication.UserAdministrationImpl;
 import org.wamblee.security.authentication.UserMgtException.Reason;
 
-
 /**
  * User access that always returns a user that belongs to a fixed group.
  * 
@@ -37,31 +36,32 @@ public class TestUserAccessor implements UserAccessor {
 
     private static final String GROUP = "users";
 
-    private UserAdministration userAdmin; 
-    
-    public TestUserAccessor() { 
-        userAdmin = new UserAdministrationImpl(
-            new InMemoryUserSet(new RegexpNameValidator(
-                RegexpNameValidator.PASSWORD_PATTERN, Reason.INVALID_PASSWORD,
+    private UserAdministration userAdmin;
+
+    public TestUserAccessor() {
+        userAdmin = new UserAdministrationImpl(new InMemoryUserSet(
+            new RegexpNameValidator(RegexpNameValidator.PASSWORD_PATTERN,
+                Reason.INVALID_PASSWORD,
                 "Password must contain at least 6 characters"),
-                new Md5HexMessageDigester()), new InMemoryGroupSet(),
+            new Md5HexMessageDigester()), new InMemoryGroupSet(),
             new RegexpNameValidator(RegexpNameValidator.ID_PATTERN,
                 Reason.INVALID_USERNAME, "Invalid user"),
             new RegexpNameValidator(RegexpNameValidator.ID_PATTERN,
                 Reason.INVALID_GROUPNAME, "Invalid group"));
 
-            userAdmin.createGroup(GROUP);
-            userAdmin.createUser(USER, PASSWORD);
-            userAdmin.addUserToGroup(USER, GROUP);
+        userAdmin.createGroup(GROUP);
+        userAdmin.createUser(USER, PASSWORD);
+        userAdmin.addUserToGroup(USER, GROUP);
     }
-    
+
     // NOTE: This is only for test. Normally the user accessor would not depend
-    // on user administration. This just ensures that a user administration is created
-    // that knows about the given user. 
+    // on user administration. This just ensures that a user administration is
+    // created
+    // that knows about the given user.
     public UserAdministration getUserAdmin() {
         return userAdmin;
     }
-    
+
     /*
      * (non-Javadoc)
      * 
index 335a606e3f83672dc3e331e483f3e78c1f26ef13..766c180a019f2175ed77b205ac2d648f1fc41bfc 100644 (file)
@@ -12,7 +12,7 @@
  * 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.wamblee.security.authorization;
 
 import static org.wamblee.security.authorization.AuthorizationResult.*;
@@ -25,14 +25,14 @@ import junit.framework.TestCase;
  * @author Erik Brakkee
  */
 public class UrlAuthorizationRuleTest extends TestCase {
-    
-    private TestUserAccessor userAccessor; 
-    
-    public void setUp() { 
-        userAccessor = new TestUserAccessor(); 
-        
+
+    private TestUserAccessor userAccessor;
+
+    public void setUp() {
+        userAccessor = new TestUserAccessor();
+
     }
-    
+
     /**
      * Constructs the rule with a result of UNDECIDED. Verifies that an
      * IllegalArgumentException is thrown.