directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From vte...@apache.org
Subject svn commit: rev 22497 - in incubator/directory/janus/trunk/core/impl/src: java/org/apache/janus/authentication/group java/org/apache/janus/authentication/realm test/org/apache/janus/authentication/realm
Date Sat, 03 Jul 2004 04:13:16 GMT
Author: vtence
Date: Fri Jul  2 21:13:15 2004
New Revision: 22497

Modified:
   incubator/directory/janus/trunk/core/impl/src/java/org/apache/janus/authentication/group/DefaultGroupManager.java
   incubator/directory/janus/trunk/core/impl/src/java/org/apache/janus/authentication/realm/UsernamePasswordAuthentication.java
   incubator/directory/janus/trunk/core/impl/src/test/org/apache/janus/authentication/realm/UsernamePasswordAuthenticationTest.java
Log:
Minor refactorings

Modified: incubator/directory/janus/trunk/core/impl/src/java/org/apache/janus/authentication/group/DefaultGroupManager.java
==============================================================================
--- incubator/directory/janus/trunk/core/impl/src/java/org/apache/janus/authentication/group/DefaultGroupManager.java
(original)
+++ incubator/directory/janus/trunk/core/impl/src/java/org/apache/janus/authentication/group/DefaultGroupManager.java
Fri Jul  2 21:13:15 2004
@@ -68,22 +68,20 @@
     public boolean addPrincipal( String groupName, Principal p ) throws NoSuchGroupException
     {
         final Group group = getGroup( groupName );
-        if ( group == null ) throw new NoSuchGroupException( groupName );
         return group.addMember( p );
     }
 
     public boolean addSubGroup( String groupName, String subGroupName ) throws NoSuchGroupException
     {
         final Group grandGroup = getGroup( groupName );
-        if ( grandGroup == null ) throw new NoSuchGroupException( groupName );
         final Group subGroup = getGroup( subGroupName );
-        if ( subGroup == null ) throw new NoSuchGroupException( subGroupName );
-
         return grandGroup.addSubGroup( subGroup );
     }
 
-    private Group getGroup( String groupName )
+    private Group getGroup( String groupName ) throws NoSuchGroupException
     {
-        return ( Group ) m_groups.get( groupName );
+        final Group group = ( Group ) m_groups.get( groupName );
+        if ( group == null ) throw new NoSuchGroupException( groupName );
+        return group;
     }
 }

Modified: incubator/directory/janus/trunk/core/impl/src/java/org/apache/janus/authentication/realm/UsernamePasswordAuthentication.java
==============================================================================
--- incubator/directory/janus/trunk/core/impl/src/java/org/apache/janus/authentication/realm/UsernamePasswordAuthentication.java
(original)
+++ incubator/directory/janus/trunk/core/impl/src/java/org/apache/janus/authentication/realm/UsernamePasswordAuthentication.java
Fri Jul  2 21:13:15 2004
@@ -46,11 +46,6 @@
         return true;
     }
 
-    public CredentialsMatcher matcher( CredentialSet credentials )
-    {
-        return new EqualMatcher( credentials );
-    }
-
     public CredentialsMatcher authenticate( CredentialSet credentials )
     {
         return new EqualMatcher( credentials );

Modified: incubator/directory/janus/trunk/core/impl/src/test/org/apache/janus/authentication/realm/UsernamePasswordAuthenticationTest.java
==============================================================================
--- incubator/directory/janus/trunk/core/impl/src/test/org/apache/janus/authentication/realm/UsernamePasswordAuthenticationTest.java
(original)
+++ incubator/directory/janus/trunk/core/impl/src/test/org/apache/janus/authentication/realm/UsernamePasswordAuthenticationTest.java
Fri Jul  2 21:13:15 2004
@@ -75,8 +75,8 @@
 
     public void testCredentialsMatchIfEqual()
     {
-        assertTrue( "Equal sets of credentials do not match", m_auth.matcher( validCredentials()
).matches( validCredentials() ) );
-        assertFalse( "Different sets of credentials were matched", m_auth.matcher( extraCredentials()
).matches( validCredentials() ) );
+        assertTrue( "Equal sets of credentials do not match", m_auth.authenticate( validCredentials()
).matches( validCredentials() ) );
+        assertFalse( "Different sets of credentials were matched", m_auth.authenticate( extraCredentials()
).matches( validCredentials() ) );
     }
 
     public void testPrincipalsCreatedAreUsernamePrincipals()

Mime
View raw message