The JaasAuthenticationCallbackHandler handle method now takes a callback and the authentication in progress, the setAuthentication method has been removed.

The JaasAuthenticationProvider afterPropertiesSet method now makes use of the java.security.auth.login.config System property before trying to use the login.config.url.X properties.
This commit is contained in:
Ray Krueger
2005-01-31 05:16:32 +00:00
parent 358056bf4d
commit 82c15b1874
7 changed files with 99 additions and 105 deletions

View File

@@ -17,7 +17,12 @@ package net.sf.acegisecurity.providers.jaas;
import junit.framework.TestCase;
import net.sf.acegisecurity.*;
import net.sf.acegisecurity.AcegiSecurityException;
import net.sf.acegisecurity.Authentication;
import net.sf.acegisecurity.AuthenticationException;
import net.sf.acegisecurity.GrantedAuthority;
import net.sf.acegisecurity.GrantedAuthorityImpl;
import net.sf.acegisecurity.LockedException;
import net.sf.acegisecurity.providers.TestingAuthenticationToken;
import net.sf.acegisecurity.providers.UsernamePasswordAuthenticationToken;
@@ -25,6 +30,10 @@ import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextException;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import java.net.URL;
import java.security.Security;
import java.util.Arrays;
import java.util.List;
@@ -72,6 +81,17 @@ public class JaasAuthenticationProviderTests extends TestCase {
assertNull("Success event was fired", eventCheck.successEvent);
}
public void testConfigurationLoop() throws Exception {
String resName = "/" + getClass().getName().replace('.', '/') + ".conf";
URL url = getClass().getResource(resName);
Security.setProperty("policy.allowSystemProperty", "false");
Security.setProperty("login.config.url.1", url.toString());
setUp();
testFull();
}
public void testDetectsMissingLoginConfig() throws Exception {
JaasAuthenticationProvider myJaasProvider = new JaasAuthenticationProvider();
myJaasProvider.setApplicationContext(context);

View File

@@ -25,23 +25,15 @@ import javax.security.auth.callback.UnsupportedCallbackException;
/**
* DOCUMENT ME!
* TestCallbackHandler
*
* @author Ray Krueger
* @version $Id$
*/
public class TestCallbackHandler implements JaasAuthenticationCallbackHandler {
//~ Instance fields ========================================================
Authentication auth;
//~ Methods ================================================================
public void setAuthentication(Authentication auth) {
this.auth = auth;
}
public void handle(Callback callback)
public void handle(Callback callback, Authentication auth)
throws IOException, UnsupportedCallbackException {
if (callback instanceof TextInputCallback) {
TextInputCallback tic = (TextInputCallback) callback;

View File

@@ -0,0 +1,3 @@
JAASTest2 {
net.sf.acegisecurity.providers.jaas.TestLoginModule required;
};