فهرست منبع

Add correct supports() method and tests.

Ben Alex 21 سال پیش
والد
کامیت
d65b0e0bd2

+ 2 - 1
core/src/main/java/org/acegisecurity/providers/dao/DaoAuthenticationProvider.java

@@ -203,7 +203,8 @@ public class DaoAuthenticationProvider implements AuthenticationProvider,
 
     public boolean supports(Class authentication) {
         if (UsernamePasswordAuthenticationToken.class.isAssignableFrom(
-                authentication)) {
+                authentication)
+            || (DaoAuthenticationToken.class.isAssignableFrom(authentication))) {
             return true;
         } else {
             return false;

+ 1 - 0
core/src/test/java/org/acegisecurity/providers/dao/DaoAuthenticationProviderTests.java

@@ -334,6 +334,7 @@ public class DaoAuthenticationProviderTests extends TestCase {
         DaoAuthenticationProvider provider = new DaoAuthenticationProvider();
         assertTrue(provider.supports(UsernamePasswordAuthenticationToken.class));
         assertTrue(!provider.supports(TestingAuthenticationToken.class));
+        assertTrue(provider.supports(DaoAuthenticationToken.class));
     }
 
     //~ Inner Classes ==========================================================