|
@@ -66,6 +66,8 @@ public class DaoAuthenticationProviderTests extends TestCase {
|
|
DaoAuthenticationProvider provider = new DaoAuthenticationProvider();
|
|
DaoAuthenticationProvider provider = new DaoAuthenticationProvider();
|
|
provider.setAuthenticationDao(new MockAuthenticationDaoUserMarissa());
|
|
provider.setAuthenticationDao(new MockAuthenticationDaoUserMarissa());
|
|
provider.setUserCache(new MockUserCache());
|
|
provider.setUserCache(new MockUserCache());
|
|
|
|
+ provider.setApplicationContext(new ClassPathXmlApplicationContext(
|
|
|
|
+ "net/sf/acegisecurity/util/filtertest-valid.xml"));
|
|
|
|
|
|
try {
|
|
try {
|
|
provider.authenticate(token);
|
|
provider.authenticate(token);
|
|
@@ -89,6 +91,16 @@ public class DaoAuthenticationProviderTests extends TestCase {
|
|
} catch (AccountExpiredException expected) {
|
|
} catch (AccountExpiredException expected) {
|
|
assertTrue(true);
|
|
assertTrue(true);
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ provider.setApplicationContext(new ClassPathXmlApplicationContext(
|
|
|
|
+ "net/sf/acegisecurity/util/filtertest-valid.xml"));
|
|
|
|
+
|
|
|
|
+ try {
|
|
|
|
+ provider.authenticate(token);
|
|
|
|
+ fail("Should have thrown AccountExpiredException");
|
|
|
|
+ } catch (AccountExpiredException expected) {
|
|
|
|
+ assertTrue(true);
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
|
|
public void testAuthenticateFailsIfCredentialsExpired() {
|
|
public void testAuthenticateFailsIfCredentialsExpired() {
|
|
@@ -105,6 +117,16 @@ public class DaoAuthenticationProviderTests extends TestCase {
|
|
} catch (CredentialsExpiredException expected) {
|
|
} catch (CredentialsExpiredException expected) {
|
|
assertTrue(true);
|
|
assertTrue(true);
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ provider.setApplicationContext(new ClassPathXmlApplicationContext(
|
|
|
|
+ "net/sf/acegisecurity/util/filtertest-valid.xml"));
|
|
|
|
+
|
|
|
|
+ try {
|
|
|
|
+ provider.authenticate(token);
|
|
|
|
+ fail("Should have thrown CredentialsExpiredException");
|
|
|
|
+ } catch (CredentialsExpiredException expected) {
|
|
|
|
+ assertTrue(true);
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
|
|
public void testAuthenticateFailsIfUserDisabled() {
|
|
public void testAuthenticateFailsIfUserDisabled() {
|
|
@@ -121,6 +143,16 @@ public class DaoAuthenticationProviderTests extends TestCase {
|
|
} catch (DisabledException expected) {
|
|
} catch (DisabledException expected) {
|
|
assertTrue(true);
|
|
assertTrue(true);
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ provider.setApplicationContext(new ClassPathXmlApplicationContext(
|
|
|
|
+ "net/sf/acegisecurity/util/filtertest-valid.xml"));
|
|
|
|
+
|
|
|
|
+ try {
|
|
|
|
+ provider.authenticate(token);
|
|
|
|
+ fail("Should have thrown DisabledException");
|
|
|
|
+ } catch (DisabledException expected) {
|
|
|
|
+ assertTrue(true);
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
|
|
public void testAuthenticateFailsWhenAuthenticationDaoHasBackendFailure() {
|
|
public void testAuthenticateFailsWhenAuthenticationDaoHasBackendFailure() {
|