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:
@@ -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);
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
JAASTest2 {
|
||||
net.sf.acegisecurity.providers.jaas.TestLoginModule required;
|
||||
};
|
||||
Reference in New Issue
Block a user